From 16c7741ca5508f2bce3cdd05b575951a5c15f048 Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 7 Sep 2020 15:10:54 +0100 Subject: [PATCH] Formatting automated-tests Change-Id: Ic0fd2e6eef75ad8af21511ba6b9383fa287009a4 --- automated-tests/src/common/assert.h | 175 +- automated-tests/src/common/signal-helper.h | 687 +- automated-tests/src/common/testcase.h | 11 +- .../src/dali-internal/tct-dali-internal-core.cpp | 21 +- .../utc-Dali-Internal-ActorObserver.cpp | 181 +- .../src/dali-internal/utc-Dali-Internal-Core.cpp | 42 +- .../utc-Dali-Internal-FixedSizeMemoryPool.cpp | 69 +- .../utc-Dali-Internal-FrustumCulling.cpp | 343 +- .../dali-internal/utc-Dali-Internal-Gesture.cpp | 40 +- .../dali-internal/utc-Dali-Internal-Handles.cpp | 9 +- .../utc-Dali-Internal-LongPressGesture.cpp | 42 +- ...utc-Dali-Internal-MemoryPoolObjectAllocator.cpp | 81 +- .../utc-Dali-Internal-OwnerPointer.cpp | 244 +- .../utc-Dali-Internal-PinchGesture.cpp | 46 +- .../utc-Dali-Internal-PinchGestureProcessor.cpp | 26 +- .../utc-Dali-Internal-RotationGesture.cpp | 42 +- .../dali-internal/utc-Dali-Internal-TapGesture.cpp | 39 +- .../utc-Dali-Internal-TapGestureProcessor.cpp | 26 +- .../dali-test-suite-utils.cpp | 248 +- .../dali-test-suite-utils/dali-test-suite-utils.h | 183 +- .../dali/dali-test-suite-utils/mesh-builder.cpp | 35 +- .../src/dali/dali-test-suite-utils/mesh-builder.h | 11 +- .../dali-test-suite-utils/test-actor-utils.cpp | 58 +- .../dali/dali-test-suite-utils/test-actor-utils.h | 5 +- .../dali-test-suite-utils/test-addon-manager.cpp | 110 +- .../dali-test-suite-utils/test-addon-manager.h | 32 +- .../dali-test-suite-utils/test-application.cpp | 111 +- .../dali/dali-test-suite-utils/test-application.h | 91 +- .../dali-test-suite-utils/test-compare-types.h | 54 +- .../dali-test-suite-utils/test-custom-actor.cpp | 205 +- .../dali/dali-test-suite-utils/test-custom-actor.h | 247 +- .../test-gesture-generator.cpp | 170 +- .../dali-test-suite-utils/test-gesture-generator.h | 38 +- .../dali-test-suite-utils/test-gl-abstraction.cpp | 86 +- .../dali-test-suite-utils/test-gl-abstraction.h | 1081 +-- .../test-gl-context-helper-abstraction.h | 20 +- .../test-gl-sync-abstraction.cpp | 44 +- .../test-gl-sync-abstraction.h | 36 +- .../dali/dali-test-suite-utils/test-harness.cpp | 194 +- .../src/dali/dali-test-suite-utils/test-harness.h | 27 +- .../dali-test-suite-utils/test-intrusive-ptr.h | 22 +- .../dali-test-suite-utils/test-native-image.cpp | 15 +- .../dali/dali-test-suite-utils/test-native-image.h | 87 +- .../test-platform-abstraction.cpp | 76 +- .../test-platform-abstraction.h | 98 +- .../test-render-controller.cpp | 18 +- .../dali-test-suite-utils/test-render-controller.h | 12 +- .../dali-test-suite-utils/test-touch-event-utils.h | 5 +- .../test-trace-call-stack.cpp | 75 +- .../dali-test-suite-utils/test-trace-call-stack.h | 35 +- automated-tests/src/dali/tct-dali-core.cpp | 21 +- automated-tests/src/dali/test-sample-addon.cpp | 34 +- automated-tests/src/dali/utc-Dali-Actor.cpp | 5707 +++++++------- automated-tests/src/dali/utc-Dali-AddOn.cpp | 23 +- .../src/dali/utc-Dali-AlphaFunction.cpp | 130 +- automated-tests/src/dali/utc-Dali-AngleAxis.cpp | 58 +- automated-tests/src/dali/utc-Dali-Animation.cpp | 8265 ++++++++++---------- automated-tests/src/dali/utc-Dali-Any.cpp | 182 +- automated-tests/src/dali/utc-Dali-BaseHandle.cpp | 182 +- .../src/dali/utc-Dali-CSharp-TypeRegistry.cpp | 228 +- automated-tests/src/dali/utc-Dali-CameraActor.cpp | 1562 ++-- .../src/dali/utc-Dali-CircularQueue.cpp | 426 +- .../src/dali/utc-Dali-ConditionalWait.cpp | 97 +- .../src/dali/utc-Dali-ConnectionTracker.cpp | 90 +- automated-tests/src/dali/utc-Dali-Constrainer.cpp | 557 +- automated-tests/src/dali/utc-Dali-Constraint.cpp | 667 +- .../src/dali/utc-Dali-ConstraintFunction.cpp | 290 +- .../src/dali/utc-Dali-ConstraintSource.cpp | 62 +- automated-tests/src/dali/utc-Dali-Constraints.cpp | 305 +- automated-tests/src/dali/utc-Dali-Context.cpp | 21 +- automated-tests/src/dali/utc-Dali-Core.cpp | 14 +- automated-tests/src/dali/utc-Dali-CustomActor.cpp | 1075 +-- automated-tests/src/dali/utc-Dali-Degree.cpp | 69 +- .../src/dali/utc-Dali-DistanceField.cpp | 32 +- automated-tests/src/dali/utc-Dali-Extents.cpp | 112 +- automated-tests/src/dali/utc-Dali-FrameBuffer.cpp | 290 +- .../src/dali/utc-Dali-FrameCallbackInterface.cpp | 790 +- automated-tests/src/dali/utc-Dali-Geometry.cpp | 353 +- .../src/dali/utc-Dali-GestureDetector.cpp | 105 +- automated-tests/src/dali/utc-Dali-Handle.cpp | 1529 ++-- automated-tests/src/dali/utc-Dali-Hash.cpp | 22 +- .../src/dali/utc-Dali-HitTestAlgorithm.cpp | 281 +- .../src/dali/utc-Dali-HoverProcessing.cpp | 1078 ++- automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp | 449 +- automated-tests/src/dali/utc-Dali-KeyEvent.cpp | 437 +- automated-tests/src/dali/utc-Dali-Layer.cpp | 530 +- .../src/dali/utc-Dali-LocklessBuffer.cpp | 46 +- .../src/dali/utc-Dali-LongPressGestureDetector.cpp | 459 +- .../dali/utc-Dali-LongPressGestureRecognizer.cpp | 232 +- automated-tests/src/dali/utc-Dali-MathUtils.cpp | 72 +- automated-tests/src/dali/utc-Dali-Matrix.cpp | 340 +- automated-tests/src/dali/utc-Dali-Matrix3.cpp | 214 +- automated-tests/src/dali/utc-Dali-MeshMaterial.cpp | 8 +- automated-tests/src/dali/utc-Dali-Mutex.cpp | 84 +- .../src/dali/utc-Dali-ObjectRegistry.cpp | 93 +- automated-tests/src/dali/utc-Dali-PanGesture.cpp | 120 +- .../src/dali/utc-Dali-PanGestureDetector.cpp | 1686 ++-- .../src/dali/utc-Dali-PanGestureRecognizer.cpp | 299 +- automated-tests/src/dali/utc-Dali-Path.cpp | 329 +- .../src/dali/utc-Dali-PinchGestureDetector.cpp | 501 +- .../src/dali/utc-Dali-PinchGestureRecognizer.cpp | 423 +- automated-tests/src/dali/utc-Dali-Pixel.cpp | 561 +- automated-tests/src/dali/utc-Dali-PixelData.cpp | 124 +- automated-tests/src/dali/utc-Dali-Processors.cpp | 53 +- .../src/dali/utc-Dali-PropertyArray.cpp | 290 +- automated-tests/src/dali/utc-Dali-PropertyMap.cpp | 819 +- .../src/dali/utc-Dali-PropertyNotification.cpp | 630 +- .../src/dali/utc-Dali-PropertyTypes.cpp | 67 +- .../src/dali/utc-Dali-PropertyValue.cpp | 992 +-- automated-tests/src/dali/utc-Dali-Quaternion.cpp | 943 ++- automated-tests/src/dali/utc-Dali-Radian.cpp | 122 +- automated-tests/src/dali/utc-Dali-Random.cpp | 21 +- automated-tests/src/dali/utc-Dali-Rect.cpp | 106 +- automated-tests/src/dali/utc-Dali-RenderTask.cpp | 1795 +++-- .../src/dali/utc-Dali-RenderTaskList.cpp | 130 +- automated-tests/src/dali/utc-Dali-Renderer.cpp | 2024 ++--- .../src/dali/utc-Dali-RotationGestureDetector.cpp | 500 +- .../dali/utc-Dali-RotationGestureRecognizer.cpp | 172 +- automated-tests/src/dali/utc-Dali-Sampler.cpp | 219 +- automated-tests/src/dali/utc-Dali-Scene.cpp | 831 +- automated-tests/src/dali/utc-Dali-Scripting.cpp | 723 +- automated-tests/src/dali/utc-Dali-Shader.cpp | 281 +- .../src/dali/utc-Dali-SignalDelegate.cpp | 83 +- .../src/dali/utc-Dali-SignalTemplates.cpp | 1586 ++-- .../src/dali/utc-Dali-SignalTemplatesFunctors.cpp | 257 +- .../src/dali/utc-Dali-SingletonService.cpp | 35 +- automated-tests/src/dali/utc-Dali-Stage.cpp | 903 +-- .../src/dali/utc-Dali-TapGestureDetector.cpp | 393 +- .../src/dali/utc-Dali-TapGestureRecognizer.cpp | 224 +- automated-tests/src/dali/utc-Dali-Texture.cpp | 548 +- automated-tests/src/dali/utc-Dali-TextureSet.cpp | 300 +- automated-tests/src/dali/utc-Dali-Thread.cpp | 27 +- automated-tests/src/dali/utc-Dali-ThreadPool.cpp | 111 +- automated-tests/src/dali/utc-Dali-TouchEvent.cpp | 94 +- .../src/dali/utc-Dali-TouchEventCombiner.cpp | 653 +- .../src/dali/utc-Dali-TouchProcessing.cpp | 1610 ++-- automated-tests/src/dali/utc-Dali-TypeRegistry.cpp | 2230 +++--- automated-tests/src/dali/utc-Dali-Uint16Pair.cpp | 178 +- automated-tests/src/dali/utc-Dali-Vector.cpp | 1465 ++-- automated-tests/src/dali/utc-Dali-Vector2.cpp | 292 +- automated-tests/src/dali/utc-Dali-Vector3.cpp | 311 +- automated-tests/src/dali/utc-Dali-Vector4.cpp | 202 +- automated-tests/src/dali/utc-Dali-VertexBuffer.cpp | 166 +- automated-tests/src/dali/utc-Dali-WeakHandle.cpp | 176 +- automated-tests/src/dali/utc-Dali-WheelEvent.cpp | 157 +- dali/devel-api/actors/camera-actor-devel.h | 2 +- 146 files changed, 29994 insertions(+), 30044 deletions(-) diff --git a/automated-tests/src/common/assert.h b/automated-tests/src/common/assert.h index 7d94ae2..7a7c661 100644 --- a/automated-tests/src/common/assert.h +++ b/automated-tests/src/common/assert.h @@ -3,80 +3,131 @@ #include #include -#define assert(exp) \ - if (!(exp)) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert(exp) \ + if(!(exp)) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Following expression is not true:\n" \ - "%s\n", #exp); \ - return 1; \ - } + "%s\n", \ + #exp); \ + return 1; \ + } -#define assert_eq(var, ref) \ - if (var != ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_eq(var, ref) \ + if(var != ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Values \"%s\" and \"%s\" are not equal:\n" \ - "%s == %d, %s == %d\n", \ - #var, #ref, #var, (int)var, #ref, (int)ref); \ - return 1; \ - } + "%s == %d, %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + (int)var, \ + #ref, \ + (int)ref); \ + return 1; \ + } -#define assert_neq(var, ref) \ - if (var == ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_neq(var, ref) \ + if(var == ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Values \"%s\" and \"%s\" are equal:\n" \ - "%s == %s == %d\n", \ - #var, #ref, #var, #ref, (int)ref); \ - return 1; \ - } + "%s == %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + #ref, \ + (int)ref); \ + return 1; \ + } -#define assert_gt(var, ref) \ - if (var <= ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_gt(var, ref) \ + if(var <= ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Value \"%s\" is not greater than \"%s\":\n" \ - "%s == %d, %s == %d\n", \ - #var, #ref, #var, var, #ref, ref); \ - return 1; \ - } + "%s == %d, %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + var, \ + #ref, \ + ref); \ + return 1; \ + } -#define assert_geq(var, ref) \ - if (var < ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_geq(var, ref) \ + if(var < ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Value \"%s\" is not greater or equal to \"%s\":\n" \ - "%s == %d, %s == %d\n", \ - #var, #ref, #var, var, #ref, ref); \ - return 1; \ - } + "%s == %d, %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + var, \ + #ref, \ + ref); \ + return 1; \ + } -#define assert_lt(var, ref) \ - if (var >= ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_lt(var, ref) \ + if(var >= ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Value \"%s\" is not lower than \"%s\":\n" \ - "%s == %d, %s == %d\n", \ - #var, #ref, #var, var, #ref, ref); \ - return 1; \ - } + "%s == %d, %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + var, \ + #ref, \ + ref); \ + return 1; \ + } -#define assert_leq(var, ref) \ - if (var > ref) { \ - fprintf(stderr, \ - "Assert fail in %s:%d\n", __FILE__, __LINE__); \ - fprintf(stderr, \ +#define assert_leq(var, ref) \ + if(var > ref) \ + { \ + fprintf(stderr, \ + "Assert fail in %s:%d\n", \ + __FILE__, \ + __LINE__); \ + fprintf(stderr, \ "Value \"%s\" is not lower or equal to \"%s\":\n" \ - "%s == %d, %s == %d\n", \ - #var, #ref, #var, var, #ref, ref); \ - return 1; \ - } + "%s == %d, %s == %d\n", \ + #var, \ + #ref, \ + #var, \ + var, \ + #ref, \ + ref); \ + return 1; \ + } #endif // ASSERT_H diff --git a/automated-tests/src/common/signal-helper.h b/automated-tests/src/common/signal-helper.h index b1f555f..84844cf 100644 --- a/automated-tests/src/common/signal-helper.h +++ b/automated-tests/src/common/signal-helper.h @@ -2,7 +2,7 @@ #define SIGNAL_HELPER /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,24 +23,23 @@ class TestButton { public: - - TestButton( unsigned int id ) + TestButton(unsigned int id) : mId(id) { } void Press() { - mPanelDown.Emit( *this ); + mPanelDown.Emit(*this); } void Release() { - mPanelUp.Emit( *this ); + mPanelUp.Emit(*this); } - typedef Signal< void (TestButton&) > PanelDownSignal; - typedef Signal< void (TestButton&) > PanelUpSignal; + typedef Signal PanelDownSignal; + typedef Signal PanelUpSignal; PanelDownSignal& DownSignal() { @@ -58,8 +57,7 @@ public: } private: - - int mId; + int mId; PanelDownSignal mPanelDown; PanelUpSignal mPanelUp; }; @@ -67,23 +65,22 @@ private: class TestApp : public ConnectionTracker { public: - TestApp() - : mButtonPressed( false ), - mVoidFunctionCalled( false ) + : mButtonPressed(false), + mVoidFunctionCalled(false) { } - void OnButtonPress( TestButton& button ) + void OnButtonPress(TestButton& button) { mButtonPressed = true; - mButtonId = button.GetId(); + mButtonId = button.GetId(); } - void OnButtonRelease( TestButton& button ) + void OnButtonRelease(TestButton& button) { mButtonPressed = false; - mButtonId = button.GetId(); + mButtonId = button.GetId(); } int GetButtonPressedId() @@ -108,68 +105,105 @@ public: bool mButtonPressed; bool mVoidFunctionCalled; - int mButtonId; + int mButtonId; }; class TestSignals { public: - // Void return, no parameters - typedef Signal VoidRetNoParamSignal; + typedef Signal VoidRetNoParamSignal; // Void return, 1 value parameter - typedef Signal VoidRet1ValueParamSignal; + typedef Signal VoidRet1ValueParamSignal; // Void return, 1 reference parameter - typedef Signal< void (int&)> VoidRet1RefParamSignal; + typedef Signal VoidRet1RefParamSignal; // Void return, 2 value parameters - typedef Signal VoidRet2ValueParamSignal; + typedef Signal VoidRet2ValueParamSignal; // Void return, 3 value parameters - typedef Signal VoidRet3ValueParamSignal; + typedef Signal VoidRet3ValueParamSignal; // bool return, 1 value parameter - typedef Signal< bool (float)> BoolRet1ValueParamSignal; + typedef Signal BoolRet1ValueParamSignal; // bool return, 2 value parameter - typedef Signal BoolRet2ValueParamSignal; + typedef Signal BoolRet2ValueParamSignal; // int return, 2 value parameter - typedef Signal IntRet2ValueParamSignal; + typedef Signal IntRet2ValueParamSignal; // float return, 0 parameters - typedef Signal< float () > FloatRet0ParamSignal; + typedef Signal FloatRet0ParamSignal; // float return, 1 value parameters - typedef Signal< float (float ) > FloatRet1ParamSignal; + typedef Signal FloatRet1ParamSignal; // float return, 2 value parameters - typedef Signal FloatRet2ValueParamSignal; + typedef Signal FloatRet2ValueParamSignal; // float return, 3 value parameters - typedef Signal FloatRet3ValueParamSignal; + typedef Signal FloatRet3ValueParamSignal; // void return, 3 value parameters - typedef Signal VoidSignalTypeFloatValue3; - + typedef Signal VoidSignalTypeFloatValue3; - VoidRetNoParamSignal& SignalVoidNone() { return mSignalVoid0; } - VoidRet1RefParamSignal& SignalVoid1Ref() { return mSignalVoid1R; } - VoidRet1ValueParamSignal& SignalVoid1Value() { return mSignalVoid1V; } - VoidRet2ValueParamSignal& SignalVoid2Value() { return mSignalVoid2V; } - VoidRet3ValueParamSignal& SignalVoid3Value() { return mSignalVoid3V; } + VoidRetNoParamSignal& SignalVoidNone() + { + return mSignalVoid0; + } + VoidRet1RefParamSignal& SignalVoid1Ref() + { + return mSignalVoid1R; + } + VoidRet1ValueParamSignal& SignalVoid1Value() + { + return mSignalVoid1V; + } + VoidRet2ValueParamSignal& SignalVoid2Value() + { + return mSignalVoid2V; + } + VoidRet3ValueParamSignal& SignalVoid3Value() + { + return mSignalVoid3V; + } - BoolRet1ValueParamSignal& SignalBool1Value() { return mSignalBool1V; } - BoolRet2ValueParamSignal& SignalBool2Value() { return mSignalBool2V; } - IntRet2ValueParamSignal& SignalInt2Value() { return mSignalInt2V; } - FloatRet0ParamSignal& SignalFloat0() { return mSignalFloat0; } - FloatRet1ParamSignal& SignalFloat1Value() {return mSignalFloat1V; } - FloatRet2ValueParamSignal& SignalFloat2Value() { return mSignalFloat2V; } + BoolRet1ValueParamSignal& SignalBool1Value() + { + return mSignalBool1V; + } + BoolRet2ValueParamSignal& SignalBool2Value() + { + return mSignalBool2V; + } + IntRet2ValueParamSignal& SignalInt2Value() + { + return mSignalInt2V; + } + FloatRet0ParamSignal& SignalFloat0() + { + return mSignalFloat0; + } + FloatRet1ParamSignal& SignalFloat1Value() + { + return mSignalFloat1V; + } + FloatRet2ValueParamSignal& SignalFloat2Value() + { + return mSignalFloat2V; + } - VoidSignalTypeFloatValue3& VoidSignalFloatValue3() { return mVoidSignalFloatValue3; } - FloatRet3ValueParamSignal& SignalFloat3Value() { return mFloatSignalFloatValue3; } + VoidSignalTypeFloatValue3& VoidSignalFloatValue3() + { + return mVoidSignalFloatValue3; + } + FloatRet3ValueParamSignal& SignalFloat3Value() + { + return mFloatSignalFloatValue3; + } TestSignals() { @@ -177,19 +211,19 @@ public: void CheckNoConnections() { - DALI_TEST_EQUALS( mSignalVoid0.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalVoid1R.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalVoid1V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalVoid2V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalVoid3V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalBool1V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalBool2V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalInt2V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalFloat0.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalFloat1V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mSignalFloat2V.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mVoidSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mFloatSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(mSignalVoid0.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalVoid1R.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalVoid1V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalVoid2V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalVoid3V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalBool1V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalBool2V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalInt2V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalFloat0.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalFloat1V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mSignalFloat2V.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mVoidSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mFloatSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION); } void EmitVoidSignalVoid() @@ -209,15 +243,14 @@ public: void EmitVoidSignal2IntValue(int p1, int p2) { - mSignalVoid2V.Emit(p1,p2); + mSignalVoid2V.Emit(p1, p2); } void EmitVoidSignal3IntValue(int p1, int p2, int p3) { - mSignalVoid3V.Emit(p1,p2,p3); + mSignalVoid3V.Emit(p1, p2, p3); } - bool EmitBoolSignalFloatValue(float p1) { return mSignalBool1V.Emit(p1); @@ -233,9 +266,9 @@ public: return mSignalInt2V.Emit(p1, p2); } - float EmitFloat1VSignal(float p1 ) + float EmitFloat1VSignal(float p1) { - return mSignalFloat1V.Emit(p1 ); + return mSignalFloat1V.Emit(p1); } float EmitFloat2VSignal(float p1, float p2) @@ -259,21 +292,20 @@ public: } private: - - VoidRetNoParamSignal mSignalVoid0; - VoidRet1RefParamSignal mSignalVoid1R; - VoidRet1ValueParamSignal mSignalVoid1V; - VoidRet2ValueParamSignal mSignalVoid2V; - VoidRet3ValueParamSignal mSignalVoid3V; - - BoolRet1ValueParamSignal mSignalBool1V; - BoolRet2ValueParamSignal mSignalBool2V; - IntRet2ValueParamSignal mSignalInt2V; - FloatRet0ParamSignal mSignalFloat0; - FloatRet1ParamSignal mSignalFloat1V; - FloatRet2ValueParamSignal mSignalFloat2V; - VoidSignalTypeFloatValue3 mVoidSignalFloatValue3; - FloatRet3ValueParamSignal mFloatSignalFloatValue3; + VoidRetNoParamSignal mSignalVoid0; + VoidRet1RefParamSignal mSignalVoid1R; + VoidRet1ValueParamSignal mSignalVoid1V; + VoidRet2ValueParamSignal mSignalVoid2V; + VoidRet3ValueParamSignal mSignalVoid3V; + + BoolRet1ValueParamSignal mSignalBool1V; + BoolRet2ValueParamSignal mSignalBool2V; + IntRet2ValueParamSignal mSignalInt2V; + FloatRet0ParamSignal mSignalFloat0; + FloatRet1ParamSignal mSignalFloat1V; + FloatRet2ValueParamSignal mSignalFloat2V; + VoidSignalTypeFloatValue3 mVoidSignalFloatValue3; + FloatRet3ValueParamSignal mFloatSignalFloatValue3; }; /** @@ -282,34 +314,33 @@ private: class TestSlotHandler : public ConnectionTracker { public: - TestSlotHandler() - : mIntParam1( 0 ), - mIntParam2( 0 ), - mIntParam3( 0 ), - mFloatParam1( 0.0f ), - mFloatParam2( 0.0f ), - mFloatParam3( 0.0f ), - mBoolReturn( false ), - mIntReturn( 0 ), - mFloatReturn( 0.0f ), - mHandled( false ), - mHandledCount( 0 ) + : mIntParam1(0), + mIntParam2(0), + mIntParam3(0), + mFloatParam1(0.0f), + mFloatParam2(0.0f), + mFloatParam3(0.0f), + mBoolReturn(false), + mIntReturn(0), + mFloatReturn(0.0f), + mHandled(false), + mHandledCount(0) { } void Reset() { - mIntParam1 = 0; - mIntParam2 = 0; - mIntParam3 = 0; + mIntParam1 = 0; + mIntParam2 = 0; + mIntParam3 = 0; mFloatParam1 = 0.0f; mFloatParam2 = 0.0f; mFloatParam3 = 0.0f; - mBoolReturn = false; - mIntReturn = 0; + mBoolReturn = false; + mIntReturn = 0; mFloatReturn = 0.0f; - mHandled = false; + mHandled = false; } void VoidSlotVoid() @@ -320,61 +351,61 @@ public: void VoidSlotVoidAlternative() { - mHandled = true; - ++mHandledCount; + mHandled = true; + ++mHandledCount; } - void VoidSlotIntRef( int& p1 ) + void VoidSlotIntRef(int& p1) { mIntParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidSlotIntValue( int p1 ) + void VoidSlotIntValue(int p1) { mIntParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidDuplicateSlotIntValue( int p1 ) + void VoidDuplicateSlotIntValue(int p1) { mIntParam2 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidSlotIntValueIntValue( int p1, int p2 ) + void VoidSlotIntValueIntValue(int p1, int p2) { mIntParam1 = p1; mIntParam2 = p2; - mHandled = true; + mHandled = true; ++mHandledCount; } - bool BoolSlotFloatValue( float p1 ) + bool BoolSlotFloatValue(float p1) { mFloatParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; return mBoolReturn; } - bool BoolSlotFloatValueIntValue( float p1, int p2 ) + bool BoolSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; ++mHandledCount; return mBoolReturn; } - int IntSlotFloatValueIntValue( float p1, int p2 ) + int IntSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; ++mHandledCount; return mIntReturn; } @@ -386,41 +417,41 @@ public: return mFloatReturn; } - float FloatSlotFloatValueFloatValue( float p1, float p2 ) + float FloatSlotFloatValueFloatValue(float p1, float p2) { mFloatParam1 = p1; mFloatParam2 = p2; - mHandled = true; + mHandled = true; ++mHandledCount; return mFloatReturn; } - void VoidSlotFloatValue3( float p1, float p2, float p3 ) + void VoidSlotFloatValue3(float p1, float p2, float p3) { mFloatParam1 = p1; mFloatParam2 = p2; mFloatParam3 = p3; - mHandled = true; + mHandled = true; ++mHandledCount; } - float FloatSlotFloatValue3( float p1, float p2, float p3 ) + float FloatSlotFloatValue3(float p1, float p2, float p3) { mFloatParam1 = p1; mFloatParam2 = p2; mFloatParam3 = p3; - mHandled = true; + mHandled = true; ++mHandledCount; return mFloatReturn; } - int mIntParam1, mIntParam2, mIntParam3; + int mIntParam1, mIntParam2, mIntParam3; float mFloatParam1, mFloatParam2, mFloatParam3; - bool mBoolReturn; - int mIntReturn; + bool mBoolReturn; + int mIntReturn; float mFloatReturn; - bool mHandled; - int mHandledCount; + bool mHandled; + int mHandledCount; }; /** @@ -429,91 +460,90 @@ public: class TestSlotDisconnector : public ConnectionTracker { public: - TestSlotDisconnector() - : mIntParam1( 0 ), - mIntParam2( 0 ), - mIntParam3( 0 ), - mFloatParam1( 0.0f ), - mFloatParam2( 0.0f ), - mBoolReturn( false ), - mIntReturn( 0 ), - mFloatReturn( 0.0f ), - mHandled( false ) + : mIntParam1(0), + mIntParam2(0), + mIntParam3(0), + mFloatParam1(0.0f), + mFloatParam2(0.0f), + mBoolReturn(false), + mIntReturn(0), + mFloatReturn(0.0f), + mHandled(false) { } void Reset() { - mIntParam1 = 0; - mIntParam2 = 0; - mIntParam3 = 0; + mIntParam1 = 0; + mIntParam2 = 0; + mIntParam3 = 0; mFloatParam1 = 0.0f; mFloatParam2 = 0.0f; - mBoolReturn = false; - mIntReturn = 0; + mBoolReturn = false; + mIntReturn = 0; mFloatReturn = 0.0f; - mHandled = false; + mHandled = false; } - void VoidConnectVoid( TestSignals::VoidRetNoParamSignal& signal ) + void VoidConnectVoid(TestSignals::VoidRetNoParamSignal& signal) { mVoidSignalVoid = &signal; - signal.Connect( this, &TestSlotDisconnector::VoidSlotVoid ); + signal.Connect(this, &TestSlotDisconnector::VoidSlotVoid); } void VoidSlotVoid() { - mVoidSignalVoid->Disconnect( this, &TestSlotDisconnector::VoidSlotVoid ); + mVoidSignalVoid->Disconnect(this, &TestSlotDisconnector::VoidSlotVoid); mHandled = true; } - void VoidConnectIntRef( TestSignals::VoidRet1RefParamSignal& signal ) + void VoidConnectIntRef(TestSignals::VoidRet1RefParamSignal& signal) { mVoidSignalIntRef = &signal; - signal.Connect( this, &TestSlotDisconnector::VoidSlotIntRef ); + signal.Connect(this, &TestSlotDisconnector::VoidSlotIntRef); } - void VoidSlotIntRef( int& p1 ) + void VoidSlotIntRef(int& p1) { - mVoidSignalIntRef->Disconnect( this, &TestSlotDisconnector::VoidSlotIntRef ); + mVoidSignalIntRef->Disconnect(this, &TestSlotDisconnector::VoidSlotIntRef); mIntParam1 = p1; - mHandled = true; + mHandled = true; } - void VoidSlotIntValue( int p1 ) + void VoidSlotIntValue(int p1) { mIntParam1 = p1; - mHandled = true; + mHandled = true; } - void VoidSlotIntValueIntValue( int p1, int p2 ) + void VoidSlotIntValueIntValue(int p1, int p2) { mIntParam1 = p1; mIntParam2 = p2; - mHandled = true; + mHandled = true; } - bool BoolSlotFloatValue( float p1 ) + bool BoolSlotFloatValue(float p1) { mFloatParam1 = p1; - mHandled = true; + mHandled = true; return mBoolReturn; } - bool BoolSlotFloatValueIntValue( float p1, int p2 ) + bool BoolSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; return mBoolReturn; } - int IntSlotFloatValueIntValue( float p1, int p2 ) + int IntSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; return mIntReturn; } @@ -523,23 +553,23 @@ public: return mFloatReturn; } - float FloatSlotFloatValueFloatValue( float p1, float p2 ) + float FloatSlotFloatValueFloatValue(float p1, float p2) { mFloatParam1 = p1; mFloatParam2 = p2; - mHandled = true; + mHandled = true; return mFloatReturn; } TestSignals::VoidRetNoParamSignal* mVoidSignalVoid; TestSignals::VoidRet1RefParamSignal* mVoidSignalIntRef; - int mIntParam1, mIntParam2, mIntParam3; + int mIntParam1, mIntParam2, mIntParam3; float mFloatParam1, mFloatParam2; - bool mBoolReturn; - int mIntReturn; + bool mBoolReturn; + int mIntReturn; float mFloatReturn; - bool mHandled; + bool mHandled; }; /** @@ -548,36 +578,35 @@ public: class TestSlotMultiDisconnector : public ConnectionTracker { public: - static const int NUM_SLOTS = 10; TestSlotMultiDisconnector() - : mVoidSignalVoid( NULL ) + : mVoidSignalVoid(NULL) { Reset(); } void Reset() { - for( int i=0; iDisconnect( this, &TestSlotMultiDisconnector::Slot1 ); - mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot3 ); - mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot5 ); - mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot7 ); - mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot9 ); + mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot1); + mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot3); + mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot5); + mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot7); + mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot9); } void Slot4() @@ -642,55 +671,53 @@ public: bool mSlotHandled[NUM_SLOTS]; }; - /** * A version of TestSlotHandler which disconnects during the callback */ class TestEmitDuringCallback : public ConnectionTracker { public: - TestEmitDuringCallback() - : mVoidSignalVoid( NULL ), - mFloatRet0ParamSignal( NULL), - mFloatRet1ParamSignal( NULL ), - mFloatRet2ParamSignal( NULL ), - mFloatRet3ParamSignal( NULL ), - mHandled( false ) + : mVoidSignalVoid(NULL), + mFloatRet0ParamSignal(NULL), + mFloatRet1ParamSignal(NULL), + mFloatRet2ParamSignal(NULL), + mFloatRet3ParamSignal(NULL), + mHandled(false) { } - void VoidConnectVoid( TestSignals::VoidRetNoParamSignal& signal ) + void VoidConnectVoid(TestSignals::VoidRetNoParamSignal& signal) { mVoidSignalVoid = &signal; - signal.Connect( this, &TestEmitDuringCallback::VoidSlotVoid ); + signal.Connect(this, &TestEmitDuringCallback::VoidSlotVoid); } - void FloatRet0ParamConnect( TestSignals::FloatRet0ParamSignal& signal ) + void FloatRet0ParamConnect(TestSignals::FloatRet0ParamSignal& signal) { mFloatRet0ParamSignal = &signal; - signal.Connect( this, &TestEmitDuringCallback::FloatRet0Param ); + signal.Connect(this, &TestEmitDuringCallback::FloatRet0Param); } - void FloatRet1ParamConnect( TestSignals::FloatRet1ParamSignal& signal ) + void FloatRet1ParamConnect(TestSignals::FloatRet1ParamSignal& signal) { mFloatRet1ParamSignal = &signal; - signal.Connect( this, &TestEmitDuringCallback::FloatRet1Param ); + signal.Connect(this, &TestEmitDuringCallback::FloatRet1Param); } - void FloatRet2ParamConnect( TestSignals::FloatRet2ValueParamSignal& signal ) + void FloatRet2ParamConnect(TestSignals::FloatRet2ValueParamSignal& signal) { mFloatRet2ParamSignal = &signal; - signal.Connect( this, &TestEmitDuringCallback::FloatRet2Param ); + signal.Connect(this, &TestEmitDuringCallback::FloatRet2Param); } - void FloatRet3ParamConnect( TestSignals::FloatRet3ValueParamSignal& signal ) + void FloatRet3ParamConnect(TestSignals::FloatRet3ValueParamSignal& signal) { mFloatRet3ParamSignal = &signal; - signal.Connect( this, &TestEmitDuringCallback::FloatRet3Param ); + signal.Connect(this, &TestEmitDuringCallback::FloatRet3Param); } - void DeleteDuringEmitConnect( TestSignals::VoidRetNoParamSignal& signal ) + void DeleteDuringEmitConnect(TestSignals::VoidRetNoParamSignal& signal) { mVoidSignalVoid = &signal; - signal.Connect( this, &TestEmitDuringCallback::DeleteSignalDuringEmit ); + signal.Connect(this, &TestEmitDuringCallback::DeleteSignalDuringEmit); } void VoidSlotVoid() @@ -708,75 +735,72 @@ public: float FloatRet0Param() { - // Emitting during Emit is very bad! + // Emitting during Emit is very bad! mHandled = true; return mFloatRet0ParamSignal->Emit(); } - float FloatRet1Param( float x ) + float FloatRet1Param(float x) { // Emitting during Emit is very bad! mHandled = true; return mFloatRet1ParamSignal->Emit(x); } - float FloatRet2Param( float x, float y ) + float FloatRet2Param(float x, float y) { // Emitting during Emit is very bad! mHandled = true; - return mFloatRet2ParamSignal->Emit( x, y ); + return mFloatRet2ParamSignal->Emit(x, y); } - float FloatRet3Param( float x, float y, float z) + float FloatRet3Param(float x, float y, float z) { // Emitting during Emit is very bad! mHandled = true; - return mFloatRet3ParamSignal->Emit( x, y, z ); + return mFloatRet3ParamSignal->Emit(x, y, z); } - TestSignals::VoidRetNoParamSignal* mVoidSignalVoid; + TestSignals::VoidRetNoParamSignal* mVoidSignalVoid; TestSignals::FloatRet0ParamSignal* mFloatRet0ParamSignal; - TestSignals::FloatRet1ParamSignal* mFloatRet1ParamSignal; + TestSignals::FloatRet1ParamSignal* mFloatRet1ParamSignal; TestSignals::FloatRet2ValueParamSignal* mFloatRet2ParamSignal; TestSignals::FloatRet3ValueParamSignal* mFloatRet3ParamSignal; - bool mHandled; }; - /** * A version of TestSlotHandler which uses SlotDelegate */ class TestSlotDelegateHandler // This does not inherit from ConnectionTrackerInterface! { public: - TestSlotDelegateHandler() - : mSlotDelegate( this ), - mIntParam1( 0 ), - mIntParam2( 0 ), - mIntParam3( 0 ), - mFloatParam1( 0.0f ), - mFloatParam2( 0.0f ), - mFloatParam3( 0.0f ), - mBoolReturn( false ), - mIntReturn( 0 ), - mFloatReturn( 0.0f ), - mHandled( false ), - mHandledCount( 0 ) + : mSlotDelegate(this), + mIntParam1(0), + mIntParam2(0), + mIntParam3(0), + mFloatParam1(0.0f), + mFloatParam2(0.0f), + mFloatParam3(0.0f), + mBoolReturn(false), + mIntReturn(0), + mFloatReturn(0.0f), + mHandled(false), + mHandledCount(0) { } void Reset() { - mIntParam1 = 0; - mIntParam2 = 0; - mIntParam3 = 0; + mIntParam1 = 0; + mIntParam2 = 0; + mIntParam3 = 0; mFloatParam1 = 0.0f; mFloatParam2 = 0.0f; mFloatParam3 = 0.0f; - mBoolReturn = false; - mIntReturn = 0; + mBoolReturn = false; + mIntReturn = 0; mFloatReturn = 0.0f; - mHandled = false; + mHandled = false; } void VoidSlotVoid() @@ -791,57 +815,57 @@ public: ++mHandledCount; } - void VoidSlotIntRef( int& p1 ) + void VoidSlotIntRef(int& p1) { mIntParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidSlotIntValue( int p1 ) + void VoidSlotIntValue(int p1) { mIntParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidDuplicateSlotIntValue( int p1 ) + void VoidDuplicateSlotIntValue(int p1) { mIntParam2 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; } - void VoidSlotIntValueIntValue( int p1, int p2 ) + void VoidSlotIntValueIntValue(int p1, int p2) { mIntParam1 = p1; mIntParam2 = p2; - mHandled = true; + mHandled = true; ++mHandledCount; } - bool BoolSlotFloatValue( float p1 ) + bool BoolSlotFloatValue(float p1) { mFloatParam1 = p1; - mHandled = true; + mHandled = true; ++mHandledCount; return mBoolReturn; } - bool BoolSlotFloatValueIntValue( float p1, int p2 ) + bool BoolSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; ++mHandledCount; return mBoolReturn; } - int IntSlotFloatValueIntValue( float p1, int p2 ) + int IntSlotFloatValueIntValue(float p1, int p2) { mFloatParam1 = p1; - mIntParam2 = p2; - mHandled = true; + mIntParam2 = p2; + mHandled = true; ++mHandledCount; return mIntReturn; } @@ -853,43 +877,43 @@ public: return mFloatReturn; } - float FloatSlotFloatValueFloatValue( float p1, float p2 ) + float FloatSlotFloatValueFloatValue(float p1, float p2) { mFloatParam1 = p1; mFloatParam2 = p2; - mHandled = true; + mHandled = true; ++mHandledCount; return mFloatReturn; } - void VoidSlotFloatValue3( float p1, float p2, float p3 ) + void VoidSlotFloatValue3(float p1, float p2, float p3) { mFloatParam1 = p1; mFloatParam2 = p2; mFloatParam3 = p3; - mHandled = true; + mHandled = true; ++mHandledCount; } - float FloatSlotFloatValue3( float p1, float p2, float p3 ) + float FloatSlotFloatValue3(float p1, float p2, float p3) { mFloatParam1 = p1; mFloatParam2 = p2; mFloatParam3 = p3; - mHandled = true; + mHandled = true; ++mHandledCount; return mFloatReturn; } SlotDelegate mSlotDelegate; - int mIntParam1, mIntParam2, mIntParam3; + int mIntParam1, mIntParam2, mIntParam3; float mFloatParam1, mFloatParam2, mFloatParam3; - bool mBoolReturn; - int mIntReturn; + bool mBoolReturn; + int mIntReturn; float mFloatReturn; - bool mHandled; - int mHandledCount; + bool mHandled; + int mHandledCount; }; /** @@ -899,20 +923,19 @@ public: class TestBasicConnectionTrackerInterface : public ConnectionTrackerInterface { public: - TestBasicConnectionTrackerInterface() - : mCallbackHandled( false ), - mCallback( NULL ), - mSlotObserver( NULL ) + : mCallbackHandled(false), + mCallback(NULL), + mSlotObserver(NULL) { } ~TestBasicConnectionTrackerInterface() { - if( mSlotObserver && mCallback ) + if(mSlotObserver && mCallback) { // Notify signal since the slot has been destroyed - mSlotObserver->SlotDisconnected( mCallback ); + mSlotObserver->SlotDisconnected(mCallback); // mCallback and mSlotObserver are not owned } } @@ -930,7 +953,7 @@ public: */ virtual std::size_t GetConnectionCount() const { - if( mCallback ) + if(mCallback) { return 1u; } @@ -941,23 +964,23 @@ public: /** * @copydoc ConnectionTrackerInterface::SignalConnected */ - virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) + virtual void SignalConnected(SlotObserver* slotObserver, CallbackBase* callback) { - DALI_ASSERT_ALWAYS( NULL == mCallback && "Only one connection supported!" ); + DALI_ASSERT_ALWAYS(NULL == mCallback && "Only one connection supported!"); - mCallback = callback; + mCallback = callback; mSlotObserver = slotObserver; } /** * @copydoc ConnectionTrackerInterface::SignalDisconnected */ - virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) + virtual void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback) { - if( mSlotObserver == slotObserver ) + if(mSlotObserver == slotObserver) { mSlotObserver = NULL; - mCallback = NULL; + mCallback = NULL; // mCallback and mSlotObserver are not owned } } @@ -968,92 +991,83 @@ public: */ void RemoveNullCallback() { - mSlotObserver->SlotDisconnected( NULL ); + mSlotObserver->SlotDisconnected(NULL); } private: - - TestBasicConnectionTrackerInterface( const TestBasicConnectionTrackerInterface& ); ///< undefined copy constructor - TestBasicConnectionTrackerInterface& operator=( const TestBasicConnectionTrackerInterface& ); ///< undefined assignment operator + TestBasicConnectionTrackerInterface(const TestBasicConnectionTrackerInterface&); ///< undefined copy constructor + TestBasicConnectionTrackerInterface& operator=(const TestBasicConnectionTrackerInterface&); ///< undefined assignment operator public: - bool mCallbackHandled; private: - CallbackBase* mCallback; ///< callback, has ownership SlotObserver* mSlotObserver; ///< a pointer to the slot observer (not owned) }; - - - // for testing static function callbacks class StaticFunctionHandlers { public: - StaticFunctionHandlers() - { - staticFunctionHandled = false; - } - void Reset() - { - staticFunctionHandled = false; - } + StaticFunctionHandlers() + { + staticFunctionHandled = false; + } + void Reset() + { + staticFunctionHandled = false; + } - static void VoidSlotVoid() - { - staticFunctionHandled = true; - } - static void VoidSlot1Param( int p1 ) - { - staticFunctionHandled = true; - } - static void VoidSlot2Param( int p1, int p2 ) - { - staticFunctionHandled = true; - } - static void VoidSlot3Param( int p1, int p2, int p3 ) - { - staticFunctionHandled = true; - } + static void VoidSlotVoid() + { + staticFunctionHandled = true; + } + static void VoidSlot1Param(int p1) + { + staticFunctionHandled = true; + } + static void VoidSlot2Param(int p1, int p2) + { + staticFunctionHandled = true; + } + static void VoidSlot3Param(int p1, int p2, int p3) + { + staticFunctionHandled = true; + } - static float RetSlot0Param( ) - { - staticFunctionHandled = true; - return 0; - } - static float RetSlot1Param( float p1 ) - { - staticFunctionHandled = true; - return 0; - } - static float RetSlot2Param( float p1, float p2 ) - { - staticFunctionHandled = true; - return 0; - } - static float RetSlot3Param( float p1, float p2, float p3 ) - { - staticFunctionHandled = true; - return 0; - } + static float RetSlot0Param() + { + staticFunctionHandled = true; + return 0; + } + static float RetSlot1Param(float p1) + { + staticFunctionHandled = true; + return 0; + } + static float RetSlot2Param(float p1, float p2) + { + staticFunctionHandled = true; + return 0; + } + static float RetSlot3Param(float p1, float p2, float p3) + { + staticFunctionHandled = true; + return 0; + } - static bool staticFunctionHandled; + static bool staticFunctionHandled; }; - /** * test functor, we store a reference to a bool which is outside of the functor * so when the functor is copied, the copy can reference the original data */ struct TestFunctor { - TestFunctor( bool& functorCalled): - mFunctorCalled( functorCalled ) - { - }; + TestFunctor(bool& functorCalled) + : mFunctorCalled(functorCalled){}; void operator()() { @@ -1065,10 +1079,9 @@ struct TestFunctor struct VoidFunctorVoid { - VoidFunctorVoid( bool& functorCalled): - mFunctorCalled( functorCalled ) + VoidFunctorVoid(bool& functorCalled) + : mFunctorCalled(functorCalled) { - } void operator()() diff --git a/automated-tests/src/common/testcase.h b/automated-tests/src/common/testcase.h index 308d539..39b9e5e 100644 --- a/automated-tests/src/common/testcase.h +++ b/automated-tests/src/common/testcase.h @@ -8,11 +8,12 @@ typedef void (*void_fun_ptr)(void); typedef int (*tc_fun_ptr)(void); /* struct describing specific testcase */ -typedef struct testcase_s { - const char* name; - tc_fun_ptr function; - void_fun_ptr startup; - void_fun_ptr cleanup; +typedef struct testcase_s +{ + const char* name; + tc_fun_ptr function; + void_fun_ptr startup; + void_fun_ptr cleanup; } testcase; #endif // TESTCASE_H diff --git a/automated-tests/src/dali-internal/tct-dali-internal-core.cpp b/automated-tests/src/dali-internal/tct-dali-internal-core.cpp index 9b11200..f5ad3e9 100644 --- a/automated-tests/src/dali-internal/tct-dali-internal-core.cpp +++ b/automated-tests/src/dali-internal/tct-dali-internal-core.cpp @@ -1,21 +1,22 @@ -#include #include #include +#include #include + #include "tct-dali-internal-core.h" -int main(int argc, char * const argv[]) +int main(int argc, char* const argv[]) { int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT; const char* optString = "sf"; - bool optRerunFailed(true); - bool optRunSerially(false); + bool optRerunFailed(true); + bool optRunSerially(false); int nextOpt = 0; do { - nextOpt = getopt( argc, argv, optString ); + nextOpt = getopt(argc, argv, optString); switch(nextOpt) { case 'f': @@ -29,17 +30,17 @@ int main(int argc, char * const argv[]) exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT); break; } - } while( nextOpt != -1 ); + } while(nextOpt != -1); - if( optind == argc ) // no testcase name in argument list + if(optind == argc) // no testcase name in argument list { - if( optRunSerially ) + if(optRunSerially) { - result = TestHarness::RunAll( argv[0], tc_array ); + result = TestHarness::RunAll(argv[0], tc_array); } else { - result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed ); + result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed); } } else diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp index 6ca2c05..50d1e87 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp @@ -15,12 +15,11 @@ * */ -#include - -#include - #include #include +#include + +#include // Internal headers are allowed here #include @@ -32,8 +31,8 @@ using ActorObserver = Internal::ActorObserver; namespace TestCallback { Internal::Actor* disconnectedActor = nullptr; -int callCount = 0; -void Function( Internal::Actor* actor ) +int callCount = 0; +void Function(Internal::Actor* actor) { disconnectedActor = actor; ++callCount; @@ -41,7 +40,7 @@ void Function( Internal::Actor* actor ) void Reset() { - callCount = 0; + callCount = 0; disconnectedActor = nullptr; } @@ -61,47 +60,47 @@ int UtcDaliActorObserverTests(void) { TestApplication application; - auto scene = application.GetScene(); - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); + auto scene = application.GetScene(); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); // Ensure we're not observing anything at the start ActorObserver actorObserver; - DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION ); + DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION); // Set the actor and ensure GetActor returns the correct pointer - actorObserver.SetActor( &actorImpl ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION ); + actorObserver.SetActor(&actorImpl); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION); - scene.Add( actor ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION ); + scene.Add(actor); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION); // Removing the actor from the scene should make it return null - scene.Remove( actor ); - DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION ); + scene.Remove(actor); + DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION); // Adding the actor back to the scene should mean it returning the actor again - scene.Add( actor ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION ); + scene.Add(actor); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION); // Resetting the actor should return nullptr actorObserver.ResetActor(); - DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION ); + DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION); // Set the actor again - actorObserver.SetActor( &actorImpl ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION ); + actorObserver.SetActor(&actorImpl); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION); // Create another Actor and observe that (don't add it to the scene just yet) { - auto actor2 = Actor::New(); - auto& actor2Impl = GetImplementation( actor2 ); - actorObserver.SetActor( &actor2Impl ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actor2Impl, TEST_LOCATION ); + auto actor2 = Actor::New(); + auto& actor2Impl = GetImplementation(actor2); + actorObserver.SetActor(&actor2Impl); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actor2Impl, TEST_LOCATION); } // Actor destroyed now, should return nullptr - DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION ); + DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION); END_TEST; } @@ -117,23 +116,23 @@ int UtcDaliActorObserverGracefulDeletion(void) { { // Scope lifetime of Actor - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); // Now scope the lifetime of ActorObserver { ActorObserver actorObserver; - actorObserver.SetActor( &actorImpl ); + actorObserver.SetActor(&actorImpl); } // ActorObserver goes out of scope - } // Actor goes out of scope + } // Actor goes out of scope // If we get here without a crash, then it's all good - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } - catch( ... ) + catch(...) { - tet_infoline( "ActorObserver did not clean up properly" ); - DALI_TEST_CHECK( false ); + tet_infoline("ActorObserver did not clean up properly"); + DALI_TEST_CHECK(false); } END_TEST; @@ -145,20 +144,20 @@ int UtcDaliActorObserverMoveConstructorAndAssignmentEmpty(void) // Copy empty observer ActorObserver observer1; - ActorObserver observer2( std::move( observer1 ) ); - DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION ); + ActorObserver observer2(std::move(observer1)); + DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); // Assign empty observer - observer1 = std::move( observer2 ); - DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION ); + observer1 = std::move(observer2); + DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); // Ensure self assignment doesn't change anything - observer1 = std::move( observer1 ); - observer2 = std::move( observer2 ); - DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION ); + observer1 = std::move(observer1); + observer2 = std::move(observer2); + DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); END_TEST; } @@ -169,28 +168,28 @@ int UtcDaliActorObserverMoveConstructorAndAssignment(void) // Ensure new observer is observing the correct actor // Ensure previous observer is not observing anything any more - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); ActorObserver observer1; - observer1.SetActor( &actorImpl ); - DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION ); + observer1.SetActor(&actorImpl); + DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION); // Move constructor - ActorObserver observer2( std::move( observer1 ) ); - DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), &actorImpl, TEST_LOCATION ); + ActorObserver observer2(std::move(observer1)); + DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), &actorImpl, TEST_LOCATION); // Move assignment - observer1 = std::move( observer2 ); - DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION ); + observer1 = std::move(observer2); + DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); // Self assignment - observer1 = std::move( observer1 ); - observer2 = std::move( observer2 ); - DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION ); - DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION ); + observer1 = std::move(observer1); + observer2 = std::move(observer2); + DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION); + DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION); END_TEST; } @@ -207,24 +206,24 @@ int UtcDaliActorObserverEnsureRValueCleansUp(void) { { // Scope lifetime of Actor - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); // Score lifetime of observers { ActorObserver observer1; - observer1.SetActor( &actorImpl ); - ActorObserver observer2( std::move( observer1 ) ); + observer1.SetActor(&actorImpl); + ActorObserver observer2(std::move(observer1)); } // Both observers die here - } // Actor goes out of scope + } // Actor goes out of scope // If we get here without a crash, then it's all good - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } - catch( ... ) + catch(...) { - tet_infoline( "ActorObserver did not clean up properly" ); - DALI_TEST_CHECK( false ); + tet_infoline("ActorObserver did not clean up properly"); + DALI_TEST_CHECK(false); } END_TEST; @@ -237,20 +236,20 @@ int UtcDaliActorObserverFunctionCallback(void) // Test to ensure the passed in callback is called when the observed actor is disconnected TestCallback::Reset(); - auto scene = application.GetScene(); - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); - scene.Add( actor ); + auto scene = application.GetScene(); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); + scene.Add(actor); - ActorObserver actorObserver( MakeCallback( &TestCallback::Function ) ); - actorObserver.SetActor( &actorImpl ); - DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION ); - DALI_TEST_EQUALS( TestCallback::disconnectedActor, nullptr, TEST_LOCATION ); + ActorObserver actorObserver(MakeCallback(&TestCallback::Function)); + actorObserver.SetActor(&actorImpl); + DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION); + DALI_TEST_EQUALS(TestCallback::disconnectedActor, nullptr, TEST_LOCATION); // Remove Actor from scene actor.Unparent(); - DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION ); - DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION ); + DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION); + DALI_TEST_EQUALS(TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION); END_TEST; } @@ -265,33 +264,33 @@ int UtcDaliActorObserverFunctionCallbackEnsureNoDoubleDelete(void) try { - auto scene = application.GetScene(); - auto actor = Actor::New(); - auto& actorImpl = GetImplementation( actor ); - scene.Add( actor ); + auto scene = application.GetScene(); + auto actor = Actor::New(); + auto& actorImpl = GetImplementation(actor); + scene.Add(actor); - ActorObserver *observer1 = new ActorObserver( MakeCallback( &TestCallback::Function ) ); - observer1->SetActor( &actorImpl ); + ActorObserver* observer1 = new ActorObserver(MakeCallback(&TestCallback::Function)); + observer1->SetActor(&actorImpl); // Move observer1 into a new observer - ActorObserver* observer2 = new ActorObserver( std::move( *observer1 ) ); + ActorObserver* observer2 = new ActorObserver(std::move(*observer1)); // Remove actor from scene, function should be called only once actor.Unparent(); - DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION ); - DALI_TEST_EQUALS( TestCallback::callCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION); + DALI_TEST_EQUALS(TestCallback::callCount, 1, TEST_LOCATION); // Delete both observers here, only one of them should delete the callback delete observer1; delete observer2; // If we get here without a crash, then the callback has NOT been double-freed - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( false ); - tet_infoline( "Callback double Freed" ); + DALI_TEST_CHECK(false); + tet_infoline("Callback double Freed"); } END_TEST; diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Core.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Core.cpp index 0004b0f..a0b47d0 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-Core.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-Core.cpp @@ -15,16 +15,14 @@ * */ -#include - -#include +#include #include +#include -#include +#include // Internal headers are allowed here - using namespace Dali; void utc_dali_internal_core_startup() @@ -39,19 +37,17 @@ void utc_dali_internal_core_cleanup() namespace { - class RelayoutSignalHandler : public Dali::ConnectionTracker { public: - - RelayoutSignalHandler( TestApplication& application ) - : mApplication( application ), - mSignalCalled( false ) + RelayoutSignalHandler(TestApplication& application) + : mApplication(application), + mSignalCalled(false) { } // callback to be connected to RelayoutSignal - void RelayoutCallback( Actor actor ) + void RelayoutCallback(Actor actor) { tet_infoline("RelayoutCallback is called"); @@ -61,7 +57,7 @@ public: } TestApplication& mApplication; - bool mSignalCalled; + bool mSignalCalled; }; } // anonymous namespace @@ -71,24 +67,24 @@ int UtcDaliCoreProcessEvents(void) TestApplication application; tet_infoline("Testing Dali::Integration::Core::ProcessEvents"); - Vector3 size( 100.0f, 100.0f, 0.0f ); - Vector3 position( 100.0f, 100.0f, 0.0f ); + Vector3 size(100.0f, 100.0f, 0.0f); + Vector3 position(100.0f, 100.0f, 0.0f); Actor actor = Actor::New(); - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - actor.SetProperty( Actor::Property::SIZE, size ); - actor.SetProperty( Actor::Property::POSITION, position ); - application.GetScene().Add( actor ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor.SetProperty(Actor::Property::SIZE, size); + actor.SetProperty(Actor::Property::POSITION, position); + application.GetScene().Add(actor); - RelayoutSignalHandler relayoutSignal( application ); - actor.OnRelayoutSignal().Connect( &relayoutSignal, &RelayoutSignalHandler::RelayoutCallback ); + RelayoutSignalHandler relayoutSignal(application); + actor.OnRelayoutSignal().Connect(&relayoutSignal, &RelayoutSignalHandler::RelayoutCallback); application.SendNotification(); - DALI_TEST_EQUALS( relayoutSignal.mSignalCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(relayoutSignal.mSignalCalled, true, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), size, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), position, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE).Get(), size, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), position, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-FixedSizeMemoryPool.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-FixedSizeMemoryPool.cpp index c4f653f..092826a 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-FixedSizeMemoryPool.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-FixedSizeMemoryPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ * */ -#include #include +#include // Internal headers are allowed here @@ -36,22 +36,19 @@ void utc_dali_internal_fixedsizememorypool_cleanup(void) namespace { - unsigned int gTestObjectConstructed = 0; -unsigned int gTestObjectDestructed = 0; -unsigned int gTestObjectMethod = 0; -unsigned int gTestObjectDataAccess = 0; +unsigned int gTestObjectDestructed = 0; +unsigned int gTestObjectMethod = 0; +unsigned int gTestObjectDataAccess = 0; } // namespace - class TestObject { public: - TestObject() - : mData1( 0 ), - mData2( false ) + : mData1(0), + mData2(false) { gTestObjectConstructed++; } @@ -75,34 +72,32 @@ public: } private: - unsigned int mData1; - bool mData2; - + bool mData2; }; int UtcDaliFixedSizeMemoryPoolCreate(void) { gTestObjectConstructed = 0; - gTestObjectDestructed = 0; - gTestObjectMethod = 0; - gTestObjectDataAccess = 0; + gTestObjectDestructed = 0; + gTestObjectMethod = 0; + gTestObjectDataAccess = 0; - Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size ); + Internal::FixedSizeMemoryPool memoryPool(Internal::TypeSizeWithAlignment::size); - TestObject* testObject1 = new (memoryPool.Allocate()) TestObject(); - DALI_TEST_CHECK( testObject1 ); - DALI_TEST_EQUALS( gTestObjectConstructed, 1U, TEST_LOCATION ); + TestObject* testObject1 = new(memoryPool.Allocate()) TestObject(); + DALI_TEST_CHECK(testObject1); + DALI_TEST_EQUALS(gTestObjectConstructed, 1U, TEST_LOCATION); testObject1->Method(); - DALI_TEST_EQUALS( gTestObjectMethod, 1U, TEST_LOCATION ); + DALI_TEST_EQUALS(gTestObjectMethod, 1U, TEST_LOCATION); testObject1->DataAccess(); - DALI_TEST_EQUALS( gTestObjectDataAccess, 1U, TEST_LOCATION ); + DALI_TEST_EQUALS(gTestObjectDataAccess, 1U, TEST_LOCATION); testObject1->~TestObject(); - memoryPool.Free( testObject1 ); - DALI_TEST_EQUALS( gTestObjectDestructed, 1U, TEST_LOCATION ); + memoryPool.Free(testObject1); + DALI_TEST_EQUALS(gTestObjectDestructed, 1U, TEST_LOCATION); END_TEST; } @@ -110,37 +105,37 @@ int UtcDaliFixedSizeMemoryPoolCreate(void) int UtcDaliFixedSizeMemoryPoolStressTest(void) { gTestObjectConstructed = 0; - gTestObjectDestructed = 0; - gTestObjectMethod = 0; - gTestObjectDataAccess = 0; + gTestObjectDestructed = 0; + gTestObjectMethod = 0; + gTestObjectDataAccess = 0; const size_t initialCapacity = 32; const size_t maximumCapacity = 1024; const unsigned int numObjects = 1024 * 1024; - Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size, initialCapacity, maximumCapacity ); + Internal::FixedSizeMemoryPool memoryPool(Internal::TypeSizeWithAlignment::size, initialCapacity, maximumCapacity); Dali::Vector objects; - objects.Reserve( numObjects ); + objects.Reserve(numObjects); - for( unsigned int i = 0; i < numObjects; ++i ) + for(unsigned int i = 0; i < numObjects; ++i) { - TestObject* testObject = new ( memoryPool.Allocate() ) TestObject(); - DALI_TEST_CHECK( testObject ); + TestObject* testObject = new(memoryPool.Allocate()) TestObject(); + DALI_TEST_CHECK(testObject); - objects.PushBack( testObject ); + objects.PushBack(testObject); } - DALI_TEST_EQUALS( gTestObjectConstructed, numObjects, TEST_LOCATION ); + DALI_TEST_EQUALS(gTestObjectConstructed, numObjects, TEST_LOCATION); - for( unsigned int i = 0; i < numObjects; ++i ) + for(unsigned int i = 0; i < numObjects; ++i) { objects[i]->~TestObject(); - memoryPool.Free( objects[i] ); + memoryPool.Free(objects[i]); } - DALI_TEST_EQUALS( gTestObjectDestructed, numObjects, TEST_LOCATION ); + DALI_TEST_EQUALS(gTestObjectDestructed, numObjects, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp index 5fd706a..7113efc 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp @@ -16,94 +16,91 @@ */ // EXTERNAL INCLUDES -#include #include -#include -#include +#include #include +#include +#include + // INTERNAL INCLUDES #include #include using namespace Dali; -#define MAKE_SHADER(A)#A +#define MAKE_SHADER(A) #A const char* VERTEX_SHADER = MAKE_SHADER( -attribute mediump vec2 aPosition; -attribute mediump vec2 aTexCoord; -uniform mediump mat4 uMvpMatrix; -uniform mediump vec3 uSize; -varying mediump vec2 vTexCoord; - -void main() -{ - mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0); - vertexPosition.xyz *= uSize; - vertexPosition = uMvpMatrix * vertexPosition; - vTexCoord = aTexCoord; - gl_Position = vertexPosition; -} -); + attribute mediump vec2 aPosition; + attribute mediump vec2 aTexCoord; + uniform mediump mat4 uMvpMatrix; + uniform mediump vec3 uSize; + varying mediump vec2 vTexCoord; + + void main() { + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0); + vertexPosition.xyz *= uSize; + vertexPosition = uMvpMatrix * vertexPosition; + vTexCoord = aTexCoord; + gl_Position = vertexPosition; + }); const char* FRAGMENT_SHADER = MAKE_SHADER( -uniform Sampler2D sTexture; -varying mediump vec2 vTexCoord; -void main() -{ - gl_FragColor = texture2D( sTexture, vTexCoord ); -} -); + uniform Sampler2D sTexture; + varying mediump vec2 vTexCoord; + void main() { + gl_FragColor = texture2D(sTexture, vTexCoord); + }); -Actor CreateMeshActorToScene( TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::Hint::Value shaderHints = Shader::Hint::NONE ) +Actor CreateMeshActorToScene(TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::Hint::Value shaderHints = Shader::Hint::NONE) { - Integration::PixelBuffer* pixelBuffer = new Integration::PixelBuffer[ 4 ]; - PixelData pixelData = PixelData::New(pixelBuffer, 4, 1, 1, Pixel::RGBA8888, PixelData::DELETE_ARRAY); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Integration::PixelBuffer* pixelBuffer = new Integration::PixelBuffer[4]; + PixelData pixelData = PixelData::New(pixelBuffer, 4, 1, 1, Pixel::RGBA8888, PixelData::DELETE_ARRAY); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); image.Upload(pixelData); - Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, shaderHints ); + Geometry geometry = CreateQuadGeometry(); + Shader shader = Shader::New(VERTEX_SHADER, FRAGMENT_SHADER, shaderHints); TextureSet textureSet = TextureSet::New(); textureSet.SetTexture(0u, image); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor meshActor = Actor::New(); - meshActor.AddRenderer( renderer ); - meshActor.SetProperty( Actor::Property::SIZE, Vector3( 400.0f, 400.0f, 0.1f ) ); - meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, parentOrigin ); - meshActor.SetProperty( Actor::Property::ANCHOR_POINT, anchorPoint ); - application.GetScene().Add( meshActor ); + meshActor.AddRenderer(renderer); + meshActor.SetProperty(Actor::Property::SIZE, Vector3(400.0f, 400.0f, 0.1f)); + meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, parentOrigin); + meshActor.SetProperty(Actor::Property::ANCHOR_POINT, anchorPoint); + application.GetScene().Add(meshActor); application.SendNotification(); - application.Render( 16 ); + application.Render(16); return meshActor; } -bool GetCameraDepths( TestApplication& application, float& nearPlane, float& farPlane, float& cameraDepth ) +bool GetCameraDepths(TestApplication& application, float& nearPlane, float& farPlane, float& cameraDepth) { RenderTaskList renderTasks = application.GetScene().GetRenderTaskList(); - CameraActor cameraActor; - for( unsigned int i = 0; i < renderTasks.GetTaskCount(); ++i ) + CameraActor cameraActor; + for(unsigned int i = 0; i < renderTasks.GetTaskCount(); ++i) { - RenderTask task = renderTasks.GetTask( i ); - cameraActor = task.GetCameraActor(); - if( cameraActor ) + RenderTask task = renderTasks.GetTask(i); + cameraActor = task.GetCameraActor(); + if(cameraActor) { break; } } - if( cameraActor ) + if(cameraActor) { application.SendNotification(); - application.Render( 16 ); + application.Render(16); - nearPlane = cameraActor.GetNearClippingPlane(); - farPlane = cameraActor.GetFarClippingPlane(); - cameraDepth = cameraActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z; + nearPlane = cameraActor.GetNearClippingPlane(); + farPlane = cameraActor.GetFarClippingPlane(); + cameraDepth = cameraActor.GetCurrentProperty(Actor::Property::POSITION).z; } return !!cameraActor; @@ -111,325 +108,325 @@ bool GetCameraDepths( TestApplication& application, float& nearPlane, float& far int UtcFrustumCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - CreateMeshActorToScene( application ); + CreateMeshActorToScene(application); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumLeftCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = -0.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT ); + float offset = -0.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_RIGHT); - float radius = meshActor.GetTargetSize().Length() * 0.5f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; Vector2 sceneSize = application.GetScene().GetSize(); - meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( -radius / sceneSize.width + offset, 0.5f, 0.5f ) ); - meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(-radius / sceneSize.width + offset, 0.5f, 0.5f)); + meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumLeftCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 0.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT ); + float offset = 0.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_RIGHT); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumRightCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 1.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT ); + float offset = 1.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_LEFT); - float radius = meshActor.GetTargetSize().Length() * 0.5f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; Vector2 sceneSize = application.GetScene().GetSize(); - meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( radius / sceneSize.width + offset, 0.5f, 0.5f ) ); - meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(radius / sceneSize.width + offset, 0.5f, 0.5f)); + meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumRightCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 0.99f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT ); + float offset = 0.99f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_LEFT); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumTopCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = -0.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER ); + float offset = -0.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::BOTTOM_CENTER); - float radius = meshActor.GetTargetSize().Length() * 0.5f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; Vector2 sceneSize = application.GetScene().GetSize(); - meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, -radius / sceneSize.width + offset, 0.5f ) ); - meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5f, -radius / sceneSize.width + offset, 0.5f)); + meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumTopCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 0.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER ); + float offset = 0.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::BOTTOM_CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be box culled - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumBottomCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 1.01f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER ); + float offset = 1.01f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::TOP_CENTER); - float radius = meshActor.GetTargetSize().Length() * 0.5f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; Vector2 sceneSize = application.GetScene().GetSize(); - meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, radius / sceneSize.width + offset, 0.5f ) ); - meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5f, radius / sceneSize.width + offset, 0.5f)); + meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumBottomCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - float offset = 0.99f; - Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER ); + float offset = 0.99f; + Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::TOP_CENTER); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumNearCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); float nearPlane, farPlane, cameraDepth; - DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) ); + DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth)); - Actor meshActor = CreateMeshActorToScene( application ); - Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + Actor meshActor = CreateMeshActorToScene(application); + Vector3 meshPosition = meshActor.GetCurrentProperty(Actor::Property::POSITION); - float radius = meshActor.GetTargetSize().Length() * 0.5f; - float offset = radius + 0.1f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; + float offset = radius + 0.1f; meshPosition.z = cameraDepth - nearPlane + offset; - meshActor.SetProperty( Actor::Property::POSITION, meshPosition ); + meshActor.SetProperty(Actor::Property::POSITION, meshPosition); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumNearCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); float nearPlane, farPlane, cameraDepth; - DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) ); + DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth)); - Actor meshActor = CreateMeshActorToScene( application ); - Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + Actor meshActor = CreateMeshActorToScene(application); + Vector3 meshPosition = meshActor.GetCurrentProperty(Actor::Property::POSITION); - float offset = meshActor.GetTargetSize().z - 0.1f; + float offset = meshActor.GetTargetSize().z - 0.1f; meshPosition.z = cameraDepth - nearPlane + offset; - meshActor.SetProperty( Actor::Property::POSITION, meshPosition ); + meshActor.SetProperty(Actor::Property::POSITION, meshPosition); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumFarCullP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); float nearPlane, farPlane, cameraDepth; - DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) ); + DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth)); - Actor meshActor = CreateMeshActorToScene( application ); - Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + Actor meshActor = CreateMeshActorToScene(application); + Vector3 meshPosition = meshActor.GetCurrentProperty(Actor::Property::POSITION); - float radius = meshActor.GetTargetSize().Length() * 0.5f; - float offset = radius + 0.1f; + float radius = meshActor.GetTargetSize().Length() * 0.5f; + float offset = radius + 0.1f; meshPosition.z = cameraDepth - farPlane - offset; - meshActor.SetProperty( Actor::Property::POSITION, meshPosition ); + meshActor.SetProperty(Actor::Property::POSITION, meshPosition); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This will be sphere culled - DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumFarCullN(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); float nearPlane, farPlane, cameraDepth; - DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) ); + DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth)); - Actor meshActor = CreateMeshActorToScene( application ); - Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + Actor meshActor = CreateMeshActorToScene(application); + Vector3 meshPosition = meshActor.GetCurrentProperty(Actor::Property::POSITION); - float offset = meshActor.GetTargetSize().z - 0.1f; + float offset = meshActor.GetTargetSize().z - 0.1f; meshPosition.z = cameraDepth - farPlane - offset; - meshActor.SetProperty( Actor::Property::POSITION, meshPosition ); + meshActor.SetProperty(Actor::Property::POSITION, meshPosition); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } int UtcFrustumCullDisabledP(void) { - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); - drawTrace.Enable( true ); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + drawTrace.Enable(true); - CreateMeshActorToScene( application, Vector3( 7.0f, 0.5f, 0.5f ), AnchorPoint::CENTER, Shader::Hint::MODIFIES_GEOMETRY ); + CreateMeshActorToScene(application, Vector3(7.0f, 0.5f, 0.5f), AnchorPoint::CENTER, Shader::Hint::MODIFIES_GEOMETRY); drawTrace.Reset(); application.SendNotification(); - application.Render( 16 ); + application.Render(16); // This should not be culled - DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements")); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp index 25938e1..3c8b6de 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp @@ -15,12 +15,12 @@ * */ -#include - -#include -#include #include #include +#include +#include + +#include using namespace Dali; @@ -36,31 +36,34 @@ void utc_dali_internal_gesture_cleanup(void) namespace { - // TestGesture Struct (Gesture constructor is protected) struct TestGesture : public Internal::Gesture { public: TestGesture(GestureType::Value type, GestureState state) - : Gesture(type, state) {} + : Gesture(type, state) + { + } - virtual ~TestGesture() {} + virtual ~TestGesture() + { + } }; -} // anon namespace +} // namespace int UtcDaliGestureConstructorP(void) { TestApplication application; // Reset all test adapter return codes Gesture empty; - DALI_TEST_CHECK( !empty ); + DALI_TEST_CHECK(!empty); - Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED)); DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION); - Gesture pinch( new TestGesture(GestureType::PINCH, GestureState::CLEAR) ); + Gesture pinch(new TestGesture(GestureType::PINCH, GestureState::CLEAR)); DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CLEAR, pinch.GetState(), TEST_LOCATION); @@ -72,7 +75,7 @@ int UtcDaliGestureConstructorP(void) // Test move constructor const auto refCount = pan.GetObjectPtr()->ReferenceCount(); - Gesture pan3( std::move( pan ) ); + Gesture pan3(std::move(pan)); DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -85,11 +88,11 @@ int UtcDaliGestureAssignmentP(void) TestApplication application; // Reset all test adapter return codes // Test Assignment operator - Gesture pan( new TestGesture(GestureType::PAN, GestureState::FINISHED) ); + Gesture pan(new TestGesture(GestureType::PAN, GestureState::FINISHED)); DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION); - Gesture test( new TestGesture(GestureType::PINCH, GestureState::STARTED) ); + Gesture test(new TestGesture(GestureType::PINCH, GestureState::STARTED)); DALI_TEST_EQUALS(GestureType::PINCH, test.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, test.GetState(), TEST_LOCATION); @@ -100,7 +103,7 @@ int UtcDaliGestureAssignmentP(void) // Move assignment const auto refCount = pan.GetObjectPtr()->ReferenceCount(); - Gesture pan3; + Gesture pan3; DALI_TEST_EQUALS(pan3, Gesture(), TEST_LOCATION); pan3 = std::move(pan); DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION); @@ -114,7 +117,7 @@ int UtcDaliGestureGetTypeP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED)); DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION); END_TEST; @@ -124,7 +127,7 @@ int UtcDaliGestureGetStateP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED)); DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION); GetImplementation(pan).SetState(GestureState::FINISHED); @@ -137,7 +140,7 @@ int UtcDaliGestureGetTimeP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED)); DALI_TEST_EQUALS(0, pan.GetTime(), TEST_LOCATION); GetImplementation(pan).SetTime(61282); @@ -145,4 +148,3 @@ int UtcDaliGestureGetTimeP(void) END_TEST; } - diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp index 94eb7b3..8c0a0ac 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp @@ -15,16 +15,14 @@ * */ -#include - -#include +#include #include +#include -#include +#include // Internal headers are allowed here - using namespace Dali; void utc_dali_internal_handles_startup() @@ -37,7 +35,6 @@ void utc_dali_internal_handles_cleanup() test_return_value = TET_PASS; } - int UtcDaliCameraActorConstructorRefObject(void) { TestApplication application; diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp index 59a0391..d1b4d4e 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp @@ -15,13 +15,13 @@ * */ -#include - -#include -#include #include #include #include +#include +#include + +#include using namespace Dali; @@ -39,12 +39,12 @@ int UtcDaliLongPressGestureConstructorP(void) { TestApplication application; - LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED ); + LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION); // Test Copy constructor - GetImplementation( gesture ).SetNumberOfTouches( 5u ); + GetImplementation(gesture).SetNumberOfTouches(5u); LongPressGesture gesture2(gesture); DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); @@ -52,8 +52,8 @@ int UtcDaliLongPressGestureConstructorP(void) DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION); // Test move constructor - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); - LongPressGesture gesture3( std::move( gesture ) ); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + LongPressGesture gesture3(std::move(gesture)); DALI_TEST_EQUALS(gesture, LongPressGesture(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -64,13 +64,13 @@ int UtcDaliLongPressGestureConstructorP(void) int UtcDaliLongPressGestureAssignmentP(void) { // Test Assignment operator - LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED ); + LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION); - GetImplementation( gesture ).SetNumberOfTouches( 5u ); + GetImplementation(gesture).SetNumberOfTouches(5u); - LongPressGesture gesture2 = DevelLongPressGesture::New( GestureState::FINISHED ); + LongPressGesture gesture2 = DevelLongPressGesture::New(GestureState::FINISHED); DALI_TEST_EQUALS(GestureState::FINISHED, gesture2.GetState(), TEST_LOCATION); gesture2 = gesture; DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); @@ -78,7 +78,7 @@ int UtcDaliLongPressGestureAssignmentP(void) DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION); // Move assignment - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); LongPressGesture gesture3; DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); @@ -93,7 +93,7 @@ int UtcDaliLongPressGestureGetNumberOfTouchesP(void) { TestApplication application; - LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED ); + LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTouches(4); @@ -106,13 +106,13 @@ int UtcDaliLongPressGestureGetScreenPointP(void) { TestApplication application; - LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED ); - DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION); - DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION); + LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED); + DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetScreenPoint(Vector2(100.0f, 300.0f)); DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION); - DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION); + DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION); END_TEST; } @@ -121,13 +121,13 @@ int UtcDaliLongPressGestureGetLocalPointP(void) { TestApplication application; - LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED ); - DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION); - DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION); + LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED); + DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetLocalPoint(Vector2(100.0f, 300.0f)); DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION); - DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION); + DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-MemoryPoolObjectAllocator.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-MemoryPoolObjectAllocator.cpp index 7355c60..25d2838 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-MemoryPoolObjectAllocator.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-MemoryPoolObjectAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ * */ -#include #include +#include // Internal headers are allowed here @@ -41,9 +41,9 @@ struct MemoryPoolObjectAllocatorTestObjectTracking int testObjectDataAccess; MemoryPoolObjectAllocatorTestObjectTracking() - : testObjectDestructed( 0 ), - testObjectMethod( 0 ), - testObjectDataAccess( 0 ) + : testObjectDestructed(0), + testObjectMethod(0), + testObjectDataAccess(0) { } }; @@ -51,17 +51,16 @@ struct MemoryPoolObjectAllocatorTestObjectTracking class MemoryPoolObjectAllocatorTestObject { public: - MemoryPoolObjectAllocatorTestObject() - : mData1( 0 ), - mData2( false ), - mTracking( NULL ) + : mData1(0), + mData2(false), + mTracking(NULL) { } ~MemoryPoolObjectAllocatorTestObject() { - if( mTracking ) + if(mTracking) { mTracking->testObjectDestructed++; } @@ -69,7 +68,7 @@ public: void Method() { - if( mTracking ) + if(mTracking) { mTracking->testObjectMethod++; } @@ -80,20 +79,19 @@ public: mData1++; mData2 = true; - if( mTracking ) + if(mTracking) { mTracking->testObjectDataAccess++; } } - void SetTracking( MemoryPoolObjectAllocatorTestObjectTracking* tracking ) + void SetTracking(MemoryPoolObjectAllocatorTestObjectTracking* tracking) { mTracking = tracking; } private: - - int mData1; + int mData1; bool mData2; MemoryPoolObjectAllocatorTestObjectTracking* mTracking; @@ -101,83 +99,82 @@ private: int UtcDaliMemoryPoolObjectAllocatorObjectAllocation(void) { - - Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator; + Internal::MemoryPoolObjectAllocator allocator; // Allocate an object MemoryPoolObjectAllocatorTestObject* testObject1 = allocator.Allocate(); - DALI_TEST_CHECK( testObject1 ); + DALI_TEST_CHECK(testObject1); MemoryPoolObjectAllocatorTestObjectTracking tracking1; - testObject1->SetTracking( &tracking1 ); + testObject1->SetTracking(&tracking1); testObject1->Method(); - DALI_TEST_EQUALS( tracking1.testObjectMethod, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking1.testObjectMethod, 1, TEST_LOCATION); testObject1->DataAccess(); - DALI_TEST_EQUALS( tracking1.testObjectDataAccess, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking1.testObjectDataAccess, 1, TEST_LOCATION); - allocator.Destroy( testObject1 ); - DALI_TEST_EQUALS( tracking1.testObjectDestructed, 1, TEST_LOCATION ); + allocator.Destroy(testObject1); + DALI_TEST_EQUALS(tracking1.testObjectDestructed, 1, TEST_LOCATION); // Reset and allocate another object allocator.ResetMemoryPool(); MemoryPoolObjectAllocatorTestObject* testObject2 = allocator.Allocate(); - DALI_TEST_CHECK( testObject2 ); + DALI_TEST_CHECK(testObject2); MemoryPoolObjectAllocatorTestObjectTracking tracking2; - testObject2->SetTracking( &tracking2 ); + testObject2->SetTracking(&tracking2); testObject2->Method(); - DALI_TEST_EQUALS( tracking2.testObjectMethod, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking2.testObjectMethod, 1, TEST_LOCATION); testObject2->DataAccess(); - DALI_TEST_EQUALS( tracking2.testObjectDataAccess, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking2.testObjectDataAccess, 1, TEST_LOCATION); - allocator.Destroy( testObject2 ); - DALI_TEST_EQUALS( tracking2.testObjectDestructed, 1, TEST_LOCATION ); + allocator.Destroy(testObject2); + DALI_TEST_EQUALS(tracking2.testObjectDestructed, 1, TEST_LOCATION); END_TEST; } int UtcDaliMemoryPoolObjectAllocatorObjectRawAllocation(void) { - Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator; + Internal::MemoryPoolObjectAllocator allocator; - MemoryPoolObjectAllocatorTestObject* testObject = new ( allocator.AllocateRaw() ) MemoryPoolObjectAllocatorTestObject(); - DALI_TEST_CHECK( testObject ); + MemoryPoolObjectAllocatorTestObject* testObject = new(allocator.AllocateRaw()) MemoryPoolObjectAllocatorTestObject(); + DALI_TEST_CHECK(testObject); MemoryPoolObjectAllocatorTestObjectTracking tracking; - testObject->SetTracking( &tracking ); + testObject->SetTracking(&tracking); testObject->Method(); - DALI_TEST_EQUALS( tracking.testObjectMethod, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking.testObjectMethod, 1, TEST_LOCATION); testObject->DataAccess(); - DALI_TEST_EQUALS( tracking.testObjectDataAccess, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(tracking.testObjectDataAccess, 1, TEST_LOCATION); - allocator.Destroy( testObject ); - DALI_TEST_EQUALS( tracking.testObjectDestructed, 1, TEST_LOCATION ); + allocator.Destroy(testObject); + DALI_TEST_EQUALS(tracking.testObjectDestructed, 1, TEST_LOCATION); END_TEST; } int UtcDaliMemoryPoolObjectAllocatorObjectAllocationPOD(void) { - Internal::MemoryPoolObjectAllocator< bool > allocator; + Internal::MemoryPoolObjectAllocator allocator; bool* testObject1 = allocator.Allocate(); - DALI_TEST_CHECK( testObject1 ); + DALI_TEST_CHECK(testObject1); - allocator.Destroy( testObject1 ); + allocator.Destroy(testObject1); allocator.ResetMemoryPool(); bool* testObject2 = allocator.Allocate(); - DALI_TEST_CHECK( testObject2 ); + DALI_TEST_CHECK(testObject2); - allocator.Destroy( testObject2 ); + allocator.Destroy(testObject2); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp index 1452895..01af1ad 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-OwnerPointer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,14 +37,12 @@ void utc_dali_internal_owner_pointer_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - /// Takes in a reference to a bool which is set to true when the destructor is called class OwnedClass { public: - - OwnedClass( bool& destructorCalled ) - : mDestructorCalled( destructorCalled ) + OwnedClass(bool& destructorCalled) + : mDestructorCalled(destructorCalled) { mDestructorCalled = false; } @@ -55,7 +53,6 @@ public: } private: - bool& mDestructorCalled; }; @@ -70,10 +67,10 @@ public: functionCalled = true; } - bool functionCalled{ false }; + bool functionCalled{false}; }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -84,13 +81,13 @@ int UtcDaliOwnerPointerEnsureDeletion(void) bool deleted = false; { - OwnerPointer< OwnedClass > pointer( new OwnedClass( deleted ) ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + OwnerPointer pointer(new OwnedClass(deleted)); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); } // OwnerPointer out-of-scope, object should be deleted. - DALI_TEST_EQUALS( deleted, true, TEST_LOCATION ); + DALI_TEST_EQUALS(deleted, true, TEST_LOCATION); END_TEST; } @@ -99,8 +96,8 @@ int UtcDaliOwnerPointerDefaultConstructor(void) { // Ensure the default constructor is created as expected. - OwnerPointer< OwnedClass > pointer; - DALI_TEST_CHECK( pointer.Get() == nullptr ); + OwnerPointer pointer; + DALI_TEST_CHECK(pointer.Get() == nullptr); END_TEST; } @@ -109,42 +106,42 @@ int UtcDaliOwnerPointerCopy(void) { // Call copy constructor and assignment operator - bool deleted = false; - OwnedClass* owned = new OwnedClass( deleted ); + bool deleted = false; + OwnedClass* owned = new OwnedClass(deleted); - OwnerPointer< OwnedClass > first( owned ); - DALI_TEST_CHECK( first.Get() == owned ); + OwnerPointer first(owned); + DALI_TEST_CHECK(first.Get() == owned); { // Copy constructor, first should have a nullptr now, no object deletion - OwnerPointer< OwnedClass > second( first ); - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( second.Get() == owned); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + OwnerPointer second(first); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(second.Get() == owned); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Self assignment, nothing should change or be deleted. - first = first; + first = first; second = second; - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( second.Get() == owned ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(second.Get() == owned); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Assign second to first, no deletion, second should have a nullptr now first = second; - DALI_TEST_CHECK( first.Get() == owned ); - DALI_TEST_CHECK( second.Get() == nullptr ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + DALI_TEST_CHECK(first.Get() == owned); + DALI_TEST_CHECK(second.Get() == nullptr); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); } // second is out-of-scope now, no object deletion - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Assign to an empty pointer, owned object should be deleted - OwnerPointer< OwnedClass > empty; + OwnerPointer empty; first = empty; - DALI_TEST_EQUALS( deleted, true, TEST_LOCATION ); - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( empty.Get() == nullptr ); + DALI_TEST_EQUALS(deleted, true, TEST_LOCATION); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(empty.Get() == nullptr); END_TEST; } @@ -153,42 +150,42 @@ int UtcDaliOwnerPointerMove(void) { // Call move constructor and move assignment operator - bool deleted = false; - OwnedClass* owned = new OwnedClass( deleted ); + bool deleted = false; + OwnedClass* owned = new OwnedClass(deleted); - OwnerPointer< OwnedClass > first( owned ); - DALI_TEST_CHECK( first.Get() == owned ); + OwnerPointer first(owned); + DALI_TEST_CHECK(first.Get() == owned); { // Move constructor, first should have a nullptr now, no object deletion - OwnerPointer< OwnedClass > second( std::move( first ) ); - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( second.Get() == owned); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + OwnerPointer second(std::move(first)); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(second.Get() == owned); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Self assignment, nothing should change or be deleted. - first = std::move( first ); - second = std::move( second ); - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( second.Get() == owned ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + first = std::move(first); + second = std::move(second); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(second.Get() == owned); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Assign second to first, no deletion, second should have a nullptr now - first = std::move( second ); - DALI_TEST_CHECK( first.Get() == owned ); - DALI_TEST_CHECK( second.Get() == nullptr ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + first = std::move(second); + DALI_TEST_CHECK(first.Get() == owned); + DALI_TEST_CHECK(second.Get() == nullptr); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); } // second is out-of-scope now, no object deletion - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); // Assign to an empty pointer, owned object should be deleted - OwnerPointer< OwnedClass > empty; - first = std::move( empty ); - DALI_TEST_EQUALS( deleted, true, TEST_LOCATION ); - DALI_TEST_CHECK( first.Get() == nullptr ); - DALI_TEST_CHECK( empty.Get() == nullptr ); + OwnerPointer empty; + first = std::move(empty); + DALI_TEST_EQUALS(deleted, true, TEST_LOCATION); + DALI_TEST_CHECK(first.Get() == nullptr); + DALI_TEST_CHECK(empty.Get() == nullptr); END_TEST; } @@ -197,20 +194,20 @@ int UtcDaliOwnerPointerIndirection(void) { // Check the indirection operators - using Ptr = OwnerPointer< int >; + using Ptr = OwnerPointer; { - int* rawIntPtr( new int( 200 ) ); - Ptr nonConstPtr( rawIntPtr ); - DALI_TEST_CHECK( rawIntPtr == &( *nonConstPtr ) ); - DALI_TEST_EQUALS( *nonConstPtr, 200, TEST_LOCATION ); + int* rawIntPtr(new int(200)); + Ptr nonConstPtr(rawIntPtr); + DALI_TEST_CHECK(rawIntPtr == &(*nonConstPtr)); + DALI_TEST_EQUALS(*nonConstPtr, 200, TEST_LOCATION); } { - int* rawIntPtr2( new int( 300 ) ); - const Ptr constPtr( rawIntPtr2 ); - DALI_TEST_CHECK( rawIntPtr2 == &( *constPtr ) ); - DALI_TEST_EQUALS( *constPtr, 300, TEST_LOCATION ); + int* rawIntPtr2(new int(300)); + const Ptr constPtr(rawIntPtr2); + DALI_TEST_CHECK(rawIntPtr2 == &(*constPtr)); + DALI_TEST_EQUALS(*constPtr, 300, TEST_LOCATION); } END_TEST; @@ -220,25 +217,24 @@ int UtcDaliOwnerPointerPointerOperator(void) { // Check the pointer operators - using Ptr = OwnerPointer< ClassWithFunction >; + using Ptr = OwnerPointer; // Check if function is called as expected when using a const OwnerPointer { - ClassWithFunction* rawPtr( new ClassWithFunction ); - Ptr nonConstPtr( rawPtr ); - DALI_TEST_EQUALS( rawPtr->functionCalled, false, TEST_LOCATION ); + ClassWithFunction* rawPtr(new ClassWithFunction); + Ptr nonConstPtr(rawPtr); + DALI_TEST_EQUALS(rawPtr->functionCalled, false, TEST_LOCATION); nonConstPtr->MyFunction(); - DALI_TEST_EQUALS( rawPtr->functionCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(rawPtr->functionCalled, true, TEST_LOCATION); } - // Check if function is called as expected when using a const OwnerPointer { - ClassWithFunction* rawPtr2( new ClassWithFunction ); - const Ptr constPtr( rawPtr2 ); - DALI_TEST_EQUALS( rawPtr2->functionCalled, false, TEST_LOCATION ); + ClassWithFunction* rawPtr2(new ClassWithFunction); + const Ptr constPtr(rawPtr2); + DALI_TEST_EQUALS(rawPtr2->functionCalled, false, TEST_LOCATION); constPtr->MyFunction(); - DALI_TEST_EQUALS( rawPtr2->functionCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(rawPtr2->functionCalled, true, TEST_LOCATION); } END_TEST; } @@ -247,12 +243,12 @@ int UtcDaliOwnerPointerComparisonOperator(void) { // Check the comparison operator - using Ptr = OwnerPointer< int >; + using Ptr = OwnerPointer; - int* rawIntPtr( new int( 200 ) ); - Ptr ownerPtr( rawIntPtr ); - DALI_TEST_CHECK( ownerPtr == rawIntPtr ); - DALI_TEST_CHECK( ! ( ownerPtr == nullptr ) ); + int* rawIntPtr(new int(200)); + Ptr ownerPtr(rawIntPtr); + DALI_TEST_CHECK(ownerPtr == rawIntPtr); + DALI_TEST_CHECK(!(ownerPtr == nullptr)); END_TEST; } @@ -263,15 +259,15 @@ int UtcDaliOwnerPointerReset(void) bool deleted = false; - OwnerPointer< OwnedClass > pointer( new OwnedClass( deleted ) ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); + OwnerPointer pointer(new OwnedClass(deleted)); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); pointer.Reset(); - DALI_TEST_EQUALS( deleted, true, TEST_LOCATION ); - DALI_TEST_CHECK( pointer.Get() == nullptr ); + DALI_TEST_EQUALS(deleted, true, TEST_LOCATION); + DALI_TEST_CHECK(pointer.Get() == nullptr); // Reset the empty pointer, should have no effect but there shouldn't be any crash pointer.Reset(); - DALI_TEST_CHECK( pointer.Get() == nullptr ); + DALI_TEST_CHECK(pointer.Get() == nullptr); END_TEST; } @@ -282,17 +278,17 @@ int UtcDaliOwnerPointerRelease(void) bool deleted = false; - OwnedClass* rawPtr = new OwnedClass( deleted ); - OwnerPointer< OwnedClass > pointer( rawPtr ); + OwnedClass* rawPtr = new OwnedClass(deleted); + OwnerPointer pointer(rawPtr); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( pointer.Release() == rawPtr ); - DALI_TEST_EQUALS( deleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( pointer.Get() == nullptr ); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); + DALI_TEST_CHECK(pointer.Release() == rawPtr); + DALI_TEST_EQUALS(deleted, false, TEST_LOCATION); + DALI_TEST_CHECK(pointer.Get() == nullptr); // Release the empty pointer, should have no effect but there shouldn't be any crash - DALI_TEST_CHECK( pointer.Release() == nullptr ); - DALI_TEST_CHECK( pointer.Get() == nullptr ); + DALI_TEST_CHECK(pointer.Release() == nullptr); + DALI_TEST_CHECK(pointer.Get() == nullptr); END_TEST; } @@ -301,11 +297,11 @@ int UtcDaliOwnerPointerGet(void) { // Check the Get method - using Ptr = OwnerPointer< int >; + using Ptr = OwnerPointer; - int* rawIntPtr( new int( 200 ) ); - Ptr ownerPtr( rawIntPtr ); - DALI_TEST_CHECK( ownerPtr.Get() == rawIntPtr ); + int* rawIntPtr(new int(200)); + Ptr ownerPtr(rawIntPtr); + DALI_TEST_CHECK(ownerPtr.Get() == rawIntPtr); END_TEST; } @@ -314,48 +310,48 @@ int UtcDaliOwnerPointerSwap(void) { // Ensure the Swap method swaps the pointers and doesn't delete any objects - using Ptr = OwnerPointer< OwnedClass >; + using Ptr = OwnerPointer; - bool firstObjectDeleted = false; + bool firstObjectDeleted = false; bool secondObjectDeleted = false; - OwnedClass* firstRawPtr = new OwnedClass( firstObjectDeleted ); - OwnedClass* secondRawPtr = new OwnedClass( secondObjectDeleted ); + OwnedClass* firstRawPtr = new OwnedClass(firstObjectDeleted); + OwnedClass* secondRawPtr = new OwnedClass(secondObjectDeleted); - Ptr firstPtr( firstRawPtr ); - Ptr secondPtr( secondRawPtr ); + Ptr firstPtr(firstRawPtr); + Ptr secondPtr(secondRawPtr); // Check initial values - DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( firstPtr == firstRawPtr ); - DALI_TEST_CHECK( secondPtr == secondRawPtr ); + DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION); + DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION); + DALI_TEST_CHECK(firstPtr == firstRawPtr); + DALI_TEST_CHECK(secondPtr == secondRawPtr); // Call Swap on first and ensure swap is done and there's no deletion - firstPtr.Swap( secondPtr ); - DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( firstPtr == secondRawPtr ); - DALI_TEST_CHECK( secondPtr == firstRawPtr ); + firstPtr.Swap(secondPtr); + DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION); + DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION); + DALI_TEST_CHECK(firstPtr == secondRawPtr); + DALI_TEST_CHECK(secondPtr == firstRawPtr); // Swap back using second, again no deletion - secondPtr.Swap( firstPtr ); - DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( firstPtr == firstRawPtr ); - DALI_TEST_CHECK( secondPtr == secondRawPtr ); + secondPtr.Swap(firstPtr); + DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION); + DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION); + DALI_TEST_CHECK(firstPtr == firstRawPtr); + DALI_TEST_CHECK(secondPtr == secondRawPtr); // Swap with self, nothing should change or be deleted - firstPtr.Swap( firstPtr ); - DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( firstPtr == firstRawPtr ); + firstPtr.Swap(firstPtr); + DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION); + DALI_TEST_CHECK(firstPtr == firstRawPtr); // Swap with an empty OwnerPointer, no deletion but firstPtr should be empty now Ptr emptyPtr; - firstPtr.Swap( emptyPtr ); - DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION ); - DALI_TEST_CHECK( firstPtr == nullptr ); - DALI_TEST_CHECK( emptyPtr == firstRawPtr ); + firstPtr.Swap(emptyPtr); + DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION); + DALI_TEST_CHECK(firstPtr == nullptr); + DALI_TEST_CHECK(emptyPtr == firstRawPtr); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp index 577f67f..975e97b 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp @@ -15,13 +15,13 @@ * */ -#include - -#include -#include #include #include #include +#include +#include + +#include using namespace Dali; @@ -40,27 +40,27 @@ int UtcDaliPinchGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); - PinchGesture gesture2 = DevelPinchGesture::New( GestureState::CONTINUING ); + PinchGesture gesture2 = DevelPinchGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION); - PinchGesture gesture3 = DevelPinchGesture::New( GestureState::FINISHED ); + PinchGesture gesture3 = DevelPinchGesture::New(GestureState::FINISHED); DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture3.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture3.GetSpeed(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION); // Test copy constructor - GetImplementation( gesture3 ).SetScale( 3.0f ); - GetImplementation( gesture3 ).SetSpeed( 5.0f ); + GetImplementation(gesture3).SetScale(3.0f); + GetImplementation(gesture3).SetSpeed(5.0f); PinchGesture pinch(gesture3); DALI_TEST_EQUALS(GestureState::FINISHED, pinch.GetState(), TEST_LOCATION); @@ -69,8 +69,8 @@ int UtcDaliPinchGestureConstructor(void) DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION); // Test move constructor - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); - PinchGesture gesture4( std::move( gesture ) ); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + PinchGesture gesture4(std::move(gesture)); DALI_TEST_CHECK(!gesture); DALI_TEST_EQUALS(GestureType::PINCH, gesture4.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -81,20 +81,20 @@ int UtcDaliPinchGestureConstructor(void) int UtcDaliPinchGestureAssignment(void) { // Test Assignment operator - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); - PinchGesture gesture2 = DevelPinchGesture::New( GestureState::CONTINUING ); + PinchGesture gesture2 = DevelPinchGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION); - GetImplementation( gesture2 ).SetScale( 3.0f ); - GetImplementation( gesture2 ).SetSpeed( 5.0f ); + GetImplementation(gesture2).SetScale(3.0f); + GetImplementation(gesture2).SetSpeed(5.0f); gesture = gesture2; DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); @@ -103,7 +103,7 @@ int UtcDaliPinchGestureAssignment(void) DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); // Move assignment - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); PinchGesture gesture3; DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); @@ -116,7 +116,7 @@ int UtcDaliPinchGestureAssignment(void) int UtcDaliPinchGestureSetGetScaleP(void) { - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetScale(), 0.0f, TEST_LOCATION); GetImplementation(gesture).SetScale(123.0f); @@ -127,7 +127,7 @@ int UtcDaliPinchGestureSetGetScaleP(void) int UtcDaliPinchGestureSetGetSpeedP(void) { - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetSpeed(), 0.0f, TEST_LOCATION); GetImplementation(gesture).SetSpeed(123.0f); @@ -138,22 +138,22 @@ int UtcDaliPinchGestureSetGetSpeedP(void) int UtcDaliPinchGestureSetGetScreenCenterPointP(void) { - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f)); - DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } int UtcDaliPinchGestureSetGetLocalCenterPointP(void) { - PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED ); + PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION); - GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f)); - DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f, 321.0f)); + DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp index 02c43eb..8ea2a81 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp @@ -15,14 +15,14 @@ * */ -#include - -#include -#include #include -#include -#include #include +#include +#include +#include +#include + +#include using namespace Dali; @@ -38,28 +38,27 @@ void utc_dali_internal_pinch_gesture_processor_cleanup(void) namespace { - void TestAbortWithState(GestureState state) { TestApplication application; Internal::PinchGestureProcessor processor; - Integration::Scene scene( application.GetScene() ); - Internal::Scene& sceneImpl = GetImplementation( scene ); - Internal::PinchGestureEvent event(state); + Integration::Scene scene(application.GetScene()); + Internal::Scene& sceneImpl = GetImplementation(scene); + Internal::PinchGestureEvent event(state); try { processor.Process(sceneImpl, event); - DALI_TEST_CHECK( false ); // Should not get here as we expect an abort + DALI_TEST_CHECK(false); // Should not get here as we expect an abort } catch(...) { - DALI_TEST_CHECK( true ); // We aborted, so the test has passed + DALI_TEST_CHECK(true); // We aborted, so the test has passed } } -} // anon namespace +} // namespace int UtcDaliPinchGestureProcessorProcessClearStateN(void) { @@ -72,4 +71,3 @@ int UtcDaliPinchGestureProcessorProcessPossibleStateN(void) TestAbortWithState(GestureState::POSSIBLE); END_TEST; } - diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp index a580828..c094c6c 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp @@ -15,13 +15,13 @@ * */ -#include - -#include -#include #include #include #include +#include +#include + +#include using namespace Dali; @@ -40,23 +40,23 @@ int UtcDaliRotationGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED ); + RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION); DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); - RotationGesture gesture2 = DevelRotationGesture::New( GestureState::CONTINUING ); + RotationGesture gesture2 = DevelRotationGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION); DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION); - RotationGesture gesture3 = DevelRotationGesture::New( GestureState::FINISHED ); + RotationGesture gesture3 = DevelRotationGesture::New(GestureState::FINISHED); DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture3.GetRotation().radian, TEST_LOCATION); DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION); // Test copy constructor - GetImplementation( gesture3 ).SetRotation( Radian( 3.0f )); + GetImplementation(gesture3).SetRotation(Radian(3.0f)); RotationGesture rotation(gesture3); DALI_TEST_EQUALS(GestureState::FINISHED, rotation.GetState(), TEST_LOCATION); @@ -64,8 +64,8 @@ int UtcDaliRotationGestureConstructor(void) DALI_TEST_EQUALS(GestureType::ROTATION, rotation.GetType(), TEST_LOCATION); // Test move constructor - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); - RotationGesture gesture4( std::move( gesture ) ); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + RotationGesture gesture4(std::move(gesture)); DALI_TEST_CHECK(!gesture); DALI_TEST_EQUALS(GestureType::ROTATION, gesture4.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -76,17 +76,17 @@ int UtcDaliRotationGestureConstructor(void) int UtcDaliRotationGestureAssignment(void) { // Test Assignment operator - RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED ); + RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION); DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); - RotationGesture gesture2 = DevelRotationGesture::New( GestureState::CONTINUING ); + RotationGesture gesture2 = DevelRotationGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION); DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION); - GetImplementation( gesture2 ).SetRotation( Radian( 3.0f )); + GetImplementation(gesture2).SetRotation(Radian(3.0f)); gesture = gesture2; DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); @@ -94,7 +94,7 @@ int UtcDaliRotationGestureAssignment(void) DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); // Move assignment - const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); + const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); RotationGesture gesture3; DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); @@ -107,7 +107,7 @@ int UtcDaliRotationGestureAssignment(void) int UtcDaliRotationGestureSetGetRotationP(void) { - RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED ); + RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetRotation(), Radian(), TEST_LOCATION); GetImplementation(gesture).SetRotation(Dali::ANGLE_270); @@ -118,22 +118,22 @@ int UtcDaliRotationGestureSetGetRotationP(void) int UtcDaliRotationGestureSetGetScreenCenterPointP(void) { - RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED ); + RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION); - GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f,321.0f)); - DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f)); + DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } int UtcDaliRotationGestureSetGetLocalCenterPointP(void) { - RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED ); + RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION); - GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f)); - DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f, 321.0f)); + DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp index a22c4ad..0af0624 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp @@ -15,13 +15,13 @@ * */ -#include - -#include -#include #include #include #include +#include +#include + +#include using namespace Dali; @@ -35,20 +35,19 @@ void utc_dali_internal_tap_gesture_cleanup(void) test_return_value = TET_PASS; } - // Positive test case for a method int UtcDaliTapGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION); // Test Copy constructor - GetImplementation( gesture ).SetNumberOfTouches( 5u ); - GetImplementation( gesture ).SetNumberOfTaps( 2u ); + GetImplementation(gesture).SetNumberOfTouches(5u); + GetImplementation(gesture).SetNumberOfTaps(2u); TapGesture gesture2(gesture); DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); @@ -57,7 +56,7 @@ int UtcDaliTapGestureConstructor(void) // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); - TapGesture gesture3( std::move( gesture ) ); + TapGesture gesture3(std::move(gesture)); DALI_TEST_CHECK(!gesture); DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -68,13 +67,13 @@ int UtcDaliTapGestureConstructor(void) int UtcDaliTapGestureAssignment(void) { // Test Assignment operator - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION); - GetImplementation( gesture ).SetNumberOfTouches( 5u ); - GetImplementation( gesture ).SetNumberOfTaps( 2u ); + GetImplementation(gesture).SetNumberOfTouches(5u); + GetImplementation(gesture).SetNumberOfTaps(2u); TapGesture gesture2; gesture2 = gesture; @@ -96,7 +95,7 @@ int UtcDaliTapGestureAssignment(void) int UtcDaliTapGestureSetGetNumberOfTapsP(void) { - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 1u, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTaps(123u); @@ -107,7 +106,7 @@ int UtcDaliTapGestureSetGetNumberOfTapsP(void) int UtcDaliTapGestureSetGetNumberOfTouchesP(void) { - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1u, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTouches(321u); @@ -118,22 +117,22 @@ int UtcDaliTapGestureSetGetNumberOfTouchesP(void) int UtcDaliTapGestureSetGetScreenPointP(void) { - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION); - GetImplementation(gesture).SetScreenPoint(Vector2(123.0f,321.0f)); - DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + GetImplementation(gesture).SetScreenPoint(Vector2(123.0f, 321.0f)); + DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } int UtcDaliTapGestureSetGetLocalPointP(void) { - TapGesture gesture = DevelTapGesture::New( GestureState::STARTED ); + TapGesture gesture = DevelTapGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION); - GetImplementation(gesture).SetLocalPoint(Vector2(123.0f,321.0f)); - DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f,321.0f), TEST_LOCATION); + GetImplementation(gesture).SetLocalPoint(Vector2(123.0f, 321.0f)); + DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp index 231dfcb..5851292 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp @@ -15,14 +15,14 @@ * */ -#include - -#include -#include #include -#include -#include #include +#include +#include +#include +#include + +#include using namespace Dali; @@ -38,28 +38,27 @@ void utc_dali_internal_tap_gesture_processor_cleanup(void) namespace { - void TestAbortWithState(GestureState state) { TestApplication application; Internal::TapGestureProcessor processor; - Integration::Scene scene( application.GetScene() ); - Internal::Scene& sceneImpl = GetImplementation( scene ); - Internal::TapGestureEvent event(state); + Integration::Scene scene(application.GetScene()); + Internal::Scene& sceneImpl = GetImplementation(scene); + Internal::TapGestureEvent event(state); try { processor.Process(sceneImpl, event); - DALI_TEST_CHECK( false ); // Should not get here as we expect an abort + DALI_TEST_CHECK(false); // Should not get here as we expect an abort } catch(...) { - DALI_TEST_CHECK( true ); // We aborted, so the test has passed + DALI_TEST_CHECK(true); // We aborted, so the test has passed } } -} // anon namespace +} // namespace int UtcDaliTapGestureProcessorProcessClearStateN(void) { @@ -78,4 +77,3 @@ int UtcDaliTapGestureProcessorProcessFinishedStateN(void) TestAbortWithState(GestureState::FINISHED); END_TEST; } - diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp index 87750e2..523bd8c 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp @@ -33,93 +33,93 @@ void tet_result(int32_t value) // First TET_PASS should set to zero // first TET_FAIL should prevent any further TET_PASS from setting back to zero // Any TET_FAIL should set to fail or leave as fail - if( test_return_value != 1 ) + if(test_return_value != 1) test_return_value = value; } #define END_TEST \ - return ((test_return_value>0)?1:0) + return ((test_return_value > 0) ? 1 : 0) extern "C" { + void tet_infoline(const char* str) + { + fprintf(stderr, "%s\n", str); + } -void tet_infoline(const char* str) -{ - fprintf(stderr, "%s\n", str); -} - -void tet_printf(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - vfprintf(stderr, format, arg); - va_end(arg); -} + void tet_printf(const char* format, ...) + { + va_list arg; + va_start(arg, format); + vfprintf(stderr, format, arg); + va_end(arg); + } } - bool operator==(TimePeriod a, TimePeriod b) { - return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ; + return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds); } -std::ostream& operator<<( std::ostream& ostream, TimePeriod value ) +std::ostream& operator<<(std::ostream& ostream, TimePeriod value) { return ostream << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")"; } -std::ostream& operator<<( std::ostream& ostream, Radian angle ) +std::ostream& operator<<(std::ostream& ostream, Radian angle) { ostream << angle.radian; return ostream; } -std::ostream& operator<<( std::ostream& ostream, Degree angle ) +std::ostream& operator<<(std::ostream& ostream, Degree angle) { ostream << angle.degree; return ostream; } -void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location ) +void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location) { - DALI_TEST_EQUALS< const BaseHandle& >( baseHandle1, baseHandle2, location ); + DALI_TEST_EQUALS(baseHandle1, baseHandle2, location); } -void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location ) +void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location) { - DALI_TEST_EQUALS< uint32_t >( ( uint32_t )( value1 ), value2, location ); + DALI_TEST_EQUALS((uint32_t)(value1), value2, location); } -void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location ) +void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location) { - DALI_TEST_EQUALS< uint32_t >( value1, ( uint32_t )( value2 ), location ); + DALI_TEST_EQUALS(value1, (uint32_t)(value2), location); } -void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location) +void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location) { - const float* m1 = matrix1.AsFloat(); - const float* m2 = matrix2.AsFloat(); - bool equivalent = true; + const float* m1 = matrix1.AsFloat(); + const float* m2 = matrix2.AsFloat(); + bool equivalent = true; - for (int32_t i=0;i<9;++i) + for(int32_t i = 0; i < 9; ++i) { - if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) ) + if(!(fabsf(m1[i] - m2[i]) < GetRangedEpsilon(m1[i], m2[i]))) { equivalent = false; } } - if( !equivalent ) + if(!equivalent) { // Align each float to 1234.67, i.e. 3.6 will be " 3.60" - fprintf( stderr, "%s, checking\n" - "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n" - "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n" - "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n", - location, - m1[0], m1[3], m1[6], m2[0], m2[3], m2[6], - m1[1], m1[4], m1[7], m2[1], m2[4], m2[7], - m1[2], m1[5], m1[8], m2[2], m2[5], m2[8] ); + // clang-format off + fprintf(stderr, "%s, checking\n" + "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n" + "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n" + "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n", + location, + m1[0],m1[3],m1[6],m2[0],m2[3],m2[6], + m1[1],m1[4],m1[7],m2[1],m2[4],m2[7], + m1[2],m1[5],m1[8],m2[2],m2[5],m2[8]); + // clang-format on tet_result(TET_FAIL); throw("TET_FAIL"); @@ -130,28 +130,30 @@ void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const cha } } -void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location) +void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location) { - const float* m1 = matrix1.AsFloat(); - const float* m2 = matrix2.AsFloat(); - bool equivalent = true; + const float* m1 = matrix1.AsFloat(); + const float* m2 = matrix2.AsFloat(); + bool equivalent = true; - for (int32_t i=0;i<9;++i) + for(int32_t i = 0; i < 9; ++i) { - equivalent &= (fabsf(m1[i] - m2[i]) #include -#include #include +#include #include // INTERNAL INCLUDES @@ -31,12 +31,12 @@ extern "C" { -void tet_infoline(const char*str); -void tet_printf(const char *format, ...); + void tet_infoline(const char* str); + void tet_printf(const char* format, ...); } -#include "test-application.h" #include "test-actor-utils.h" +#include "test-application.h" #include "test-gesture-generator.h" using namespace Dali; @@ -48,21 +48,21 @@ using namespace Dali; * Inspired by https://stackoverflow.com/questions/1706346/file-macro-manipulation-handling-at-compile-time * answer by Chetan Reddy */ -constexpr int32_t basenameIndex( const char * const path, const int32_t index = 0, const int32_t slashIndex = -1 ) +constexpr int32_t basenameIndex(const char* const path, const int32_t index = 0, const int32_t slashIndex = -1) { - return path[ index ] - ? ( path[ index ] == '/' - ? basenameIndex( path, index + 1, index ) - : basenameIndex( path, index + 1, slashIndex ) ) - : ( slashIndex + 1 ); + return path[index] + ? (path[index] == '/' + ? basenameIndex(path, index + 1, index) + : basenameIndex(path, index + 1, slashIndex)) + : (slashIndex + 1); } -#define __FILELINE__ ( { static const int32_t basenameIdx = basenameIndex( __FILE__ ); \ +#define __FILELINE__ ({ static const int32_t basenameIdx = basenameIndex( __FILE__ ); \ static_assert (basenameIdx >= 0, "compile-time basename" ); \ - __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; } ) + __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; }) #define TEST_LOCATION __FILELINE__ -#define TEST_INNER_LOCATION(x) ( std::string(x) + " (" + STRINGIZE(__LINE__) + ")" ).c_str() +#define TEST_INNER_LOCATION(x) (std::string(x) + " (" + STRINGIZE(__LINE__) + ")").c_str() #define TET_UNDEF 2 #define TET_FAIL 1 @@ -73,33 +73,32 @@ extern int32_t test_return_value; void tet_result(int32_t value); #define END_TEST \ - return ((test_return_value>0)?1:0) + return ((test_return_value > 0) ? 1 : 0) void tet_infoline(const char* str); -void tet_printf(const char *format, ...); +void tet_printf(const char* format, ...); /** * DALI_TEST_CHECK is a wrapper for tet_result. * If the condition evaluates to false, the test is stopped. * @param[in] The boolean expression to check */ -#define DALI_TEST_CHECK(condition) \ -if ( (condition) ) \ -{ \ - tet_result(TET_PASS); \ -} \ -else \ -{ \ - fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition ); \ - tet_result(TET_FAIL); \ - throw("TET_FAIL"); \ -} - +#define DALI_TEST_CHECK(condition) \ + if((condition)) \ + { \ + tet_result(TET_PASS); \ + } \ + else \ + { \ + fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition); \ + tet_result(TET_FAIL); \ + throw("TET_FAIL"); \ + } -bool operator==(TimePeriod a, TimePeriod b); -std::ostream& operator<<( std::ostream& ostream, TimePeriod value ); -std::ostream& operator<<( std::ostream& ostream, Radian angle ); -std::ostream& operator<<( std::ostream& ostream, Degree angle ); +bool operator==(TimePeriod a, TimePeriod b); +std::ostream& operator<<(std::ostream& ostream, TimePeriod value); +std::ostream& operator<<(std::ostream& ostream, Radian angle); +std::ostream& operator<<(std::ostream& ostream, Degree angle); /** * Test whether two values are equal. @@ -110,13 +109,13 @@ std::ostream& operator<<( std::ostream& ostream, Degree angle ); template inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location) { - if( !CompareType(value1, value2, 0.01f) ) + if(!CompareType(value1, value2, 0.01f)) { std::ostringstream o; o << value1 << " == " << value2 << std::endl; fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str()); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -129,18 +128,18 @@ inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location) * @param[in] value1 The first value * @param[in] value2 The second value */ -#define DALI_TEST_EQUAL( v1, v2 ) DALI_TEST_EQUALS( v1, v2, __FILELINE__ ) +#define DALI_TEST_EQUAL(v1, v2) DALI_TEST_EQUALS(v1, v2, __FILELINE__) template inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char* location) { - if( !CompareType(value1, value2, epsilon) ) + if(!CompareType(value1, value2, epsilon)) { std::ostringstream o; o << value1 << " == " << value2 << std::endl; fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str()); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -151,13 +150,13 @@ inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char template inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const char* location) { - if( CompareType(value1, value2, epsilon) ) + if(CompareType(value1, value2, epsilon)) { std::ostringstream o; o << value1 << " != " << value2 << std::endl; fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str()); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -165,7 +164,6 @@ inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const } } - /** * Test whether two TimePeriods are within a certain distance of each other. * @param[in] value1 The first value @@ -174,19 +172,19 @@ inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const * @param[in] location The TEST_LOCATION macro should be used here */ template<> -inline void DALI_TEST_EQUALS( TimePeriod value1, TimePeriod value2, float epsilon, const char* location) +inline void DALI_TEST_EQUALS(TimePeriod value1, TimePeriod value2, float epsilon, const char* location) { - if ((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon)) + if((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon)) { fprintf(stderr, "Test failed in %s, checking durations %f == %f, epsilon %f\n", location, value1.durationSeconds, value2.durationSeconds, epsilon); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } - else if ((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon)) + else if((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon)) { fprintf(stderr, "Test failed in %s, checking delays %f == %f, epsilon %f\n", location, value1.delaySeconds, value2.delaySeconds, epsilon); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -200,7 +198,7 @@ inline void DALI_TEST_EQUALS( TimePeriod value1, TimePeriod value2, * @param[in] baseHandle2 The second value * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location ); +void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location); /** * Test whether a size_t value and an uint32_t are equal. @@ -208,7 +206,7 @@ void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHand * @param[in] value2 The second value * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location ); +void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location); /** * Test whether an uint32_t and a size_t value and are equal. @@ -216,7 +214,7 @@ void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* l * @param[in] value2 The second value * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location ); +void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location); /** * Test whether two Matrix3 objects are equal. @@ -224,7 +222,7 @@ void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* l * @param[in] matrix2 The second object * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location); +void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location); /** Test whether two Matrix3 objects are equal (fuzzy compare). * @param[in] matrix1 The first object @@ -232,7 +230,7 @@ void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const cha * @param[in] epsilon The epsilon to use for comparison * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location); +void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location); /** * Test whether two Matrix objects are equal. @@ -240,7 +238,7 @@ void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float eps * @param[in] matrix2 The second object * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location); +void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, const char* location); /** * Test whether two Matrix objects are equal (fuzzy-compare). @@ -248,7 +246,7 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* * @param[in] matrix2 The second object * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location); +void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location); /** * Test whether two strings are equal. @@ -257,13 +255,13 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsil * @param[in] location The TEST_LOCATION macro should be used here */ template<> -inline void DALI_TEST_EQUALS( const char* str1, const char* str2, const char* location) +inline void DALI_TEST_EQUALS(const char* str1, const char* str2, const char* location) { - if (strcmp(str1, str2)) + if(strcmp(str1, str2)) { fprintf(stderr, "Test failed in %s, checking '%s' == '%s'\n", location, str1, str2); tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -278,7 +276,7 @@ inline void DALI_TEST_EQUALS( const char* str1, const char* str2, c * @param[in] location The TEST_LOCATION macro should be used here */ template<> -inline void DALI_TEST_EQUALS( const std::string &str1, const std::string &str2, const char* location) +inline void DALI_TEST_EQUALS(const std::string& str1, const std::string& str2, const char* location) { DALI_TEST_EQUALS(str1.c_str(), str2.c_str(), location); } @@ -289,7 +287,7 @@ inline void DALI_TEST_EQUALS( const std::string &str1, const * @param[in] str2 The second string * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location); +void DALI_TEST_EQUALS(Property::Value& str1, const char* str2, const char* location); /** * Test whether two strings are equal. @@ -297,7 +295,7 @@ void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* loca * @param[in] str2 The second string * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location); +void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* location); /** * Test whether two strings are equal. @@ -305,19 +303,18 @@ void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* lo * @param[in] str2 The second string * @param[in] location The TEST_LOCATION macro should be used here */ -void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location); +void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location); /** * Test if a property value type is equal to a trivial type. */ template -inline void DALI_TEST_VALUE_EQUALS( Property::Value&& value1, Type value2, float epsilon, const char* location) +inline void DALI_TEST_VALUE_EQUALS(Property::Value&& value1, Type value2, float epsilon, const char* location) { Property::Value value2b(value2); DALI_TEST_EQUALS(value1, value2b, epsilon, location); } - /** * Test whether one unsigned integer value is greater than another. * Test succeeds if value1 > value2 @@ -325,14 +322,14 @@ inline void DALI_TEST_VALUE_EQUALS( Property::Value&& value1, Type value2, float * @param[in] value2 The second value * @param[in] location The TEST_LOCATION macro should be used here */ -template< typename T > -void DALI_TEST_GREATER( T value1, T value2, const char* location) +template +void DALI_TEST_GREATER(T value1, T value2, const char* location) { - if (!(value1 > value2)) + if(!(value1 > value2)) { - std::cerr << "Test failed in " << location << ", checking " << value1 <<" > " << value2 << "\n"; + std::cerr << "Test failed in " << location << ", checking " << value1 << " > " << value2 << "\n"; tet_result(TET_FAIL); - throw("TET_FAIL"); \ + throw("TET_FAIL"); } else { @@ -348,15 +345,15 @@ void DALI_TEST_GREATER( T value1, T value2, const char* location) * assertion which triggered the exception. * @param[in] location The TEST_LOCATION macro should be used here. */ -void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location ); +void DALI_TEST_ASSERT(DaliException& e, std::string conditionSubString, const char* location); /** * Print the assert * @param[in] e The exception that we expect was fired by a runtime assertion failure. */ -inline void DALI_TEST_PRINT_ASSERT( DaliException& e ) +inline void DALI_TEST_PRINT_ASSERT(DaliException& e) { - tet_printf("Assertion %s failed at %s\n", e.condition, e.location ); + tet_printf("Assertion %s failed at %s\n", e.condition, e.location); } /** @@ -366,41 +363,42 @@ inline void DALI_TEST_PRINT_ASSERT( DaliException& e ) * @param expressions code to execute * @param assertstring the substring expected in the assert */ -#define DALI_TEST_ASSERTION( expressions, assertstring ) \ -try \ -{ \ - TestApplication::EnableLogging( false ); \ - expressions; \ - TestApplication::EnableLogging( true ); \ - fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring ); \ - tet_result(TET_FAIL); \ - throw("TET_FAIL"); } \ -catch( Dali::DaliException& e ) \ -{ \ - DALI_TEST_ASSERT( e, assertstring, TEST_LOCATION ); \ -} +#define DALI_TEST_ASSERTION(expressions, assertstring) \ + try \ + { \ + TestApplication::EnableLogging(false); \ + expressions; \ + TestApplication::EnableLogging(true); \ + fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring); \ + tet_result(TET_FAIL); \ + throw("TET_FAIL"); \ + } \ + catch(Dali::DaliException & e) \ + { \ + DALI_TEST_ASSERT(e, assertstring, TEST_LOCATION); \ + } // Functor to test whether an Applied signal is emitted struct ConstraintAppliedCheck { - ConstraintAppliedCheck( bool& signalReceived ); - void operator()( Constraint& constraint ); - void Reset(); - void CheckSignalReceived(); - void CheckSignalNotReceived(); + ConstraintAppliedCheck(bool& signalReceived); + void operator()(Constraint& constraint); + void Reset(); + void CheckSignalReceived(); + void CheckSignalNotReceived(); bool& mSignalReceived; // owned by individual tests }; /** * A Helper to test default functions */ -template +template struct DefaultFunctionCoverage { DefaultFunctionCoverage() { - T a; - T *b = new T(a); + T a; + T* b = new T(a); DALI_TEST_CHECK(b); a = *b; delete b; @@ -422,19 +420,18 @@ namespace Test class ObjectDestructionTracker : public ConnectionTracker { public: - /** * @brief Call in main part of code * @param[in] objectRegistry The object Registry being used */ - ObjectDestructionTracker( ObjectRegistry objectRegistry ); + ObjectDestructionTracker(ObjectRegistry objectRegistry); /** * @brief Call in sub bock of code where the Actor being checked is still alive. * * @param[in] actor Actor to be checked for destruction */ - void Start( Actor actor ); + void Start(Actor actor); /** * @brief Call to check if Actor alive or destroyed. @@ -445,7 +442,7 @@ public: private: ObjectRegistry mObjectRegistry; - bool mRefObjectDestroyed; + bool mRefObjectDestroyed; }; } // namespace Test diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp index 3d7c359..0693c43 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp @@ -20,10 +20,9 @@ namespace Dali { - Shader CreateShader() { - return Shader::New( "vertexSrc", "fragmentSrc" ); + return Shader::New("vertexSrc", "fragmentSrc"); } TextureSet CreateTextureSet() @@ -31,7 +30,7 @@ TextureSet CreateTextureSet() return TextureSet::New(); } -TextureSet CreateTextureSet( Texture texture ) +TextureSet CreateTextureSet(Texture texture) { TextureSet textureSet = TextureSet::New(); textureSet.SetTexture(0u, texture); @@ -41,34 +40,36 @@ TextureSet CreateTextureSet( Texture texture ) VertexBuffer CreateVertexBuffer() { Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; + texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexData = VertexBuffer::New( texturedQuadVertexFormat ); + VertexBuffer vertexData = VertexBuffer::New(texturedQuadVertexFormat); return vertexData; } Geometry CreateQuadGeometry(void) { - VertexBuffer vertexData = CreateVertexBuffer(); - const float halfQuadSize = .5f; - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; + VertexBuffer vertexData = CreateVertexBuffer(); + const float halfQuadSize = .5f; + struct TexturedQuadVertex + { + Vector2 position; + Vector2 textureCoordinates; + }; TexturedQuadVertex texturedQuadVertexData[4] = { - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) }, - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) }, - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; + {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)}, + {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)}, + {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)}, + {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}}; vertexData.SetData(texturedQuadVertexData, 4); - unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 }; + unsigned short indexData[6] = {0, 3, 1, 0, 2, 3}; Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexData ); - geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) ); + geometry.AddVertexBuffer(vertexData); + geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0])); return geometry; } - - } // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h index e593d38..d5c61b0 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h @@ -23,13 +23,12 @@ namespace Dali { - -Shader CreateShader(); -TextureSet CreateTextureSet(); -TextureSet CreateTextureSet( Texture texture ); -Geometry CreateQuadGeometry(); +Shader CreateShader(); +TextureSet CreateTextureSet(); +TextureSet CreateTextureSet(Texture texture); +Geometry CreateQuadGeometry(); VertexBuffer CreateVertexBuffer(); -} +} // namespace Dali #endif // MESH_BUILDER_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp index 5d45a12..2db4dbc 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp @@ -26,68 +26,66 @@ namespace Dali { - namespace { - const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( - attribute mediump vec2 aPosition;\n - uniform mediump mat4 uMvpMatrix;\n - uniform mediump vec3 uSize;\n - \n - void main()\n - {\n - mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n - vertexPosition.xyz *= uSize;\n - gl_Position = uMvpMatrix * vertexPosition;\n - }\n -); + attribute mediump vec2 aPosition;\n + uniform mediump mat4 uMvpMatrix;\n + uniform mediump vec3 uSize;\n + \n void main()\n { + \n + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0); + \n + vertexPosition.xyz *= uSize; + \n + gl_Position = uMvpMatrix * vertexPosition; + \n + }\n); const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( uniform lowp vec4 uColor;\n - \n - void main()\n - {\n - gl_FragColor = uColor;\n - }\n -); + \n void main()\n { + \n + gl_FragColor = uColor; + \n + }\n); } // unnamed namespace Actor CreateRenderableActor() { - return CreateRenderableActor( Texture(), VERTEX_SHADER, FRAGMENT_SHADER ); + return CreateRenderableActor(Texture(), VERTEX_SHADER, FRAGMENT_SHADER); } -Actor CreateRenderableActor( Texture texture ) +Actor CreateRenderableActor(Texture texture) { - return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER ); + return CreateRenderableActor(texture, VERTEX_SHADER, FRAGMENT_SHADER); } -Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader ) +Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader) { // Create the geometry Geometry geometry = CreateQuadGeometry(); // Create Shader - Shader shader = Shader::New( vertexShader, fragmentShader ); + Shader shader = Shader::New(vertexShader, fragmentShader); // Create renderer from geometry and material - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); // Create actor and set renderer Actor actor = Actor::New(); - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); // If we a texture, then create a texture-set and add to renderer - if( texture ) + if(texture) { TextureSet textureSet = TextureSet::New(); - textureSet.SetTexture( 0u, texture ); - renderer.SetTextures( textureSet ); + textureSet.SetTexture(0u, texture); + renderer.SetTextures(textureSet); // Set actor to the size of the texture if set - actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(texture.GetWidth(), texture.GetHeight())); } return actor; diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h index 4a8716e..be085bf 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h @@ -23,7 +23,6 @@ namespace Dali { - class Actor; class Image; class Texture; @@ -39,7 +38,7 @@ Actor CreateRenderableActor(); * @param[in] texture Texture to set. * @return An actor with a renderer. */ -Actor CreateRenderableActor( Texture texture ); +Actor CreateRenderableActor(Texture texture); /** * @brief Creates a renderable-actor with a texture and custom shaders. @@ -48,7 +47,7 @@ Actor CreateRenderableActor( Texture texture ); * @param[in] fragmentShader The fragment-shader. * @return An actor with a renderer. */ -Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader ); +Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader); } // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.cpp index 307e0a0..9f89cfc 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.cpp @@ -16,10 +16,12 @@ */ #include "test-addon-manager.h" + #include -#include #include +#include + #ifndef ADDON_LIBS_PATH #define ADDON_LIBS_PATH "" #endif @@ -28,7 +30,6 @@ namespace Dali { namespace Test { - std::vector AddOnManager::EnumerateAddOns() { std::string listFileName(ADDON_LIBS_PATH); @@ -37,41 +38,41 @@ std::vector AddOnManager::EnumerateAddOns() // Read list of available test addons tet_printf("Enumerating addons, file: %s\n", listFileName.c_str()); std::vector addons{}; - auto* fin = fopen( listFileName.c_str(), "r" ); - char* lineBuf = new char[256]; - size_t n = 256; - while( getline( &lineBuf, &n, fin ) > 0 ) + auto* fin = fopen(listFileName.c_str(), "r"); + char* lineBuf = new char[256]; + size_t n = 256; + while(getline(&lineBuf, &n, fin) > 0) { tet_printf("Adding %s\n", lineBuf); - addons.emplace_back( lineBuf ); + addons.emplace_back(lineBuf); } fclose(fin); - delete [] lineBuf; + delete[] lineBuf; std::vector retval{}; // Open addons - for( auto& name : addons ) + for(auto& name : addons) { std::string path(ADDON_LIBS_PATH); path += "/"; path += name; mAddOnCache.emplace_back(); - mAddOnCache.back().handle = dlopen( path.c_str(), RTLD_DEEPBIND|RTLD_LAZY ); - if( !mAddOnCache.back().handle ) + mAddOnCache.back().handle = dlopen(path.c_str(), RTLD_DEEPBIND | RTLD_LAZY); + if(!mAddOnCache.back().handle) { mAddOnCache.back().valid = false; - tet_printf( "Can't open addon lib: %s\n", path.c_str()); + tet_printf("Can't open addon lib: %s\n", path.c_str()); continue; } // Here addon must self register - if( !mAddOnCache.back().valid ) + if(!mAddOnCache.back().valid) { puts("Addon invalid!"); } else { - tet_printf( "Valid AddOn: %s\n", mAddOnCache.back().name.c_str() ); - retval.emplace_back( mAddOnCache.back().name ); + tet_printf("Valid AddOn: %s\n", mAddOnCache.back().name.c_str()); + retval.emplace_back(mAddOnCache.back().name); } } @@ -82,31 +83,29 @@ std::vector AddOnManager::EnumerateAddOns() */ } -void AddOnManager::RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) +void AddOnManager::RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable) { // Register the dispatch table auto& entry = mAddOnCache.back(); - entry.name = dispatchTable->name; - tet_printf( "Registering AddOn: %s\n", entry.name.c_str()); - entry.GetGlobalProc = dispatchTable->GetGlobalProc; + entry.name = dispatchTable->name; + tet_printf("Registering AddOn: %s\n", entry.name.c_str()); + entry.GetGlobalProc = dispatchTable->GetGlobalProc; entry.GetInstanceProc = dispatchTable->GetInstanceProc; - entry.GetAddOnInfo = dispatchTable->GetAddOnInfo; - entry.OnStart = dispatchTable->OnStart; - entry.OnStop = dispatchTable->OnStop; - entry.OnPause = dispatchTable->OnPause; - entry.OnResume = dispatchTable->OnResume; - entry.valid = true; + entry.GetAddOnInfo = dispatchTable->GetAddOnInfo; + entry.OnStart = dispatchTable->OnStart; + entry.OnStop = dispatchTable->OnStop; + entry.OnPause = dispatchTable->OnPause; + entry.OnResume = dispatchTable->OnResume; + entry.valid = true; } -bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info ) +bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info) { auto retval = false; - std::find_if( mAddOnCache.begin(), mAddOnCache.end(), - [&retval, name, &info]( AddOnCacheEntry& entry ) - { + std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &info](AddOnCacheEntry& entry) { if(entry.name == name) { - entry.GetAddOnInfo( info ); + entry.GetAddOnInfo(info); retval = true; return true; } @@ -115,7 +114,7 @@ bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info ) return retval; } -std::vector AddOnManager::LoadAddOns( const std::vector& addonNames ) +std::vector AddOnManager::LoadAddOns(const std::vector& addonNames) { if(mAddOnCache.empty()) { @@ -123,47 +122,45 @@ std::vector AddOnManager::LoadAddOns( const std::vector retval{}; - for( auto& name : addonNames) + for(auto& name : addonNames) { size_t index = 0; - auto iter = std::find_if( mAddOnCache.begin(), mAddOnCache.end(), - [&retval, name, &index]( AddOnCacheEntry& entry ) + auto iter = std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &index](AddOnCacheEntry& entry) { + index++; + if(entry.name == name) { - index++; - if(entry.name == name) - { - return true; - } - return false; - }); - if( iter != mAddOnCache.end() ) + return true; + } + return false; + }); + if(iter != mAddOnCache.end()) { - retval.emplace_back( *reinterpret_cast( &index ) ); + retval.emplace_back(*reinterpret_cast(&index)); } else { - retval.emplace_back( nullptr ); + retval.emplace_back(nullptr); } } return retval; } -void* AddOnManager::GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) +void* AddOnManager::GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) { - auto index = *reinterpret_cast( &addOnLibrary ); - return mAddOnCache[index-1].GetGlobalProc( procName ); + auto index = *reinterpret_cast(&addOnLibrary); + return mAddOnCache[index - 1].GetGlobalProc(procName); } -void* AddOnManager::GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) +void* AddOnManager::GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) { - auto index = *reinterpret_cast( &addOnLibrary ); - return mAddOnCache[index-1].GetInstanceProc( procName ); + auto index = *reinterpret_cast(&addOnLibrary); + return mAddOnCache[index - 1].GetInstanceProc(procName); } void AddOnManager::Start() { - for( auto& entry : mAddOnCache ) + for(auto& entry : mAddOnCache) { if(entry.OnStart) { @@ -174,7 +171,7 @@ void AddOnManager::Start() void AddOnManager::Resume() { - for( auto& entry : mAddOnCache ) + for(auto& entry : mAddOnCache) { if(entry.OnResume) { @@ -185,7 +182,7 @@ void AddOnManager::Resume() void AddOnManager::Stop() { - for( auto& entry : mAddOnCache ) + for(auto& entry : mAddOnCache) { if(entry.OnStop) { @@ -196,7 +193,7 @@ void AddOnManager::Stop() void AddOnManager::Pause() { - for( auto& entry : mAddOnCache ) + for(auto& entry : mAddOnCache) { if(entry.OnPause) { @@ -205,6 +202,5 @@ void AddOnManager::Pause() } } -} -} - +} // namespace Test +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.h b/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.h index d6a7404..62a8f3b 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-addon-manager.h @@ -20,6 +20,7 @@ #include #include + #include namespace Dali @@ -29,7 +30,6 @@ namespace Test class AddOnManager : public Dali::Integration::AddOnManager { public: - /** * @brief Constructor, initialised by the Adaptor */ @@ -42,15 +42,15 @@ public: std::vector EnumerateAddOns() override; - bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) override; + bool GetAddOnInfo(const std::string& name, AddOnInfo& info) override; - std::vector LoadAddOns( const std::vector& addonNames ) override; + std::vector LoadAddOns(const std::vector& addonNames) override; - void* GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override; + void* GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override; - void* GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override; + void* GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override; - void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) override; + void RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable) override; void Start() override; @@ -63,20 +63,20 @@ public: struct AddOnCacheEntry { std::string name{}; - AddOnInfo info{}; + AddOnInfo info{}; // library handle - void* handle {nullptr}; + void* handle{nullptr}; // main function pointers - void(*GetAddOnInfo)(AddOnInfo& ) = nullptr; ///< Returns AddOnInfo structure - void*(*GetInstanceProc)( const char* ) = nullptr; ///< Returns pointer of instance function (member funtion) - void*(*GetGlobalProc)( const char* ) = nullptr; ///< Returns pointer of global function (non-member function) - - void(*OnStart)() = nullptr; - void(*OnResume)() = nullptr; - void(*OnPause)() = nullptr; - void(*OnStop)() = nullptr; + void (*GetAddOnInfo)(AddOnInfo&) = nullptr; ///< Returns AddOnInfo structure + void* (*GetInstanceProc)(const char*) = nullptr; ///< Returns pointer of instance function (member funtion) + void* (*GetGlobalProc)(const char*) = nullptr; ///< Returns pointer of global function (non-member function) + + void (*OnStart)() = nullptr; + void (*OnResume)() = nullptr; + void (*OnPause)() = nullptr; + void (*OnStop)() = nullptr; bool valid = false; }; diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index b2a3fb9..062276a 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -19,24 +19,23 @@ namespace Dali { - bool TestApplication::mLoggingEnabled = true; -TestApplication::TestApplication( uint32_t surfaceWidth, - uint32_t surfaceHeight, - uint32_t horizontalDpi, - uint32_t verticalDpi, - bool initialize, - bool enablePartialUpdate ) -: mCore( NULL ), - mSurfaceWidth( surfaceWidth ), - mSurfaceHeight( surfaceHeight ), - mFrame( 0u ), - mDpi{ horizontalDpi, verticalDpi }, +TestApplication::TestApplication(uint32_t surfaceWidth, + uint32_t surfaceHeight, + uint32_t horizontalDpi, + uint32_t verticalDpi, + bool initialize, + bool enablePartialUpdate) +: mCore(NULL), + mSurfaceWidth(surfaceWidth), + mSurfaceHeight(surfaceHeight), + mFrame(0u), + mDpi{horizontalDpi, verticalDpi}, mLastVSyncTime(0u), mPartialUpdateEnabled(enablePartialUpdate) { - if( initialize ) + if(initialize) { Initialize(); } @@ -54,15 +53,15 @@ void TestApplication::CreateCore() // We always need the first update! mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING; - mCore = Dali::Integration::Core::New( mRenderController, - mPlatformAbstraction, - mGlAbstraction, - mGlSyncAbstraction, - mGlContextHelperAbstraction, - Integration::RenderToFrameBuffer::FALSE, - Integration::DepthBufferAvailable::TRUE, - Integration::StencilBufferAvailable::TRUE, - mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE ); + mCore = Dali::Integration::Core::New(mRenderController, + mPlatformAbstraction, + mGlAbstraction, + mGlSyncAbstraction, + mGlContextHelperAbstraction, + Integration::RenderToFrameBuffer::FALSE, + Integration::DepthBufferAvailable::TRUE, + Integration::StencilBufferAvailable::TRUE, + mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE); mCore->ContextCreated(); @@ -70,15 +69,15 @@ void TestApplication::CreateCore() Dali::Integration::Log::InstallLogFunction(logFunction); Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext); - Dali::Integration::Trace::InstallLogContextFunction( logContextFunction ); + Dali::Integration::Trace::InstallLogContextFunction(logContextFunction); - Dali::Integration::Trace::LogContext( true, "Test" ); + Dali::Integration::Trace::LogContext(true, "Test"); } void TestApplication::CreateScene() { - mScene = Dali::Integration::Scene::New( Size( static_cast( mSurfaceWidth ), static_cast( mSurfaceHeight ) ) ); - mScene.SetDpi( Vector2( static_cast( mDpi.x ), static_cast( mDpi.y ) ) ); + mScene = Dali::Integration::Scene::New(Size(static_cast(mSurfaceWidth), static_cast(mSurfaceHeight))); + mScene.SetDpi(Vector2(static_cast(mDpi.x), static_cast(mDpi.y))); } void TestApplication::InitializeCore() @@ -93,9 +92,9 @@ TestApplication::~TestApplication() delete mCore; } -void TestApplication::LogContext( bool start, const char* tag ) +void TestApplication::LogContext(bool start, const char* tag) { - if( start ) + if(start) { fprintf(stderr, "INFO: Trace Start: %s\n", tag); } @@ -107,7 +106,7 @@ void TestApplication::LogContext( bool start, const char* tag ) void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { - if( mLoggingEnabled ) + if(mLoggingEnabled) { switch(level) { @@ -168,37 +167,37 @@ void TestApplication::SendNotification() mCore->ProcessEvents(); } -void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location ) +void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location) { - if( GetUpdateStatus() == 0 && - mRenderStatus.NeedsUpdate() == false && - ! GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc) ) + if(GetUpdateStatus() == 0 && + mRenderStatus.NeedsUpdate() == false && + !GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc)) { - fprintf(stderr, "WARNING - Update not required :%s\n", location==NULL?"NULL":location); + fprintf(stderr, "WARNING - Update not required :%s\n", location == NULL ? "NULL" : location); } - uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds; - float elapsedSeconds = static_cast( intervalMilliseconds ) * 0.001f; + uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds; + float elapsedSeconds = static_cast(intervalMilliseconds) * 0.001f; - mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false ); + mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false); GetRenderController().Initialize(); mLastVSyncTime = nextVSyncTime; } -bool TestApplication::Render( uint32_t intervalMilliseconds, const char* location ) +bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location) { - DoUpdate( intervalMilliseconds, location ); + DoUpdate(intervalMilliseconds, location); // Reset the status - mRenderStatus.SetNeedsUpdate( false ); - mRenderStatus.SetNeedsPostRender( false ); + mRenderStatus.SetNeedsUpdate(false); + mRenderStatus.SetNeedsPostRender(false); - mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); - mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ ); - mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ ); - mCore->PostRender( false /*do not skip rendering*/ ); + mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); + mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); + mCore->PostRender(false /*do not skip rendering*/); mFrame++; @@ -209,7 +208,7 @@ bool TestApplication::PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, { DoUpdate(intervalMilliseconds, location); - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); + mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); mCore->PreRender(mScene, damagedRects); return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); @@ -231,9 +230,9 @@ uint32_t TestApplication::GetUpdateStatus() return mStatus.KeepUpdating(); } -bool TestApplication::UpdateOnly( uint32_t intervalMilliseconds ) +bool TestApplication::UpdateOnly(uint32_t intervalMilliseconds) { - DoUpdate( intervalMilliseconds ); + DoUpdate(intervalMilliseconds); return mStatus.KeepUpdating(); } @@ -247,13 +246,13 @@ bool TestApplication::GetRenderNeedsPostRender() return mRenderStatus.NeedsPostRender(); } -bool TestApplication::RenderOnly( ) +bool TestApplication::RenderOnly() { // Update Time values - mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); - mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ ); - mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ ); - mCore->PostRender( false /*do not skip rendering*/ ); + mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); + mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); + mCore->PostRender(false /*do not skip rendering*/); mFrame++; @@ -267,11 +266,11 @@ void TestApplication::ResetContext() mCore->ContextCreated(); } -uint32_t TestApplication::Wait( uint32_t durationToWait ) +uint32_t TestApplication::Wait(uint32_t durationToWait) { int time = 0; - for(uint32_t i = 0; i <= ( durationToWait / RENDER_FRAME_INTERVAL); i++) + for(uint32_t i = 0; i <= (durationToWait / RENDER_FRAME_INTERVAL); i++) { SendNotification(); Render(RENDER_FRAME_INTERVAL); @@ -280,4 +279,4 @@ uint32_t TestApplication::Wait( uint32_t durationToWait ) return time; } -} // Namespace dali +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.h b/automated-tests/src/dali/dali-test-suite-utils/test-application.h index e224c6b..7362505 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.h @@ -19,25 +19,24 @@ */ // INTERNAL INCLUDES +#include +#include +#include +#include #include -#include "test-gl-sync-abstraction.h" + #include "test-gl-abstraction.h" #include "test-gl-context-helper-abstraction.h" +#include "test-gl-sync-abstraction.h" #include "test-render-controller.h" -#include -#include -#include -#include namespace Dali { - class DALI_CORE_API TestApplication : public ConnectionTracker { public: - // Default values derived from H2 device. - static const uint32_t DEFAULT_SURFACE_WIDTH = 480; + static const uint32_t DEFAULT_SURFACE_WIDTH = 480; static const uint32_t DEFAULT_SURFACE_HEIGHT = 800; static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220; @@ -47,39 +46,39 @@ public: static const uint32_t RENDER_FRAME_INTERVAL = 16; - TestApplication( uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH, - uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, - uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI, - uint32_t verticalDpi = DEFAULT_VERTICAL_DPI, - bool initialize = true, - bool enablePartialUpdate = false ); + TestApplication(uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH, + uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, + uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI, + uint32_t verticalDpi = DEFAULT_VERTICAL_DPI, + bool initialize = true, + bool enablePartialUpdate = false); void Initialize(); void CreateCore(); void CreateScene(); void InitializeCore(); ~TestApplication() override; - static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message ); - static void LogContext( bool start, const char* tag ); - Dali::Integration::Core& GetCore(); - TestPlatformAbstraction& GetPlatform(); - TestRenderController& GetRenderController(); - TestGlAbstraction& GetGlAbstraction(); - TestGlSyncAbstraction& GetGlSyncAbstraction(); + static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message); + static void LogContext(bool start, const char* tag); + Dali::Integration::Core& GetCore(); + TestPlatformAbstraction& GetPlatform(); + TestRenderController& GetRenderController(); + TestGlAbstraction& GetGlAbstraction(); + TestGlSyncAbstraction& GetGlSyncAbstraction(); TestGlContextHelperAbstraction& GetGlContextHelperAbstraction(); - void ProcessEvent(const Integration::Event& event); - void SendNotification(); - bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL ); - bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects); - bool RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect); - uint32_t GetUpdateStatus(); - bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); - bool RenderOnly( ); - void ResetContext(); - bool GetRenderNeedsUpdate(); - bool GetRenderNeedsPostRender(); - uint32_t Wait( uint32_t durationToWait ); - static void EnableLogging( bool enabled ) + void ProcessEvent(const Integration::Event& event); + void SendNotification(); + bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL); + bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects); + bool RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect); + uint32_t GetUpdateStatus(); + bool UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL); + bool RenderOnly(); + void ResetContext(); + bool GetRenderNeedsUpdate(); + bool GetRenderNeedsPostRender(); + uint32_t Wait(uint32_t durationToWait); + static void EnableLogging(bool enabled) { mLoggingEnabled = enabled; } @@ -90,31 +89,35 @@ public: } private: - void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL ); + void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL); protected: - TestPlatformAbstraction mPlatformAbstraction; - TestRenderController mRenderController; - TestGlAbstraction mGlAbstraction; - TestGlSyncAbstraction mGlSyncAbstraction; + TestPlatformAbstraction mPlatformAbstraction; + TestRenderController mRenderController; + TestGlAbstraction mGlAbstraction; + TestGlSyncAbstraction mGlSyncAbstraction; TestGlContextHelperAbstraction mGlContextHelperAbstraction; Integration::UpdateStatus mStatus; Integration::RenderStatus mRenderStatus; - Integration::Core* mCore; + Integration::Core* mCore; Dali::Integration::Scene mScene; uint32_t mSurfaceWidth; uint32_t mSurfaceHeight; uint32_t mFrame; - struct { uint32_t x; uint32_t y; } mDpi; - uint32_t mLastVSyncTime; - bool mPartialUpdateEnabled; + struct + { + uint32_t x; + uint32_t y; + } mDpi; + uint32_t mLastVSyncTime; + bool mPartialUpdateEnabled; static bool mLoggingEnabled; }; -} // Dali +} // namespace Dali #endif // DALI_TEST_APPLICATION_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-compare-types.h b/automated-tests/src/dali/dali-test-suite-utils/test-compare-types.h index 5870028..d917107 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-compare-types.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-compare-types.h @@ -2,7 +2,7 @@ #define DALI_TEST_COMPARE_TYPES_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,7 @@ #include using namespace Dali; - -template +template inline bool CompareType(Type value1, Type value2, float epsilon) { return value1 == value2; @@ -34,7 +33,7 @@ inline bool CompareType(Type value1, Type value2, float epsilon) * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(float value1, float value2, float epsilon) { return fabsf(value1 - value2) < epsilon; @@ -47,10 +46,10 @@ inline bool CompareType(float value1, float value2, float epsilon) * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector2 vector1, Vector2 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x)(Vector2 vector1, Vector2 vector2, float epsilon * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector3 vector1, Vector3 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x)(Vector3 vector1, Vector3 vector2, float epsilon * @param[in] epsilon difference threshold * @returns true if difference is smaller than epsilon threshold, false otherwise */ -template <> +template<> inline bool CompareType(Vector4 vector1, Vector4 vector2, float epsilon) { - return fabsf(vector1.x - vector2.x) +template<> inline bool CompareType(Quaternion q1, Quaternion q2, float epsilon) { Quaternion q2N = -q2; // These quaternions represent the same rotation return CompareType(q1.mVector, q2.mVector, epsilon) || CompareType(q1.mVector, q2N.mVector, epsilon); } -template <> +template<> inline bool CompareType(Radian q1, Radian q2, float epsilon) { return CompareType(q1.radian, q2.radian, epsilon); } -template <> +template<> inline bool CompareType(Degree q1, Degree q2, float epsilon) { return CompareType(q1.degree, q2.degree, epsilon); } -template <> +template<> inline bool CompareType(Extents extents1, Extents extents2, float epsilon) { return (extents1.start == extents2.start) && @@ -113,11 +111,11 @@ inline bool CompareType(Extents extents1, Extents extents2, float epsil (extents1.bottom == extents2.bottom); } -template <> +template<> inline bool CompareType(Property::Value q1, Property::Value q2, float epsilon) { Property::Type type = q1.GetType(); - if( type != q2.GetType() ) + if(type != q2.GetType()) { return false; } @@ -130,7 +128,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, bool a, b; q1.Get(a); q2.Get(b); - result = a == b; + result = a == b; break; } case Property::INTEGER: @@ -138,7 +136,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, int a, b; q1.Get(a); q2.Get(b); - result = a == b; + result = a == b; break; } case Property::FLOAT: @@ -146,7 +144,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, float a, b; q1.Get(a); q2.Get(b); - result = CompareType(a, b, epsilon); + result = CompareType(a, b, epsilon); break; } case Property::VECTOR2: @@ -196,7 +194,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, case Property::MAP: { //TODO: Implement this? - DALI_ASSERT_ALWAYS( 0 && "Not implemented"); + DALI_ASSERT_ALWAYS(0 && "Not implemented"); result = false; break; } @@ -205,7 +203,7 @@ inline bool CompareType(Property::Value q1, Property::Value q2, Extents a, b; q1.Get(a); q2.Get(b); - result = CompareType( a, b, epsilon ); + result = CompareType(a, b, epsilon); break; } case Property::NONE: @@ -218,6 +216,4 @@ inline bool CompareType(Property::Value q1, Property::Value q2, return result; } - - #endif diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.cpp index 84f54b6..e4f1099 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.cpp @@ -2,8 +2,8 @@ using namespace Dali; -std::vector< std::string > MasterCallStack; -bool gOnRelayout = false; +std::vector MasterCallStack; +bool gOnRelayout = false; namespace Test { @@ -12,11 +12,10 @@ namespace Impl struct TestCustomActor; } - TestCustomActor TestCustomActor::New() { Impl::TestCustomActor* impl = new Impl::TestCustomActor; - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -25,19 +24,19 @@ TestCustomActor TestCustomActor::New() TestCustomActor TestCustomActor::NewNegoSize() { - Impl::TestCustomActor* impl = new Impl::TestCustomActor( true ); - TestCustomActor custom( *impl ); // takes ownership - custom.SetProperty( Dali::Actor::Property::NAME, "SizeNegotiationActor" ); + Impl::TestCustomActor* impl = new Impl::TestCustomActor(true); + TestCustomActor custom(*impl); // takes ownership + custom.SetProperty(Dali::Actor::Property::NAME, "SizeNegotiationActor"); impl->Initialize(); return custom; } -TestCustomActor TestCustomActor::NewVariant1( Actor childToAdd ) +TestCustomActor TestCustomActor::NewVariant1(Actor childToAdd) { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1( childToAdd ); - TestCustomActor custom( *impl ); // takes ownership + Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1(childToAdd); + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -47,17 +46,17 @@ TestCustomActor TestCustomActor::NewVariant1( Actor childToAdd ) TestCustomActor TestCustomActor::NewVariant2() { Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant2(); - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); return custom; } -TestCustomActor TestCustomActor::NewVariant3( Actor childToAdd ) +TestCustomActor TestCustomActor::NewVariant3(Actor childToAdd) { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3( childToAdd ); - TestCustomActor custom( *impl ); // takes ownership + Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3(childToAdd); + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -67,7 +66,7 @@ TestCustomActor TestCustomActor::NewVariant3( Actor childToAdd ) TestCustomActor TestCustomActor::NewVariant4() { Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant4(); - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -77,7 +76,7 @@ TestCustomActor TestCustomActor::NewVariant4() TestCustomActor TestCustomActor::NewVariant5(Integration::Scene scene) { Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant5(scene); - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -87,27 +86,27 @@ TestCustomActor TestCustomActor::NewVariant5(Integration::Scene scene) TestCustomActor TestCustomActor::NewVariant6(Integration::Scene scene) { Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant6(scene); - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); return custom; } -TestCustomActor TestCustomActor::NewVariant7( const char* name ) +TestCustomActor TestCustomActor::NewVariant7(const char* name) { Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant7(); - TestCustomActor custom( *impl ); // takes ownership + TestCustomActor custom(*impl); // takes ownership - impl->Initialize( name ); + impl->Initialize(name); return custom; } -TestCustomActor TestCustomActor::NewVariant8( Actor rival ) +TestCustomActor TestCustomActor::NewVariant8(Actor rival) { - Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8( rival ); - TestCustomActor custom( *impl ); // takes ownership + Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8(rival); + TestCustomActor custom(*impl); // takes ownership impl->Initialize(); @@ -123,7 +122,7 @@ Impl::TestCustomActor& TestCustomActor::GetImpl() return static_cast(GetImplementation()); } -std::vector< std::string >& TestCustomActor::GetMethodsCalled() +std::vector& TestCustomActor::GetMethodsCalled() { return GetImpl().mMethodsCalled; } @@ -150,28 +149,28 @@ Vector3 TestCustomActor::GetTargetSize() Vector3 TestCustomActor::GetNaturalSize() { - return Vector3( 0.0f, 0.0f, 0.0f ); + return Vector3(0.0f, 0.0f, 0.0f); } -float TestCustomActor::GetHeightForWidth( float width ) +float TestCustomActor::GetHeightForWidth(float width) { return 0.0f; } -float TestCustomActor::GetWidthForHeight( float height ) +float TestCustomActor::GetWidthForHeight(float height) { return 0.0f; } -void TestCustomActor::OnRelayout( const Vector2& size, RelayoutContainer& container ) +void TestCustomActor::OnRelayout(const Vector2& size, RelayoutContainer& container) { } -void TestCustomActor::OnLayoutNegotiated( float size, Dimension::Type dimension ) +void TestCustomActor::OnLayoutNegotiated(float size, Dimension::Type dimension) { } -void TestCustomActor::OnCalculateRelayoutSize( Dimension::Type dimension ) +void TestCustomActor::OnCalculateRelayoutSize(Dimension::Type dimension) { } @@ -180,24 +179,24 @@ void TestCustomActor::TestRelayoutRequest() GetImpl().TestRelayoutRequest(); } -float TestCustomActor::TestGetHeightForWidthBase( float width ) +float TestCustomActor::TestGetHeightForWidthBase(float width) { - return GetImpl().TestGetHeightForWidthBase( width ); + return GetImpl().TestGetHeightForWidthBase(width); } -float TestCustomActor::TestGetWidthForHeightBase( float height ) +float TestCustomActor::TestGetWidthForHeightBase(float height) { - return GetImpl().TestGetWidthForHeightBase( height ); + return GetImpl().TestGetWidthForHeightBase(height); } -float TestCustomActor::TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) +float TestCustomActor::TestCalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension) { - return GetImpl().TestCalculateChildSizeBase( child, dimension ); + return GetImpl().TestCalculateChildSizeBase(child, dimension); } -bool TestCustomActor::TestRelayoutDependentOnChildrenBase( Dimension::Type dimension ) +bool TestCustomActor::TestRelayoutDependentOnChildrenBase(Dimension::Type dimension) { - return GetImpl().TestRelayoutDependentOnChildrenBase( dimension ); + return GetImpl().TestRelayoutDependentOnChildrenBase(dimension); } uint32_t TestCustomActor::GetDepth() @@ -209,26 +208,26 @@ TestCustomActor::TestCustomActor() { } -TestCustomActor::TestCustomActor( Impl::TestCustomActor& impl ) -: CustomActor( impl ) +TestCustomActor::TestCustomActor(Impl::TestCustomActor& impl) +: CustomActor(impl) { } -TestCustomActor::TestCustomActor( Dali::Internal::CustomActor* internal ) -: CustomActor( internal ) +TestCustomActor::TestCustomActor(Dali::Internal::CustomActor* internal) +: CustomActor(internal) { } -TestCustomActor TestCustomActor::DownCast( BaseHandle handle ) +TestCustomActor TestCustomActor::DownCast(BaseHandle handle) { TestCustomActor actor; - CustomActor custom = Dali::CustomActor::DownCast(handle); + CustomActor custom = Dali::CustomActor::DownCast(handle); if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); Test::Impl::TestCustomActor* impl = dynamic_cast(&customImpl); - if( impl ) + if(impl) { actor = TestCustomActor(customImpl.GetOwner()); } @@ -238,25 +237,24 @@ TestCustomActor TestCustomActor::DownCast( BaseHandle handle ) namespace Impl { - TestCustomActor::TestCustomActor() -: CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) ), - mDaliProperty( Property::INVALID_INDEX ), - mSizeSet( Vector3::ZERO ), - mTargetSize( Vector3::ZERO ), - mNego( false ), +: CustomActorImpl(ActorFlags(DISABLE_SIZE_NEGOTIATION)), + mDaliProperty(Property::INVALID_INDEX), + mSizeSet(Vector3::ZERO), + mTargetSize(Vector3::ZERO), + mNego(false), mDepth(0u), - develProp6( 10.0f ) + develProp6(10.0f) { } TestCustomActor::TestCustomActor(bool nego) -: CustomActorImpl( ActorFlags() ), - mDaliProperty( Property::INVALID_INDEX ), - mSizeSet( Vector3::ZERO ), - mTargetSize( Vector3::ZERO ), - mNego( nego ), - develProp6( 10.0f ) +: CustomActorImpl(ActorFlags()), + mDaliProperty(Property::INVALID_INDEX), + mSizeSet(Vector3::ZERO), + mTargetSize(Vector3::ZERO), + mNego(nego), + develProp6(10.0f) { } /** @@ -266,32 +264,34 @@ TestCustomActor::~TestCustomActor() { } -void TestCustomActor::Initialize( const char* name ) +void TestCustomActor::Initialize(const char* name) { - mDaliProperty = Self().RegisterProperty( "Dali", std::string("no"), Property::READ_WRITE); + mDaliProperty = Self().RegisterProperty("Dali", std::string("no"), Property::READ_WRITE); - OnInitialize( name ); + OnInitialize(name); } -void TestCustomActor::OnInitialize( const char* name ) {} +void TestCustomActor::OnInitialize(const char* name) +{ +} /** * Resets the call stack */ void TestCustomActor::ResetCallStack() { - mSizeSet = Vector3(); + mSizeSet = Vector3(); mTargetSize = Vector3(); mMethodsCalled.clear(); } -void TestCustomActor::AddToCallStacks( const char* method ) +void TestCustomActor::AddToCallStacks(const char* method) { - mMethodsCalled.push_back( method ); + mMethodsCalled.push_back(method); // Combine Actor name with method string - std::string nameAndMethod( Self().GetProperty< std::string >( Dali::Actor::Property::NAME ) ); - if ( 0 == nameAndMethod.size() ) + std::string nameAndMethod(Self().GetProperty(Dali::Actor::Property::NAME)); + if(0 == nameAndMethod.size()) { nameAndMethod = "Unknown: "; } @@ -301,11 +301,11 @@ void TestCustomActor::AddToCallStacks( const char* method ) } nameAndMethod += method; - MasterCallStack.push_back( nameAndMethod ); + MasterCallStack.push_back(nameAndMethod); } // From CustomActorImpl -void TestCustomActor::OnSceneConnection( int depth ) +void TestCustomActor::OnSceneConnection(int depth) { AddToCallStacks("OnSceneConnection"); mDepth = depth; @@ -322,7 +322,7 @@ void TestCustomActor::OnChildRemove(Actor& child) { AddToCallStacks("OnChildRemove"); } -void TestCustomActor::OnPropertySet( Property::Index index, const Property::Value& propertyValue ) +void TestCustomActor::OnPropertySet(Property::Index index, const Property::Value& propertyValue) { AddToCallStacks("OnPropertySet"); } @@ -346,42 +346,42 @@ void TestCustomActor::OnKeyInputFocusLost() } Vector3 TestCustomActor::GetNaturalSize() { - return Vector3( 0.0f, 0.0f, 0.0f ); + return Vector3(0.0f, 0.0f, 0.0f); } -float TestCustomActor::GetHeightForWidth( float width ) +float TestCustomActor::GetHeightForWidth(float width) { return 0.0f; } -float TestCustomActor::GetWidthForHeight( float height ) +float TestCustomActor::GetWidthForHeight(float height) { return 0.0f; } -void TestCustomActor::OnRelayout( const Vector2& size, RelayoutContainer& container ) +void TestCustomActor::OnRelayout(const Vector2& size, RelayoutContainer& container) { gOnRelayout = true; } -void TestCustomActor::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) +void TestCustomActor::OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) { } -void TestCustomActor::OnCalculateRelayoutSize( Dimension::Type dimension ) +void TestCustomActor::OnCalculateRelayoutSize(Dimension::Type dimension) { } -float TestCustomActor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) +float TestCustomActor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) { return 0.0f; } -void TestCustomActor::OnLayoutNegotiated( float size, Dimension::Type dimension ) +void TestCustomActor::OnLayoutNegotiated(float size, Dimension::Type dimension) { } -bool TestCustomActor::RelayoutDependentOnChildren( Dimension::Type dimension ) +bool TestCustomActor::RelayoutDependentOnChildren(Dimension::Type dimension) { return false; } @@ -395,31 +395,31 @@ void TestCustomActor::TestRelayoutRequest() RelayoutRequest(); } -float TestCustomActor::TestGetHeightForWidthBase( float width ) +float TestCustomActor::TestGetHeightForWidthBase(float width) { - return GetHeightForWidthBase( width ); + return GetHeightForWidthBase(width); } -float TestCustomActor::TestGetWidthForHeightBase( float height ) +float TestCustomActor::TestGetWidthForHeightBase(float height) { - return GetWidthForHeightBase( height ); + return GetWidthForHeightBase(height); } -float TestCustomActor::TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) +float TestCustomActor::TestCalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension) { - return CalculateChildSizeBase( child, dimension ); + return CalculateChildSizeBase(child, dimension); } -bool TestCustomActor::TestRelayoutDependentOnChildrenBase( Dimension::Type dimension ) +bool TestCustomActor::TestRelayoutDependentOnChildrenBase(Dimension::Type dimension) { - return RelayoutDependentOnChildrenBase( dimension ); + return RelayoutDependentOnChildrenBase(dimension); } -void TestCustomActor::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) +void TestCustomActor::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value) { - Test::TestCustomActor actor = Test::TestCustomActor::DownCast( Dali::BaseHandle( object ) ); + Test::TestCustomActor actor = Test::TestCustomActor::DownCast(Dali::BaseHandle(object)); - if ( actor ) + if(actor) { TestCustomActor& actorImpl = GetImpl(actor); switch(index) @@ -453,11 +453,11 @@ void TestCustomActor::SetProperty( BaseObject* object, Property::Index index, co } } -Property::Value TestCustomActor::GetProperty( BaseObject* object, Property::Index index ) +Property::Value TestCustomActor::GetProperty(BaseObject* object, Property::Index index) { - Test::TestCustomActor actor = Test::TestCustomActor::DownCast( Dali::BaseHandle( object ) ); + Test::TestCustomActor actor = Test::TestCustomActor::DownCast(Dali::BaseHandle(object)); - if ( actor ) + if(actor) { TestCustomActor& actorImpl = GetImpl(actor); switch(index) @@ -491,22 +491,21 @@ Property::Value TestCustomActor::GetProperty( BaseObject* object, Property::Inde return Property::Value(); } - BaseHandle CreateActor() { return Test::TestCustomActor::New(); } -DALI_TYPE_REGISTRATION_BEGIN( Test::TestCustomActor, Dali::CustomActor, CreateActor ); +DALI_TYPE_REGISTRATION_BEGIN(Test::TestCustomActor, Dali::CustomActor, CreateActor); -DALI_PROPERTY_REGISTRATION( Test, TestCustomActor, "testProperty1", FLOAT, TEST_PROPERTY1) -DALI_PROPERTY_REGISTRATION( Test, TestCustomActor, "testProperty2", VECTOR4, TEST_PROPERTY2) -DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty3", VECTOR4, DEVEL_TEST_PROPERTY3) -DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty4", INTEGER, DEVEL_TEST_PROPERTY4) -DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty5", FLOAT, DEVEL_TEST_PROPERTY5) -DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Test, TestCustomActor, "develTestProperty6", FLOAT, DEVEL_TEST_PROPERTY6) +DALI_PROPERTY_REGISTRATION(Test, TestCustomActor, "testProperty1", FLOAT, TEST_PROPERTY1) +DALI_PROPERTY_REGISTRATION(Test, TestCustomActor, "testProperty2", VECTOR4, TEST_PROPERTY2) +DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty3", VECTOR4, DEVEL_TEST_PROPERTY3) +DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty4", INTEGER, DEVEL_TEST_PROPERTY4) +DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty5", FLOAT, DEVEL_TEST_PROPERTY5) +DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Test, TestCustomActor, "develTestProperty6", FLOAT, DEVEL_TEST_PROPERTY6) DALI_TYPE_REGISTRATION_END() -} // Impl -} // Test namespace +} // namespace Impl +} // namespace Test diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.h b/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.h index 97dffcd..ed11c58 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.h @@ -18,12 +18,12 @@ * */ -#include #include #include +#include -extern std::vector< std::string > MasterCallStack; -extern bool gOnRelayout; +extern std::vector MasterCallStack; +extern bool gOnRelayout; namespace Test { @@ -41,7 +41,7 @@ public: enum PropertyRange { PROPERTY_START_INDEX = Dali::PROPERTY_REGISTRATION_START_INDEX, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 }; struct Property @@ -56,68 +56,65 @@ public: TestCustomActor(); static TestCustomActor New(); static TestCustomActor NewNegoSize(); - static TestCustomActor NewVariant1( Actor childToAdd ); + static TestCustomActor NewVariant1(Actor childToAdd); static TestCustomActor NewVariant2(); - static TestCustomActor NewVariant3( Actor childToAdd ); + static TestCustomActor NewVariant3(Actor childToAdd); static TestCustomActor NewVariant4(); - static TestCustomActor NewVariant5( Dali::Integration::Scene scene ); - static TestCustomActor NewVariant6( Dali::Integration::Scene scene ); - static TestCustomActor NewVariant7( const char* name ); - static TestCustomActor NewVariant8( Actor rival ); - static TestCustomActor DownCast( Dali::BaseHandle handle ); + static TestCustomActor NewVariant5(Dali::Integration::Scene scene); + static TestCustomActor NewVariant6(Dali::Integration::Scene scene); + static TestCustomActor NewVariant7(const char* name); + static TestCustomActor NewVariant8(Actor rival); + static TestCustomActor DownCast(Dali::BaseHandle handle); virtual ~TestCustomActor(); Impl::TestCustomActor& GetImpl(); - TestCustomActor( TestCustomActor&& rhs ) = default; - TestCustomActor& operator=( TestCustomActor&& rhs ) = default; - - std::vector< std::string >& GetMethodsCalled(); - void ResetCallStack(); - void SetDaliProperty(std::string s); - Dali::Vector3 GetSize(); - Dali::Vector3 GetTargetSize(); - virtual Dali::Vector3 GetNaturalSize(); - virtual float GetHeightForWidth( float width ); - virtual float GetWidthForHeight( float height ); - virtual void OnRelayout( const Dali::Vector2& size, Dali::RelayoutContainer& container ); - virtual void OnLayoutNegotiated( float size, Dali::Dimension::Type dimension ); - virtual void OnCalculateRelayoutSize( Dali::Dimension::Type dimension ); - void TestRelayoutRequest(); - float TestGetHeightForWidthBase( float width ); - float TestGetWidthForHeightBase( float height ); - float TestCalculateChildSizeBase( const Dali::Actor& child, Dali::Dimension::Type dimension ); - bool TestRelayoutDependentOnChildrenBase( Dali::Dimension::Type dimension ); - uint32_t GetDepth(); + TestCustomActor(TestCustomActor&& rhs) = default; + TestCustomActor& operator=(TestCustomActor&& rhs) = default; + + std::vector& GetMethodsCalled(); + void ResetCallStack(); + void SetDaliProperty(std::string s); + Dali::Vector3 GetSize(); + Dali::Vector3 GetTargetSize(); + virtual Dali::Vector3 GetNaturalSize(); + virtual float GetHeightForWidth(float width); + virtual float GetWidthForHeight(float height); + virtual void OnRelayout(const Dali::Vector2& size, Dali::RelayoutContainer& container); + virtual void OnLayoutNegotiated(float size, Dali::Dimension::Type dimension); + virtual void OnCalculateRelayoutSize(Dali::Dimension::Type dimension); + void TestRelayoutRequest(); + float TestGetHeightForWidthBase(float width); + float TestGetWidthForHeightBase(float height); + float TestCalculateChildSizeBase(const Dali::Actor& child, Dali::Dimension::Type dimension); + bool TestRelayoutDependentOnChildrenBase(Dali::Dimension::Type dimension); + uint32_t GetDepth(); private: - TestCustomActor( Impl::TestCustomActor& impl ); + TestCustomActor(Impl::TestCustomActor& impl); explicit TestCustomActor(Dali::Internal::CustomActor* internal); }; - namespace DevelTestCustomActor { namespace Property { enum Type { - TEST_PROPERTY1 = Test::TestCustomActor::Property::TEST_PROPERTY1, - TEST_PROPERTY2 = Test::TestCustomActor::Property::TEST_PROPERTY2, - DEVEL_TEST_PROPERTY3 = TEST_PROPERTY2+1, - DEVEL_TEST_PROPERTY4 = TEST_PROPERTY2+2, - DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2+3, - DEVEL_TEST_PROPERTY6 = TEST_PROPERTY2+4 + TEST_PROPERTY1 = Test::TestCustomActor::Property::TEST_PROPERTY1, + TEST_PROPERTY2 = Test::TestCustomActor::Property::TEST_PROPERTY2, + DEVEL_TEST_PROPERTY3 = TEST_PROPERTY2 + 1, + DEVEL_TEST_PROPERTY4 = TEST_PROPERTY2 + 2, + DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2 + 3, + DEVEL_TEST_PROPERTY6 = TEST_PROPERTY2 + 4 }; } // Namespace Property } // Namespace DevelTestCustomActor - // TypeRegistry needs custom actor Implementations to have the same name (namespaces are ignored so we use one here) namespace Impl { - struct TestCustomActor : public Dali::CustomActorImpl { public: @@ -127,45 +124,45 @@ public: TestCustomActor(); TestCustomActor(bool nego); virtual ~TestCustomActor(); - void Initialize( const char* name = NULL ); - virtual void OnInitialize( const char* name ); - void ResetCallStack(); - void AddToCallStacks( const char* method ); - void OnSceneConnection( int depth ) override; - void OnSceneDisconnection() override; - void OnChildAdd(Dali::Actor& child) override; - void OnChildRemove(Dali::Actor& child) override; - void OnPropertySet( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) override; - void OnSizeSet(const Dali::Vector3& targetSize) override; - void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override; - virtual void OnKeyInputFocusGained(); - virtual void OnKeyInputFocusLost(); - Dali::Vector3 GetNaturalSize() override; - float GetHeightForWidth( float width ) override; - float GetWidthForHeight( float height ) override; - void OnRelayout( const Dali::Vector2& size, Dali::RelayoutContainer& container ) override; - void OnSetResizePolicy( Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension ) override; - void OnCalculateRelayoutSize( Dali::Dimension::Type dimension ) override; - float CalculateChildSize( const Dali::Actor& child, Dali::Dimension::Type dimension ) override; - void OnLayoutNegotiated( float size, Dali::Dimension::Type dimension ) override; - bool RelayoutDependentOnChildren( Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS ) override; - static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); - static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index index ); - - void SetDaliProperty(std::string s); - void TestRelayoutRequest(); - float TestGetHeightForWidthBase( float width ); - float TestGetWidthForHeightBase( float height ); - float TestCalculateChildSizeBase( const Dali::Actor& child, Dali::Dimension::Type dimension ); - bool TestRelayoutDependentOnChildrenBase( Dali::Dimension::Type dimension ); + void Initialize(const char* name = NULL); + virtual void OnInitialize(const char* name); + void ResetCallStack(); + void AddToCallStacks(const char* method); + void OnSceneConnection(int depth) override; + void OnSceneDisconnection() override; + void OnChildAdd(Dali::Actor& child) override; + void OnChildRemove(Dali::Actor& child) override; + void OnPropertySet(Dali::Property::Index index, const Dali::Property::Value& propertyValue) override; + void OnSizeSet(const Dali::Vector3& targetSize) override; + void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override; + virtual void OnKeyInputFocusGained(); + virtual void OnKeyInputFocusLost(); + Dali::Vector3 GetNaturalSize() override; + float GetHeightForWidth(float width) override; + float GetWidthForHeight(float height) override; + void OnRelayout(const Dali::Vector2& size, Dali::RelayoutContainer& container) override; + void OnSetResizePolicy(Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension) override; + void OnCalculateRelayoutSize(Dali::Dimension::Type dimension) override; + float CalculateChildSize(const Dali::Actor& child, Dali::Dimension::Type dimension) override; + void OnLayoutNegotiated(float size, Dali::Dimension::Type dimension) override; + bool RelayoutDependentOnChildren(Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS) override; + static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value); + static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index index); + + void SetDaliProperty(std::string s); + void TestRelayoutRequest(); + float TestGetHeightForWidthBase(float width); + float TestGetWidthForHeightBase(float height); + float TestCalculateChildSizeBase(const Dali::Actor& child, Dali::Dimension::Type dimension); + bool TestRelayoutDependentOnChildrenBase(Dali::Dimension::Type dimension); public: - Dali::Property::Index mDaliProperty; - std::vector< std::string > mMethodsCalled; - Dali::Vector3 mSizeSet; - Dali::Vector3 mTargetSize; - bool mNego; - uint32_t mDepth; + Dali::Property::Index mDaliProperty; + std::vector mMethodsCalled; + Dali::Vector3 mSizeSet; + Dali::Vector3 mTargetSize; + bool mNego; + uint32_t mDepth; float prop1; Dali::Vector4 prop2; @@ -175,21 +172,20 @@ public: float develProp6; }; -inline TestCustomActor& GetImpl( Test::TestCustomActor& handle ) +inline TestCustomActor& GetImpl(Test::TestCustomActor& handle) { - DALI_ASSERT_ALWAYS( handle ); + DALI_ASSERT_ALWAYS(handle); Dali::RefObject& object = handle.GetImplementation(); - return static_cast( object ); + return static_cast(object); } -inline const TestCustomActor& GetImpl( const Test::TestCustomActor& handle ) +inline const TestCustomActor& GetImpl(const Test::TestCustomActor& handle) { - DALI_ASSERT_ALWAYS( handle ); + DALI_ASSERT_ALWAYS(handle); const Dali::RefObject& object = handle.GetImplementation(); - return static_cast( object ); + return static_cast(object); } - /** * Variant which adds a new child during OnSceneConnection */ @@ -198,19 +194,19 @@ struct TestCustomActorVariant1 : public TestCustomActor /** * Constructor */ - TestCustomActorVariant1( Dali::Actor childToAdd ) - : mChildToAdd( childToAdd ) + TestCustomActorVariant1(Dali::Actor childToAdd) + : mChildToAdd(childToAdd) { } // From CustomActorImpl - void OnSceneConnection( int depth ) override + void OnSceneConnection(int depth) override { // Chain up first - TestCustomActor::OnSceneConnection( depth ); + TestCustomActor::OnSceneConnection(depth); // Add the child - Self().Add( mChildToAdd ); + Self().Add(mChildToAdd); } Dali::Actor mChildToAdd; @@ -229,15 +225,15 @@ struct TestCustomActorVariant2 : public TestCustomActor } // From CustomActorImpl - virtual void OnSceneConnection( int depth ) + virtual void OnSceneConnection(int depth) { // Chain up first - TestCustomActor::OnSceneConnection( depth ); + TestCustomActor::OnSceneConnection(depth); // Remove all the children - for( uint32_t i=0, num=Self().GetChildCount(); i -#include -#include -#include #include +#include #include // for strcmp +#include +#include +#include #include // INTERNAL INCLUDES -#include #include #include #include #include -#include +#include #include +#include namespace Dali { - static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64; -static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] = -{ +static const char* mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] = + { "aPosition", // ATTRIB_POSITION "aNormal", // ATTRIB_NORMAL "aTexCoord", // ATTRIB_TEXCOORD @@ -50,7 +49,7 @@ static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] = "aBoneIndices" // ATTRIB_BONE_INDICES }; -class DALI_CORE_API TestGlAbstraction: public Dali::Integration::GlAbstraction +class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction { public: TestGlAbstraction(); @@ -62,11 +61,11 @@ public: bool IsSurfacelessContextSupported() const override; - bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const override; + bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override; /* OpenGL ES 2.0 */ - inline void ActiveTexture( GLenum textureUnit ) override + inline void ActiveTexture(GLenum textureUnit) override { mActiveTextureUnit = textureUnit - GL_TEXTURE0; } @@ -76,32 +75,32 @@ public: return mActiveTextureUnit + GL_TEXTURE0; } - inline void AttachShader( GLuint program, GLuint shader ) override + inline void AttachShader(GLuint program, GLuint shader) override { std::stringstream out; out << program << ", " << shader; TraceCallStack::NamedParams namedParams; namedParams["program"] = ToString(program); - namedParams["shader"] = ToString(shader); + namedParams["shader"] = ToString(shader); mShaderTrace.PushCall("AttachShader", out.str(), namedParams); } - inline void BindAttribLocation( GLuint program, GLuint index, const char* name ) override + inline void BindAttribLocation(GLuint program, GLuint index, const char* name) override { } - inline void BindBuffer( GLenum target, GLuint buffer ) override + inline void BindBuffer(GLenum target, GLuint buffer) override { } - inline void BindFramebuffer( GLenum target, GLuint framebuffer ) override + inline void BindFramebuffer(GLenum target, GLuint framebuffer) override { //Add 010 bit; mFramebufferStatus |= 2; } - inline void BindRenderbuffer( GLenum target, GLuint renderbuffer ) override + inline void BindRenderbuffer(GLenum target, GLuint renderbuffer) override { } @@ -119,9 +118,9 @@ public: * @param[in] activeTextureUnit The specific active texture unit. * @return A vector containing the IDs that were bound. */ - inline const std::vector& GetBoundTextures( GLuint activeTextureUnit ) const + inline const std::vector& GetBoundTextures(GLuint activeTextureUnit) const { - return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures; + return mActiveTextures[activeTextureUnit - GL_TEXTURE0].mBoundTextures; } /** @@ -131,22 +130,22 @@ public: { mBoundTextures.clear(); - for( unsigned int i=0; i::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter) + for(std::vector::iterator iter = mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter) { if(*iter == textureId) { @@ -503,7 +502,7 @@ public: out << program << ", " << shader; TraceCallStack::NamedParams namedParams; namedParams["program"] = ToString(program); - namedParams["shader"] = ToString(shader); + namedParams["shader"] = ToString(shader); mShaderTrace.PushCall("DetachShader", out.str(), namedParams); } @@ -518,7 +517,7 @@ public: inline void DisableVertexAttribArray(GLuint index) override { - SetVertexAttribArray( index, false ); + SetVertexAttribArray(index, false); } inline void DrawArrays(GLenum mode, GLint first, GLsizei count) override @@ -526,7 +525,7 @@ public: std::stringstream out; out << mode << ", " << first << ", " << count; TraceCallStack::NamedParams namedParams; - namedParams["mode"] = ToString(mode); + namedParams["mode"] = ToString(mode); namedParams["first"] = ToString(first); namedParams["count"] = ToString(count); mDrawTrace.PushCall("DrawArrays", out.str(), namedParams); @@ -538,9 +537,9 @@ public: out << mode << ", " << count << ", " << type << ", indices"; TraceCallStack::NamedParams namedParams; - namedParams["mode"] = ToString(mode); + namedParams["mode"] = ToString(mode); namedParams["count"] = ToString(count); - namedParams["type"] = ToString(type); + namedParams["type"] = ToString(type); // Skip void pointers - are they of any use? mDrawTrace.PushCall("DrawElements", out.str(), namedParams); } @@ -556,7 +555,7 @@ public: inline void EnableVertexAttribArray(GLuint index) override { - SetVertexAttribArray( index, true); + SetVertexAttribArray(index, true); } inline void Finish(void) override @@ -569,11 +568,11 @@ public: inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override { - if (attachment == GL_DEPTH_ATTACHMENT) + if(attachment == GL_DEPTH_ATTACHMENT) { mFramebufferDepthAttached = true; } - else if (attachment == GL_STENCIL_ATTACHMENT) + else if(attachment == GL_STENCIL_ATTACHMENT) { mFramebufferStencilAttached = true; } @@ -585,10 +584,10 @@ public: mFramebufferStatus |= 4; //We check 4 attachment colors - if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS)) + if((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS)) { uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0); - if ((mFrameBufferColorStatus & mask) == 0) + if((mFrameBufferColorStatus & mask) == 0) { mFrameBufferColorStatus |= mask; ++mFramebufferColorAttachmentCount; @@ -609,7 +608,7 @@ public: inline void GenerateMipmap(GLenum target) override { std::stringstream out; - out<& ids ) + inline void SetNextTextureIds(const std::vector& ids) { mNextTextureIds = ids; } @@ -651,16 +650,16 @@ public: inline void GenTextures(GLsizei count, GLuint* textures) override { - for( int i=0; isecond; - UniformIDMap::iterator it2 = uniformIDs.find( name ); - if( it2 == uniformIDs.end() ) + UniformIDMap& uniformIDs = it->second; + UniformIDMap::iterator it2 = uniformIDs.find(name); + if(it2 == uniformIDs.end()) { // Uniform not found, so add it... uniformIDs[name] = ++mLastUniformIdUsed; @@ -933,7 +933,7 @@ public: namedParams["program"] = ToString(program); mShaderTrace.PushCall("LinkProgram", out.str(), namedParams); - mNumberOfActiveUniforms=3; + mNumberOfActiveUniforms = 3; GetUniformLocation(program, "sTexture"); GetUniformLocation(program, "sEffect"); GetUniformLocation(program, "sGloss"); @@ -965,19 +965,19 @@ public: inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override { - mScissorParams.x = x; - mScissorParams.y = y; - mScissorParams.width = width; + mScissorParams.x = x; + mScissorParams.y = y; + mScissorParams.width = width; mScissorParams.height = height; std::stringstream out; out << x << ", " << y << ", " << width << ", " << height; TraceCallStack::NamedParams namedParams; - namedParams["x"] = ToString( x ); - namedParams["y"] = ToString( y ); - namedParams["width"] = ToString( width ); - namedParams["height"] = ToString( height ); - mScissorTrace.PushCall( "Scissor", out.str(), namedParams ); + namedParams["x"] = ToString(x); + namedParams["y"] = ToString(y); + namedParams["width"] = ToString(width); + namedParams["height"] = ToString(height); + mScissorTrace.PushCall("Scissor", out.str(), namedParams); } inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override @@ -992,21 +992,21 @@ public: stringBuilder += string[i]; } mShaderSources[shader] = stringBuilder; - mLastShaderCompiled = shader; + mLastShaderCompiled = shader; } inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override { - const std::string shaderSource = mShaderSources[shader]; - const int shaderSourceLength = static_cast(shaderSource.length()); - if( shaderSourceLength < bufsize ) + const std::string shaderSource = mShaderSources[shader]; + const int shaderSourceLength = static_cast(shaderSource.length()); + if(shaderSourceLength < bufsize) { - strncpy( source, shaderSource.c_str(), shaderSourceLength ); + strncpy(source, shaderSource.c_str(), shaderSourceLength); *length = shaderSourceLength; } else { - *length = bufsize -1; + *length = bufsize - 1; strncpy(source, shaderSource.c_str(), *length); source[*length] = 0x0; } @@ -1023,11 +1023,11 @@ public: out << func << ", " << ref << ", " << mask; TraceCallStack::NamedParams namedParams; - namedParams["func"] = ToString( func ); - namedParams["ref"] = ToString( ref ); - namedParams["mask"] = ToString( mask ); + namedParams["func"] = ToString(func); + namedParams["ref"] = ToString(ref); + namedParams["mask"] = ToString(mask); - mStencilFunctionTrace.PushCall( "StencilFunc", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilFunc", out.str(), namedParams); } inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override @@ -1036,12 +1036,12 @@ public: out << face << ", " << func << ", " << ref << ", " << mask; TraceCallStack::NamedParams namedParams; - namedParams["face"] = ToString( face ); - namedParams["func"] = ToString( func ); - namedParams["ref"] = ToString( ref ); - namedParams["mask"] = ToString( mask ); + namedParams["face"] = ToString(face); + namedParams["func"] = ToString(func); + namedParams["ref"] = ToString(ref); + namedParams["mask"] = ToString(mask); - mStencilFunctionTrace.PushCall( "StencilFuncSeparate", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilFuncSeparate", out.str(), namedParams); } inline void StencilMask(GLuint mask) override @@ -1050,9 +1050,9 @@ public: out << mask; TraceCallStack::NamedParams namedParams; - namedParams["mask"] = ToString( mask ); + namedParams["mask"] = ToString(mask); - mStencilFunctionTrace.PushCall( "StencilMask", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilMask", out.str(), namedParams); } inline void StencilMaskSeparate(GLenum face, GLuint mask) override @@ -1061,10 +1061,10 @@ public: out << face << ", " << mask; TraceCallStack::NamedParams namedParams; - namedParams["face"] = ToString( face ); - namedParams["mask"] = ToString( mask ); + namedParams["face"] = ToString(face); + namedParams["mask"] = ToString(mask); - mStencilFunctionTrace.PushCall( "StencilMaskSeparate", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilMaskSeparate", out.str(), namedParams); } inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override @@ -1073,11 +1073,11 @@ public: out << fail << ", " << zfail << ", " << zpass; TraceCallStack::NamedParams namedParams; - namedParams["fail"] = ToString( fail ); - namedParams["zfail"] = ToString( zfail ); - namedParams["zpass"] = ToString( zpass ); + namedParams["fail"] = ToString(fail); + namedParams["zfail"] = ToString(zfail); + namedParams["zpass"] = ToString(zpass); - mStencilFunctionTrace.PushCall( "StencilOp", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilOp", out.str(), namedParams); } inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override @@ -1086,28 +1086,28 @@ public: out << face << ", " << fail << ", " << zfail << "," << zpass; TraceCallStack::NamedParams namedParams; - namedParams["face"] = ToString( face ); - namedParams["fail"] = ToString( fail ); - namedParams["zfail"] = ToString( zfail ); - namedParams["zpass"] = ToString( zpass ); + namedParams["face"] = ToString(face); + namedParams["fail"] = ToString(fail); + namedParams["zfail"] = ToString(zfail); + namedParams["zpass"] = ToString(zpass); - mStencilFunctionTrace.PushCall( "StencilOpSeparate", out.str(), namedParams ); + mStencilFunctionTrace.PushCall("StencilOpSeparate", out.str(), namedParams); } inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override { std::stringstream out; - out << target<<", "<second == location ) + if(it->second == location) { - name = it->first; + name = it->first; matched = true; break; } } - if ( matched ) + if(matched) { - mSetUniformTrace.PushCall( name, value ); + mSetUniformTrace.PushCall(name, value); } } - public: // TEST FUNCTIONS - inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; } - inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; } - inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; } - inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; } - inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; } - inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; } - inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; } - inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; } - inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; } - inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; } - inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; } - inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; } - inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; } - inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; } - inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; } - inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; } + inline void SetCompileStatus(GLuint value) + { + mCompileStatus = value; + } + inline void SetLinkStatus(GLuint value) + { + mLinkStatus = value; + } + inline void SetGetAttribLocationResult(int result) + { + mGetAttribLocationResult = result; + } + inline void SetGetErrorResult(GLenum result) + { + mGetErrorResult = result; + } + inline void SetGetStringResult(GLubyte* result) + { + mGetStringResult = result; + } + inline void SetIsBufferResult(GLboolean result) + { + mIsBufferResult = result; + } + inline void SetIsEnabledResult(GLboolean result) + { + mIsEnabledResult = result; + } + inline void SetIsFramebufferResult(GLboolean result) + { + mIsFramebufferResult = result; + } + inline void SetIsProgramResult(GLboolean result) + { + mIsProgramResult = result; + } + inline void SetIsRenderbufferResult(GLboolean result) + { + mIsRenderbufferResult = result; + } + inline void SetIsShaderResult(GLboolean result) + { + mIsShaderResult = result; + } + inline void SetIsTextureResult(GLboolean result) + { + mIsTextureResult = result; + } + inline void SetCheckFramebufferStatusResult(GLenum result) + { + mCheckFramebufferStatusResult = result; + } + inline void SetNumBinaryFormats(GLint numFormats) + { + mNumBinaryFormats = numFormats; + } + inline void SetBinaryFormats(GLint binaryFormats) + { + mBinaryFormats = binaryFormats; + } + inline void SetProgramBinaryLength(GLint length) + { + mProgramBinaryLength = length; + } inline bool GetVertexAttribArrayState(GLuint index) { - if( index >= MAX_ATTRIBUTE_CACHE_SIZE ) + if(index >= MAX_ATTRIBUTE_CACHE_SIZE) { // out of range return false; } - return mVertexAttribArrayState[ index ]; + return mVertexAttribArrayState[index]; + } + inline void ClearVertexAttribArrayChanged() + { + mVertexAttribArrayChanged = false; + } + inline bool GetVertexAttribArrayChanged() + { + return mVertexAttribArrayChanged; } - inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; } - inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; } //Methods for CullFace verification - inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); } - inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); } - inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; } + inline void EnableCullFaceCallTrace(bool enable) + { + mCullFaceTrace.Enable(enable); + } + inline void ResetCullFaceCallStack() + { + mCullFaceTrace.Reset(); + } + inline TraceCallStack& GetCullFaceTrace() + { + return mCullFaceTrace; + } //Methods for Enable/Disable call verification - inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); } - inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); } - inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; } + inline void EnableEnableDisableCallTrace(bool enable) + { + mEnableDisableTrace.Enable(enable); + } + inline void ResetEnableDisableCallStack() + { + mEnableDisableTrace.Reset(); + } + inline TraceCallStack& GetEnableDisableTrace() + { + return mEnableDisableTrace; + } //Methods for Shader verification - inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); } - inline void ResetShaderCallStack() { mShaderTrace.Reset(); } - inline TraceCallStack& GetShaderTrace() { return mShaderTrace; } + inline void EnableShaderCallTrace(bool enable) + { + mShaderTrace.Enable(enable); + } + inline void ResetShaderCallStack() + { + mShaderTrace.Reset(); + } + inline TraceCallStack& GetShaderTrace() + { + return mShaderTrace; + } //Methods for Texture verification - inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); } - inline void ResetTextureCallStack() { mTextureTrace.Reset(); } - inline TraceCallStack& GetTextureTrace() { return mTextureTrace; } + inline void EnableTextureCallTrace(bool enable) + { + mTextureTrace.Enable(enable); + } + inline void ResetTextureCallStack() + { + mTextureTrace.Reset(); + } + inline TraceCallStack& GetTextureTrace() + { + return mTextureTrace; + } //Methods for Texture verification - inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); } - inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); } - inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; } + inline void EnableTexParameterCallTrace(bool enable) + { + mTexParamaterTrace.Enable(enable); + } + inline void ResetTexParameterCallStack() + { + mTexParamaterTrace.Reset(); + } + inline TraceCallStack& GetTexParameterTrace() + { + return mTexParamaterTrace; + } //Methods for Draw verification - inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); } - inline void ResetDrawCallStack() { mDrawTrace.Reset(); } - inline TraceCallStack& GetDrawTrace() { return mDrawTrace; } + inline void EnableDrawCallTrace(bool enable) + { + mDrawTrace.Enable(enable); + } + inline void ResetDrawCallStack() + { + mDrawTrace.Reset(); + } + inline TraceCallStack& GetDrawTrace() + { + return mDrawTrace; + } //Methods for Depth function verification - inline void EnableDepthFunctionCallTrace(bool enable) { mDepthFunctionTrace.Enable(enable); } - inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); } - inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; } + inline void EnableDepthFunctionCallTrace(bool enable) + { + mDepthFunctionTrace.Enable(enable); + } + inline void ResetDepthFunctionCallStack() + { + mDepthFunctionTrace.Reset(); + } + inline TraceCallStack& GetDepthFunctionTrace() + { + return mDepthFunctionTrace; + } //Methods for Stencil function verification - inline void EnableStencilFunctionCallTrace(bool enable) { mStencilFunctionTrace.Enable(enable); } - inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); } - inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; } + inline void EnableStencilFunctionCallTrace(bool enable) + { + mStencilFunctionTrace.Enable(enable); + } + inline void ResetStencilFunctionCallStack() + { + mStencilFunctionTrace.Reset(); + } + inline TraceCallStack& GetStencilFunctionTrace() + { + return mStencilFunctionTrace; + } //Methods for Scissor verification - inline void EnableScissorCallTrace(bool enable) { mScissorTrace.Enable(enable); } - inline void ResetScissorCallStack() { mScissorTrace.Reset(); } - inline TraceCallStack& GetScissorTrace() { return mScissorTrace; } + inline void EnableScissorCallTrace(bool enable) + { + mScissorTrace.Enable(enable); + } + inline void ResetScissorCallStack() + { + mScissorTrace.Reset(); + } + inline TraceCallStack& GetScissorTrace() + { + return mScissorTrace; + } //Methods for Uniform function verification - inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); } - inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); } - inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; } + inline void EnableSetUniformCallTrace(bool enable) + { + mSetUniformTrace.Enable(enable); + } + inline void ResetSetUniformCallStack() + { + mSetUniformTrace.Reset(); + } + inline TraceCallStack& GetSetUniformTrace() + { + return mSetUniformTrace; + } //Methods for Viewport verification - inline void EnableViewportCallTrace(bool enable) { mViewportTrace.Enable(enable); } - inline void ResetViewportCallStack() { mViewportTrace.Reset(); } - inline TraceCallStack& GetViewportTrace() { return mViewportTrace; } + inline void EnableViewportCallTrace(bool enable) + { + mViewportTrace.Enable(enable); + } + inline void ResetViewportCallStack() + { + mViewportTrace.Reset(); + } + inline TraceCallStack& GetViewportTrace() + { + return mViewportTrace; + } - template - inline bool GetUniformValue( const char* name, T& value ) const + template + inline bool GetUniformValue(const char* name, T& value) const { - for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); - program_it != mUniforms.end(); - ++program_it ) + for(ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it) { - const UniformIDMap &uniformIDs = program_it->second; + const UniformIDMap& uniformIDs = program_it->second; - UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); - if( uniform_it != uniformIDs.end() ) + UniformIDMap::const_iterator uniform_it = uniformIDs.find(name); + if(uniform_it != uniformIDs.end()) { // found one matching uniform name, lets check the value... GLuint programId = program_it->first; - GLint uniformId = uniform_it->second; + GLint uniformId = uniform_it->second; - const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( value ); - return mProgramUniforms.GetUniformValue( programId, uniformId, value ); + const ProgramUniformValue& mProgramUniforms = GetProgramUniformsForType(value); + return mProgramUniforms.GetUniformValue(programId, uniformId, value); } } return false; } - - template - inline bool CheckUniformValue( const char* name, const T& value ) const + template + inline bool CheckUniformValue(const char* name, const T& value) const { - for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); - program_it != mUniforms.end(); - ++program_it ) + for(ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it) { - const UniformIDMap &uniformIDs = program_it->second; + const UniformIDMap& uniformIDs = program_it->second; - UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); - if( uniform_it != uniformIDs.end() ) + UniformIDMap::const_iterator uniform_it = uniformIDs.find(name); + if(uniform_it != uniformIDs.end()) { // found one matching uniform name, lets check the value... GLuint programId = program_it->first; - GLint uniformId = uniform_it->second; + GLint uniformId = uniform_it->second; - const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( value ); - if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) ) + const ProgramUniformValue& mProgramUniforms = GetProgramUniformsForType(value); + if(mProgramUniforms.CheckUniformValue(programId, uniformId, value)) { // the value matches return true; @@ -2048,50 +2198,50 @@ public: // TEST FUNCTIONS } } - fprintf(stderr, "Not found, printing possible values:\n" ); - for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); - program_it != mUniforms.end(); - ++program_it ) + fprintf(stderr, "Not found, printing possible values:\n"); + for(ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it) { - const UniformIDMap &uniformIDs = program_it->second; + const UniformIDMap& uniformIDs = program_it->second; - UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); - if( uniform_it != uniformIDs.end() ) + UniformIDMap::const_iterator uniform_it = uniformIDs.find(name); + if(uniform_it != uniformIDs.end()) { // found one matching uniform name, lets check the value... GLuint programId = program_it->first; - GLint uniformId = uniform_it->second; + GLint uniformId = uniform_it->second; - const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( value ); - T origValue; - if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) ) + const ProgramUniformValue& mProgramUniforms = GetProgramUniformsForType(value); + T origValue; + if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue)) { std::stringstream out; out << uniform_it->first << ": " << origValue; - fprintf(stderr, "%s\n", out.str().c_str() ); + fprintf(stderr, "%s\n", out.str().c_str()); } } } return false; } - template - inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const + template + inline bool GetUniformValue(GLuint programId, GLuint uniformId, T& outValue) const { - const ProgramUniformValue &mProgramUniforms = GetProgramUniformsForType( outValue ); - return mProgramUniforms.GetUniformValue( programId, uniformId, outValue ); + const ProgramUniformValue& mProgramUniforms = GetProgramUniformsForType(outValue); + return mProgramUniforms.GetUniformValue(programId, uniformId, outValue); } - inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const + inline bool GetUniformIds(const char* name, GLuint& programId, GLuint& uniformId) const { - for( ProgramUniformMap::const_iterator program_it = mUniforms.begin(); - program_it != mUniforms.end(); - ++program_it ) + for(ProgramUniformMap::const_iterator program_it = mUniforms.begin(); + program_it != mUniforms.end(); + ++program_it) { - const UniformIDMap &uniformIDs = program_it->second; + const UniformIDMap& uniformIDs = program_it->second; - UniformIDMap::const_iterator uniform_it = uniformIDs.find( name ); - if( uniform_it != uniformIDs.end() ) + UniformIDMap::const_iterator uniform_it = uniformIDs.find(name); + if(uniform_it != uniformIDs.end()) { programId = program_it->first; uniformId = uniform_it->second; @@ -2130,16 +2280,25 @@ public: // TEST FUNCTIONS struct ScissorParams { - GLint x; - GLint y; + GLint x; + GLint y; GLsizei width; GLsizei height; - ScissorParams() : x( 0 ), y( 0 ), width( 0 ), height( 0 ) { } + ScissorParams() + : x(0), + y(0), + width(0), + height(0) + { + } }; // Methods to check scissor tests - inline const ScissorParams& GetScissorParams() const { return mScissorParams; } + inline const ScissorParams& GetScissorParams() const + { + return mScissorParams; + } struct ColorMaskParams { @@ -2148,59 +2307,86 @@ public: // TEST FUNCTIONS GLboolean blue; GLboolean alpha; - ColorMaskParams() : red( true ), green( true ), blue( true ), alpha( true ) { } + ColorMaskParams() + : red(true), + green(true), + blue(true), + alpha(true) + { + } }; - inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; } + inline bool GetProgramBinaryCalled() const + { + return mGetProgramBinaryCalled; + } - inline unsigned int GetClearCountCalled() const { return mClearCount; } + inline unsigned int GetClearCountCalled() const + { + return mClearCount; + } - inline const ColorMaskParams& GetColorMaskParams() const { return mColorMaskParams; } + inline const ColorMaskParams& GetColorMaskParams() const + { + return mColorMaskParams; + } - typedef std::vector BufferDataCalls; - inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; } - inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); } + typedef std::vector BufferDataCalls; + inline const BufferDataCalls& GetBufferDataCalls() const + { + return mBufferDataCalls; + } + inline void ResetBufferDataCalls() + { + mBufferDataCalls.clear(); + } - typedef std::vector BufferSubDataCalls; - inline const BufferSubDataCalls& GetBufferSubDataCalls() const { return mBufferSubDataCalls; } - inline void ResetBufferSubDataCalls() { mBufferSubDataCalls.clear(); } + typedef std::vector BufferSubDataCalls; + inline const BufferSubDataCalls& GetBufferSubDataCalls() const + { + return mBufferSubDataCalls; + } + inline void ResetBufferSubDataCalls() + { + mBufferSubDataCalls.clear(); + } private: - GLuint mCurrentProgram; - GLuint mCompileStatus; - BufferDataCalls mBufferDataCalls; - BufferSubDataCalls mBufferSubDataCalls; - GLuint mLinkStatus; - GLint mNumberOfActiveUniforms; - GLint mGetAttribLocationResult; - GLenum mGetErrorResult; - GLubyte* mGetStringResult; - GLboolean mIsBufferResult; - GLboolean mIsEnabledResult; - GLboolean mIsFramebufferResult; - GLboolean mIsProgramResult; - GLboolean mIsRenderbufferResult; - GLboolean mIsShaderResult; - GLboolean mIsTextureResult; - GLenum mActiveTextureUnit; - GLenum mCheckFramebufferStatusResult; - GLint mFramebufferStatus; - GLenum mFramebufferDepthAttached; - GLenum mFramebufferStencilAttached; - GLuint mFramebufferColorAttachmentCount; - GLuint mFrameBufferColorStatus; - GLint mNumBinaryFormats; - GLint mBinaryFormats; - GLint mProgramBinaryLength; - bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE]; - bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed - bool mGetProgramBinaryCalled; - typedef std::map< GLuint, std::string> ShaderSourceMap; - ShaderSourceMap mShaderSources; - GLuint mLastShaderCompiled; - GLbitfield mLastClearBitMask; - Vector4 mLastClearColor; - unsigned int mClearCount; + GLuint mCurrentProgram; + GLuint mCompileStatus; + BufferDataCalls mBufferDataCalls; + BufferSubDataCalls mBufferSubDataCalls; + GLuint mLinkStatus; + GLint mNumberOfActiveUniforms; + GLint mGetAttribLocationResult; + GLenum mGetErrorResult; + GLubyte* mGetStringResult; + GLboolean mIsBufferResult; + GLboolean mIsEnabledResult; + GLboolean mIsFramebufferResult; + GLboolean mIsProgramResult; + GLboolean mIsRenderbufferResult; + GLboolean mIsShaderResult; + GLboolean mIsTextureResult; + GLenum mActiveTextureUnit; + GLenum mCheckFramebufferStatusResult; + GLint mFramebufferStatus; + GLenum mFramebufferDepthAttached; + GLenum mFramebufferStencilAttached; + GLuint mFramebufferColorAttachmentCount; + GLuint mFrameBufferColorStatus; + GLint mNumBinaryFormats; + GLint mBinaryFormats; + GLint mProgramBinaryLength; + bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE]; + bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed + bool mGetProgramBinaryCalled; + typedef std::map ShaderSourceMap; + ShaderSourceMap mShaderSources; + GLuint mLastShaderCompiled; + GLbitfield mLastClearBitMask; + Vector4 mLastClearColor; + unsigned int mClearCount; Vector4 mLastBlendColor; GLenum mLastBlendEquationRgb; @@ -2213,8 +2399,8 @@ private: GLboolean mLastDepthMask; // Data for manipulating the IDs returned by GenTextures - GLuint mLastAutoTextureIdUsed; - GLuint mNumGeneratedTextures; + GLuint mLastAutoTextureIdUsed; + GLuint mNumGeneratedTextures; std::vector mNextTextureIds; std::vector mDeletedTextureIds; std::vector mBoundTextures; @@ -2224,7 +2410,7 @@ private: std::vector mBoundTextures; }; - ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ]; + ActiveTextureType mActiveTextures[MIN_TEXTURE_UNIT_LIMIT]; TraceCallStack mCullFaceTrace; TraceCallStack mEnableDisableTrace; @@ -2239,46 +2425,46 @@ private: TraceCallStack mViewportTrace; // Shaders & Uniforms - GLuint mLastShaderIdUsed; - GLuint mLastProgramIdUsed; - GLuint mLastUniformIdUsed; - typedef std::map< std::string, GLint > UniformIDMap; - typedef std::map< GLuint, UniformIDMap > ProgramUniformMap; - ProgramUniformMap mUniforms; + GLuint mLastShaderIdUsed; + GLuint mLastProgramIdUsed; + GLuint mLastUniformIdUsed; + typedef std::map UniformIDMap; + typedef std::map ProgramUniformMap; + ProgramUniformMap mUniforms; - template - struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > > + template + struct ProgramUniformValue : public std::map > { public: - typedef std::map< GLint, T > UniformValueMap; - typedef std::map< GLuint, UniformValueMap > Map; + typedef std::map UniformValueMap; + typedef std::map Map; - bool SetUniformValue( GLuint program, GLuint uniform, const T& value ) + bool SetUniformValue(GLuint program, GLuint uniform, const T& value) { - if( program == 0 ) + if(program == 0) { return false; } - typename Map::iterator it = Map::find( program ); - if( it == Map::end() ) + typename Map::iterator it = Map::find(program); + if(it == Map::end()) { // if its the first uniform for this program add it - std::pair< typename Map::iterator, bool > result = - Map::insert( typename Map::value_type( program, UniformValueMap() ) ); + std::pair result = + Map::insert(typename Map::value_type(program, UniformValueMap())); it = result.first; } UniformValueMap& uniforms = it->second; - uniforms[uniform] = value; + uniforms[uniform] = value; return true; } - bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const + bool CheckUniformValue(GLuint program, GLuint uniform, const T& value) const { T uniformValue; - if ( GetUniformValue( program, uniform, uniformValue ) ) + if(GetUniformValue(program, uniform, uniformValue)) { return CompareType(value, uniformValue, Math::MACHINE_EPSILON_10); } @@ -2286,24 +2472,24 @@ private: return false; } - bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const + bool GetUniformValue(GLuint program, GLuint uniform, T& value) const { - if( program == 0 ) + if(program == 0) { return false; } - typename Map::const_iterator it = Map::find( program ); - if( it == Map::end() ) + typename Map::const_iterator it = Map::find(program); + if(it == Map::end()) { // Uniform values always initialised as 0 value = GetZero(); return true; } - const UniformValueMap& uniforms = it->second; - typename UniformValueMap::const_iterator it2 = uniforms.find( uniform ); - if( it2 == uniforms.end() ) + const UniformValueMap& uniforms = it->second; + typename UniformValueMap::const_iterator it2 = uniforms.find(uniform); + if(it2 == uniforms.end()) { // Uniform values always initialised as 0 value = GetZero(); @@ -2316,97 +2502,97 @@ private: T GetZero() const; }; - ProgramUniformValue mProgramUniforms1i; - ProgramUniformValue mProgramUniforms1f; + ProgramUniformValue mProgramUniforms1i; + ProgramUniformValue mProgramUniforms1f; ProgramUniformValue mProgramUniforms2f; ProgramUniformValue mProgramUniforms3f; ProgramUniformValue mProgramUniforms4f; - ProgramUniformValue mProgramUniformsMat4; + ProgramUniformValue mProgramUniformsMat4; ProgramUniformValue mProgramUniformsMat3; - inline const ProgramUniformValue& GetProgramUniformsForType( const int ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const int) const { return mProgramUniforms1i; } - inline const ProgramUniformValue& GetProgramUniformsForType( const float ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const float) const { return mProgramUniforms1f; } - inline const ProgramUniformValue& GetProgramUniformsForType( const Vector2& ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const Vector2&) const { return mProgramUniforms2f; } - inline const ProgramUniformValue& GetProgramUniformsForType( const Vector3& ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const Vector3&) const { return mProgramUniforms3f; } - inline const ProgramUniformValue& GetProgramUniformsForType( const Vector4& ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const Vector4&) const { return mProgramUniforms4f; } - inline const ProgramUniformValue& GetProgramUniformsForType( const Matrix& ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const Matrix&) const { return mProgramUniformsMat4; } - inline const ProgramUniformValue& GetProgramUniformsForType( const Matrix3& ) const + inline const ProgramUniformValue& GetProgramUniformsForType(const Matrix3&) const { return mProgramUniformsMat3; } inline void SetVertexAttribArray(GLuint index, bool state) { - if( index >= MAX_ATTRIBUTE_CACHE_SIZE ) + if(index >= MAX_ATTRIBUTE_CACHE_SIZE) { // out of range return; } - mVertexAttribArrayState[ index ] = state; - mVertexAttribArrayChanged = true; + mVertexAttribArrayState[index] = state; + mVertexAttribArrayChanged = true; } - ScissorParams mScissorParams; + ScissorParams mScissorParams; ColorMaskParams mColorMaskParams; }; -template <> +template<> inline int TestGlAbstraction::ProgramUniformValue::GetZero() const { return 0; } -template <> +template<> inline float TestGlAbstraction::ProgramUniformValue::GetZero() const { return 0.0f; } -template <> +template<> inline Vector2 TestGlAbstraction::ProgramUniformValue::GetZero() const { return Vector2::ZERO; } -template <> +template<> inline Vector3 TestGlAbstraction::ProgramUniformValue::GetZero() const { return Vector3::ZERO; } -template <> +template<> inline Vector4 TestGlAbstraction::ProgramUniformValue::GetZero() const { return Vector4::ZERO; } -template <> +template<> inline Matrix TestGlAbstraction::ProgramUniformValue::GetZero() const { return Matrix(); } -template <> +template<> inline Matrix3 TestGlAbstraction::ProgramUniformValue::GetZero() const { - return Matrix3( Matrix() ); + return Matrix3(Matrix()); } } // namespace Dali @@ -2414,5 +2600,4 @@ inline Matrix3 TestGlAbstraction::ProgramUniformValue::GetZero() const bool BlendEnabled(const Dali::TraceCallStack& callStack); bool BlendDisabled(const Dali::TraceCallStack& callStack); - #endif // TEST_GL_ABSTRACTION_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h index 8ef26dc..1a5a54c 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h @@ -23,44 +23,42 @@ namespace Dali { - /** * Class to emulate the GL context helper */ -class DALI_CORE_API TestGlContextHelperAbstraction: public Integration::GlContextHelperAbstraction +class DALI_CORE_API TestGlContextHelperAbstraction : public Integration::GlContextHelperAbstraction { public: /** * Constructor */ - TestGlContextHelperAbstraction() {}; + TestGlContextHelperAbstraction(){}; /** * Destructor */ - ~TestGlContextHelperAbstraction() override {}; + ~TestGlContextHelperAbstraction() override{}; /** * @brief Switch to the surfaceless GL context */ - void MakeSurfacelessContextCurrent() override {}; + void MakeSurfacelessContextCurrent() override{}; /** * @brief Clear the GL context */ - void MakeContextNull() override {}; + void MakeContextNull() override{}; /** * @brief Wait until all GL rendering calls for the current GL context are executed */ - void WaitClient() override {}; + void WaitClient() override{}; private: - - TestGlContextHelperAbstraction( const TestGlContextHelperAbstraction& ); ///< Undefined - TestGlContextHelperAbstraction& operator=( const TestGlContextHelperAbstraction& ); ///< Undefined + TestGlContextHelperAbstraction(const TestGlContextHelperAbstraction&); ///< Undefined + TestGlContextHelperAbstraction& operator=(const TestGlContextHelperAbstraction&); ///< Undefined }; -} // Dali +} // namespace Dali #endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp index 858e930..f404f32 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp @@ -19,7 +19,6 @@ namespace Dali { - TestSyncObject::TestSyncObject(TraceCallStack& trace) : synced(false), mTrace(trace) @@ -36,8 +35,6 @@ bool TestSyncObject::IsSynced() return synced; } - - TestGlSyncAbstraction::TestGlSyncAbstraction() { Initialize(); @@ -48,7 +45,7 @@ TestGlSyncAbstraction::TestGlSyncAbstraction() */ TestGlSyncAbstraction::~TestGlSyncAbstraction() { - for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter ) + for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter) { delete *iter; } @@ -66,12 +63,12 @@ void TestGlSyncAbstraction::Initialize() * Create a sync object * @return the sync object */ -Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( ) +Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject() { mTrace.PushCall("CreateSyncObject", ""); // Trace the method TestSyncObject* syncObject = new TestSyncObject(mTrace); - mSyncObjects.push_back( syncObject ); + mSyncObjects.push_back(syncObject); return syncObject; } @@ -79,15 +76,15 @@ Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObj * Destroy a sync object * @param[in] syncObject The object to destroy */ -void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ) +void TestGlSyncAbstraction::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) { std::stringstream out; out << syncObject; mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method - for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter ) + for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter) { - if( *iter == syncObject ) + if(*iter == syncObject) { delete *iter; mSyncObjects.erase(iter); @@ -96,10 +93,9 @@ void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::S } } - -Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( ) +Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject() { - if( !mSyncObjects.empty() ) + if(!mSyncObjects.empty()) { return mSyncObjects.back(); } @@ -111,31 +107,39 @@ Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncOb * @param[in] * @param[in] sync The sync value to set */ -void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync ) +void TestGlSyncAbstraction::SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync) { TestSyncObject* testSyncObject = static_cast(syncObject); - testSyncObject->synced = sync; + testSyncObject->synced = sync; } /** * Turn trace on */ -void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); } +void TestGlSyncAbstraction::EnableTrace(bool enable) +{ + mTrace.Enable(enable); +} /** * Reset the trace callstack */ -void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); } +void TestGlSyncAbstraction::ResetTrace() +{ + mTrace.Reset(); +} /** * Get the trace object (allows test case to find methods on it) */ -TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; } +TraceCallStack& TestGlSyncAbstraction::GetTrace() +{ + return mTrace; +} int32_t TestGlSyncAbstraction::GetNumberOfSyncObjects() { - return static_cast( mSyncObjects.size() ); + return static_cast(mSyncObjects.size()); } - -} // Dali +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.h index 6524a06..6a01143 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.h @@ -2,7 +2,7 @@ #define TEST_GL_SYNC_ABSTRACTION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,32 +19,32 @@ */ // EXTERNAL INCLUDES +#include #include #include -#include // INTERNAL INCLUDES #include #include + #include "test-trace-call-stack.h" namespace Dali { - class DALI_CORE_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject { public: TestSyncObject(TraceCallStack& trace); ~TestSyncObject() override; - bool IsSynced() override; - bool synced; + bool IsSynced() override; + bool synced; TraceCallStack& mTrace; }; /** * Class to emulate the GL sync functions with tracing */ -class DALI_CORE_API TestGlSyncAbstraction: public Integration::GlSyncAbstraction +class DALI_CORE_API TestGlSyncAbstraction : public Integration::GlSyncAbstraction { public: /** @@ -66,24 +66,23 @@ public: * Create a sync object * @return the sync object */ - Integration::GlSyncAbstraction::SyncObject* CreateSyncObject( ) override; + Integration::GlSyncAbstraction::SyncObject* CreateSyncObject() override; /** * Destroy a sync object * @param[in] syncObject The object to destroy */ - void DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ) override; - + void DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) override; public: // TEST FUNCTIONS - Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject( ); + Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject(); /** * Test method to trigger the object sync behaviour. * @param[in] * @param[in] sync The sync value to set */ - void SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync ); + void SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync); /** * Turn trace on @@ -108,16 +107,15 @@ public: // TEST FUNCTIONS int32_t GetNumberOfSyncObjects(); private: + TestGlSyncAbstraction(const TestGlSyncAbstraction&); ///< Undefined + TestGlSyncAbstraction& operator=(const TestGlSyncAbstraction&); ///< Undefined - TestGlSyncAbstraction( const TestGlSyncAbstraction& ); ///< Undefined - TestGlSyncAbstraction& operator=( const TestGlSyncAbstraction& ); ///< Undefined - - typedef std::vector SyncContainer; - typedef SyncContainer::iterator SyncIter; - SyncContainer mSyncObjects; ///< The sync objects - TraceCallStack mTrace; ///< the trace call stack for testing + typedef std::vector SyncContainer; + typedef SyncContainer::iterator SyncIter; + SyncContainer mSyncObjects; ///< The sync objects + TraceCallStack mTrace; ///< the trace call stack for testing }; -} // Dali +} // namespace Dali #endif // TEST_GL_SYNC_ABSTRACTION_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-harness.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-harness.cpp index b42b9f9..0b814e7 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-harness.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-harness.cpp @@ -15,28 +15,29 @@ */ #include "test-harness.h" + +#include #include #include #include +#include #include -#include -#include + #include -#include -#include +#include +#include namespace TestHarness { - typedef std::map RunningTestCases; const char* basename(const char* path) { - const char* ptr=path; - const char* slash=NULL; - for( ; *ptr != '\0' ; ++ptr ) + const char* ptr = path; + const char* slash = NULL; + for(; *ptr != '\0'; ++ptr) { - if(*ptr == '/') slash=ptr; + if(*ptr == '/') slash = ptr; } if(slash != NULL) ++slash; return slash; @@ -56,14 +57,14 @@ void SuppressLogOutput() open("/dev/null", O_RDWR); // Redirect file descriptor number 2 (i.e. stderr) to /dev/null } -int32_t RunTestCase( struct ::testcase_s& testCase ) +int32_t RunTestCase(struct ::testcase_s& testCase) { int32_t result = EXIT_STATUS_TESTCASE_FAILED; -// dont want to catch exception as we want to be able to get -// gdb stack trace from the first error -// by default tests should all always pass with no exceptions - if( testCase.startup ) + // dont want to catch exception as we want to be able to get + // gdb stack trace from the first error + // by default tests should all always pass with no exceptions + if(testCase.startup) { testCase.startup(); } @@ -71,11 +72,11 @@ int32_t RunTestCase( struct ::testcase_s& testCase ) { result = testCase.function(); } - catch( const char* ) + catch(const char*) { // just catch test fail exception, return is already set to EXIT_STATUS_TESTCASE_FAILED } - if( testCase.cleanup ) + if(testCase.cleanup) { testCase.cleanup(); } @@ -83,36 +84,35 @@ int32_t RunTestCase( struct ::testcase_s& testCase ) return result; } - -int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput ) +int32_t RunTestCaseInChildProcess(struct ::testcase_s& testCase, bool suppressOutput) { int32_t testResult = EXIT_STATUS_TESTCASE_FAILED; int32_t pid = fork(); - if( pid == 0 ) // Child process + if(pid == 0) // Child process { - if( suppressOutput ) + if(suppressOutput) { SuppressLogOutput(); } else { printf("\n"); - for(int32_t i=0; i<80; ++i) printf("#"); + for(int32_t i = 0; i < 80; ++i) printf("#"); printf("\nTC: %s\n", testCase.name); fflush(stdout); } - int32_t status = RunTestCase( testCase ); + int32_t status = RunTestCase(testCase); - if( ! suppressOutput ) + if(!suppressOutput) { fflush(stdout); fflush(stderr); fclose(stdout); fclose(stderr); } - exit( status ); + exit(status); } else if(pid == -1) { @@ -121,31 +121,31 @@ int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressO } else // Parent process { - int32_t status = 0; + int32_t status = 0; int32_t childPid = waitpid(pid, &status, 0); - if( childPid == -1 ) + if(childPid == -1) { perror("waitpid"); exit(EXIT_STATUS_WAITPID_FAILED); } - if( WIFEXITED(status) ) + if(WIFEXITED(status)) { - if( childPid > 0 ) + if(childPid > 0) { testResult = WEXITSTATUS(status); - if( testResult ) + if(testResult) { printf("Test case %s failed: %d\n", testCase.name, testResult); } } } - else if(WIFSIGNALED(status) ) + else if(WIFSIGNALED(status)) { int32_t signal = WTERMSIG(status); - testResult = EXIT_STATUS_TESTCASE_ABORTED; - if( signal == SIGABRT ) + testResult = EXIT_STATUS_TESTCASE_ABORTED; + if(signal == SIGABRT) { - printf("Test case %s failed: test case asserted\n", testCase.name ); + printf("Test case %s failed: test case asserted\n", testCase.name); } else { @@ -162,43 +162,43 @@ int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressO return testResult; } -void OutputStatistics( const char* processName, int32_t numPasses, int32_t numFailures ) +void OutputStatistics(const char* processName, int32_t numPasses, int32_t numFailures) { - FILE* fp=fopen("summary.xml", "a"); - if( fp != NULL ) + FILE* fp = fopen("summary.xml", "a"); + if(fp != NULL) { - fprintf( fp, - " \n" - " %d\n" - " %d\n" - " %5.2f\n" - " %d\n" - " %5.2f\n" - " 0\n" - " 0.00\n" - " 0\n" - " 0.00\n" - " \n", - basename(processName), - numPasses+numFailures, - numPasses, - (float)numPasses/(numPasses+numFailures), - numFailures, - (float)numFailures/(numPasses+numFailures) ); + fprintf(fp, + " \n" + " %d\n" + " %d\n" + " %5.2f\n" + " %d\n" + " %5.2f\n" + " 0\n" + " 0.00\n" + " 0\n" + " 0.00\n" + " \n", + basename(processName), + numPasses + numFailures, + numPasses, + (float)numPasses / (numPasses + numFailures), + numFailures, + (float)numFailures / (numPasses + numFailures)); fclose(fp); } } -int32_t RunAll( const char* processName, ::testcase tc_array[] ) +int32_t RunAll(const char* processName, ::testcase tc_array[]) { int32_t numFailures = 0; - int32_t numPasses = 0; + int32_t numPasses = 0; // Run test cases in child process( to kill output/handle signals ), but run serially. - for( uint32_t i=0; tc_array[i].name; i++) + for(uint32_t i = 0; tc_array[i].name; i++) { - int32_t result = RunTestCaseInChildProcess( tc_array[i], false ); - if( result == 0 ) + int32_t result = RunTestCaseInChildProcess(tc_array[i], false); + if(result == 0) { numPasses++; } @@ -208,36 +208,36 @@ int32_t RunAll( const char* processName, ::testcase tc_array[] ) } } - OutputStatistics( processName, numPasses, numFailures); + OutputStatistics(processName, numPasses, numFailures); return numFailures; } // Constantly runs up to MAX_NUM_CHILDREN processes -int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRunFailed) +int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], bool reRunFailed) { int32_t numFailures = 0; - int32_t numPasses = 0; + int32_t numPasses = 0; - RunningTestCases children; + RunningTestCases children; std::vector failedTestCases; // Fork up to MAX_NUM_CHILDREN processes, then // wait. As soon as a proc completes, fork the next. - int32_t nextTestCase = 0; + int32_t nextTestCase = 0; int32_t numRunningChildren = 0; - while( tc_array[nextTestCase].name || numRunningChildren > 0) + while(tc_array[nextTestCase].name || numRunningChildren > 0) { // Create more children (up to the max number or til the end of the array) - while( numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name ) + while(numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name) { int32_t pid = fork(); - if( pid == 0 ) // Child process + if(pid == 0) // Child process { SuppressLogOutput(); - exit( RunTestCase( tc_array[nextTestCase] ) ); + exit(RunTestCase(tc_array[nextTestCase])); } else if(pid == -1) { @@ -255,20 +255,20 @@ int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool // Wait for the next child to finish - int32_t status=0; + int32_t status = 0; int32_t childPid = waitpid(-1, &status, 0); - if( childPid == -1 ) + if(childPid == -1) { perror("waitpid"); exit(EXIT_STATUS_WAITPID_FAILED); } - if( WIFEXITED(status) ) + if(WIFEXITED(status)) { - if( childPid > 0 ) + if(childPid > 0) { int32_t testResult = WEXITSTATUS(status); - if( testResult ) + if(testResult) { printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult); failedTestCases.push_back(children[childPid].testCase); @@ -282,14 +282,14 @@ int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool } } - else if( WIFSIGNALED(status) || WIFSTOPPED(status)) + else if(WIFSIGNALED(status) || WIFSTOPPED(status)) { - status = WIFSIGNALED(status)?WTERMSIG(status):WSTOPSIG(status); + status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status); - if( childPid > 0 ) + if(childPid > 0) { RunningTestCases::iterator iter = children.find(childPid); - if( iter != children.end() ) + if(iter != children.end()) { printf("Test case %s exited with signal %s\n", iter->second.testCaseName, strsignal(status)); failedTestCases.push_back(iter->second.testCase); @@ -305,38 +305,36 @@ int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool } } - OutputStatistics( processName, numPasses, numFailures ); + OutputStatistics(processName, numPasses, numFailures); - if( reRunFailed ) + if(reRunFailed) { - for( uint32_t i=0; i\t\t Execute a test case\n" - " %s \t\t Execute all test cases in parallel\n" - " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n" - " %s -s\t\t Execute all test cases serially\n", - program, program, program, program); + printf( + "Usage: \n" + " %s \t\t Execute a test case\n" + " %s \t\t Execute all test cases in parallel\n" + " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n" + " %s -s\t\t Execute all test cases serially\n", + program, + program, + program, + program); } -} // namespace +} // namespace TestHarness diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-harness.h b/automated-tests/src/dali/dali-test-suite-utils/test-harness.h index e40492c..c4b5e03 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-harness.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-harness.h @@ -2,7 +2,7 @@ #define TEST_HARNESS_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,27 +19,27 @@ #include #include + #include namespace TestHarness { - enum ExitStatus { - EXIT_STATUS_TESTCASE_SUCCEEDED, // 0 - EXIT_STATUS_TESTCASE_FAILED, // 1 - EXIT_STATUS_TESTCASE_ABORTED, // 2 - EXIT_STATUS_FORK_FAILED, // 3 - EXIT_STATUS_WAITPID_FAILED, // 4 - EXIT_STATUS_BAD_ARGUMENT, // 5 - EXIT_STATUS_TESTCASE_NOT_FOUND // 6 + EXIT_STATUS_TESTCASE_SUCCEEDED, // 0 + EXIT_STATUS_TESTCASE_FAILED, // 1 + EXIT_STATUS_TESTCASE_ABORTED, // 2 + EXIT_STATUS_FORK_FAILED, // 3 + EXIT_STATUS_WAITPID_FAILED, // 4 + EXIT_STATUS_BAD_ARGUMENT, // 5 + EXIT_STATUS_TESTCASE_NOT_FOUND // 6 }; const int32_t MAX_NUM_CHILDREN(16); struct TestCase { - int32_t testCase; + int32_t testCase; const char* testCaseName; TestCase() @@ -60,10 +60,9 @@ struct TestCase } TestCase& operator=(const TestCase& rhs) { - testCase = rhs.testCase; + testCase = rhs.testCase; testCaseName = rhs.testCaseName; return *this; - } }; @@ -71,7 +70,7 @@ struct TestCase * Run a test case * @param[in] testCase The Testkit-lite test case to run */ -int32_t RunTestCase( struct testcase_s& testCase ); +int32_t RunTestCase(struct testcase_s& testCase); /** * Run all test cases in parallel @@ -88,7 +87,7 @@ int32_t RunAllInParallel(const char* processName, testcase tc_array[], bool reRu * @param[in] tc_array The array of auto-generated testkit-lite test cases * @return 0 on success */ -int32_t RunAll( const char* processName, testcase tc_array[] ); +int32_t RunAll(const char* processName, testcase tc_array[]); /** * Find the named test case in the given array, and run it diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-intrusive-ptr.h b/automated-tests/src/dali/dali-test-suite-utils/test-intrusive-ptr.h index 5fb17da..1336745 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-intrusive-ptr.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-intrusive-ptr.h @@ -2,7 +2,7 @@ #define TEST_INTRUSIVE_PTR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,25 +19,25 @@ */ // INTERNAL INCLUDES -#include -#include -#include #include +#include +#include + +#include namespace Dali { - -template +template struct UtcCoverageIntrusivePtr { typedef IntrusivePtr (*Creator)(); - void Check( Creator creator) + void Check(Creator creator) { IntrusivePtr a = creator(); IntrusivePtr b = creator(); - DALI_TEST_CHECK( a.Get() ); + DALI_TEST_CHECK(a.Get()); a.Reset(); @@ -48,13 +48,9 @@ struct UtcCoverageIntrusivePtr DALI_TEST_CHECK(a); a.Reset(); - }; - }; -} // Dali +} // namespace Dali #endif // TEST_INTRUSIVE_PTR_H - - diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-native-image.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-native-image.cpp index 5fdc5c3..76c9e5e 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-native-image.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-native-image.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,21 +15,24 @@ * */ - #include "test-application.h" -#include "test-native-image.h" +#include "test-native-image.h" namespace Dali { - TestNativeImagePointer TestNativeImage::New(uint32_t width, uint32_t height) { return new TestNativeImage(width, height); } TestNativeImage::TestNativeImage(uint32_t width, uint32_t height) -: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true) +: mWidth(width), + mHeight(height), + mExtensionCreateCalls(0), + mExtensionDestroyCalls(0), + mTargetTextureCalls(0), + createResult(true) { } @@ -37,4 +40,4 @@ TestNativeImage::~TestNativeImage() { } -} // namespace dali +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-native-image.h b/automated-tests/src/dali/dali-test-suite-utils/test-native-image.h index 89d5095..f7d4f78 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-native-image.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-native-image.h @@ -2,7 +2,7 @@ #define TEST_NATIVE_IMAGE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include + #include namespace Dali @@ -32,22 +33,63 @@ class DALI_CORE_API TestNativeImage : public Dali::NativeImageInterface public: static TestNativeImagePointer New(uint32_t width, uint32_t height); - inline void SetGlExtensionCreateResult(bool result){ createResult = result;} - inline virtual bool CreateResource() { ++mExtensionCreateCalls; return createResult;}; - inline virtual void DestroyResource() { ++mExtensionDestroyCalls; }; - inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return mTargetTextureError;}; - inline virtual void PrepareTexture() {}; - inline virtual uint32_t GetWidth() const {return mWidth;}; - inline virtual uint32_t GetHeight() const {return mHeight;}; - inline virtual bool RequiresBlending() const {return true;}; - inline virtual int GetTextureTarget() const {return GL_TEXTURE_EXTERNAL_OES;}; - inline virtual const char* GetCustomFragmentPrefix() const {return "#extension GL_OES_EGL_image_external:require\n";}; - inline const char* GetCustomSamplerTypename() const override { return "samplerExternalOES"; }; + inline void SetGlExtensionCreateResult(bool result) + { + createResult = result; + } + inline virtual bool CreateResource() + { + ++mExtensionCreateCalls; + return createResult; + }; + inline virtual void DestroyResource() + { + ++mExtensionDestroyCalls; + }; + inline virtual GLenum TargetTexture() + { + ++mTargetTextureCalls; + return mTargetTextureError; + }; + inline virtual void PrepareTexture(){}; + inline virtual uint32_t GetWidth() const + { + return mWidth; + }; + inline virtual uint32_t GetHeight() const + { + return mHeight; + }; + inline virtual bool RequiresBlending() const + { + return true; + }; + inline virtual int GetTextureTarget() const + { + return GL_TEXTURE_EXTERNAL_OES; + }; + inline virtual const char* GetCustomFragmentPrefix() const + { + return "#extension GL_OES_EGL_image_external:require\n"; + }; + inline const char* GetCustomSamplerTypename() const override + { + return "samplerExternalOES"; + }; - inline Any GetNativeImageHandle() const override { return nullptr; }; - inline bool SourceChanged() const override { return false; }; + inline Any GetNativeImageHandle() const override + { + return nullptr; + }; + inline bool SourceChanged() const override + { + return false; + }; - inline virtual Dali::NativeImageInterface::Extension* GetExtension() {return nullptr;} + inline virtual Dali::NativeImageInterface::Extension* GetExtension() + { + return nullptr; + } private: TestNativeImage(uint32_t width, uint32_t height); @@ -55,16 +97,15 @@ private: uint32_t mWidth; uint32_t mHeight; + public: - int32_t mExtensionCreateCalls; - int32_t mExtensionDestroyCalls; - int32_t mTargetTextureCalls; - uint32_t mTargetTextureError=0u; - bool createResult; + int32_t mExtensionCreateCalls; + int32_t mExtensionDestroyCalls; + int32_t mTargetTextureCalls; + uint32_t mTargetTextureError = 0u; + bool createResult; }; - - -} // Dali +} // namespace Dali #endif // TEST_NATIVE_IMAGE_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp index 3962870..41ad1e5 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,19 @@ */ #include "test-platform-abstraction.h" -#include "dali-test-suite-utils.h" + #include +#include "dali-test-suite-utils.h" + namespace Dali { - TestPlatformAbstraction::TestPlatformAbstraction() : mTrace(), - mIsLoadingResult( false ), + mIsLoadingResult(false), mClosestSize(), mLoadFileResult(), - mSaveFileResult( false ), + mSaveFileResult(false), mSynchronouslyLoadedResource(), mTimerId(0), mCallbackFunction(nullptr) @@ -39,44 +40,44 @@ TestPlatformAbstraction::~TestPlatformAbstraction() { } -ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ) +ImageDimensions TestPlatformAbstraction::GetClosestImageSize(const std::string& filename, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) { - ImageDimensions closestSize = ImageDimensions( mClosestSize ); + ImageDimensions closestSize = ImageDimensions(mClosestSize); mTrace.PushCall("GetClosestImageSize", ""); return closestSize; } -ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ) +ImageDimensions TestPlatformAbstraction::GetClosestImageSize(Integration::ResourcePointer resourceBuffer, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) { - ImageDimensions closestSize = ImageDimensions( mClosestSize ); + ImageDimensions closestSize = ImageDimensions(mClosestSize); mTrace.PushCall("GetClosestImageSize", ""); return closestSize; } -Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath ) +Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath) { mTrace.PushCall("LoadResourceSynchronously", ""); return mSynchronouslyLoadedResource; } -Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ) +Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer(const Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size) { mTrace.PushCall("DecodeBuffer", ""); return mDecodedBitmap; } -bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const +bool TestPlatformAbstraction::LoadShaderBinaryFile(const std::string& filename, Dali::Vector& buffer) const { mTrace.PushCall("LoadShaderBinaryFile", ""); - if( mLoadFileResult.loadResult ) + if(mLoadFileResult.loadResult) { buffer = mLoadFileResult.buffer; } @@ -89,7 +90,7 @@ void TestPlatformAbstraction::Initialize() { mTrace.Reset(); mTrace.Enable(true); - mIsLoadingResult=false; + mIsLoadingResult = false; mSynchronouslyLoadedResource.Reset(); mDecodedBitmap.Reset(); } @@ -98,9 +99,12 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func) { switch(func) { - case LoadResourceSynchronouslyFunc: return mTrace.FindMethod("LoadResourceSynchronously"); - case LoadShaderBinaryFileFunc: return mTrace.FindMethod("LoadShaderBinaryFile"); - case SaveShaderBinaryFileFunc: return mTrace.FindMethod("SaveShaderBinaryFile"); + case LoadResourceSynchronouslyFunc: + return mTrace.FindMethod("LoadResourceSynchronously"); + case LoadShaderBinaryFileFunc: + return mTrace.FindMethod("LoadShaderBinaryFile"); + case SaveShaderBinaryFileFunc: + return mTrace.FindMethod("SaveShaderBinaryFile"); } return false; } @@ -116,36 +120,36 @@ void TestPlatformAbstraction::ClearReadyResources() mDecodedBitmap.Reset(); } -void TestPlatformAbstraction::SetClosestImageSize( const Vector2& size ) +void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size) { - mClosestSize = ImageDimensions( static_cast( size.x ), static_cast( size.y ) ); + mClosestSize = ImageDimensions(static_cast(size.x), static_cast(size.y)); } -void TestPlatformAbstraction::SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer ) +void TestPlatformAbstraction::SetLoadFileResult(bool result, Dali::Vector& buffer) { mLoadFileResult.loadResult = result; - if( result ) + if(result) { mLoadFileResult.buffer = buffer; } } -void TestPlatformAbstraction::SetSaveFileResult( bool result ) +void TestPlatformAbstraction::SetSaveFileResult(bool result) { mSaveFileResult = result; } -void TestPlatformAbstraction::SetSynchronouslyLoadedResource( Integration::ResourcePointer resource ) +void TestPlatformAbstraction::SetSynchronouslyLoadedResource(Integration::ResourcePointer resource) { mSynchronouslyLoadedResource = resource; } -void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap ) +void TestPlatformAbstraction::SetDecodedBitmap(Integration::BitmapPtr bitmap) { mDecodedBitmap = bitmap; } -uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBase* callback ) +uint32_t TestPlatformAbstraction::StartTimer(uint32_t milliseconds, CallbackBase* callback) { mCallbackFunction = callback; mTimerId++; @@ -154,13 +158,13 @@ uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBas void TestPlatformAbstraction::TriggerTimer() { - if (mCallbackFunction != nullptr) + if(mCallbackFunction != nullptr) { - CallbackBase::Execute( *mCallbackFunction ); + CallbackBase::Execute(*mCallbackFunction); } } -void TestPlatformAbstraction::CancelTimer ( uint32_t timerId ) +void TestPlatformAbstraction::CancelTimer(uint32_t timerId) { mCallbackFunction = nullptr; } diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h index 1adedd4..9be034b 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h @@ -2,7 +2,7 @@ #define DALI_TEST_PLATFORM_ABSTRACTION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include + #include #include #include @@ -32,15 +33,12 @@ namespace Dali { - /** * Concrete implementation of the platform abstraction class. */ class DALI_CORE_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction { - public: - /** * Constructor */ @@ -54,53 +52,55 @@ public: /** * @copydoc PlatformAbstraction::GetClosestImageSize() */ - ImageDimensions GetClosestImageSize( const std::string& filename, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ) override; + ImageDimensions GetClosestImageSize(const std::string& filename, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) override; /** * @copydoc PlatformAbstraction::GetClosestImageSize() */ - ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ) override; + ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) override; /** * @copydoc PlatformAbstraction::LoadResourceSynchronously() */ - Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath ) override; + Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath) override; /** * @copydoc PlatformAbstraction::DecodeBuffer() */ - Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ) override; + Integration::BitmapPtr DecodeBuffer(const Dali::Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size) override; /** * @copydoc PlatformAbstraction::LoadShaderBinaryFile() */ - bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const override; + bool LoadShaderBinaryFile(const std::string& filename, Dali::Vector& buffer) const override; /** * @copydoc PlatformAbstraction::SaveShaderBinaryFile() */ - virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const override { return true; } + virtual bool SaveShaderBinaryFile(const std::string& filename, const unsigned char* buffer, unsigned int numBytes) const override + { + return true; + } /** * @copydoc PlatformAbstraction::StartTimer() */ - uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) override; + uint32_t StartTimer(uint32_t milliseconds, CallbackBase* callback) override; /* * @copydoc PlatformAbstraction::CancelTimer() */ - void CancelTimer ( uint32_t timerId ) override; + void CancelTimer(uint32_t timerId) override; public: // TEST FUNCTIONS - // Enumeration of Platform Abstraction methods typedef enum { @@ -112,9 +112,18 @@ public: // TEST FUNCTIONS /** Call this every test */ void Initialize(); - inline void EnableTrace(bool enable) { mTrace.Enable(enable); } - inline void ResetTrace() { mTrace.Reset(); } - inline TraceCallStack& GetTrace() { return mTrace; } + inline void EnableTrace(bool enable) + { + mTrace.Enable(enable); + } + inline void ResetTrace() + { + mTrace.Reset(); + } + inline TraceCallStack& GetTrace() + { + return mTrace; + } /** * @brief Checks if a platform function was called @@ -138,32 +147,32 @@ public: // TEST FUNCTIONS * @brief Sets the value returned by GetClosestImageSize. * @param[in] size The size that should be returned. */ - void SetClosestImageSize( const Vector2& size ); + void SetClosestImageSize(const Vector2& size); /** * @brief Sets the result return by LoadFile. * @param[in] result The value that LoadFile should return. * @param[in] buffer The buffer of the loaded file. */ - void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer ); + void SetLoadFileResult(bool result, Dali::Vector& buffer); /** * @brief Sets the SaveFile result * @param[in] result The value that SaveFile should return */ - void SetSaveFileResult( bool result ); + void SetSaveFileResult(bool result); /** * @brief Sets the resource loaded by LoadResourceSynchronously * @param[in] resource The loaded resource */ - void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource ); + void SetSynchronouslyLoadedResource(Integration::ResourcePointer resource); /** * @brief Sets the bitmap returned by DecodeBuffer() * @param[in] bitmap The decoded bitmap */ - void SetDecodedBitmap( Integration::BitmapPtr bitmap ); + void SetDecodedBitmap(Integration::BitmapPtr bitmap); /** * @brief Triggers the previously stored callback function @@ -171,38 +180,35 @@ public: // TEST FUNCTIONS void TriggerTimer(); private: - - TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined - TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined + TestPlatformAbstraction(const TestPlatformAbstraction&); ///< Undefined + TestPlatformAbstraction& operator=(const TestPlatformAbstraction&); ///< Undefined private: - struct LoadFileResult { inline LoadFileResult() : loadResult(false) { - } - bool loadResult; - Dali::Vector< unsigned char> buffer; + bool loadResult; + Dali::Vector buffer; }; - mutable TraceCallStack mTrace; - bool mIsLoadingResult; - ImageDimensions mClosestSize; + mutable TraceCallStack mTrace; + bool mIsLoadingResult; + ImageDimensions mClosestSize; - LoadFileResult mLoadFileResult; - bool mSaveFileResult; + LoadFileResult mLoadFileResult; + bool mSaveFileResult; - Integration::ResourcePointer mSynchronouslyLoadedResource; - Integration::BitmapPtr mDecodedBitmap; + Integration::ResourcePointer mSynchronouslyLoadedResource; + Integration::BitmapPtr mDecodedBitmap; - uint32_t mTimerId; - CallbackBase* mCallbackFunction; + uint32_t mTimerId; + CallbackBase* mCallbackFunction; }; -} // Dali +} // namespace Dali #endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */ diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.cpp index 6f845d4..1b90e0c 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ namespace Dali { - TestRenderController::TestRenderController() { Initialize(); @@ -29,12 +28,12 @@ TestRenderController::~TestRenderController() { } -void TestRenderController::RequestUpdate( bool forceUpdate ) +void TestRenderController::RequestUpdate(bool forceUpdate) { mRequestUpdateCalled = true; } -void TestRenderController::RequestProcessEventsOnIdle( bool forceProcess ) +void TestRenderController::RequestProcessEventsOnIdle(bool forceProcess) { mRequestProcessEventsOnIdleCalled = true; } @@ -43,8 +42,10 @@ bool TestRenderController::WasCalled(TestRenderControllerFuncEnum func) { switch(func) { - case RequestUpdateFunc: return mRequestUpdateCalled; - case RequestProcessEventsOnIdleFunc: return mRequestProcessEventsOnIdleCalled; + case RequestUpdateFunc: + return mRequestUpdateCalled; + case RequestProcessEventsOnIdleFunc: + return mRequestProcessEventsOnIdleCalled; } return false; @@ -52,9 +53,8 @@ bool TestRenderController::WasCalled(TestRenderControllerFuncEnum func) void TestRenderController::Initialize() { - mRequestUpdateCalled = false; + mRequestUpdateCalled = false; mRequestProcessEventsOnIdleCalled = false; } - -} // namespace dali +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.h b/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.h index facb50c..f7cafa4 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-render-controller.h @@ -2,7 +2,7 @@ #define TEST_RENDER_CONTROLLER_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,20 +19,19 @@ */ // INTERNAL INCLUDES -#include #include +#include namespace Dali { - class DALI_CORE_API TestRenderController : public Dali::Integration::RenderController { public: TestRenderController(); ~TestRenderController() override; - void RequestUpdate( bool forceUpdate ) override; - void RequestProcessEventsOnIdle( bool forceProcess ) override; + void RequestUpdate(bool forceUpdate) override; + void RequestProcessEventsOnIdle(bool forceProcess) override; typedef enum { @@ -43,12 +42,11 @@ public: bool WasCalled(TestRenderControllerFuncEnum func); void Initialize(); - private: bool mRequestUpdateCalled; bool mRequestProcessEventsOnIdleCalled; }; -} // Dali +} // namespace Dali #endif // TEST_RENDER_CONTROLLER_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-touch-event-utils.h b/automated-tests/src/dali/dali-test-suite-utils/test-touch-event-utils.h index 08bf684..73074e7 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-touch-event-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-touch-event-utils.h @@ -26,8 +26,8 @@ */ struct TouchEventFunctorConsumeSetter { - TouchEventFunctorConsumeSetter( bool& consume ) - : mConsume( consume ) + TouchEventFunctorConsumeSetter(bool& consume) + : mConsume(consume) { } @@ -41,4 +41,3 @@ private: }; #endif // TEST_TOUCH_EVENT_UTILS_H - diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp index f894389..9fde7c4 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,11 @@ */ #include "test-trace-call-stack.h" + #include namespace Dali { - std::string ToString(int x) { std::stringstream out; @@ -45,19 +45,30 @@ std::string ToString(float x) /** * Constructor */ -TraceCallStack::TraceCallStack() : mTraceActive(false) { } +TraceCallStack::TraceCallStack() +: mTraceActive(false) +{ +} /** * Destructor */ -TraceCallStack::~TraceCallStack() { } +TraceCallStack::~TraceCallStack() +{ +} /** * Turn on / off tracing */ -void TraceCallStack::Enable(bool enable) { mTraceActive = enable; } +void TraceCallStack::Enable(bool enable) +{ + mTraceActive = enable; +} -bool TraceCallStack::IsEnabled() { return mTraceActive; } +bool TraceCallStack::IsEnabled() +{ + return mTraceActive; +} /** * Push a call onto the stack if the trace is active @@ -69,7 +80,7 @@ void TraceCallStack::PushCall(std::string method, std::string params) if(mTraceActive) { FunctionCall stackFrame(method, params); - mCallStack.push_back( stackFrame ); + mCallStack.push_back(stackFrame); } } @@ -78,7 +89,7 @@ void TraceCallStack::PushCall(std::string method, std::string params, const Trac if(mTraceActive) { FunctionCall stackFrame(method, params, altParams); - mCallStack.push_back( stackFrame ); + mCallStack.push_back(stackFrame); } } @@ -90,9 +101,9 @@ void TraceCallStack::PushCall(std::string method, std::string params, const Trac bool TraceCallStack::FindMethod(std::string method) const { bool found = false; - for( size_t i=0; i < mCallStack.size(); i++ ) + for(size_t i = 0; i < mCallStack.size(); i++) { - if( 0 == mCallStack[i].method.compare(method) ) + if(0 == mCallStack[i].method.compare(method)) { found = true; break; @@ -101,14 +112,14 @@ bool TraceCallStack::FindMethod(std::string method) const return found; } -bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params ) const +bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params) const { bool found = false; - for( size_t i=0; i < mCallStack.size(); i++ ) + for(size_t i = 0; i < mCallStack.size(); i++) { - if( 0 == mCallStack[i].method.compare(method) ) + if(0 == mCallStack[i].method.compare(method)) { - found = true; + found = true; params = mCallStack[i].paramList; break; } @@ -119,9 +130,9 @@ bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& int TraceCallStack::CountMethod(std::string method) const { int numCalls = 0; - for( size_t i=0; i < mCallStack.size(); i++ ) + for(size_t i = 0; i < mCallStack.size(); i++) { - if( 0 == mCallStack[i].method.compare(method) ) + if(0 == mCallStack[i].method.compare(method)) { numCalls++; } @@ -137,19 +148,19 @@ int TraceCallStack::CountMethod(std::string method) const */ bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const { - return FindIndexFromMethodAndParams( method, params ) > -1; + return FindIndexFromMethodAndParams(method, params) > -1; } bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams& params) const { - return FindIndexFromMethodAndParams( method, params ) > -1; + return FindIndexFromMethodAndParams(method, params) > -1; } -bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const +bool TraceCallStack::FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const { - for( size_t i = startIndex; i < mCallStack.size(); ++i ) + for(size_t i = startIndex; i < mCallStack.size(); ++i) { - if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) ) + if((mCallStack[i].method.compare(method) == 0) && (mCallStack[i].paramList.compare(params) == 0)) { startIndex = i; return true; @@ -167,11 +178,11 @@ bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std: int32_t TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string params) const { int32_t index = -1; - for( size_t i=0; i < mCallStack.size(); i++ ) + for(size_t i = 0; i < mCallStack.size(); i++) { - if( 0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params) ) + if(0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params)) { - index = static_cast( i ); + index = static_cast(i); break; } } @@ -181,24 +192,24 @@ int32_t TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::st int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const TraceCallStack::NamedParams& params) const { int32_t index = -1; - for( size_t i=0; i < mCallStack.size(); i++ ) + for(size_t i = 0; i < mCallStack.size(); i++) { - if( 0 == mCallStack[i].method.compare(method) ) + if(0 == mCallStack[i].method.compare(method)) { // Test each of the passed in parameters: bool match = true; - for( NamedParams::const_iterator iter = params.begin() ; iter != params.end() ; ++iter ) + for(NamedParams::const_iterator iter = params.begin(); iter != params.end(); ++iter) { NamedParams::const_iterator paramIter = mCallStack[i].namedParams.find(iter->first); - if( paramIter == params.end() || paramIter->second.compare(iter->second) != 0 ) + if(paramIter == params.end() || paramIter->second.compare(iter->second) != 0) { match = false; break; } } - if( match == true ) + if(match == true) { - index = static_cast( i ); + index = static_cast(i); break; } } @@ -206,7 +217,6 @@ int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const Trace return index; } - /** * Test if the given method and parameters are at a given index in the stack * @param[in] index Index in the call stack @@ -215,7 +225,7 @@ int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const Trace */ bool TraceCallStack::TestMethodAndParams(int index, std::string method, std::string params) const { - return ( 0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params) ); + return (0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params)); } /** @@ -226,5 +236,4 @@ void TraceCallStack::Reset() mCallStack.clear(); } - } // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.h b/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.h index d569cba..8cb5922 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.h @@ -2,7 +2,7 @@ #define TEST_TRACE_CALL_STACK_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,13 @@ * */ -#include -#include #include #include +#include +#include namespace Dali { - template std::string ToString(const T& x) { @@ -42,9 +41,8 @@ std::string ToString(float x); class TraceCallStack { public: - /// Typedef for passing and storing named parameters - typedef std::map< std::string, std::string > NamedParams; + typedef std::map NamedParams; /** * Constructor @@ -91,7 +89,7 @@ public: * @param[out] params of the method * @return true if the method was in the stack */ - bool FindMethodAndGetParameters(std::string method, std::string& params ) const; + bool FindMethodAndGetParameters(std::string method, std::string& params) const; /** * Count how many times a method was called @@ -127,7 +125,7 @@ public: * calls can search for methods occuring after this one. * @return True if the method was in the stack */ - bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const; + bool FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const; /** * Search for a method in the stack with the given parameter list @@ -165,10 +163,10 @@ public: std::string GetTraceString() { std::stringstream traceStream; - std::size_t functionCount = mCallStack.size(); - for( std::size_t i = 0; i < functionCount; ++i ) + std::size_t functionCount = mCallStack.size(); + for(std::size_t i = 0; i < functionCount; ++i) { - Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ]; + Dali::TraceCallStack::FunctionCall functionCall = mCallStack[i]; traceStream << "StackTrace: Index:" << i << ", Function:" << functionCall.method << ", ParamList:" << functionCall.paramList << std::endl; } @@ -183,19 +181,22 @@ private: std::string method; std::string paramList; NamedParams namedParams; - FunctionCall( const std::string& aMethod, const std::string& aParamList ) - : method( aMethod ), paramList( aParamList ) + FunctionCall(const std::string& aMethod, const std::string& aParamList) + : method(aMethod), + paramList(aParamList) { } - FunctionCall( const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams ) - : method( aMethod ), paramList( aParamList ), namedParams( altParams ) + FunctionCall(const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams) + : method(aMethod), + paramList(aParamList), + namedParams(altParams) { } }; - std::vector< FunctionCall > mCallStack; ///< The call stack + std::vector mCallStack; ///< The call stack }; -} // namespace dali +} // namespace Dali #endif // TEST_TRACE_CALL_STACK_H diff --git a/automated-tests/src/dali/tct-dali-core.cpp b/automated-tests/src/dali/tct-dali-core.cpp index dcc24ea..0e00214 100644 --- a/automated-tests/src/dali/tct-dali-core.cpp +++ b/automated-tests/src/dali/tct-dali-core.cpp @@ -1,21 +1,22 @@ -#include #include #include +#include #include + #include "tct-dali-core.h" -int main(int argc, char * const argv[]) +int main(int argc, char* const argv[]) { int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT; const char* optString = "sf"; - bool optRerunFailed(true); - bool optRunSerially(false); + bool optRerunFailed(true); + bool optRunSerially(false); int nextOpt = 0; do { - nextOpt = getopt( argc, argv, optString ); + nextOpt = getopt(argc, argv, optString); switch(nextOpt) { case 'f': @@ -29,17 +30,17 @@ int main(int argc, char * const argv[]) exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT); break; } - } while( nextOpt != -1 ); + } while(nextOpt != -1); - if( optind == argc ) // no testcase name in argument list + if(optind == argc) // no testcase name in argument list { - if( optRunSerially ) + if(optRunSerially) { - result = TestHarness::RunAll( argv[0], tc_array ); + result = TestHarness::RunAll(argv[0], tc_array); } else { - result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed ); + result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed); } } else diff --git a/automated-tests/src/dali/test-sample-addon.cpp b/automated-tests/src/dali/test-sample-addon.cpp index 8a3931e..cddf0d5 100644 --- a/automated-tests/src/dali/test-sample-addon.cpp +++ b/automated-tests/src/dali/test-sample-addon.cpp @@ -15,33 +15,33 @@ * */ -#include -#include #include +#include + +#include static const std::string DUMMY_ADDON_NAME = "SampleAddOn"; -int StringLen( const char* str ) +int StringLen(const char* str) { - return strlen( str ); + return strlen(str); } -int DoSum( int a, int b ) +int DoSum(int a, int b) { - return a+b; + return a + b; } class TestDummyAddOn : public Dali::AddOns::AddOnBase { public: - - void GetAddOnInfo( Dali::AddOnInfo& info ) override + void GetAddOnInfo(Dali::AddOnInfo& info) override { - info.type = Dali::AddOnType::GENERIC; - info.name = "SampleAddOn"; - info.version = Dali::DALI_ADDON_VERSION( 1, 0, 0 ); - info.next = nullptr; - tet_printf( "SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str()); + info.type = Dali::AddOnType::GENERIC; + info.name = "SampleAddOn"; + info.version = Dali::DALI_ADDON_VERSION(1, 0, 0); + info.next = nullptr; + tet_printf("SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str()); } /** @@ -51,10 +51,10 @@ public: Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override { static Dali::AddOns::DispatchTable dispatchTable{}; - if( dispatchTable.Empty() ) + if(dispatchTable.Empty()) { - dispatchTable["DoSum"] = DoSum; - dispatchTable["StringLen"] = StringLen; + dispatchTable["DoSum"] = DoSum; + dispatchTable["StringLen"] = StringLen; } return &dispatchTable; } @@ -89,4 +89,4 @@ public: } }; -REGISTER_ADDON_CLASS( TestDummyAddOn ); +REGISTER_ADDON_CLASS(TestDummyAddOn); diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 01419e2..f0aef23 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -18,23 +18,24 @@ // Enable debug log for test coverage #define DEBUG_ENABLED 1 -#include "assert.h" -#include -#include -#include // For FLT_MAX +#include #include -#include -#include #include -#include +#include +#include +#include #include +#include // For FLT_MAX +#include + +#include "assert.h" + //& set: DaliActor using std::string; using namespace Dali; - void utc_dali_actor_startup(void) { test_return_value = TET_UNDEF; @@ -47,11 +48,11 @@ void utc_dali_actor_cleanup(void) namespace { -bool gTouchCallBackCalled=false; -bool gTouchCallBackCalled2=false; -bool gTouchCallBackCalled3=false; +bool gTouchCallBackCalled = false; +bool gTouchCallBackCalled2 = false; +bool gTouchCallBackCalled3 = false; -bool gHoverCallBackCalled=false; +bool gHoverCallBackCalled = false; static bool gTestConstraintCalled; @@ -59,7 +60,7 @@ LayoutDirection::Type gLayoutDirectionType; struct TestConstraint { - void operator()( Vector4& color, const PropertyInputContainer& /* inputs */ ) + void operator()(Vector4& color, const PropertyInputContainer& /* inputs */) { gTestConstraintCalled = true; } @@ -79,16 +80,15 @@ struct TestConstraintRef { } - void operator()( T& current, const PropertyInputContainer& /* inputs */ ) + void operator()(T& current, const PropertyInputContainer& /* inputs */) { mResultRef = mValue; } unsigned int& mResultRef; - unsigned int mValue; + unsigned int mValue; }; - static bool TestTouchCallback(Actor, const TouchEvent&) { gTouchCallBackCalled = true; @@ -112,7 +112,7 @@ static bool TestTouchCallback3(Actor, const TouchEvent&) static void ResetTouchCallbacks() { - gTouchCallBackCalled = false; + gTouchCallBackCalled = false; gTouchCallBackCalled2 = false; gTouchCallBackCalled3 = false; } @@ -125,65 +125,69 @@ static bool TestCallback3(Actor actor, const HoverEvent& event) } // validation stuff for onstage & offstage signals -static std::vector< std::string > gActorNamesOnOffScene; -static int gOnSceneCallBackCalled; -void OnSceneCallback( Actor actor ) +static std::vector gActorNamesOnOffScene; +static int gOnSceneCallBackCalled; +void OnSceneCallback(Actor actor) { ++gOnSceneCallBackCalled; - gActorNamesOnOffScene.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true ); + gActorNamesOnOffScene.push_back(actor.GetProperty(Actor::Property::NAME)); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE) == true); } static int gOffSceneCallBackCalled; -void OffSceneCallback( Actor actor ) +void OffSceneCallback(Actor actor) { ++gOffSceneCallBackCalled; - gActorNamesOnOffScene.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == false ); + gActorNamesOnOffScene.push_back(actor.GetProperty(Actor::Property::NAME)); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE) == false); } struct PositionComponentConstraint { - PositionComponentConstraint(){} + PositionComponentConstraint() + { + } - void operator()( Vector3& pos, const PropertyInputContainer& inputs ) + void operator()(Vector3& pos, const PropertyInputContainer& inputs) { const Matrix& m = inputs[0]->GetMatrix(); - Vector3 scale; - Quaternion rot; + Vector3 scale; + Quaternion rot; m.GetTransformComponents(pos, rot, scale); } }; struct OrientationComponentConstraint { - OrientationComponentConstraint(){} + OrientationComponentConstraint() + { + } - void operator()( Quaternion& orientation, const PropertyInputContainer& inputs ) + void operator()(Quaternion& orientation, const PropertyInputContainer& inputs) { const Quaternion& parentOrientation = inputs[0]->GetQuaternion(); - Vector3 pos, scale; - Quaternion rot; + Vector3 pos, scale; + Quaternion rot; orientation = parentOrientation; } }; // OnRelayout -static bool gOnRelayoutCallBackCalled = false; -static std::vector< std::string > gActorNamesRelayout; +static bool gOnRelayoutCallBackCalled = false; +static std::vector gActorNamesRelayout; -void OnRelayoutCallback( Actor actor ) +void OnRelayoutCallback(Actor actor) { gOnRelayoutCallBackCalled = true; - gActorNamesRelayout.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) ); + gActorNamesRelayout.push_back(actor.GetProperty(Actor::Property::NAME)); } struct VisibilityChangedFunctorData { VisibilityChangedFunctorData() : actor(), - visible( false ), - type( DevelActor::VisibilityChange::SELF ), - called( false ) + visible(false), + type(DevelActor::VisibilityChange::SELF), + called(false) { } @@ -191,54 +195,57 @@ struct VisibilityChangedFunctorData { actor.Reset(); visible = false; - type = DevelActor::VisibilityChange::SELF; - called = false; + type = DevelActor::VisibilityChange::SELF; + called = false; } - void Check( bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char * location ) + void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location) { - DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) ); - DALI_TEST_EQUALS( actor, compareActor, TEST_INNER_LOCATION( location ) ); - DALI_TEST_EQUALS( visible, compareVisible, TEST_INNER_LOCATION( location ) ); - DALI_TEST_EQUALS( (int)type, (int)compareType, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location)); + DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location)); + DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location)); + DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location)); } - void Check( bool compareCalled, const std::string& location ) + void Check(bool compareCalled, const std::string& location) { - DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location)); } - Actor actor; - bool visible; + Actor actor; + bool visible; DevelActor::VisibilityChange::Type type; - bool called; + bool called; }; struct VisibilityChangedFunctor { - VisibilityChangedFunctor( VisibilityChangedFunctorData& dataVar ) : data( dataVar ) { } + VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar) + : data(dataVar) + { + } - void operator()( Actor actor, bool visible, DevelActor::VisibilityChange::Type type ) + void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type) { - data.actor = actor; + data.actor = actor; data.visible = visible; - data.type = type; - data.called = true; + data.type = type; + data.called = true; } VisibilityChangedFunctorData& data; }; - struct VisibilityChangedVoidFunctor { VisibilityChangedVoidFunctor(bool& signalCalled) - : mSignalCalled( signalCalled ) - { } + : mSignalCalled(signalCalled) + { + } void operator()() { - mSignalCalled = true; + mSignalCalled = true; } bool& mSignalCalled; @@ -247,40 +254,41 @@ struct VisibilityChangedVoidFunctor struct ChildOrderChangedFunctor { ChildOrderChangedFunctor(bool& signalCalled, Actor& actor) - : mSignalCalled( signalCalled ), - mActor( actor ) - { } + : mSignalCalled(signalCalled), + mActor(actor) + { + } - void operator()( Actor actor ) + void operator()(Actor actor) { - mSignalCalled = true; - mActor = actor; + mSignalCalled = true; + mActor = actor; } - bool& mSignalCalled; + bool& mSignalCalled; Actor& mActor; }; struct CulledPropertyNotificationFunctor { - CulledPropertyNotificationFunctor( bool& signalCalled, PropertyNotification& propertyNotification ) - : mSignalCalled( signalCalled ), - mPropertyNotification( propertyNotification ) - { } + CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification) + : mSignalCalled(signalCalled), + mPropertyNotification(propertyNotification) + { + } - void operator()( PropertyNotification& source ) + void operator()(PropertyNotification& source) { - mSignalCalled = true; + mSignalCalled = true; mPropertyNotification = source; } - bool& mSignalCalled; + bool& mSignalCalled; PropertyNotification& mPropertyNotification; }; } // anonymous namespace - //& purpose: Testing New API int UtcDaliActorNew(void) { @@ -298,9 +306,9 @@ int UtcDaliActorDownCastP(void) TestApplication application; tet_infoline("Testing Dali::Actor::DownCast()"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); BaseHandle object(actor); - Actor actor2 = Actor::DownCast(object); + Actor actor2 = Actor::DownCast(object); DALI_TEST_CHECK(actor2); END_TEST; } @@ -312,7 +320,7 @@ int UtcDaliActorDownCastN(void) tet_infoline("Testing Dali::Actor::DownCast()"); BaseHandle unInitializedObject; - Actor actor = Actor::DownCast(unInitializedObject); + Actor actor = Actor::DownCast(unInitializedObject); DALI_TEST_CHECK(!actor); END_TEST; } @@ -322,14 +330,14 @@ int UtcDaliActorMoveConstructor(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - int id = actor.GetProperty< int >( Actor::Property::ID ); + int id = actor.GetProperty(Actor::Property::ID); - Actor moved = std::move( actor); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION ); - DALI_TEST_CHECK( !actor ); + Actor moved = std::move(actor); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_CHECK(!actor); END_TEST; } @@ -339,15 +347,15 @@ int UtcDaliActorMoveAssignment(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - int id = actor.GetProperty< int >( Actor::Property::ID ); + int id = actor.GetProperty(Actor::Property::ID); Actor moved; - moved = std::move( actor); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION ); - DALI_TEST_CHECK( !actor ); + moved = std::move(actor); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_CHECK(!actor); END_TEST; } @@ -359,7 +367,7 @@ int UtcDaliActorGetName(void) Actor actor = Actor::New(); - DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ).empty()); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::NAME).empty()); END_TEST; } @@ -369,10 +377,10 @@ int UtcDaliActorSetName(void) TestApplication application; string str("ActorName"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::NAME,str); - DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ) == str); + actor.SetProperty(Actor::Property::NAME, str); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::NAME) == str); END_TEST; } @@ -381,12 +389,12 @@ int UtcDaliActorGetId(void) tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )"); TestApplication application; - Actor first = Actor::New(); + Actor first = Actor::New(); Actor second = Actor::New(); - Actor third = Actor::New(); + Actor third = Actor::New(); - DALI_TEST_CHECK(first.GetProperty< int >( Actor::Property::ID ) != second.GetProperty< int >( Actor::Property::ID )); - DALI_TEST_CHECK(second.GetProperty< int >( Actor::Property::ID ) != third.GetProperty< int >( Actor::Property::ID )); + DALI_TEST_CHECK(first.GetProperty(Actor::Property::ID) != second.GetProperty(Actor::Property::ID)); + DALI_TEST_CHECK(second.GetProperty(Actor::Property::ID) != third.GetProperty(Actor::Property::ID)); END_TEST; } @@ -395,11 +403,11 @@ int UtcDaliActorIsRoot(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK(!actor.GetProperty< bool >( Actor::Property::IS_ROOT )); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::IS_ROOT)); // get the root layer - actor = application.GetScene().GetLayer( 0 ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::IS_ROOT ) ); + actor = application.GetScene().GetLayer(0); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::IS_ROOT)); END_TEST; } @@ -408,11 +416,11 @@ int UtcDaliActorOnScene(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); // get the root layer - actor = application.GetScene().GetLayer( 0 ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + actor = application.GetScene().GetLayer(0); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); END_TEST; } @@ -421,11 +429,11 @@ int UtcDaliActorIsLayer(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::IS_LAYER ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::IS_LAYER)); // get the root layer - actor = application.GetScene().GetLayer( 0 ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::IS_LAYER ) ); + actor = application.GetScene().GetLayer(0); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::IS_LAYER)); END_TEST; } @@ -440,8 +448,8 @@ int UtcDaliActorGetLayer(void) DALI_TEST_CHECK(layer); // get the root layers layer - actor = application.GetScene().GetLayer( 0 ); - DALI_TEST_CHECK( actor.GetLayer() ); + actor = application.GetScene().GetLayer(0); + DALI_TEST_CHECK(actor.GetLayer()); END_TEST; } @@ -451,33 +459,33 @@ int UtcDaliActorAddP(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); + Actor child = Actor::New(); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); parent.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); Actor parent2 = Actor::New(); - parent2.Add( child ); + parent2.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); // try Adding to same parent again, works - parent2.Add( child ); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + parent2.Add(child); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); // try reparenting an orphaned child { Actor temporaryParent = Actor::New(); - temporaryParent.Add( child ); - DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION ); + temporaryParent.Add(child); + DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION); } // temporaryParent has now died, reparent the orphaned child - parent2.Add( child ); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + parent2.Add(child); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); END_TEST; } @@ -490,43 +498,43 @@ int UtcDaliActorAddN(void) Actor child = Actor::New(); Actor parent2 = Actor::New(); - parent2.Add( child ); + parent2.Add(child); // try illegal Add try { - parent2.Add( parent2 ); - tet_printf("Assertion test failed - no Exception\n" ); + parent2.Add(parent2); + tet_printf("Assertion test failed - no Exception\n"); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } // try reparenting root try { - parent2.Add( application.GetScene().GetLayer( 0 ) ); - tet_printf("Assertion test failed - no Exception\n" ); + parent2.Add(application.GetScene().GetLayer(0)); + tet_printf("Assertion test failed - no Exception\n"); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -534,19 +542,19 @@ int UtcDaliActorAddN(void) try { Actor empty; - parent2.Add( empty ); - tet_printf("Assertion test failed - no Exception\n" ); + parent2.Add(empty); + tet_printf("Assertion test failed - no Exception\n"); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "actor", TEST_LOCATION); - DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -559,43 +567,43 @@ int UtcDaliActorRemoveN(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); + Actor child = Actor::New(); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); parent.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); parent.Remove(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); // remove again, no problem parent.Remove(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); // add child back parent.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); // try Remove self, its a no-op - parent.Remove( parent ); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); + parent.Remove(parent); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); // try Remove empty try { Actor empty; - parent.Remove( empty ); - tet_printf("Assertion test failed - no Exception\n" ); + parent.Remove(empty); + tet_printf("Assertion test failed - no Exception\n"); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "actor", TEST_LOCATION); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } END_TEST; @@ -606,10 +614,10 @@ int UtcDaliActorRemoveP(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); + Actor child = Actor::New(); Actor random = Actor::New(); - application.GetScene().Add( parent ); + application.GetScene().Add(parent); DALI_TEST_CHECK(parent.GetChildCount() == 0); @@ -621,7 +629,7 @@ int UtcDaliActorRemoveP(void) DALI_TEST_CHECK(parent.GetChildCount() == 1); - application.GetScene().Remove( parent ); + application.GetScene().Remove(parent); DALI_TEST_CHECK(parent.GetChildCount() == 1); END_TEST; @@ -632,7 +640,7 @@ int UtcDaliActorGetChildCount(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); + Actor child = Actor::New(); DALI_TEST_CHECK(parent.GetChildCount() == 0); @@ -687,7 +695,7 @@ int UtcDaliActorGetParent01(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); + Actor child = Actor::New(); parent.Add(child); @@ -710,21 +718,21 @@ int UtcDaliActorCustomProperty(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - float startValue(1.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + float startValue(1.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); - actor.SetProperty( index, 5.0f ); + actor.SetProperty(index, 5.0f); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == 5.0f ); + DALI_TEST_CHECK(actor.GetProperty(index) == 5.0f); END_TEST; } @@ -733,21 +741,21 @@ int UtcDaliActorCustomPropertyIntToFloat(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - float startValue(5.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + float startValue(5.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); - actor.SetProperty( index, int(1) ); + actor.SetProperty(index, int(1)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == 1.0f ); + DALI_TEST_CHECK(actor.GetProperty(index) == 1.0f); END_TEST; } @@ -756,21 +764,21 @@ int UtcDaliActorCustomPropertyFloatToInt(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - int startValue(5); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + int startValue(5); + Property::Index index = actor.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); - actor.SetProperty( index, float(1.5) ); + actor.SetProperty(index, float(1.5)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == 1 ); + DALI_TEST_CHECK(actor.GetProperty(index) == 1); END_TEST; } @@ -781,27 +789,27 @@ int UtcDaliActorSetParentOrigin(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN)); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN)); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.1f, 0.2f, 0.3f ) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -812,31 +820,31 @@ int UtcDaliActorSetParentOriginIndividual(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN)); - actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION); END_TEST; } @@ -848,15 +856,15 @@ int UtcDaliActorGetCurrentParentOrigin(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN)); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN)); END_TEST; } @@ -867,26 +875,26 @@ int UtcDaliActorSetAnchorPoint(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT)); - actor.SetProperty( Actor::Property::ANCHOR_POINT, vector ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT)); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.SetProperty( Actor::Property::ANCHOR_POINT, Vector3( 0.1f, 0.2f, 0.3f ) ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -897,31 +905,31 @@ int UtcDaliActorSetAnchorPointIndividual(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT)); - actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x ); + actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y ); + actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z ); + actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION); END_TEST; } @@ -933,15 +941,15 @@ int UtcDaliActorGetCurrentAnchorPoint(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT)); - actor.SetProperty( Actor::Property::ANCHOR_POINT, vector); + actor.SetProperty(Actor::Property::ANCHOR_POINT, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT)); END_TEST; } @@ -949,63 +957,63 @@ int UtcDaliActorSetSize01(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 0.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE, Vector2( vector.x, vector.y ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y)); // Immediately retrieve the size after setting - Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(vector.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(vector.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(vector.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); // Flush the queue and render once application.SendNotification(); application.Render(); // Check the size in the new frame - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(vector.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(vector.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(vector.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); // Check async behaviour - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); // Change the resize policy and check whether the size stays the same - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); // Set a new size after resize policy is changed and check the new size - actor.SetProperty( Actor::Property::SIZE, Vector3( 0.1f, 0.2f, 0.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f)); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION); // Change the resize policy again and check whether the new size stays the same - actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION); // Set another new size after resize policy is changed and check the new size - actor.SetProperty( Actor::Property::SIZE, Vector3( 50.0f, 60.0f, 0.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f)); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, Vector3( 50.0f, 60.0f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -1014,26 +1022,26 @@ int UtcDaliActorSetSize02(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE, Vector3( vector.x, vector.y, vector.z ) ); + actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z)); // Immediately check the size after setting - Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the size in the new frame - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -1043,26 +1051,26 @@ int UtcDaliActorSetSize03(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 0.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE,Vector2(vector.x, vector.y)); + actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y)); // Immediately check the size after setting - Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the size in the new frame - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -1072,42 +1080,42 @@ int UtcDaliActorSetSize04(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE,vector); + actor.SetProperty(Actor::Property::SIZE, vector); // Immediately check the size after setting - Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the size in the new frame - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); - application.GetScene().Add( actor ); - actor.SetProperty( Actor::Property::SIZE, Vector3( 0.1f, 0.2f, 0.3f ) ); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f)); // Immediately check the size after setting - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the size in the new frame - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty(Actor::Property::SIZE), TEST_LOCATION); - currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1118,79 +1126,79 @@ int UtcDaliActorSetSizeIndividual(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width ); + actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width); // Immediately check the width after setting - float sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(); - DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get(); + DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the width in the new frame - DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty(Actor::Property::SIZE).width, TEST_LOCATION); - sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(); - DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get(); + DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION); - actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height ); + actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height); // Immediately check the height after setting - float sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(); - DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get(); + DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the height in the new frame - DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty(Actor::Property::SIZE).height, TEST_LOCATION); - sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(); - DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get(); + DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION); - actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth ); + actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth); // Immediately check the depth after setting - float sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(); - DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get(); + DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the depth in the new frame - DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty(Actor::Property::SIZE).depth, TEST_LOCATION); - sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(); - DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get(); + DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION); // Change the resize policy and check whether the size stays the same - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); - sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(); - DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get(); + DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION); - sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(); - DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get(); + DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION); - sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(); - DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get(); + DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION); // Change the resize policy again and check whether the size stays the same - actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS); - sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(); - DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get(); + DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION); - sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(); - DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get(); + DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION); - sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(); - DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get(); + DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -1200,49 +1208,48 @@ int UtcDaliActorSetSizeIndividual02(void) TestApplication application; Actor actor = Actor::New(); - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( actor ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(actor); - Vector3 vector( 100.0f, 200.0f, 400.0f ); - DALI_TEST_CHECK( vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) ); + Vector3 vector(100.0f, 200.0f, 400.0f); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION); - actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION); - actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); // Check the width in the new frame - DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION ); + DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty(Actor::Property::SIZE).width, TEST_LOCATION); + DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty(Actor::Property::SIZE).height, TEST_LOCATION); END_TEST; } - int UtcDaliActorGetCurrentSize(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 20.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE,vector); + actor.SetProperty(Actor::Property::SIZE, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); END_TEST; } @@ -1250,10 +1257,10 @@ int UtcDaliActorGetNaturalSize(void) { TestApplication application; - Actor actor = Actor::New(); - Vector3 vector( 0.0f, 0.0f, 0.0f ); + Actor actor = Actor::New(); + Vector3 vector(0.0f, 0.0f, 0.0f); - DALI_TEST_CHECK( actor.GetNaturalSize() == vector ); + DALI_TEST_CHECK(actor.GetNaturalSize() == vector); END_TEST; } @@ -1262,40 +1269,40 @@ int UtcDaliActorGetCurrentSizeImmediate(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 20.0f); DALI_TEST_CHECK(vector != actor.GetTargetSize()); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); - actor.SetProperty( Actor::Property::SIZE,vector); + actor.SetProperty(Actor::Property::SIZE, vector); DALI_TEST_CHECK(vector == actor.GetTargetSize()); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SIZE)); // flush the queue and render once application.SendNotification(); application.Render(); DALI_TEST_CHECK(vector == actor.GetTargetSize()); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SIZE)); // Animation // Build the animation - const float durationSeconds = 2.0f; - Animation animation = Animation::New( durationSeconds ); - const Vector3 targetValue( 10.0f, 20.0f, 30.0f ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue ); + const float durationSeconds = 2.0f; + Animation animation = Animation::New(durationSeconds); + const Vector3 targetValue(10.0f, 20.0f, 30.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue); - DALI_TEST_CHECK( actor.GetTargetSize() == vector ); + DALI_TEST_CHECK(actor.GetTargetSize() == vector); // Start the animation animation.Play(); application.SendNotification(); - application.Render( static_cast( durationSeconds * 1000.0f ) ); + application.Render(static_cast(durationSeconds * 1000.0f)); - DALI_TEST_CHECK( actor.GetTargetSize() == targetValue ); + DALI_TEST_CHECK(actor.GetTargetSize() == targetValue); END_TEST; } @@ -1306,20 +1313,20 @@ int UtcDaliActorCalculateScreenExtents(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f)); - actor.SetProperty( Actor::Property::SIZE,Vector3{ 1.0f, 1.0f, 1.0f }); + actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f)); + actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f}); application.SendNotification(); application.Render(); - auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f }; - auto actualExtent = DevelActor::CalculateScreenExtents( actor ); - DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); - DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); - DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); - DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + auto expectedExtent = Rect<>{-0.5f, -0.5f, 1.0f, 1.0f}; + auto actualExtent = DevelActor::CalculateScreenExtents(actor); + DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1331,40 +1338,40 @@ int UtcDaliActorSetPosition01(void) Actor actor = Actor::New(); // Set to random to start off with - actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f)); Vector3 vector(100.0f, 100.0f, 0.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION, Vector2(vector.x, vector.y)); + actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); - application.GetScene().Add( actor ); - actor.SetProperty( Actor::Property::POSITION, Vector3( 0.1f, 0.2f, 0.3f ) ); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION_X, 1.0f ); - actor.SetProperty( Actor::Property::POSITION_Y, 1.1f ); - actor.SetProperty( Actor::Property::POSITION_Z, 1.2f ); + actor.SetProperty(Actor::Property::POSITION_X, 1.0f); + actor.SetProperty(Actor::Property::POSITION_Y, 1.1f); + actor.SetProperty(Actor::Property::POSITION_Z, 1.2f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); - actor.TranslateBy( Vector3( 0.1f, 0.1f, 0.1f ) ); + actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Math::MACHINE_EPSILON_10000, TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1376,19 +1383,19 @@ int UtcDaliActorSetPosition02(void) Actor actor = Actor::New(); // Set to random to start off with - actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f)); Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z)); + actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1400,19 +1407,19 @@ int UtcDaliActorSetPosition03(void) Actor actor = Actor::New(); // Set to random to start off with - actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f)); Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION, vector); + actor.SetProperty(Actor::Property::POSITION, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1424,15 +1431,15 @@ int UtcDaliActorSetX(void) Vector3 vector(100.0f, 0.0f, 0.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION_X, 100.0f); + actor.SetProperty(Actor::Property::POSITION_X, 100.0f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1444,15 +1451,15 @@ int UtcDaliActorSetY(void) Vector3 vector(0.0f, 100.0f, 0.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION_Y, 100.0f); + actor.SetProperty(Actor::Property::POSITION_Y, 100.0f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1464,15 +1471,15 @@ int UtcDaliActorSetZ(void) Vector3 vector(0.0f, 0.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION_Z, 100.0f); + actor.SetProperty(Actor::Property::POSITION_Z, 100.0f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1483,49 +1490,49 @@ int UtcDaliActorSetPositionProperties(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION_X, vector.x ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::POSITION_X, vector.x); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::POSITION).x, TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::POSITION_X), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::POSITION).x, TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::POSITION).x, TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::POSITION_X), TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::POSITION).x, TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::POSITION_X), TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION_Y, vector.y ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::POSITION_Y, vector.y); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::POSITION).y, TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::POSITION_Y), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::POSITION).y, TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::POSITION).y, TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::POSITION_Y), TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::POSITION).y, TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::POSITION_Y), TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION_Z, vector.z ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::POSITION_Z, vector.z); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::POSITION).z, TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::POSITION_Z), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::POSITION).z, TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::POSITION).z, TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::POSITION_Z), TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::POSITION).z, TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::POSITION_Z), TEST_LOCATION); END_TEST; } @@ -1534,18 +1541,18 @@ int UtcDaliActorTranslateBy(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::POSITION)); - actor.SetProperty( Actor::Property::POSITION, vector); + actor.SetProperty(Actor::Property::POSITION, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::POSITION)); actor.TranslateBy(vector); @@ -1553,7 +1560,7 @@ int UtcDaliActorTranslateBy(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); + DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty(Actor::Property::POSITION)); END_TEST; } @@ -1561,15 +1568,15 @@ int UtcDaliActorGetCurrentPosition(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 setVector(100.0f, 100.0f, 0.0f); - actor.SetProperty( Actor::Property::POSITION, setVector); + actor.SetProperty(Actor::Property::POSITION, setVector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) == setVector); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::POSITION) == setVector); END_TEST; } @@ -1577,33 +1584,33 @@ int UtcDaliActorGetCurrentWorldPosition(void) { TestApplication application; - Actor parent = Actor::New(); - Vector3 parentPosition( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::POSITION, parentPosition ); - parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Vector3 parentPosition(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::POSITION, parentPosition); + parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - Vector3 childPosition( 6.0f, 6.0f, 6.0f ); - child.SetProperty( Actor::Property::POSITION, childPosition ); - parent.Add( child ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + Vector3 childPosition(6.0f, 6.0f, 6.0f); + child.SetProperty(Actor::Property::POSITION, childPosition); + parent.Add(child); // The actors should not have a world position yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::POSITION), childPosition, TEST_LOCATION); // The actors should have a world position now - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION); END_TEST; } @@ -1612,56 +1619,56 @@ int UtcDaliActorSetInheritPosition(void) tet_infoline("Testing Actor::SetInheritPosition"); TestApplication application; - Actor parent = Actor::New(); - Vector3 parentPosition( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::POSITION, parentPosition ); - parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Vector3 parentPosition(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::POSITION, parentPosition); + parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - Vector3 childPosition( 10.0f, 11.0f, 12.0f ); - child.SetProperty( Actor::Property::POSITION, childPosition ); - parent.Add( child ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + Vector3 childPosition(10.0f, 11.0f, 12.0f); + child.SetProperty(Actor::Property::POSITION, childPosition); + parent.Add(child); // The actors should not have a world position yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION); // first test default, which is to inherit position - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION); application.SendNotification(); application.Render(0); // should only really call Update as Render is not required to update scene - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::POSITION), childPosition, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION); //Change child position - Vector3 childOffset( -1.0f, 1.0f, 0.0f ); - child.SetProperty( Actor::Property::POSITION, childOffset ); + Vector3 childOffset(-1.0f, 1.0f, 0.0f); + child.SetProperty(Actor::Property::POSITION, childOffset); // Use local position as world postion - child.SetProperty( Actor::Property::INHERIT_POSITION, false ); - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), false, TEST_LOCATION ); + child.SetProperty(Actor::Property::INHERIT_POSITION, false); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION); application.SendNotification(); application.Render(0); // should only really call Update as Render is not required to update scene - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), childOffset, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::POSITION), childOffset, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION); //Change back to inherit position from parent - child.SetProperty( Actor::Property::INHERIT_POSITION, true ); - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION ); + child.SetProperty(Actor::Property::INHERIT_POSITION, true); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION); application.SendNotification(); application.Render(0); // should only really call Update as Render is not required to update scene - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childOffset, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::POSITION), childOffset, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION); END_TEST; } @@ -1671,31 +1678,31 @@ int UtcDaliActorInheritOpacity(void) TestApplication application; Actor parent = Actor::New(); - Actor child = Actor::New(); - parent.Add( child ); - application.GetScene().Add( parent ); + Actor child = Actor::New(); + parent.Add(child); + application.GetScene().Add(parent); - DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get(), 1.0f, 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get(), 1.0f, 0.0001f, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - parent.SetProperty( Actor::Property::OPACITY, 0.1f ); + parent.SetProperty(Actor::Property::OPACITY, 0.1f); - DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 0.1f, 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.0f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get(), 0.1f, 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get(), 1.0f, 0.0001f, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get(), 0.1f, 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get(), 1.f, 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get(), 0.1f, 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get(), 1.f, 0.0001f, TEST_LOCATION); END_TEST; } @@ -1705,16 +1712,16 @@ int UtcDaliActorSetOrientation01(void) { TestApplication application; - Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - Actor actor = Actor::New(); + Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, rotation); + actor.SetProperty(Actor::Property::ORIENTATION, rotation); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); END_TEST; } @@ -1724,34 +1731,34 @@ int UtcDaliActorSetOrientation02(void) Actor actor = Actor::New(); - Radian angle( 0.785f ); + Radian angle(0.785f); Vector3 axis(1.0f, 1.0f, 0.0f); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( angle, axis ) ); - Quaternion rotation( angle, axis ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis)); + Quaternion rotation(angle, axis); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - application.GetScene().Add( actor ); - actor.RotateBy( Degree( 360 ), axis); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + application.GetScene().Add(actor); + actor.RotateBy(Degree(360), axis); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) ) ); - Quaternion result( Radian( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f))); + Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(result, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( angle, axis ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1760,19 +1767,19 @@ int UtcDaliActorSetOrientationProperty(void) { TestApplication application; - Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - Actor actor = Actor::New(); + Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, rotation ); - DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + actor.SetProperty(Actor::Property::ORIENTATION, rotation); + DALI_TEST_EQUALS(rotation, actor.GetProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); - DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); END_TEST; } @@ -1783,22 +1790,22 @@ int UtcDaliActorRotateBy01(void) Actor actor = Actor::New(); - Radian angle( M_PI * 0.25f ); - actor.RotateBy(( angle ), Vector3::ZAXIS); + Radian angle(M_PI * 0.25f); + actor.RotateBy((angle), Vector3::ZAXIS); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(Quaternion( angle, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.RotateBy( angle, Vector3::ZAXIS); + actor.RotateBy(angle, Vector3::ZAXIS); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1809,33 +1816,33 @@ int UtcDaliActorRotateBy02(void) Actor actor = Actor::New(); - Radian angle( M_PI * 0.25f ); + Radian angle(M_PI * 0.25f); Quaternion rotation(angle, Vector3::ZAXIS); actor.RotateBy(rotation); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); actor.RotateBy(rotation); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); END_TEST; } int UtcDaliActorGetCurrentOrientation(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - actor.SetProperty( Actor::Property::ORIENTATION, rotation ); + actor.SetProperty(Actor::Property::ORIENTATION, rotation); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); END_TEST; } @@ -1844,39 +1851,39 @@ int UtcDaliActorGetCurrentWorldOrientation(void) tet_infoline("Testing Actor::GetCurrentWorldRotation"); TestApplication application; - Actor parent = Actor::New(); - Radian rotationAngle( Degree(90.0f) ); - Quaternion rotation( rotationAngle, Vector3::YAXIS ); - parent.SetProperty( Actor::Property::ORIENTATION, rotation ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Radian rotationAngle(Degree(90.0f)); + Quaternion rotation(rotationAngle, Vector3::YAXIS); + parent.SetProperty(Actor::Property::ORIENTATION, rotation); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::ORIENTATION, rotation ); - parent.Add( child ); + child.SetProperty(Actor::Property::ORIENTATION, rotation); + parent.Add(child); // The actors should not have a world rotation yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION); // The actors should have a world rotation now - DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION); // turn off child rotation inheritance - child.SetProperty( Actor::Property::INHERIT_ORIENTATION, false ); - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION ); + child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION); application.SendNotification(); application.Render(0); // The actors should have a world rotation now - DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION); END_TEST; } @@ -1888,18 +1895,18 @@ int UtcDaliActorSetScale01(void) Actor actor = Actor::New(); // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale() - actor.SetProperty( Actor::Property::SCALE,0.25f); + actor.SetProperty(Actor::Property::SCALE, 0.25f); Vector3 scale(10.0f, 10.0f, 10.0f); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) != scale); - actor.SetProperty( Actor::Property::SCALE,scale.x); + actor.SetProperty(Actor::Property::SCALE, scale.x); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) == scale); END_TEST; } @@ -1907,30 +1914,30 @@ int UtcDaliActorSetScale01(void) int UtcDaliActorSetScale02(void) { TestApplication application; - Vector3 scale(10.0f, 10.0f, 10.0f); + Vector3 scale(10.0f, 10.0f, 10.0f); Actor actor = Actor::New(); // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale() - actor.SetProperty( Actor::Property::SCALE, Vector3( 12.0f, 1.0f, 2.0f ) ); + actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f)); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) != scale); - actor.SetProperty( Actor::Property::SCALE, Vector3( scale.x, scale.y, scale.z ) ); + actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) == scale); // add to stage and test - application.GetScene().Add( actor ); - actor.SetProperty( Actor::Property::SCALE, Vector3( 2.0f, 2.0f, 2.0f ) ); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty(Actor::Property::SCALE), 0.001, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -1939,22 +1946,22 @@ int UtcDaliActorSetScale02(void) int UtcDaliActorSetScale03(void) { TestApplication application; - Vector3 scale(10.0f, 10.0f, 10.0f); + Vector3 scale(10.0f, 10.0f, 10.0f); Actor actor = Actor::New(); // Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale() - actor.SetProperty( Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f)); + actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f)); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) != scale); - actor.SetProperty( Actor::Property::SCALE,scale); + actor.SetProperty(Actor::Property::SCALE, scale); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) == scale); END_TEST; } @@ -1965,43 +1972,43 @@ int UtcDaliActorSetScaleIndividual(void) Actor actor = Actor::New(); Vector3 vector(0.7f, 0.8f, 0.9f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SCALE)); - actor.SetProperty( Actor::Property::SCALE_X, vector.x ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::SCALE_X, vector.x); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::SCALE_X), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::SCALE).x, TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetProperty(Actor::Property::SCALE_X), TEST_LOCATION); + DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty(Actor::Property::SCALE_X), TEST_LOCATION); - actor.SetProperty( Actor::Property::SCALE_Y, vector.y ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::SCALE_Y, vector.y); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::SCALE_Y), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::SCALE).y, TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetProperty(Actor::Property::SCALE_Y), TEST_LOCATION); + DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty(Actor::Property::SCALE_Y), TEST_LOCATION); - actor.SetProperty( Actor::Property::SCALE_Z, vector.z ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::SCALE_Z, vector.z); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::SCALE_Z), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::SCALE).z, TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetProperty(Actor::Property::SCALE_Z), TEST_LOCATION); + DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty(Actor::Property::SCALE_Z), TEST_LOCATION); - DALI_TEST_EQUALS( vector, actor.GetProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector, actor.GetProperty(Actor::Property::SCALE), TEST_LOCATION); + DALI_TEST_EQUALS(vector, actor.GetCurrentProperty(Actor::Property::SCALE), TEST_LOCATION); END_TEST; } @@ -2009,18 +2016,18 @@ int UtcDaliActorSetScaleIndividual(void) int UtcDaliActorScaleBy(void) { TestApplication application; - Actor actor = Actor::New(); - Vector3 vector(100.0f, 100.0f, 100.0f); + Actor actor = Actor::New(); + Vector3 vector(100.0f, 100.0f, 100.0f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::SCALE)); - actor.SetProperty( Actor::Property::SCALE,vector); + actor.SetProperty(Actor::Property::SCALE, vector); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); + DALI_TEST_CHECK(vector == actor.GetCurrentProperty(Actor::Property::SCALE)); actor.ScaleBy(vector); @@ -2028,24 +2035,24 @@ int UtcDaliActorScaleBy(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); + DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty(Actor::Property::SCALE)); END_TEST; } int UtcDaliActorGetCurrentScale(void) { TestApplication application; - Vector3 scale(12.0f, 1.0f, 2.0f); + Vector3 scale(12.0f, 1.0f, 2.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SCALE,scale); + actor.SetProperty(Actor::Property::SCALE, scale); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::SCALE) == scale); END_TEST; } @@ -2053,33 +2060,33 @@ int UtcDaliActorGetCurrentWorldScale(void) { TestApplication application; - Actor parent = Actor::New(); - Vector3 parentScale( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::SCALE, parentScale ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Vector3 parentScale(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::SCALE, parentScale); + application.GetScene().Add(parent); - Actor child = Actor::New(); - Vector3 childScale( 2.0f, 2.0f, 2.0f ); - child.SetProperty( Actor::Property::SCALE, childScale ); - parent.Add( child ); + Actor child = Actor::New(); + Vector3 childScale(2.0f, 2.0f, 2.0f); + child.SetProperty(Actor::Property::SCALE, childScale); + parent.Add(child); // The actors should not have a scale yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // The actors should not have a world scale yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), parentScale, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), childScale, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::SCALE), parentScale, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::SCALE), childScale, TEST_LOCATION); // The actors should have a world scale now - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION); END_TEST; } @@ -2088,29 +2095,29 @@ int UtcDaliActorInheritScale(void) tet_infoline("Testing Actor::SetInheritScale"); TestApplication application; - Actor parent = Actor::New(); - Vector3 parentScale( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::SCALE, parentScale ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Vector3 parentScale(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::SCALE, parentScale); + application.GetScene().Add(parent); - Actor child = Actor::New(); - Vector3 childScale( 2.0f, 2.0f, 2.0f ); - child.SetProperty( Actor::Property::SCALE, childScale ); - parent.Add( child ); + Actor child = Actor::New(); + Vector3 childScale(2.0f, 2.0f, 2.0f); + child.SetProperty(Actor::Property::SCALE, childScale); + parent.Add(child); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION); - child.SetProperty( Actor::Property::INHERIT_SCALE, false ); - DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION ); + child.SetProperty(Actor::Property::INHERIT_SCALE, false); + DALI_TEST_EQUALS(child.GetProperty(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), childScale, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION); END_TEST; } @@ -2119,25 +2126,25 @@ int UtcDaliActorSetVisible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == false); - actor.SetProperty( Actor::Property::VISIBLE,true); + actor.SetProperty(Actor::Property::VISIBLE, true); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == true); // put actor on stage - application.GetScene().Add( actor ); - actor.SetProperty( Actor::Property::VISIBLE,false); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::VISIBLE, false); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == false); END_TEST; } @@ -2147,7 +2154,7 @@ int UtcDaliActorIsVisible(void) Actor actor = Actor::New(); - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == true); END_TEST; } @@ -2157,38 +2164,38 @@ int UtcDaliActorSetOpacity(void) Actor actor = Actor::New(); // initial opacity is 1 - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 1.0f, TEST_LOCATION); - actor.SetProperty( Actor::Property::OPACITY, 0.4f); + actor.SetProperty(Actor::Property::OPACITY, 0.4f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.4f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 0.4f, TEST_LOCATION); // change opacity, actor is on stage to change is not immediate - actor.SetProperty( Actor::Property::OPACITY, actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) + 0.1f ); + actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty(Actor::Property::OPACITY) + 0.1f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 0.5f, TEST_LOCATION); // put actor on stage - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // change opacity, actor is on stage to change is not immediate - actor.SetProperty( Actor::Property::OPACITY, 0.9f ); - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, TEST_LOCATION ); + actor.SetProperty(Actor::Property::OPACITY, 0.9f); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 0.5f, TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.9f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 0.9f, TEST_LOCATION); // change opacity, actor is on stage to change is not immediate - actor.SetProperty( Actor::Property::OPACITY, actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) - 0.9f ); + actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty(Actor::Property::OPACITY) - 0.9f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::OPACITY), 0.0f, TEST_LOCATION); END_TEST; } @@ -2197,83 +2204,83 @@ int UtcDaliActorGetCurrentOpacity(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) != 0.5f); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::OPACITY) != 0.5f); - actor.SetProperty( Actor::Property::OPACITY,0.5f); + actor.SetProperty(Actor::Property::OPACITY, 0.5f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) == 0.5f); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::OPACITY) == 0.5f); END_TEST; } int UtcDaliActorSetSensitive(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); - bool sensitive = !actor.GetProperty< bool >( Actor::Property::SENSITIVE ); + bool sensitive = !actor.GetProperty(Actor::Property::SENSITIVE); - actor.SetProperty( Actor::Property::SENSITIVE,sensitive); + actor.SetProperty(Actor::Property::SENSITIVE, sensitive); - DALI_TEST_CHECK(sensitive == actor.GetProperty< bool >( Actor::Property::SENSITIVE )); + DALI_TEST_CHECK(sensitive == actor.GetProperty(Actor::Property::SENSITIVE)); END_TEST; } int UtcDaliActorIsSensitive(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SENSITIVE,false); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SENSITIVE, false); - DALI_TEST_CHECK(false == actor.GetProperty< bool >( Actor::Property::SENSITIVE )); + DALI_TEST_CHECK(false == actor.GetProperty(Actor::Property::SENSITIVE)); END_TEST; } int UtcDaliActorSetColor(void) { TestApplication application; - Actor actor = Actor::New(); - Vector4 color(1.0f, 1.0f, 1.0f, 0.5f); + Actor actor = Actor::New(); + Vector4 color(1.0f, 1.0f, 1.0f, 0.5f); - DALI_TEST_CHECK(color != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR )); + DALI_TEST_CHECK(color != actor.GetCurrentProperty(Actor::Property::COLOR)); - actor.SetProperty( Actor::Property::COLOR,color); + actor.SetProperty(Actor::Property::COLOR, color); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR )); + DALI_TEST_CHECK(color == actor.GetCurrentProperty(Actor::Property::COLOR)); - actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) ); + actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty(Actor::Property::COLOR), TEST_LOCATION); - application.GetScene().Add( actor ); - actor.SetProperty( Actor::Property::COLOR, color ); + application.GetScene().Add(actor); + actor.SetProperty(Actor::Property::COLOR, color); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( color, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + DALI_TEST_EQUALS(color, actor.GetCurrentProperty(Actor::Property::COLOR), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) ); + actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f)); // flush the queue and render once application.SendNotification(); application.Render(); // Actor color is not clamped - DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty(Actor::Property::COLOR), TEST_LOCATION); // world color is clamped - DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty(Actor::Property::WORLD_COLOR), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR, color ); - DALI_TEST_EQUALS( color, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR, color); + DALI_TEST_EQUALS(color, actor.GetProperty(Actor::Property::COLOR), TEST_LOCATION); - Vector3 newColor( 1.0f, 0.0f, 0.0f ); - actor.SetProperty( Actor::Property::COLOR, newColor ); - DALI_TEST_EQUALS( Vector4( newColor.r, newColor.g, newColor.b, 1.0f ), actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + Vector3 newColor(1.0f, 0.0f, 0.0f); + actor.SetProperty(Actor::Property::COLOR, newColor); + DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty(Actor::Property::COLOR), TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); END_TEST; } @@ -2284,80 +2291,77 @@ int UtcDaliActorSetColorIndividual(void) Actor actor = Actor::New(); Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f); - DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR )); + DALI_TEST_CHECK(vector != actor.GetCurrentProperty(Actor::Property::COLOR)); - actor.SetProperty( Actor::Property::COLOR_RED, vector.r ); - DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_RED, vector.r); + DALI_TEST_EQUALS(vector.r, actor.GetProperty(Actor::Property::COLOR_RED), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty(Actor::Property::COLOR).r, TEST_LOCATION); + DALI_TEST_EQUALS(vector.r, actor.GetProperty(Actor::Property::COLOR_RED), TEST_LOCATION); + DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty(Actor::Property::COLOR_RED), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g ); - DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g); + DALI_TEST_EQUALS(vector.g, actor.GetProperty(Actor::Property::COLOR_GREEN), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty(Actor::Property::COLOR).g, TEST_LOCATION); + DALI_TEST_EQUALS(vector.g, actor.GetProperty(Actor::Property::COLOR_GREEN), TEST_LOCATION); + DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b ); - DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b); + DALI_TEST_EQUALS(vector.b, actor.GetProperty(Actor::Property::COLOR_BLUE), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION ); - + DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty(Actor::Property::COLOR).b, TEST_LOCATION); + DALI_TEST_EQUALS(vector.b, actor.GetProperty(Actor::Property::COLOR_BLUE), TEST_LOCATION); + DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a ); - DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a); + DALI_TEST_EQUALS(vector.a, actor.GetProperty(Actor::Property::COLOR_ALPHA), TEST_LOCATION); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION ); - DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION ); - - DALI_TEST_EQUALS( vector, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); - DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION ); + DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty(Actor::Property::COLOR).a, TEST_LOCATION); + DALI_TEST_EQUALS(vector.a, actor.GetProperty(Actor::Property::COLOR_ALPHA), TEST_LOCATION); + DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), TEST_LOCATION); - actor.SetProperty( Actor::Property::OPACITY, 0.2f ); + DALI_TEST_EQUALS(vector, actor.GetProperty(Actor::Property::COLOR), TEST_LOCATION); + DALI_TEST_EQUALS(vector, actor.GetCurrentProperty(Actor::Property::COLOR), TEST_LOCATION); + actor.SetProperty(Actor::Property::OPACITY, 0.2f); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( 0.2f, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION ); + DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty(Actor::Property::COLOR).a, TEST_LOCATION); END_TEST; } - int UtcDaliActorGetCurrentColor(void) { TestApplication application; - Actor actor = Actor::New(); - Vector4 color(1.0f, 1.0f, 1.0f, 0.5f); + Actor actor = Actor::New(); + Vector4 color(1.0f, 1.0f, 1.0f, 0.5f); - actor.SetProperty( Actor::Property::COLOR,color); + actor.SetProperty(Actor::Property::COLOR, color); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR )); + DALI_TEST_CHECK(color == actor.GetCurrentProperty(Actor::Property::COLOR)); END_TEST; } @@ -2366,57 +2370,57 @@ int UtcDaliActorGetCurrentWorldColor(void) tet_infoline("Actor::GetCurrentWorldColor"); TestApplication application; - Actor parent = Actor::New(); - Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f ); - parent.SetProperty( Actor::Property::COLOR, parentColor ); - application.GetScene().Add( parent ); + Actor parent = Actor::New(); + Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f); + parent.SetProperty(Actor::Property::COLOR, parentColor); + application.GetScene().Add(parent); - Actor child = Actor::New(); - Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f ); - child.SetProperty( Actor::Property::COLOR, childColor ); - parent.Add( child ); + Actor child = Actor::New(); + Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f); + child.SetProperty(Actor::Property::COLOR, childColor); + parent.Add(child); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // verify the default color mode - DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION ); + DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty(Actor::Property::COLOR_MODE), TEST_LOCATION); // The actors should not have a world color yet - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), parentColor, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR), parentColor, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR), childColor, TEST_LOCATION); // The actors should have a world color now - DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION); // use own color - child.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR ); + child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), childColor, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION); // use parent color - child.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR ); + child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR), childColor, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION); // use parent alpha - child.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA ); + child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA); application.SendNotification(); application.Render(0); - Vector4 expectedColor( childColor ); + Vector4 expectedColor(childColor); expectedColor.a *= parentColor.a; - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), expectedColor, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR), childColor, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION); END_TEST; } @@ -2424,31 +2428,31 @@ int UtcDaliActorSetColorMode(void) { tet_infoline("Actor::SetColorMode"); TestApplication application; - Actor actor = Actor::New(); - Actor child = Actor::New(); - actor.Add( child ); + Actor actor = Actor::New(); + Actor child = Actor::New(); + actor.Add(child); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR ); - DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR); + DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty(Actor::Property::COLOR_MODE), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR ); - DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR); + DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty(Actor::Property::COLOR_MODE), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR ); - DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR); + DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty(Actor::Property::COLOR_MODE), TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA ); - DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA); + DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty(Actor::Property::COLOR_MODE), TEST_LOCATION); END_TEST; } int UtcDaliActorScreenToLocal(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::POSITION, Vector2(10.0f, 10.0f)); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f)); application.GetScene().Add(actor); // flush the queue and render once @@ -2461,7 +2465,7 @@ int UtcDaliActorScreenToLocal(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) ); + DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f)); DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION); @@ -2474,11 +2478,11 @@ int UtcDaliActorSetLeaveRequired(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::LEAVE_REQUIRED,false); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::LEAVE_REQUIRED) == false); - actor.SetProperty( Actor::Property::LEAVE_REQUIRED,true); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == true); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::LEAVE_REQUIRED) == true); END_TEST; } @@ -2488,7 +2492,7 @@ int UtcDaliActorGetLeaveRequired(void) Actor actor = Actor::New(); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::LEAVE_REQUIRED) == false); END_TEST; } @@ -2498,11 +2502,11 @@ int UtcDaliActorSetKeyboardFocusable(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == true); + actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) == true); - actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, false ); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == false); + actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) == false); END_TEST; } @@ -2512,7 +2516,7 @@ int UtcDaliActorIsKeyboardFocusable(void) Actor actor = Actor::New(); - DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == false); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) == false); END_TEST; } @@ -2525,13 +2529,13 @@ int UtcDaliActorRemoveConstraints(void) Actor actor = Actor::New(); - Constraint constraint = Constraint::New( actor, Actor::Property::COLOR, TestConstraint() ); + Constraint constraint = Constraint::New(actor, Actor::Property::COLOR, TestConstraint()); constraint.Apply(); actor.RemoveConstraints(); - DALI_TEST_CHECK( gTestConstraintCalled == false ); + DALI_TEST_CHECK(gTestConstraintCalled == false); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); constraint.Apply(); // flush the queue and render once @@ -2540,7 +2544,7 @@ int UtcDaliActorRemoveConstraints(void) actor.RemoveConstraints(); - DALI_TEST_CHECK( gTestConstraintCalled == true ); + DALI_TEST_CHECK(gTestConstraintCalled == true); END_TEST; } @@ -2555,75 +2559,75 @@ int UtcDaliActorRemoveConstraintTag(void) unsigned int result1 = 0u; unsigned int result2 = 0u; - unsigned constraint1Tag = 1u; - Constraint constraint1 = Constraint::New( actor, Actor::Property::COLOR, TestConstraintRef(result1, 1) ); - constraint1.SetTag( constraint1Tag ); + unsigned constraint1Tag = 1u; + Constraint constraint1 = Constraint::New(actor, Actor::Property::COLOR, TestConstraintRef(result1, 1)); + constraint1.SetTag(constraint1Tag); constraint1.Apply(); - unsigned constraint2Tag = 2u; - Constraint constraint2 = Constraint::New( actor, Actor::Property::COLOR, TestConstraintRef(result2, 2) ); - constraint2.SetTag( constraint2Tag ); + unsigned constraint2Tag = 2u; + Constraint constraint2 = Constraint::New(actor, Actor::Property::COLOR, TestConstraintRef(result2, 2)); + constraint2.SetTag(constraint2Tag); constraint2.Apply(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION); // 2. Remove Constraint1 and test... result1 = 0; result2 = 0; actor.RemoveConstraints(constraint1Tag); // make color property dirty, which will trigger constraints to be reapplied. - actor.SetProperty( Actor::Property::COLOR, Color::WHITE ); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now. - DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now. + DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION); // 3. Re-Apply Constraint1 and test... result1 = 0; result2 = 0; constraint1.Apply(); // make color property dirty, which will trigger constraints to be reapplied. - actor.SetProperty( Actor::Property::COLOR, Color::WHITE ); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION); // 2. Remove Constraint2 and test... result1 = 0; result2 = 0; actor.RemoveConstraints(constraint2Tag); // make color property dirty, which will trigger constraints to be reapplied. - actor.SetProperty( Actor::Property::COLOR, Color::WHITE ); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now. + DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now. // 2. Remove Constraint1 as well and test... result1 = 0; result2 = 0; actor.RemoveConstraints(constraint1Tag); // make color property dirty, which will trigger constraints to be reapplied. - actor.SetProperty( Actor::Property::COLOR, Color::WHITE ); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now. - DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now. + DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now. + DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now. END_TEST; } @@ -2635,25 +2639,25 @@ int UtcDaliActorTouchedSignal(void) // get the root layer Actor actor = application.GetScene().GetRootLayer(); - DALI_TEST_CHECK( gTouchCallBackCalled == false ); + DALI_TEST_CHECK(gTouchCallBackCalled == false); application.SendNotification(); application.Render(); // connect to its touch signal - actor.TouchedSignal().Connect( TestTouchCallback ); + actor.TouchedSignal().Connect(TestTouchCallback); // simulate a touch event in the middle of the screen - Vector2 touchPoint( application.GetScene().GetSize() * 0.5 ); + Vector2 touchPoint(application.GetScene().GetSize() * 0.5); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); - application.ProcessEvent( touchEvent ); + touchEvent.AddPoint(point); + application.ProcessEvent(touchEvent); - DALI_TEST_CHECK( gTouchCallBackCalled == true ); + DALI_TEST_CHECK(gTouchCallBackCalled == true); END_TEST; } @@ -2665,25 +2669,25 @@ int UtcDaliActorHoveredSignal(void) // get the root layer Actor actor = application.GetScene().GetRootLayer(); - DALI_TEST_CHECK( gHoverCallBackCalled == false ); + DALI_TEST_CHECK(gHoverCallBackCalled == false); application.SendNotification(); application.Render(); // connect to its hover signal - actor.HoveredSignal().Connect( TestCallback3 ); + actor.HoveredSignal().Connect(TestCallback3); // simulate a hover event in the middle of the screen - Vector2 touchPoint( application.GetScene().GetSize() * 0.5 ); + Vector2 touchPoint(application.GetScene().GetSize() * 0.5); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::MOTION ); - point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) ); + point.SetDeviceId(1); + point.SetState(PointState::MOTION); + point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y)); Dali::Integration::HoverEvent hoverEvent; - hoverEvent.AddPoint( point ); - application.ProcessEvent( hoverEvent ); + hoverEvent.AddPoint(point); + application.ProcessEvent(hoverEvent); - DALI_TEST_CHECK( gHoverCallBackCalled == true ); + DALI_TEST_CHECK(gHoverCallBackCalled == true); END_TEST; } @@ -2698,19 +2702,19 @@ int UtcDaliActorOnOffSceneSignal(void) gActorNamesOnOffScene.clear(); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::NAME, "parent" ); - parent.OnSceneSignal().Connect( OnSceneCallback ); - parent.OffSceneSignal().Connect( OffSceneCallback ); + parent.SetProperty(Actor::Property::NAME, "parent"); + parent.OnSceneSignal().Connect(OnSceneCallback); + parent.OffSceneSignal().Connect(OffSceneCallback); // sanity check - DALI_TEST_CHECK( gOnSceneCallBackCalled == 0 ); - DALI_TEST_CHECK( gOffSceneCallBackCalled == 0 ); + DALI_TEST_CHECK(gOnSceneCallBackCalled == 0); + DALI_TEST_CHECK(gOffSceneCallBackCalled == 0); // add parent to the scene - application.GetScene().Add( parent ); + application.GetScene().Add(parent); // onstage emitted, offstage not - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION); // test adding a child, should get onstage emitted // clean test data @@ -2718,60 +2722,60 @@ int UtcDaliActorOnOffSceneSignal(void) gActorNamesOnOffScene.clear(); Actor child = Actor::New(); - child.SetProperty( Actor::Property::NAME, "child" ); - child.OnSceneSignal().Connect( OnSceneCallback ); - child.OffSceneSignal().Connect( OffSceneCallback ); - parent.Add( child ); // add child + child.SetProperty(Actor::Property::NAME, "child"); + child.OnSceneSignal().Connect(OnSceneCallback); + child.OffSceneSignal().Connect(OffSceneCallback); + parent.Add(child); // add child // onscene emitted, offscene not - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION); // test removing parent from the scene // clean test data gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0; gActorNamesOnOffScene.clear(); - application.GetScene().Remove( parent ); + application.GetScene().Remove(parent); // onscene not emitted, offscene is - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION); + DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION); + DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION); // test adding parent back to the scene // clean test data gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0; gActorNamesOnOffScene.clear(); - application.GetScene().Add( parent ); + application.GetScene().Add(parent); // onscene emitted, offscene not - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION); + DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION); // test removing child // clean test data gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0; gActorNamesOnOffScene.clear(); - parent.Remove( child ); + parent.Remove(child); // onscene not emitted, offscene is - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION); + DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION); // test removing parent // clean test data gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0; gActorNamesOnOffScene.clear(); - application.GetScene().Remove( parent ); + application.GetScene().Remove(parent); // onscene not emitted, offscene is - DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( gOffSceneCallBackCalled, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION); + DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION); + DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION); END_TEST; } @@ -2781,26 +2785,26 @@ int UtcDaliActorFindChildByName(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::NAME, "parent" ); - Actor first = Actor::New(); - first .SetProperty( Actor::Property::NAME, "first" ); + parent.SetProperty(Actor::Property::NAME, "parent"); + Actor first = Actor::New(); + first.SetProperty(Actor::Property::NAME, "first"); Actor second = Actor::New(); - second.SetProperty( Actor::Property::NAME, "second" ); + second.SetProperty(Actor::Property::NAME, "second"); parent.Add(first); first.Add(second); - Actor found = parent.FindChildByName( "foo" ); - DALI_TEST_CHECK( !found ); + Actor found = parent.FindChildByName("foo"); + DALI_TEST_CHECK(!found); - found = parent.FindChildByName( "parent" ); - DALI_TEST_CHECK( found == parent ); + found = parent.FindChildByName("parent"); + DALI_TEST_CHECK(found == parent); - found = parent.FindChildByName( "first" ); - DALI_TEST_CHECK( found == first ); + found = parent.FindChildByName("first"); + DALI_TEST_CHECK(found == first); - found = parent.FindChildByName( "second" ); - DALI_TEST_CHECK( found == second ); + found = parent.FindChildByName("second"); + DALI_TEST_CHECK(found == second); END_TEST; } @@ -2816,17 +2820,17 @@ int UtcDaliActorFindChildById(void) parent.Add(first); first.Add(second); - Actor found = parent.FindChildById( 100000 ); - DALI_TEST_CHECK( !found ); + Actor found = parent.FindChildById(100000); + DALI_TEST_CHECK(!found); - found = parent.FindChildById( parent.GetProperty< int >( Actor::Property::ID ) ); - DALI_TEST_CHECK( found == parent ); + found = parent.FindChildById(parent.GetProperty(Actor::Property::ID)); + DALI_TEST_CHECK(found == parent); - found = parent.FindChildById( first.GetProperty< int >( Actor::Property::ID ) ); - DALI_TEST_CHECK( found == first ); + found = parent.FindChildById(first.GetProperty(Actor::Property::ID)); + DALI_TEST_CHECK(found == first); - found = parent.FindChildById( second.GetProperty< int >( Actor::Property::ID ) ); - DALI_TEST_CHECK( found == second ); + found = parent.FindChildById(second.GetProperty(Actor::Property::ID)); + DALI_TEST_CHECK(found == second); END_TEST; } @@ -2835,15 +2839,16 @@ int UtcDaliActorHitTest(void) struct HitTestData { public: - HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result ) - : mScale( scale ), - mTouchPoint( touchPoint ), - mResult( result ) - {} + HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result) + : mScale(scale), + mTouchPoint(touchPoint), + mResult(result) + { + } Vector3 mScale; Vector2 mTouchPoint; - bool mResult; + bool mResult; }; TestApplication application; @@ -2852,56 +2857,59 @@ int UtcDaliActorHitTest(void) // Fill a vector with different hit tests. struct HitTestData* hitTestData[] = { // scale touch point result - new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ), // touch point close to the right edge (inside) - new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside) - new HitTestData( Vector3( 110.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), true ), // same point as above with a wider scale. Should be inside. - new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside) - new HitTestData( Vector3( 100.f, 110.f, 1.f ), Vector2( 200.f, 451.f ), true ), // same point as above with a wider scale. Should be inside. + new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside) + new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside) + new HitTestData(Vector3(110.f, 100.f, 1.f), Vector2(291.f, 400.f), true), // same point as above with a wider scale. Should be inside. + new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside) + new HitTestData(Vector3(100.f, 110.f, 1.f), Vector2(200.f, 451.f), true), // same point as above with a wider scale. Should be inside. NULL, }; // get the root layer Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); ResetTouchCallbacks(); unsigned int index = 0; - while( NULL != hitTestData[index] ) + while(NULL != hitTestData[index]) { - actor.SetProperty( Actor::Property::SIZE, Vector2( 1.f, 1.f ) ); - actor.SetProperty( Actor::Property::SCALE, Vector3( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f)); + actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z)); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK( !gTouchCallBackCalled ); + DALI_TEST_CHECK(!gTouchCallBackCalled); // connect to its touch signal actor.TouchedSignal().Connect(TestTouchCallback); Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y)); Dali::Integration::TouchEvent event; - event.AddPoint( point ); + event.AddPoint(point); // flush the queue and render once application.SendNotification(); application.Render(); - application.ProcessEvent( event ); + application.ProcessEvent(event); - DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult ); + DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult); - if( gTouchCallBackCalled != hitTestData[index]->mResult ) + if(gTouchCallBackCalled != hitTestData[index]->mResult) tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n", - hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z, - hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y, - hitTestData[index]->mResult ); + hitTestData[index]->mScale.x, + hitTestData[index]->mScale.y, + hitTestData[index]->mScale.z, + hitTestData[index]->mTouchPoint.x, + hitTestData[index]->mTouchPoint.y, + hitTestData[index]->mResult); ResetTouchCallbacks(); ++index; @@ -2922,19 +2930,19 @@ int UtcDaliActorSetDrawMode(void) application.SendNotification(); application.Render(1); - DALI_TEST_CHECK( DrawMode::NORMAL == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Ensure overlay is off by default + DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default - a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); + a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); application.SendNotification(); application.Render(1); - DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Check Actor is overlay + DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty(Actor::Property::DRAW_MODE)); // Check Actor is overlay - a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL ); + a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL); application.SendNotification(); application.Render(1); - DALI_TEST_CHECK( DrawMode::NORMAL == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Check Actor is normal + DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty(Actor::Property::DRAW_MODE)); // Check Actor is normal END_TEST; } @@ -2947,17 +2955,17 @@ int UtcDaliActorSetDrawModeOverlayRender(void) application.Render(1); std::vector ids; - ids.push_back( 8 ); // first rendered actor - ids.push_back( 9 ); // second rendered actor - ids.push_back( 10 ); // third rendered actor - application.GetGlAbstraction().SetNextTextureIds( ids ); + ids.push_back(8); // first rendered actor + ids.push_back(9); // second rendered actor + ids.push_back(10); // third rendered actor + application.GetGlAbstraction().SetNextTextureIds(ids); Texture imageA = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); Texture imageB = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); Texture imageC = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); - Actor a = CreateRenderableActor( imageA ); - Actor b = CreateRenderableActor( imageB ); - Actor c = CreateRenderableActor( imageC ); + Actor a = CreateRenderableActor(imageA); + Actor b = CreateRenderableActor(imageB); + Actor c = CreateRenderableActor(imageC); application.SendNotification(); application.Render(1); @@ -2977,14 +2985,14 @@ int UtcDaliActorSetDrawModeOverlayRender(void) application.Render(1); // Should be 3 textures changes. - const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 ); + const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0); typedef std::vector::size_type TextureSize; - DALI_TEST_EQUALS( boundTextures.size(), static_cast( 3 ), TEST_LOCATION ); - if( boundTextures.size() == 3 ) + DALI_TEST_EQUALS(boundTextures.size(), static_cast(3), TEST_LOCATION); + if(boundTextures.size() == 3) { - DALI_TEST_CHECK( boundTextures[0] == 8u ); - DALI_TEST_CHECK( boundTextures[1] == 9u ); - DALI_TEST_CHECK( boundTextures[2] == 10u ); + DALI_TEST_CHECK(boundTextures[0] == 8u); + DALI_TEST_CHECK(boundTextures[1] == 9u); + DALI_TEST_CHECK(boundTextures[2] == 10u); } // Now texture ids have been set, we can monitor their render order. @@ -2992,19 +3000,19 @@ int UtcDaliActorSetDrawModeOverlayRender(void) // b (9) // c (10) // a (8) - a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); + a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); application.GetGlAbstraction().ClearBoundTextures(); application.SendNotification(); application.Render(1); // Should be 3 texture changes. - DALI_TEST_EQUALS( boundTextures.size(), static_cast(3), TEST_LOCATION ); - if( boundTextures.size() == 3 ) + DALI_TEST_EQUALS(boundTextures.size(), static_cast(3), TEST_LOCATION); + if(boundTextures.size() == 3) { - DALI_TEST_CHECK( boundTextures[0] == 9u ); - DALI_TEST_CHECK( boundTextures[1] == 10u ); - DALI_TEST_CHECK( boundTextures[2] == 8u ); + DALI_TEST_CHECK(boundTextures[0] == 9u); + DALI_TEST_CHECK(boundTextures[1] == 10u); + DALI_TEST_CHECK(boundTextures[2] == 8u); } END_TEST; } @@ -3015,27 +3023,27 @@ int UtcDaliActorGetCurrentWorldMatrix(void) tet_infoline(" UtcDaliActorGetCurrentWorldMatrix"); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - Vector3 parentPosition( 10.0f, 20.0f, 30.0f); - Radian rotationAngle(Degree(85.0f)); + parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + Vector3 parentPosition(10.0f, 20.0f, 30.0f); + Radian rotationAngle(Degree(85.0f)); Quaternion parentRotation(rotationAngle, Vector3::ZAXIS); - Vector3 parentScale( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::POSITION, parentPosition ); - parent.SetProperty( Actor::Property::ORIENTATION, parentRotation ); - parent.SetProperty( Actor::Property::SCALE, parentScale ); - application.GetScene().Add( parent ); + Vector3 parentScale(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::POSITION, parentPosition); + parent.SetProperty(Actor::Property::ORIENTATION, parentRotation); + parent.SetProperty(Actor::Property::SCALE, parentScale); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - Vector3 childPosition( 0.0f, 0.0f, 100.0f ); - Radian childRotationAngle(Degree(23.0f)); - Quaternion childRotation( childRotationAngle, Vector3::YAXIS ); - Vector3 childScale( 2.0f, 2.0f, 2.0f ); - child.SetProperty( Actor::Property::POSITION, childPosition ); - child.SetProperty( Actor::Property::ORIENTATION, childRotation ); - child.SetProperty( Actor::Property::SCALE, childScale ); - parent.Add( child ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector3 childPosition(0.0f, 0.0f, 100.0f); + Radian childRotationAngle(Degree(23.0f)); + Quaternion childRotation(childRotationAngle, Vector3::YAXIS); + Vector3 childScale(2.0f, 2.0f, 2.0f); + child.SetProperty(Actor::Property::POSITION, childPosition); + child.SetProperty(Actor::Property::ORIENTATION, childRotation); + child.SetProperty(Actor::Property::SCALE, childScale); + parent.Add(child); application.SendNotification(); application.Render(0); @@ -3046,43 +3054,41 @@ int UtcDaliActorGetCurrentWorldMatrix(void) parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition); Matrix childMatrix(false); - childMatrix.SetTransformComponents( childScale, childRotation, childPosition ); + childMatrix.SetTransformComponents(childScale, childRotation, childPosition); //Child matrix should be the composition of child and parent Matrix childWorldMatrix(false); - Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix); + Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), childWorldMatrix, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION); END_TEST; } - - int UtcDaliActorConstrainedToWorldMatrix(void) { TestApplication application; tet_infoline(" UtcDaliActorConstrainedToWorldMatrix"); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - Vector3 parentPosition( 10.0f, 20.0f, 30.0f); - Radian rotationAngle(Degree(85.0f)); + parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + Vector3 parentPosition(10.0f, 20.0f, 30.0f); + Radian rotationAngle(Degree(85.0f)); Quaternion parentRotation(rotationAngle, Vector3::ZAXIS); - Vector3 parentScale( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::POSITION, parentPosition ); - parent.SetProperty( Actor::Property::ORIENTATION, parentRotation ); - parent.SetProperty( Actor::Property::SCALE, parentScale ); - application.GetScene().Add( parent ); + Vector3 parentScale(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::POSITION, parentPosition); + parent.SetProperty(Actor::Property::ORIENTATION, parentRotation); + parent.SetProperty(Actor::Property::SCALE, parentScale); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - Constraint posConstraint = Constraint::New( child, Actor::Property::POSITION, PositionComponentConstraint() ); - posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Constraint posConstraint = Constraint::New(child, Actor::Property::POSITION, PositionComponentConstraint()); + posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX)); posConstraint.Apply(); - application.GetScene().Add( child ); + application.GetScene().Add(child); application.SendNotification(); application.Render(0); @@ -3092,8 +3098,8 @@ int UtcDaliActorConstrainedToWorldMatrix(void) Matrix parentMatrix(false); parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition); - DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::POSITION), parent.GetCurrentProperty(Actor::Property::POSITION), 0.001, TEST_LOCATION); END_TEST; } @@ -3103,31 +3109,31 @@ int UtcDaliActorConstrainedToOrientation(void) tet_infoline(" UtcDaliActorConstrainedToOrientation"); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - Vector3 parentPosition( 10.0f, 20.0f, 30.0f); - Radian rotationAngle(Degree(85.0f)); + parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + Vector3 parentPosition(10.0f, 20.0f, 30.0f); + Radian rotationAngle(Degree(85.0f)); Quaternion parentRotation(rotationAngle, Vector3::ZAXIS); - Vector3 parentScale( 1.0f, 2.0f, 3.0f ); - parent.SetProperty( Actor::Property::POSITION, parentPosition ); - parent.SetProperty( Actor::Property::ORIENTATION, parentRotation ); - parent.SetProperty( Actor::Property::SCALE, parentScale ); - application.GetScene().Add( parent ); + Vector3 parentScale(1.0f, 2.0f, 3.0f); + parent.SetProperty(Actor::Property::POSITION, parentPosition); + parent.SetProperty(Actor::Property::ORIENTATION, parentRotation); + parent.SetProperty(Actor::Property::SCALE, parentScale); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - Constraint posConstraint = Constraint::New( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() ); - posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Constraint posConstraint = Constraint::New(child, Actor::Property::ORIENTATION, OrientationComponentConstraint()); + posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION)); posConstraint.Apply(); - application.GetScene().Add( child ); + application.GetScene().Add(child); application.SendNotification(); application.Render(0); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::ORIENTATION), parent.GetCurrentProperty(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION); END_TEST; } @@ -3137,31 +3143,31 @@ int UtcDaliActorConstrainedToOpacity(void) tet_infoline(" UtcDaliActorConstrainedToOpacity"); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::OPACITY, 0.7f ); - application.GetScene().Add( parent ); + parent.SetProperty(Actor::Property::OPACITY, 0.7f); + application.GetScene().Add(parent); - Actor child = Actor::New(); - Constraint opacityConstraint = Constraint::New( child, Actor::Property::OPACITY, EqualToConstraint() ); - opacityConstraint.AddSource( Source( parent, Actor::Property::OPACITY ) ); + Actor child = Actor::New(); + Constraint opacityConstraint = Constraint::New(child, Actor::Property::OPACITY, EqualToConstraint()); + opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY)); opacityConstraint.Apply(); - application.GetScene().Add( child ); + application.GetScene().Add(child); application.SendNotification(); application.Render(0); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( child.GetCurrentProperty< float >( Actor::Property::OPACITY ), parent.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::OPACITY), parent.GetCurrentProperty(Actor::Property::OPACITY), 0.001f, TEST_LOCATION); - parent.SetProperty( Actor::Property::OPACITY, 0.3f ); + parent.SetProperty(Actor::Property::OPACITY, 0.3f); application.SendNotification(); application.Render(0); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( child.GetCurrentProperty< float >( Actor::Property::OPACITY ), parent.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::OPACITY), parent.GetCurrentProperty(Actor::Property::OPACITY), 0.001f, TEST_LOCATION); END_TEST; } @@ -3172,45 +3178,45 @@ int UtcDaliActorUnparent(void) tet_infoline(" UtcDaliActorUnparent"); Actor parent = Actor::New(); - application.GetScene().Add( parent ); + application.GetScene().Add(parent); Actor child = Actor::New(); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); - DALI_TEST_CHECK( !child.GetParent() ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); + DALI_TEST_CHECK(!child.GetParent()); // Test that calling Unparent with no parent is a NOOP child.Unparent(); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); - DALI_TEST_CHECK( !child.GetParent() ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); + DALI_TEST_CHECK(!child.GetParent()); // Test that Unparent works - parent.Add( child ); + parent.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); - DALI_TEST_CHECK( parent == child.GetParent() ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); + DALI_TEST_CHECK(parent == child.GetParent()); child.Unparent(); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); - DALI_TEST_CHECK( !child.GetParent() ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); + DALI_TEST_CHECK(!child.GetParent()); // Test that UnparentAndReset works - parent.Add( child ); + parent.Add(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION ); - DALI_TEST_CHECK( parent == child.GetParent() ); + DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION); + DALI_TEST_CHECK(parent == child.GetParent()); - UnparentAndReset( child ); + UnparentAndReset(child); - DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION ); - DALI_TEST_CHECK( !child ); + DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION); + DALI_TEST_CHECK(!child); // Test that UnparentAndReset is a NOOP with empty handle - UnparentAndReset( child ); + UnparentAndReset(child); - DALI_TEST_CHECK( !child ); + DALI_TEST_CHECK(!child); END_TEST; } @@ -3220,20 +3226,20 @@ int UtcDaliActorGetChildAt(void) tet_infoline(" UtcDaliActorGetChildAt"); Actor parent = Actor::New(); - application.GetScene().Add( parent ); + application.GetScene().Add(parent); Actor child0 = Actor::New(); - parent.Add( child0 ); + parent.Add(child0); Actor child1 = Actor::New(); - parent.Add( child1 ); + parent.Add(child1); Actor child2 = Actor::New(); - parent.Add( child2 ); + parent.Add(child2); - DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION ); + DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION); + DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION); END_TEST; } @@ -3243,16 +3249,15 @@ int UtcDaliActorSetGetOverlay(void) tet_infoline(" UtcDaliActorSetGetOverlay"); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::DRAW_MODE,DrawMode::OVERLAY_2D ); - DALI_TEST_CHECK( parent.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) == DrawMode::OVERLAY_2D ); + parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); + DALI_TEST_CHECK(parent.GetProperty(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D); END_TEST; } - int UtcDaliActorCreateDestroy(void) { Actor* actor = new Actor; - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); delete actor; END_TEST; } @@ -3261,69 +3266,69 @@ namespace { struct PropertyStringIndex { - const char * const name; + const char* const name; const Property::Index index; - const Property::Type type; + const Property::Type type; }; const PropertyStringIndex PROPERTY_TABLE[] = -{ - { "parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3 }, - { "parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT }, - { "parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT }, - { "parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT }, - { "anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3 }, - { "anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT }, - { "anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT }, - { "anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT }, - { "size", Actor::Property::SIZE, Property::VECTOR3 }, - { "sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT }, - { "sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT }, - { "sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT }, - { "position", Actor::Property::POSITION, Property::VECTOR3 }, - { "positionX", Actor::Property::POSITION_X, Property::FLOAT }, - { "positionY", Actor::Property::POSITION_Y, Property::FLOAT }, - { "positionZ", Actor::Property::POSITION_Z, Property::FLOAT }, - { "worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3 }, - { "worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT }, - { "worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT }, - { "worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT }, - { "orientation", Actor::Property::ORIENTATION, Property::ROTATION }, - { "worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION }, - { "scale", Actor::Property::SCALE, Property::VECTOR3 }, - { "scaleX", Actor::Property::SCALE_X, Property::FLOAT }, - { "scaleY", Actor::Property::SCALE_Y, Property::FLOAT }, - { "scaleZ", Actor::Property::SCALE_Z, Property::FLOAT }, - { "worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3 }, - { "visible", Actor::Property::VISIBLE, Property::BOOLEAN }, - { "color", Actor::Property::COLOR, Property::VECTOR4 }, - { "colorRed", Actor::Property::COLOR_RED, Property::FLOAT }, - { "colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT }, - { "colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT }, - { "colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT }, - { "worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4 }, - { "worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX }, - { "name", Actor::Property::NAME, Property::STRING }, - { "sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN }, - { "leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN }, - { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN }, - { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN }, - { "colorMode", Actor::Property::COLOR_MODE, Property::INTEGER }, - { "drawMode", Actor::Property::DRAW_MODE, Property::INTEGER }, - { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 }, - { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING }, - { "heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING }, - { "sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER }, - { "widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN }, - { "heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN }, - { "padding", Actor::Property::PADDING, Property::VECTOR4 }, - { "minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2 }, - { "maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2 }, - { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN }, - { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING }, - { "opacity", Actor::Property::OPACITY, Property::FLOAT }, + { + {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3}, + {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT}, + {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT}, + {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT}, + {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3}, + {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT}, + {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT}, + {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT}, + {"size", Actor::Property::SIZE, Property::VECTOR3}, + {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT}, + {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT}, + {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT}, + {"position", Actor::Property::POSITION, Property::VECTOR3}, + {"positionX", Actor::Property::POSITION_X, Property::FLOAT}, + {"positionY", Actor::Property::POSITION_Y, Property::FLOAT}, + {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT}, + {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3}, + {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT}, + {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT}, + {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT}, + {"orientation", Actor::Property::ORIENTATION, Property::ROTATION}, + {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION}, + {"scale", Actor::Property::SCALE, Property::VECTOR3}, + {"scaleX", Actor::Property::SCALE_X, Property::FLOAT}, + {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT}, + {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT}, + {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3}, + {"visible", Actor::Property::VISIBLE, Property::BOOLEAN}, + {"color", Actor::Property::COLOR, Property::VECTOR4}, + {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT}, + {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT}, + {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT}, + {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT}, + {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4}, + {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX}, + {"name", Actor::Property::NAME, Property::STRING}, + {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN}, + {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN}, + {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN}, + {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN}, + {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER}, + {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER}, + {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3}, + {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING}, + {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING}, + {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER}, + {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN}, + {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN}, + {"padding", Actor::Property::PADDING, Property::VECTOR4}, + {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2}, + {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2}, + {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN}, + {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING}, + {"opacity", Actor::Property::OPACITY, Property::FLOAT}, }; -const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] ); +const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]); } // unnamed namespace int UtcDaliActorProperties(void) @@ -3332,12 +3337,12 @@ int UtcDaliActorProperties(void) Actor actor = Actor::New(); - for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i ) + for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i) { - tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index ); - DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION ); + tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index); + DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION); } END_TEST; } @@ -3349,35 +3354,35 @@ int UtcDaliRelayoutProperties_ResizePolicies(void) Actor actor = Actor::New(); // Defaults - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get(), "USE_NATURAL_SIZE", TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get(), "USE_NATURAL_SIZE", TEST_LOCATION); // Set resize policy for all dimensions - actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i) + actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS); + for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i) { - DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION); } // Set individual dimensions - const char* const widthPolicy = "FILL_TO_PARENT"; + const char* const widthPolicy = "FILL_TO_PARENT"; const char* const heightPolicy = "FIXED"; - actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy ); - actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy ); + actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy); + actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get(), widthPolicy, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get(), heightPolicy, TEST_LOCATION); // Set individual dimensions using enums - ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE; + ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE; ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT; - actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum ); - actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum ); + actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum); + actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum); - DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(actor.GetResizePolicy(Dimension::WIDTH)), static_cast(widthPolicyEnum), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast(heightPolicyEnum), TEST_LOCATION); END_TEST; } @@ -3389,21 +3394,21 @@ int UtcDaliRelayoutProperties_SizeScalePolicy(void) Actor actor = Actor::New(); // Defaults - DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION); SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO; - actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy ); - DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION); // Set const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO; const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO; - actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 ); - DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy1, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION); - actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 ); - DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy2, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION); END_TEST; } @@ -3415,18 +3420,18 @@ int UtcDaliRelayoutProperties_SizeModeFactor(void) Actor actor = Actor::New(); // Defaults - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION); - Vector3 sizeMode( 1.0f, 2.0f, 3.0f ); - actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ), sizeMode, TEST_LOCATION ); + Vector3 sizeMode(1.0f, 2.0f, 3.0f); + actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION); // Set - Vector3 sizeMode1( 2.0f, 3.0f, 4.0f ); + Vector3 sizeMode1(2.0f, 3.0f, 4.0f); - actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION ); + actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get(), sizeMode1, TEST_LOCATION); END_TEST; } @@ -3438,19 +3443,19 @@ int UtcDaliRelayoutProperties_DimensionDependency(void) Actor actor = Actor::New(); // Defaults - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get(), false, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get(), false, TEST_LOCATION); // Set - actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION ); + actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get(), true, TEST_LOCATION); - actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION ); + actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get(), true, TEST_LOCATION); // Test setting another resize policy - actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION ); + actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get(), false, TEST_LOCATION); END_TEST; } @@ -3462,13 +3467,13 @@ int UtcDaliRelayoutProperties_Padding(void) Actor actor = Actor::New(); // Data - Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f ); + Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f); // PADDING - actor.SetProperty( Actor::Property::PADDING, padding ); - Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >(); + actor.SetProperty(Actor::Property::PADDING, padding); + Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get(); - DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -3480,19 +3485,19 @@ int UtcDaliRelayoutProperties_MinimumMaximumSize(void) Actor actor = Actor::New(); // Data - Vector2 minSize( 1.0f, 2.0f ); + Vector2 minSize(1.0f, 2.0f); - actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize ); - Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >(); + actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize); + Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get(); - DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); - Vector2 maxSize( 3.0f, 4.0f ); + Vector2 maxSize(3.0f, 4.0f); - actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize ); - Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >(); + actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize); + Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get(); - DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -3503,7 +3508,7 @@ int UtcDaliActorGetHeightForWidth(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION); END_TEST; } @@ -3514,7 +3519,7 @@ int UtcDaliActorGetWidthForHeight(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION); END_TEST; } @@ -3526,18 +3531,18 @@ int UtcDaliActorGetRelayoutSize(void) Actor actor = Actor::New(); // Add actor to stage - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION); - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 0.0f ) ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH); + actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f)); // Flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION); END_TEST; } @@ -3549,22 +3554,22 @@ int UtcDaliActorSetPadding(void) Actor actor = Actor::New(); Padding padding; - padding = actor.GetProperty( Actor::Property::PADDING ); + padding = actor.GetProperty(Actor::Property::PADDING); - DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION); - Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f ); - actor.SetProperty( Actor::Property::PADDING, padding2 ); + Padding padding2(1.0f, 2.0f, 3.0f, 4.0f); + actor.SetProperty(Actor::Property::PADDING, padding2); - padding = actor.GetProperty( Actor::Property::PADDING ); + padding = actor.GetProperty(Actor::Property::PADDING); - DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION ); - DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION ); + DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION); + DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION); + DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION); + DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION); END_TEST; } @@ -3575,18 +3580,18 @@ int UtcDaliActorSetMinimumSize(void) Actor actor = Actor::New(); - Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE ); + Vector2 size = actor.GetProperty(Actor::Property::MINIMUM_SIZE); - DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION); - Vector2 size2( 1.0f, 2.0f ); - actor.SetProperty( Actor::Property::MINIMUM_SIZE, size2 ); + Vector2 size2(1.0f, 2.0f); + actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2); - size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE ); + size = actor.GetProperty(Actor::Property::MINIMUM_SIZE); - DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION ); + DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION); + DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION); END_TEST; } @@ -3597,18 +3602,18 @@ int UtcDaliActorSetMaximumSize(void) Actor actor = Actor::New(); - Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ); + Vector2 size = actor.GetProperty(Actor::Property::MAXIMUM_SIZE); - DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION ); + DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION); + DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION); - Vector2 size2( 1.0f, 2.0f ); - actor.SetProperty( Actor::Property::MAXIMUM_SIZE, size2 ); + Vector2 size2(1.0f, 2.0f); + actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2); - size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ); + size = actor.GetProperty(Actor::Property::MAXIMUM_SIZE); - DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION ); + DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION); + DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION); END_TEST; } @@ -3624,25 +3629,25 @@ int UtcDaliActorOnRelayoutSignal(void) gActorNamesRelayout.clear(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::NAME, "actor" ); - actor.OnRelayoutSignal().Connect( OnRelayoutCallback ); + actor.SetProperty(Actor::Property::NAME, "actor"); + actor.OnRelayoutSignal().Connect(OnRelayoutCallback); // Sanity check - DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled ); + DALI_TEST_CHECK(!gOnRelayoutCallBackCalled); // Add actor to stage - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 2.0 ) ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0)); // Flush the queue and render once application.SendNotification(); application.Render(); // OnRelayout emitted - DALI_TEST_EQUALS( gOnRelayoutCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION); END_TEST; } @@ -3652,7 +3657,6 @@ int UtcDaliActorGetHierachyDepth(void) TestApplication application; tet_infoline("Testing Dali::Actor::GetHierarchyDepth()"); - /* Build tree of actors: * * Depth @@ -3665,7 +3669,7 @@ int UtcDaliActorGetHierachyDepth(void) * * GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F. */ - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); @@ -3675,48 +3679,48 @@ int UtcDaliActorGetHierachyDepth(void) Actor actorF = Actor::New(); //Test that root actor has depth equal 0 - DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); + DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); //Test actors return depth -1 when not connected to the tree - DALI_TEST_EQUALS( -1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); + DALI_TEST_EQUALS(-1, actorA.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorB.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorC.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorD.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorE.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorF.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); //Create the hierarchy - stage.Add( actorA ); - actorA.Add( actorB ); - actorA.Add( actorC ); - actorB.Add( actorD ); - actorB.Add( actorE ); - actorC.Add( actorF ); + stage.Add(actorA); + actorA.Add(actorB); + actorA.Add(actorC); + actorB.Add(actorD); + actorB.Add(actorE); + actorC.Add(actorF); //Test actors return correct depth - DALI_TEST_EQUALS( 1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( 2, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( 2, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( 3, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( 3, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( 3, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); + DALI_TEST_EQUALS(1, actorA.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(2, actorB.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(2, actorC.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(3, actorD.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(3, actorE.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(3, actorF.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); //Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1 - actorA.Remove( actorB ); + actorA.Remove(actorB); - DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); + DALI_TEST_EQUALS(-1, actorB.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorD.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorE.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); //Removing actorA from the stage. All actors should have depth equal -1 - stage.Remove( actorA ); + stage.Remove(actorA); - DALI_TEST_EQUALS( -1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION ); + DALI_TEST_EQUALS(-1, actorA.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorB.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorC.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorD.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorE.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); + DALI_TEST_EQUALS(-1, actorF.GetProperty(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION); END_TEST; } @@ -3727,36 +3731,36 @@ int UtcDaliActorAnchorPointPropertyAsString(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION); // Invalid should not change anything - actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION); END_TEST; } @@ -3767,36 +3771,36 @@ int UtcDaliActorParentOriginPropertyAsString(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION); // Invalid should not change anything - actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION); END_TEST; } @@ -3807,21 +3811,21 @@ int UtcDaliActorColorModePropertyAsString(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION); // Invalid should not change anything - actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION); END_TEST; } @@ -3832,15 +3836,15 @@ int UtcDaliActorDrawModePropertyAsString(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" ); - DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::NORMAL, TEST_LOCATION ); + actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION); - actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" ); - DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION ); + actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION); // Invalid should not change anything - actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" ); - DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION ); + actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION); END_TEST; } @@ -3851,17 +3855,17 @@ int UtcDaliActorColorModePropertyAsEnum(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION); - actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA ); - DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION ); + actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION); END_TEST; } @@ -3872,11 +3876,11 @@ int UtcDaliActorDrawModePropertyAsEnum(void) Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL ); - DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::NORMAL, TEST_LOCATION ); + actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION); - actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); - DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION ); + actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION); END_TEST; } @@ -3888,15 +3892,15 @@ int UtcDaliActorAddRendererP(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); + actor.AddRenderer(renderer); + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION); END_TEST; } @@ -3906,25 +3910,25 @@ int UtcDaliActorAddRendererN01(void) tet_infoline("Testing Actor::AddRenderer"); TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Renderer renderer; // try illegal Add try { - actor.AddRenderer( renderer ); - tet_printf("Assertion test failed - no Exception\n" ); + actor.AddRenderer(renderer); + tet_printf("Assertion test failed - no Exception\n"); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -3933,17 +3937,17 @@ int UtcDaliActorAddRendererN01(void) int UtcDaliActorAddRendererN02(void) { - tet_infoline( "UtcDaliActorAddRendererN02" ); + tet_infoline("UtcDaliActorAddRendererN02"); - Actor actor; + Actor actor; Renderer renderer; { TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + renderer = Renderer::New(geometry, shader); actor = Actor::New(); } @@ -3951,19 +3955,19 @@ int UtcDaliActorAddRendererN02(void) // try illegal AddRenderer try { - actor.AddRenderer( renderer ); - tet_printf( "Assertion test failed - no Exception\n" ); - tet_result( TET_FAIL ); + actor.AddRenderer(renderer); + tet_printf("Assertion test failed - no Exception\n"); + tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION); } catch(...) { - tet_printf( "Assertion test failed - wrong Exception\n" ); - tet_result( TET_FAIL ); + tet_printf("Assertion test failed - wrong Exception\n"); + tet_result(TET_FAIL); } END_TEST; @@ -3981,7 +3985,7 @@ int UtcDaliActorAddRendererOnScene(void) application.Render(0); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); application.SendNotification(); @@ -3989,7 +3993,7 @@ int UtcDaliActorAddRendererOnScene(void) try { - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); tet_result(TET_PASS); } catch(...) @@ -4007,16 +4011,16 @@ int UtcDaliActorRemoveRendererP1(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); { Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); + actor.AddRenderer(renderer); + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION); application.SendNotification(); application.Render(); @@ -4025,7 +4029,7 @@ int UtcDaliActorRemoveRendererP1(void) { Renderer renderer = actor.GetRendererAt(0); actor.RemoveRenderer(renderer); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); application.SendNotification(); application.Render(); @@ -4047,30 +4051,29 @@ int UtcDaliActorRemoveRendererP2(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION); actor.RemoveRenderer(0); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); // Shut down whilst holding onto the renderer handle. END_TEST; } - int UtcDaliActorRemoveRendererN(void) { tet_infoline("Testing Actor::RemoveRenderer"); @@ -4078,111 +4081,111 @@ int UtcDaliActorRemoveRendererN(void) Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); + actor.AddRenderer(renderer); + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION); actor.RemoveRenderer(10); - DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); END_TEST; } // Clipping test helper functions: -Actor CreateActorWithContent( uint32_t width, uint32_t height) +Actor CreateActorWithContent(uint32_t width, uint32_t height) { - Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - Actor actor = CreateRenderableActor( image ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + Actor actor = CreateRenderableActor(image); // Setup dimensions and position so actor is not skipped by culling. - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - actor.SetProperty( Actor::Property::SIZE, Vector2( width, height ) ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor.SetProperty(Actor::Property::SIZE, Vector2(width, height)); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); return actor; } Actor CreateActorWithContent16x16() { - return CreateActorWithContent( 16, 16 ); + return CreateActorWithContent(16, 16); } -void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace ) +void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace) { enabledDisableTrace.Reset(); stencilTrace.Reset(); - enabledDisableTrace.Enable( true ); - stencilTrace.Enable( true ); + enabledDisableTrace.Enable(true); + stencilTrace.Enable(true); application.SendNotification(); application.Render(); - enabledDisableTrace.Enable( false ); - stencilTrace.Enable( false ); + enabledDisableTrace.Enable(false); + stencilTrace.Enable(false); } -void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue ) +void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue) { const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams(); - DALI_TEST_EQUALS( colorMaskParams.red, maskValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.green, maskValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.blue, maskValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.alpha, maskValue, TEST_LOCATION ); + DALI_TEST_EQUALS(colorMaskParams.red, maskValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.green, maskValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.blue, maskValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.alpha, maskValue, TEST_LOCATION); } int UtcDaliActorPropertyClippingP(void) { // This test checks the clippingMode property. - tet_infoline( "Testing Actor::Property::ClippingMode: P" ); + tet_infoline("Testing Actor::Property::ClippingMode: P"); TestApplication application; Actor actor = Actor::New(); // Check default clippingEnabled value. - Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) ); + Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE)); - int value = 0; - bool getValueResult = getValue.Get( value ); - DALI_TEST_CHECK( getValueResult ); + int value = 0; + bool getValueResult = getValue.Get(value); + DALI_TEST_CHECK(getValueResult); - if( getValueResult ) + if(getValueResult) { - DALI_TEST_EQUALS( value, ClippingMode::DISABLED, TEST_LOCATION ); + DALI_TEST_EQUALS(value, ClippingMode::DISABLED, TEST_LOCATION); } // Check setting the property to the stencil mode. - actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); // Check the new value was set. - getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE ); - getValueResult = getValue.Get( value ); - DALI_TEST_CHECK( getValueResult ); + getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE); + getValueResult = getValue.Get(value); + DALI_TEST_CHECK(getValueResult); - if( getValueResult ) + if(getValueResult) { - DALI_TEST_EQUALS( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION ); + DALI_TEST_EQUALS(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION); } // Check setting the property to the scissor mode. - actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); + actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); // Check the new value was set. - getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE ); - getValueResult = getValue.Get( value ); - DALI_TEST_CHECK( getValueResult ); + getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE); + getValueResult = getValue.Get(value); + DALI_TEST_CHECK(getValueResult); - if( getValueResult ) + if(getValueResult) { - DALI_TEST_EQUALS( value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION ); + DALI_TEST_EQUALS(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION); } END_TEST; } @@ -4190,33 +4193,33 @@ int UtcDaliActorPropertyClippingP(void) int UtcDaliActorPropertyClippingN(void) { // Negative test case for Clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: N" ); + tet_infoline("Testing Actor::Property::ClippingMode: N"); TestApplication application; Actor actor = Actor::New(); // Check default clippingEnabled value. - Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) ); + Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE)); - int value = 0; - bool getValueResult = getValue.Get( value ); - DALI_TEST_CHECK( getValueResult ); + int value = 0; + bool getValueResult = getValue.Get(value); + DALI_TEST_CHECK(getValueResult); - if( getValueResult ) + if(getValueResult) { - DALI_TEST_EQUALS( value, ClippingMode::DISABLED, TEST_LOCATION ); + DALI_TEST_EQUALS(value, ClippingMode::DISABLED, TEST_LOCATION); } // Check setting an invalid property value won't change the current property value. - actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" ); + actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY"); - getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE ); - getValueResult = getValue.Get( value ); - DALI_TEST_CHECK( getValueResult ); + getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE); + getValueResult = getValue.Get(value); + DALI_TEST_CHECK(getValueResult); - if( getValueResult ) + if(getValueResult) { - DALI_TEST_EQUALS( value, ClippingMode::DISABLED, TEST_LOCATION ); + DALI_TEST_EQUALS(value, ClippingMode::DISABLED, TEST_LOCATION); } END_TEST; @@ -4225,35 +4228,35 @@ int UtcDaliActorPropertyClippingN(void) int UtcDaliActorPropertyClippingActor(void) { // This test checks that an actor is correctly setup for clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - size_t startIndex = 0u; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + size_t startIndex = 0u; // Create a clipping actor. Actor actorDepth1Clip = CreateActorWithContent16x16(); - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - application.GetScene().Add( actorDepth1Clip ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + application.GetScene().Add(actorDepth1Clip); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + GenerateTrace(application, enabledDisableTrace, stencilTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check the stencil buffer was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST // Check the stencil buffer was cleared. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) ); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex)); // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE END_TEST; } @@ -4261,48 +4264,48 @@ int UtcDaliActorPropertyClippingActor(void) int UtcDaliActorPropertyClippingActorEnableThenDisable(void) { // This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - size_t startIndex = 0u; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + size_t startIndex = 0u; // Create a clipping actor. Actor actorDepth1Clip = CreateActorWithContent16x16(); - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - application.GetScene().Add( actorDepth1Clip ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + application.GetScene().Add(actorDepth1Clip); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + GenerateTrace(application, enabledDisableTrace, stencilTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check the stencil buffer was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST // Check the stencil buffer was cleared. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) ); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex)); // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE // Now disable the clipping - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + GenerateTrace(application, enabledDisableTrace, stencilTrace); // Check the stencil buffer was disabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) ); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", "2960")); // 2960 is GL_STENCIL_TEST // Ensure all values in stencil-mask are set to 1. startIndex = 0u; - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) ); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex)); END_TEST; } @@ -4311,74 +4314,74 @@ int UtcDaliActorPropertyClippingNestedChildren(void) { // This test checks that a hierarchy of actors are clipped correctly by // writing to and reading from the correct bit-planes of the stencil buffer. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children" ); - TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children"); + TestApplication application; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); // Create a clipping actor. Actor actorDepth1Clip = CreateActorWithContent16x16(); - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - application.GetScene().Add( actorDepth1Clip ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + application.GetScene().Add(actorDepth1Clip); // Create a child actor. Actor childDepth2 = CreateActorWithContent16x16(); - actorDepth1Clip.Add( childDepth2 ); + actorDepth1Clip.Add(childDepth2); // Create another clipping actor. Actor childDepth2Clip = CreateActorWithContent16x16(); - childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - childDepth2.Add( childDepth2Clip ); + childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + childDepth2.Add(childDepth2Clip); // Create another 2 child actors. We do this so 2 nodes will have the same clipping ID. // This tests the sort algorithm. Actor childDepth3 = CreateActorWithContent16x16(); - childDepth2Clip.Add( childDepth3 ); + childDepth2Clip.Add(childDepth3); Actor childDepth4 = CreateActorWithContent16x16(); - childDepth3.Add( childDepth4 ); + childDepth3.Add(childDepth4); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + GenerateTrace(application, enabledDisableTrace, stencilTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check the stencil buffer was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST // Perform the test twice, once for 2D layer, and once for 3D. - for( unsigned int i = 0u ; i < 2u; ++i ) + for(unsigned int i = 0u; i < 2u; ++i) { size_t startIndex = 0u; // Check the stencil buffer was cleared. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) ); + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex)); // Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); // Write to the first bit-plane - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node. + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE // Check the correct setup was done to test against first bit-plane (only) of the stencil buffer. - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 255", startIndex ) ); // 514 is GL_EQUAL - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 255", startIndex)); // 514 is GL_EQUAL + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP // Check we are set up to write to the second bitplane of the stencil buffer (only). - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 1", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2 - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "3", startIndex ) ); // Write to second (and previous) bit-planes - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2 + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE // Check we are set up to test against both the first and second bit-planes of the stencil buffer. // (Both must be set to pass the check). - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 255", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2 - DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 255", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2 + DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP // If we are on the first loop, set the layer to 3D and loop to perform the test again. - if( i == 0u ) + if(i == 0u) { - application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D); + GenerateTrace(application, enabledDisableTrace, stencilTrace); } } @@ -4388,10 +4391,10 @@ int UtcDaliActorPropertyClippingNestedChildren(void) int UtcDaliActorPropertyClippingActorDrawOrder(void) { // This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order" ); - TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order"); + TestApplication application; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); /* We create a small tree of actors as follows: @@ -4404,48 +4407,48 @@ int UtcDaliActorPropertyClippingActorDrawOrder(void) The correct draw order is "ABCDE" (the same as if clipping was not enabled). */ Actor actors[5]; - for( int i = 0; i < 5; ++i ) + for(int i = 0; i < 5; ++i) { - Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u ); - Actor actor = CreateRenderableActor( image ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u); + Actor actor = CreateRenderableActor(image); // Setup dimensions and position so actor is not skipped by culling. - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 16.0f, 16.0f ) ); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f)); - if( i == 0 ) + if(i == 0) { - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); } else { float b = i > 2 ? 1.0f : -1.0f; - actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5 + ( 0.2f * b ), 0.8f, 0.8f ) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f)); } actors[i] = actor; } // Enable clipping on the actor at the top of the left branch. - actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); // Build the scene graph. - application.GetScene().Add( actors[0] ); + application.GetScene().Add(actors[0]); // Left branch: - actors[0].Add( actors[1] ); - actors[1].Add( actors[2] ); + actors[0].Add(actors[1]); + actors[1].Add(actors[2]); // Right branch: - actors[0].Add( actors[3] ); - actors[3].Add( actors[4] ); + actors[0].Add(actors[3]); + actors[3].Add(actors[4]); // Gather the call trace. enabledDisableTrace.Reset(); - enabledDisableTrace.Enable( true ); + enabledDisableTrace.Enable(true); application.SendNotification(); application.Render(); - enabledDisableTrace.Enable( false ); + enabledDisableTrace.Enable(false); /* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn). @@ -4453,26 +4456,26 @@ int UtcDaliActorPropertyClippingActorDrawOrder(void) Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960 */ size_t startIndex = 0u; - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "3042", startIndex ) ); - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) ); // 2960 is GL_STENCIL_TEST - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) ); + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "3042", startIndex)); + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex)); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex)); // Swap the clipping actor from top of left branch to top of right branch. - actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED ); - actors[3].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED); + actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); // Gather the call trace. enabledDisableTrace.Reset(); - enabledDisableTrace.Enable( true ); + enabledDisableTrace.Enable(true); application.SendNotification(); application.Render(); - enabledDisableTrace.Enable( false ); + enabledDisableTrace.Enable(false); // Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn). // This proves the draw order has remained the same. startIndex = 0u; - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) ); - DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) ); + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex)); + DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex)); END_TEST; } @@ -4480,50 +4483,50 @@ int UtcDaliActorPropertyClippingActorDrawOrder(void) int UtcDaliActorPropertyScissorClippingActor(void) { // This test checks that an actor is correctly setup for clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ); - const Vector2 imageSize( 16.0f, 16.0f ); + const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + const Vector2 imageSize(16.0f, 16.0f); // Create a clipping actor. Actor clippingActorA = CreateActorWithContent16x16(); // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system. // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test. - clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); - clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); - clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - application.GetScene().Add( clippingActorA ); + clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT); + clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT); + clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + application.GetScene().Add(clippingActorA); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check scissor test was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) // Check the scissor was set, and the coordinates are correct. std::stringstream compareParametersString; compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y; - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 0, 0, 16, 16 + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16 - clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT ); - clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT ); + clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT); + clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check the scissor was set, and the coordinates are correct. - compareParametersString.str( std::string() ); + compareParametersString.str(std::string()); compareParametersString.clear(); - compareParametersString << ( stageSize.x - imageSize.x ) << ", " << ( stageSize.y - imageSize.y ) << ", " << imageSize.x << ", " << imageSize.y; - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 464, 784, 16, 16 + compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y; + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16 END_TEST; } @@ -4531,53 +4534,52 @@ int UtcDaliActorPropertyScissorClippingActor(void) int UtcDaliActorPropertyScissorClippingActorSiblings(void) { // This test checks that an actor is correctly setup for clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings"); TestApplication application; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - - const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ); - const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f }; - const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f }; + const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f}; + const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f}; // Create a clipping actors. - Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height ); - Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height ); + Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height); + Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height); - clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); + clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); - clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); + clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); - clippingActorA.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, -200.0f, 0.0f )); - clippingActorB.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f )); + clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f)); + clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); - application.GetScene().Add( clippingActorA ); - application.GetScene().Add( clippingActorB ); + application.GetScene().Add(clippingActorA); + application.GetScene().Add(clippingActorB); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check scissor test was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) // Check the scissor was set, and the coordinates are correct. std::stringstream compareParametersString; - std::string clipA( "0, 500, 480, 200" ); - std::string clipB( "0, 380, 480, 40" ); + std::string clipA("0, 500, 480, 200"); + std::string clipB("0, 380, 480, 40"); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) ); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) ); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA)); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB)); END_TEST; } @@ -4585,15 +4587,15 @@ int UtcDaliActorPropertyScissorClippingActorSiblings(void) int UtcDaliActorPropertyScissorClippingActorNested01(void) { // This test checks that an actor is correctly setup for clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ); - const Vector2 imageSize( 16.0f, 16.0f ); + const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + const Vector2 imageSize(16.0f, 16.0f); /* Create a nest of 2 scissors to test nesting (intersecting clips). @@ -4616,44 +4618,44 @@ int UtcDaliActorPropertyScissorClippingActorNested01(void) Actor clippingActorA = CreateActorWithContent16x16(); // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system. // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test. - clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - application.GetScene().Add( clippingActorA ); + clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + application.GetScene().Add(clippingActorA); // Create a child clipping actor. Actor clippingActorB = CreateActorWithContent16x16(); - clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - clippingActorA.Add( clippingActorB ); + clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + clippingActorA.Add(clippingActorB); // positionModifiers is an array of positions to position B around. // expect is an array of expected scissor clip coordinate results. - const Vector2 positionModifiers[4] = { Vector2( 1.0f, 1.0f ), Vector2( -1.0f, 1.0f ), Vector2( -1.0f, -1.0f ), Vector2( 1.0f, -1.0f ) }; - const Vector4 expect[4] = { Vector4( 240, 392, 8, 8 ), Vector4( 232, 392, 8, 8 ), Vector4( 232, 400, 8, 8 ), Vector4( 240, 400, 8, 8 ) }; + const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)}; + const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)}; // Loop through each overlap combination. - for( unsigned int test = 0u; test < 4u; ++test ) + for(unsigned int test = 0u; test < 4u; ++test) { // Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop. - const Vector2 position = ( imageSize / 2.0f ) * positionModifiers[test]; - clippingActorB.SetProperty( Actor::Property::POSITION, Vector2( position.x, position.y )); + const Vector2 position = (imageSize / 2.0f) * positionModifiers[test]; + clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y)); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check scissor test was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) // Check the scissor was set, and the coordinates are correct. - const Vector4& expectResults( expect[test] ); + const Vector4& expectResults(expect[test]); std::stringstream compareParametersString; compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w; - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with the expected result + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result } END_TEST; @@ -4662,12 +4664,12 @@ int UtcDaliActorPropertyScissorClippingActorNested01(void) int UtcDaliActorPropertyScissorClippingActorNested02(void) { // This test checks that an actor is correctly setup for clipping. - tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" ); + tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); /* Create a nest of 2 scissors and siblings of the parent. @@ -4679,71 +4681,71 @@ int UtcDaliActorPropertyScissorClippingActorNested02(void) B E */ - const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ); - const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f }; - const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f }; - const Vector2 sizeC{ stageSize.width, stageSize.height * 0.25f }; - const Vector2 sizeD{ stageSize.width, stageSize.height * 0.25f }; - const Vector2 sizeE{ stageSize.width, stageSize.height * 0.05f }; + const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); + const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f}; + const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f}; + const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f}; + const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f}; + const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f}; // Create a clipping actors. - Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height ); - Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height ); - Actor clippingActorC = CreateActorWithContent( sizeC.width, sizeC.height ); - Actor clippingActorD = CreateActorWithContent( sizeD.width, sizeD.height ); - Actor clippingActorE = CreateActorWithContent( sizeE.width, sizeE.height ); - - clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - - clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - - clippingActorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorC.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - - clippingActorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - clippingActorD.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); - - clippingActorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT ); - clippingActorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - - clippingActorA.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, -200.0f, 0.0f )); - clippingActorB.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f )); - clippingActorC.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 100.0f, 0.0f )); - clippingActorD.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f )); - clippingActorE.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f )); - - application.GetScene().Add( clippingActorA ); - clippingActorA.Add( clippingActorB ); - application.GetScene().Add( clippingActorC ); - application.GetScene().Add( clippingActorD ); - clippingActorD.Add( clippingActorE ); + Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height); + Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height); + Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height); + Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height); + Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height); + + clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + + clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + + clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + + clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + + clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT); + clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + + clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f)); + clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f)); + clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + + application.GetScene().Add(clippingActorA); + clippingActorA.Add(clippingActorB); + application.GetScene().Add(clippingActorC); + application.GetScene().Add(clippingActorD); + clippingActorD.Add(clippingActorE); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check scissor test was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) // Check the scissor was set, and the coordinates are correct. - std::string clipA( "0, 500, 480, 200" ); - std::string clipB( "0, 580, 480, 40" ); - std::string clipC( "0, 200, 480, 200" ); - std::string clipD( "0, 300, 480, 200" ); + std::string clipA("0, 500, 480, 200"); + std::string clipB("0, 580, 480, 40"); + std::string clipC("0, 200, 480, 200"); + std::string clipD("0, 300, 480, 200"); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) ); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) ); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipC ) ); - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipD ) ); - DALI_TEST_CHECK( scissorTrace.CountMethod( "Scissor" ) == 4 ); // Scissor rect should not be changed in clippingActorE case. So count should be 4. + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA)); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB)); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC)); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD)); + DALI_TEST_CHECK(scissorTrace.CountMethod("Scissor") == 4); // Scissor rect should not be changed in clippingActorE case. So count should be 4. END_TEST; } @@ -4751,203 +4753,203 @@ int UtcDaliActorPropertyScissorClippingActorNested02(void) int UtcDaliActorPropertyClippingActorWithRendererOverride(void) { // This test checks that an actor with clipping will be ignored if overridden by the Renderer properties. - tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" ); + tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override"); TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); // Create a clipping actor. Actor actorDepth1Clip = CreateActorWithContent16x16(); - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - application.GetScene().Add( actorDepth1Clip ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + application.GetScene().Add(actorDepth1Clip); // Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode. - actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR ); + actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, stencilTrace ); + GenerateTrace(application, enabledDisableTrace, stencilTrace); // Check we are writing to the color buffer. - CheckColorMask( glAbstraction, true ); + CheckColorMask(glAbstraction, true); // Check the stencil buffer was not enabled. - DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST + DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST // Check stencil functions are not called. - DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) ); - DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) ); - DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) ); + DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc")); + DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask")); + DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp")); // Check that scissor clipping is overriden by the renderer properties. TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); - actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); + actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); // Gather the call trace. - GenerateTrace( application, enabledDisableTrace, scissorTrace ); + GenerateTrace(application, enabledDisableTrace, scissorTrace); // Check the stencil buffer was not enabled. - DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) - DALI_TEST_CHECK( !scissorTrace.FindMethod( "StencilFunc" ) ); + DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc")); END_TEST; } int UtcDaliGetPropertyN(void) { - tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" ); + tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range"); TestApplication application; Actor actor = Actor::New(); unsigned int propertyCount = actor.GetPropertyCount(); - DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION); END_TEST; } int UtcDaliActorRaiseLower(void) { - tet_infoline( "UtcDaliActor Raise and Lower test\n" ); + tet_infoline("UtcDaliActor Raise and Lower test\n"); TestApplication application; - Debug::Filter::SetGlobalLogLevel( Debug::Verbose ); + Debug::Filter::SetGlobalLogLevel(Debug::Verbose); - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - stage.Add( actorA ); - stage.Add( actorB ); - stage.Add( actorC ); + stage.Add(actorA); + stage.Add(actorB); + stage.Add(actorC); ResetTouchCallbacks(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Testing Raising of Actor\n" ); + tet_printf("Testing Raising of Actor\n"); - int preActorOrder( 0 ); - int postActorOrder( 0 ); + int preActorOrder(0); + int postActorOrder(0); - Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); - value.Get( preActorOrder ); + Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER); + value.Get(preActorOrder); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.Raise(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); // Ensure sort order is calculated before next touch event application.SendNotification(); - value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); - value.Get( postActorOrder ); + value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER); + value.Get(postActorOrder); - tet_printf( "Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder ); + tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true , TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Testing Lowering of Actor\n" ); + tet_printf("Testing Lowering of Actor\n"); - value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); - value.Get( preActorOrder ); + value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER); + value.Get(preActorOrder); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.Lower(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); application.SendNotification(); // ensure sort order calculated before next touch event - value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); - value.Get( postActorOrder ); + value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER); + value.Get(postActorOrder); - tet_printf( "Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder ); + tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false , TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - Debug::Filter::SetGlobalLogLevel( Debug::NoLogging ); + Debug::Filter::SetGlobalLogLevel(Debug::NoLogging); END_TEST; } int UtcDaliActorRaiseToTopLowerToBottom(void) { - tet_infoline( "UtcDaliActorRaiseToTop and LowerToBottom test \n" ); + tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); @@ -4956,13 +4958,13 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each // enables checking of which actor the uniform is assigned too Shader shaderA = CreateShader(); - shaderA.RegisterProperty( "uRendererColor",1.f); + shaderA.RegisterProperty("uRendererColor", 1.f); Shader shaderB = CreateShader(); - shaderB.RegisterProperty( "uRendererColor", 2.f ); + shaderB.RegisterProperty("uRendererColor", 2.f); Shader shaderC = CreateShader(); - shaderC.RegisterProperty( "uRendererColor", 3.f ); + shaderC.RegisterProperty("uRendererColor", 3.f); Geometry geometry = CreateQuadGeometry(); @@ -4976,35 +4978,35 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) Renderer rendererC = Renderer::New(geometry, shaderC); actorC.AddRenderer(rendererC); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - stage.Add( actorA ); - stage.Add( actorB ); - stage.Add( actorC ); + stage.Add(actorA); + stage.Add(actorB); + stage.Add(actorC); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); // Set up gl abstraction trace so can query the set uniform order TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); @@ -5016,53 +5018,52 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) application.SendNotification(); application.Render(); - tet_printf( "Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str() ); - + tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - bool CBA = ( indexC > indexB) && ( indexB > indexA ); + bool CBA = (indexC > indexB) && (indexB > indexA); - DALI_TEST_EQUALS( CBA, true, TEST_LOCATION ); + DALI_TEST_EQUALS(CBA, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "RaiseToTop ActorA\n" ); + tet_printf("RaiseToTop ActorA\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorA.RaiseToTop(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); application.SendNotification(); // ensure sorting order is calculated before next touch event - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); @@ -5070,36 +5071,36 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) application.SendNotification(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - tet_infoline( "Testing A above C and B at bottom\n" ); - bool ACB = ( indexA > indexC) && ( indexC > indexB ); + tet_infoline("Testing A above C and B at bottom\n"); + bool ACB = (indexA > indexC) && (indexC > indexB); - DALI_TEST_EQUALS( ACB, true, TEST_LOCATION ); + DALI_TEST_EQUALS(ACB, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "RaiseToTop ActorB\n" ); + tet_printf("RaiseToTop ActorB\n"); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.RaiseToTop(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); application.SendNotification(); // Ensure sort order is calculated before next touch event - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); @@ -5107,47 +5108,47 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) application.SendNotification(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - tet_infoline( "Testing B above A and C at bottom\n" ); - bool BAC = ( indexB > indexA ) && ( indexA > indexC ); + tet_infoline("Testing B above A and C at bottom\n"); + bool BAC = (indexB > indexA) && (indexA > indexC); - DALI_TEST_EQUALS( BAC, true, TEST_LOCATION ); + DALI_TEST_EQUALS(BAC, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" ); + tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n"); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorA.LowerToBottom(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); application.SendNotification(); application.Render(); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.LowerToBottom(); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); @@ -5155,21 +5156,21 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) application.SendNotification(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - tet_infoline( "Testing C above A and B at bottom\n" ); - bool CAB = ( indexC > indexA ) && ( indexA > indexB ); + tet_infoline("Testing C above A and B at bottom\n"); + bool CAB = (indexC > indexA) && (indexA > indexB); - DALI_TEST_EQUALS( CAB, true, TEST_LOCATION ); + DALI_TEST_EQUALS(CAB, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); @@ -5178,107 +5179,107 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) int UtcDaliActorRaiseAbove(void) { - tet_infoline( "UtcDaliActor RaiseToAbove test \n" ); + tet_infoline("UtcDaliActor RaiseToAbove test \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - stage.Add( actorA ); - stage.Add( actorB ); - stage.Add( actorC ); + stage.Add(actorA); + stage.Add(actorB); + stage.Add(actorC); ResetTouchCallbacks(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Raise actor B Above Actor C\n" ); + tet_printf("Raise actor B Above Actor C\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorB.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorB.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Raise actor A Above Actor B\n" ); + tet_printf("Raise actor A Above Actor B\n"); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorB ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorB); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); // process a touch event on ordered actors. + application.ProcessEvent(touchEvent); // process a touch event on ordered actors. - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); @@ -5287,22 +5288,22 @@ int UtcDaliActorRaiseAbove(void) int UtcDaliActorLowerBelow(void) { - tet_infoline( "UtcDaliActor LowerBelow test \n" ); + tet_infoline("UtcDaliActor LowerBelow test \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each // enables checking of which actor the uniform is assigned too Shader shaderA = CreateShader(); - shaderA.RegisterProperty( "uRendererColor",1.f); + shaderA.RegisterProperty("uRendererColor", 1.f); Shader shaderB = CreateShader(); - shaderB.RegisterProperty( "uRendererColor", 2.f ); + shaderB.RegisterProperty("uRendererColor", 2.f); Shader shaderC = CreateShader(); - shaderC.RegisterProperty( "uRendererColor", 3.f ); + shaderC.RegisterProperty("uRendererColor", 3.f); Actor actorA = Actor::New(); Actor actorB = Actor::New(); @@ -5320,40 +5321,40 @@ int UtcDaliActorLowerBelow(void) Renderer rendererC = Renderer::New(geometry, shaderC); actorC.AddRenderer(rendererC); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); Actor container = Actor::New(); - container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - stage.Add( container ); + container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + stage.Add(container); - container.Add( actorA ); - container.Add( actorB ); - container.Add( actorC ); + container.Add(actorA); + container.Add(actorB); + container.Add(actorC); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( container ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(container).Connect(&application, f); // Set up gl abstraction trace so can query the set uniform order TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); @@ -5368,57 +5369,57 @@ int UtcDaliActorLowerBelow(void) glSetUniformStack = glAbstraction.GetSetUniformTrace(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - tet_infoline( "Testing C above B and A at bottom\n" ); - bool CBA = ( indexC > indexB) && ( indexB > indexA ); + tet_infoline("Testing C above B and A at bottom\n"); + bool CBA = (indexC > indexB) && (indexB > indexA); - DALI_TEST_EQUALS( CBA, true, TEST_LOCATION ); + DALI_TEST_EQUALS(CBA, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - tet_infoline( "UtcDaliActor Test Set up completed \n" ); + tet_infoline("UtcDaliActor Test Set up completed \n"); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n" ); + tet_printf("Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorC.LowerBelow( actorB ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorC.LowerBelow(actorB); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); // touch event + application.ProcessEvent(touchEvent); // touch event glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); @@ -5426,193 +5427,192 @@ int UtcDaliActorLowerBelow(void) application.SendNotification(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - tet_infoline( "Testing render order is A, C, B" ); - DALI_TEST_EQUALS( indexC > indexA, true, TEST_LOCATION ); - DALI_TEST_EQUALS( indexB > indexC, true, TEST_LOCATION ); + tet_infoline("Testing render order is A, C, B"); + DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION); + DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Lower actor C below Actor A leaving B on top\n" ); + tet_printf("Lower actor C below Actor A leaving B on top\n"); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorC.LowerBelow( actorA ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorC.LowerBelow(actorA); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION ); - DALI_TEST_EQUALS( indexB > indexA, true, TEST_LOCATION ); + DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION); + DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Lower actor B below Actor C leaving A on top\n" ); + tet_printf("Lower actor B below Actor C leaving A on top\n"); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorB.LowerBelow( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorB.LowerBelow(actorC); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); glAbstraction.ResetSetUniformCallStack(); glSetUniformStack = glAbstraction.GetSetUniformTrace(); application.Render(); - tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() ); + tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str()); // Test order of uniforms in stack - indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" ); - indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" ); - indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" ); + indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3"); + indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2"); + indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1"); - DALI_TEST_EQUALS( indexC > indexB, true, TEST_LOCATION ); - DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION ); + DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION); + DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION); END_TEST; } - int UtcDaliActorRaiseAboveDifferentParentsN(void) { - tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" ); + tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor parentA = Actor::New(); Actor parentB = Actor::New(); - parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); - parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); + parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - parentA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - parentA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - parentB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - parentB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - stage.Add( parentA ); - stage.Add( parentB ); + stage.Add(parentA); + stage.Add(parentB); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - parentA.Add( actorA ); - parentA.Add( actorB ); + parentA.Add(actorA); + parentA.Add(actorB); - tet_printf( "Actor C added to different parent from A and B \n" ); - parentB.Add( actorC ); + tet_printf("Actor C added to different parent from A and B \n"); + parentB.Add(actorC); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_printf( "Raise actor A Above Actor C which have different parents\n" ); + tet_printf("Raise actor A Above Actor C which have different parents\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); // touch event + application.ProcessEvent(touchEvent); // touch event - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); @@ -5621,657 +5621,656 @@ int UtcDaliActorRaiseAboveDifferentParentsN(void) int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) { - tet_infoline( "UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n" ); + tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - tet_printf( "Raise actor A Above Actor C which have no parents\n" ); + tet_printf("Raise actor A Above Actor C which have no parents\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so RaiseAbove should show no effect\n" ); + tet_printf("Not parented so RaiseAbove should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - stage.Add ( actorB ); - tet_printf( "Lower actor A below Actor C when only A is not on stage \n" ); + stage.Add(actorB); + tet_printf("Lower actor A below Actor C when only A is not on stage \n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.LowerBelow( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.LowerBelow(actorC); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Actor A not parented so LowerBelow should show no effect\n" ); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + tet_printf("Actor A not parented so LowerBelow should show no effect\n"); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - tet_printf( "Adding Actor A to stage, will be on top\n" ); + tet_printf("Adding Actor A to stage, will be on top\n"); - stage.Add ( actorA ); + stage.Add(actorA); application.SendNotification(); application.Render(); - tet_printf( "Raise actor B Above Actor C when only B has a parent\n" ); + tet_printf("Raise actor B Above Actor C when only B has a parent\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorB.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorB.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "C not parented so RaiseAbove should show no effect\n" ); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + tet_printf("C not parented so RaiseAbove should show no effect\n"); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - tet_printf( "Lower actor A below Actor C when only A has a parent\n" ); + tet_printf("Lower actor A below Actor C when only A has a parent\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.LowerBelow( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.LowerBelow(actorC); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "C not parented so LowerBelow should show no effect\n" ); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + tet_printf("C not parented so LowerBelow should show no effect\n"); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - stage.Add ( actorC ); + stage.Add(actorC); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Raise actor A Above Actor C, now both have same parent \n" ); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + tet_printf("Raise actor A Above Actor C, now both have same parent \n"); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); END_TEST; } int UtcDaliActorTestAllAPIwhenActorNotParented(void) { - tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" ); + tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - stage.Add ( actorA ); - tet_printf( "Raise actor B Above Actor C but B not parented\n" ); + stage.Add(actorA); + tet_printf("Raise actor B Above Actor C but B not parented\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.Raise(); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so RaiseAbove should show no effect\n" ); + tet_printf("Not parented so RaiseAbove should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); - tet_printf( "Raise actor B Above Actor C but B not parented\n" ); + tet_printf("Raise actor B Above Actor C but B not parented\n"); ResetTouchCallbacks(); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorC.Lower(); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Sort actor tree before next touch event application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so RaiseAbove should show no effect\n" ); + tet_printf("Not parented so RaiseAbove should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - tet_printf( "Lower actor C below B but C not parented\n" ); + tet_printf("Lower actor C below B but C not parented\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.Lower(); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Sort actor tree before next touch event application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so Lower should show no effect\n" ); + tet_printf("Not parented so Lower should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - tet_printf( "Raise actor B to top\n" ); + tet_printf("Raise actor B to top\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorB.RaiseToTop(); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); // Sort actor tree before next touch event application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so RaiseToTop should show no effect\n" ); + tet_printf("Not parented so RaiseToTop should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - tet_printf( "Add ActorB to stage so only Actor C not parented\n" ); + tet_printf("Add ActorB to stage so only Actor C not parented\n"); - stage.Add ( actorB ); + stage.Add(actorB); - tet_printf( "Lower actor C to Bottom, B stays at top\n" ); + tet_printf("Lower actor C to Bottom, B stays at top\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); actorC.LowerToBottom(); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_printf( "Not parented so LowerToBottom should show no effect\n" ); + tet_printf("Not parented so LowerToBottom should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); ResetTouchCallbacks(); END_TEST; } - int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) { - tet_infoline( "UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n" ); + tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); Actor actorB = Actor::New(); Actor actorC = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" ); - actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" ); + actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT"); + actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT"); - stage.Add( actorA ); - stage.Add( actorB ); - stage.Add( actorC ); + stage.Add(actorA); + stage.Add(actorB); + stage.Add(actorC); // connect to actor touch signals, will use touch callbacks to determine which actor is on top. // Only top actor will get touched. - actorA.TouchedSignal().Connect( TestTouchCallback ); - actorB.TouchedSignal().Connect( TestTouchCallback2 ); - actorC.TouchedSignal().Connect( TestTouchCallback3 ); + actorA.TouchedSignal().Connect(TestTouchCallback); + actorB.TouchedSignal().Connect(TestTouchCallback2); + actorC.TouchedSignal().Connect(TestTouchCallback3); ResetTouchCallbacks(); // Connect ChildOrderChangedSignal - bool orderChangedSignal( false ); - Actor orderChangedActor; - ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor ); - DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ; + bool orderChangedSignal(false); + Actor orderChangedActor; + ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor); + DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f); application.SendNotification(); application.Render(); Dali::Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.f, 10.f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.f, 10.f)); Dali::Integration::TouchEvent touchEvent; - touchEvent.AddPoint( point ); + touchEvent.AddPoint(point); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); - tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" ); + tet_infoline("Raise actor A Above Actor A which is the same actor!!\n"); - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorA ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorA); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_infoline( "No target is source Actor so RaiseAbove should show no effect\n" ); + tet_infoline("No target is source Actor so RaiseAbove should show no effect\n"); - DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION ); + DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION); ResetTouchCallbacks(); orderChangedSignal = false; - DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION ); - actorA.RaiseAbove( actorC ); - DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION ); + DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION); + actorA.RaiseAbove(actorC); + DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION); application.SendNotification(); application.Render(); - application.ProcessEvent( touchEvent ); + application.ProcessEvent(touchEvent); - tet_infoline( "Raise actor A Above Actor C which will now be successful \n" ); - DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION ); + tet_infoline("Raise actor A Above Actor C which will now be successful \n"); + DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION); + DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION); END_TEST; } int UtcDaliActorGetScreenPosition(void) { - tet_infoline( "UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); - Vector2 size2( 10.0f, 20.0f ); - actorA.SetProperty( Actor::Property::SIZE, size2 ); + Vector2 size2(10.0f, 20.0f); + actorA.SetProperty(Actor::Property::SIZE, size2); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n"); - stage.Add( actorA ); + stage.Add(actorA); application.SendNotification(); application.Render(); - Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION); - tet_infoline( "UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n"); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION); - tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n"); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION); - tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n"); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 0.0 )); + actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0)); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION); - tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n"); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 420.0 )); + actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0)); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 420lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y); - tet_infoline( "UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n" ); + tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n"); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 30.0 )); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0)); Actor actorB = Actor::New(); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorB.SetProperty( Actor::Property::SIZE, size2 ); - actorB.SetProperty( Actor::Property::POSITION, Vector2( 10.f, 10.f )); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorB.SetProperty(Actor::Property::SIZE, size2); + actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f)); + actorA.Add(actorB); - actorA.SetProperty( Actor::Property::SCALE, 2.0f ); + actorA.SetProperty(Actor::Property::SCALE, 2.0f); application.SendNotification(); application.Render(); - actorScreenPosition = actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - DALI_TEST_EQUALS( actorScreenPosition.x, 50lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 50lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION); END_TEST; } int UtcDaliActorGetScreenPositionAfterScaling(void) { - tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n" ); + tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - Vector2 size2( 10.0f, 20.0f ); - actorA.SetProperty( Actor::Property::SIZE, size2 ); - actorA.SetProperty( Actor::Property::SCALE, 1.5f ); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + Vector2 size2(10.0f, 20.0f); + actorA.SetProperty(Actor::Property::SIZE, size2); + actorA.SetProperty(Actor::Property::SCALE, 1.5f); + actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n"); - stage.Add( actorA ); + stage.Add(actorA); application.SendNotification(); application.Render(); - Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION); - tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n" ); + tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n"); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x , 0.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION); END_TEST; } int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void) { - tet_infoline( "UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n" ); + tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - Vector2 size2( 10.0f, 20.0f ); - actorA.SetProperty( Actor::Property::SIZE, size2 ); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector2 size2(10.0f, 20.0f); + actorA.SetProperty(Actor::Property::SIZE, size2); + actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( " TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" ); + tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n"); - stage.Add( actorA ); + stage.Add(actorA); application.SendNotification(); application.Render(); - Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 240.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 400.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION); - tet_infoline( " BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n" ); + tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n"); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT ); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x , 480.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION); END_TEST; END_TEST; @@ -6279,188 +6278,188 @@ int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void) int UtcDaliActorGetScreenPositionWithChildActors(void) { - tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n" ); + tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); - tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" ); + tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n"); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - Vector2 size1( 10.0f, 20.0f ); - actorA.SetProperty( Actor::Property::SIZE, size1 ); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector2 size1(10.0f, 20.0f); + actorA.SetProperty(Actor::Property::SIZE, size1); + actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" ); + tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n"); Actor parentActorA = Actor::New(); - parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - Vector2 size2( 30.0f, 60.0f ); - parentActorA.SetProperty( Actor::Property::SIZE, size2 ); - parentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector2 size2(30.0f, 60.0f); + parentActorA.SetProperty(Actor::Property::SIZE, size2); + parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "Add child 1 to Parent 1 and check screen position \n" ); + tet_infoline("Add child 1 to Parent 1 and check screen position \n"); - stage.Add( parentActorA ); - parentActorA.Add ( actorA ); + stage.Add(parentActorA); + parentActorA.Add(actorA); application.SendNotification(); application.Render(); - Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 255.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 430.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION); - tet_infoline( "Test 2\n"); + tet_infoline("Test 2\n"); - tet_infoline( "change parent anchor point and parent origin then check screen position \n" ); + tet_infoline("change parent anchor point and parent origin then check screen position \n"); - parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); - parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT); + parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); application.SendNotification(); application.Render(); - actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 15.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, -30.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION); END_TEST; } int UtcDaliActorGetScreenPositionWithChildActors02(void) { - tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n" ); + tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); - tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" ); + tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n"); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - Vector2 size1( 10.0f, 20.0f ); - actorA.SetProperty( Actor::Property::SIZE, size1 ); - actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector2 size1(10.0f, 20.0f); + actorA.SetProperty(Actor::Property::SIZE, size1); + actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" ); + tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n"); Actor parentActorA = Actor::New(); - parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - Vector2 size2( 30.0f, 60.0f ); - parentActorA.SetProperty( Actor::Property::SIZE, size2 ); - parentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + Vector2 size2(30.0f, 60.0f); + parentActorA.SetProperty(Actor::Property::SIZE, size2); + parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n" ); + tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n"); Actor grandParentActorA = Actor::New(); - grandParentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); - grandParentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); - Vector2 size3( 60.0f, 120.0f ); - grandParentActorA.SetProperty( Actor::Property::SIZE, size3 ); - grandParentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f )); + grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT); + grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT); + Vector2 size3(60.0f, 120.0f); + grandParentActorA.SetProperty(Actor::Property::SIZE, size3); + grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f)); - tet_infoline( "Add Parent 1 to Grand Parent 1 \n" ); + tet_infoline("Add Parent 1 to Grand Parent 1 \n"); - stage.Add( grandParentActorA ); - grandParentActorA.Add ( parentActorA ); + stage.Add(grandParentActorA); + grandParentActorA.Add(parentActorA); - tet_infoline( "Add child 1 to Parent 1 and check screen position \n" ); + tet_infoline("Add child 1 to Parent 1 and check screen position \n"); - parentActorA.Add ( actorA ); + parentActorA.Add(actorA); application.SendNotification(); application.Render(); - Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >(); - Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(); + Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get(); + Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(); - tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y ); - tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y); + tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y); - DALI_TEST_EQUALS( actorScreenPosition.x, 45.0f , TEST_LOCATION ); - DALI_TEST_EQUALS( actorScreenPosition.y, 770.0f , TEST_LOCATION ); + DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION); END_TEST; } int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void) { - tet_infoline( "UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point" ); + tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point"); TestApplication application; - Integration::Scene stage( application.GetScene() ); + Integration::Scene stage(application.GetScene()); - tet_infoline( "Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" ); + tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false"); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actorA.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - actorA.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 20.0f ) ); - stage.Add( actorA ); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f)); + stage.Add(actorA); - tet_infoline( "Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" ); + tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false"); Actor actorB = Actor::New(); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actorB.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - Vector2 actorBSize( 30.0f, 60.0f ); - actorB.SetProperty( Actor::Property::SIZE, actorBSize ); - stage.Add( actorB ); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + Vector2 actorBSize(30.0f, 60.0f); + actorB.SetProperty(Actor::Property::SIZE, actorBSize); + stage.Add(actorB); - tet_infoline( "Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" ); + tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false"); Actor actorC = Actor::New(); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actorC.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - Vector2 actorCSize( 60.0f, 120.0f ); - actorC.SetProperty( Actor::Property::SIZE, actorCSize ); - stage.Add( actorC ); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + Vector2 actorCSize(60.0f, 120.0f); + actorC.SetProperty(Actor::Property::SIZE, actorCSize); + stage.Add(actorC); application.SendNotification(); application.Render(); - tet_infoline( "Despite differing sizes and anchor-points, the screen position for all actors is the same"); + tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same"); - Vector2 center( stage.GetSize() * 0.5f ); + Vector2 center(stage.GetSize() * 0.5f); - DALI_TEST_EQUALS( actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION ); - DALI_TEST_EQUALS( actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION ); - DALI_TEST_EQUALS( actorC.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION ); + DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center, TEST_LOCATION); + DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center, TEST_LOCATION); + DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center, TEST_LOCATION); - tet_infoline( "Add scale to all actors" ); + tet_infoline("Add scale to all actors"); - actorA.SetProperty( Actor::Property::SCALE, 2.0f ); - actorB.SetProperty( Actor::Property::SCALE, 2.0f ); - actorC.SetProperty( Actor::Property::SCALE, 2.0f ); + actorA.SetProperty(Actor::Property::SCALE, 2.0f); + actorB.SetProperty(Actor::Property::SCALE, 2.0f); + actorC.SetProperty(Actor::Property::SCALE, 2.0f); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center /* TOP_LEFT Anchor */, TEST_LOCATION ); - DALI_TEST_EQUALS( actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION ); - DALI_TEST_EQUALS( actorC.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center /* TOP_LEFT Anchor */, TEST_LOCATION); + DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION); + DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION); END_TEST; } @@ -6468,28 +6467,28 @@ int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void) int utcDaliActorPositionUsesAnchorPoint(void) { TestApplication application; - tet_infoline( "Check default behaviour\n" ); + tet_infoline("Check default behaviour\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - tet_infoline( "Check that the world position is in the center\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + tet_infoline("Check that the world position is in the center\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Set the position uses anchor point property to false\n" ); - actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); + tet_infoline("Set the position uses anchor point property to false\n"); + actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); application.SendNotification(); application.Render(); - tet_infoline( "Check that the world position has changed appropriately\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION ); + tet_infoline("Check that the world position has changed appropriately\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -6497,33 +6496,33 @@ int utcDaliActorPositionUsesAnchorPoint(void) int utcDaliActorPositionUsesAnchorPointCheckScale(void) { TestApplication application; - tet_infoline( "Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" ); + tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::SCALE, 2.0f ); - actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::SCALE, 2.0f); + actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - tet_infoline( "Check the world position is the same as it would be without a scale\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION ); + tet_infoline("Check the world position is the same as it would be without a scale\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -6531,33 +6530,33 @@ int utcDaliActorPositionUsesAnchorPointCheckScale(void) int utcDaliActorPositionUsesAnchorPointCheckRotation(void) { TestApplication application; - tet_infoline( "Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" ); + tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 90.0f), Vector3::ZAXIS ) ); - actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS)); + actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - tet_infoline( "Check the world position is the same as it would be without a rotation\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION ); + tet_infoline("Check the world position is the same as it would be without a rotation\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -50.0f, 50.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 150.0f, 50.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -6565,34 +6564,34 @@ int utcDaliActorPositionUsesAnchorPointCheckRotation(void) int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void) { TestApplication application; - tet_infoline( "Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" ); + tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 90.0f), Vector3::ZAXIS ) ); - actor.SetProperty( Actor::Property::SCALE, 2.0f ); - actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS)); + actor.SetProperty(Actor::Property::SCALE, 2.0f); + actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - tet_infoline( "Check the world position is the same as it would be without a scale and rotation\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION ); + tet_infoline("Check the world position is the same as it would be without a scale and rotation\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -100.0f, 100.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION); - tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -6600,41 +6599,41 @@ int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void) int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void) { TestApplication application; - tet_infoline( "Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" ); + tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n"); Actor parent = Actor::New(); - application.GetScene().Add( parent ); - Vector2 stageSize( application.GetScene().GetSize() ); + application.GetScene().Add(parent); + Vector2 stageSize(application.GetScene().GetSize()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::INHERIT_SCALE, false ); - actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false ); - actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false ); - parent.Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::INHERIT_SCALE, false); + actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false); + actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false); + parent.Add(actor); application.SendNotification(); application.Render(); - const Vector3 expectedWorldPosition( -stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f ); + const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f); - tet_infoline( "Check the world position is in the right place\n" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION ); + tet_infoline("Check the world position is in the right place\n"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION); - tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION); - tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT ); + tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION); END_TEST; } @@ -6642,34 +6641,34 @@ int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void) int utcDaliActorVisibilityChangeSignalSelf(void) { TestApplication application; - tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" ); + tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself"); Actor actor = Actor::New(); VisibilityChangedFunctorData data; - DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) ); + DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data)); - actor.SetProperty( Actor::Property::VISIBLE, false ); + actor.SetProperty(Actor::Property::VISIBLE, false); - data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); + data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION); - tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" ); + tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at"); data.Reset(); - actor.SetProperty( Actor::Property::VISIBLE, false ); - data.Check( false /* not called */, TEST_LOCATION ); + actor.SetProperty(Actor::Property::VISIBLE, false); + data.Check(false /* not called */, TEST_LOCATION); - tet_infoline( "Change the visibility using properties, ensure called" ); + tet_infoline("Change the visibility using properties, ensure called"); data.Reset(); - actor.SetProperty( Actor::Property::VISIBLE, true ); - data.Check( true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); + actor.SetProperty(Actor::Property::VISIBLE, true); + data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION); - tet_infoline( "Set the visibility to current using properties, ensure not called" ); + tet_infoline("Set the visibility to current using properties, ensure not called"); data.Reset(); - actor.SetProperty( Actor::Property::VISIBLE, true ); - data.Check( false /* not called */, TEST_LOCATION ); + actor.SetProperty(Actor::Property::VISIBLE, true); + data.Check(false /* not called */, TEST_LOCATION); END_TEST; } @@ -6677,49 +6676,49 @@ int utcDaliActorVisibilityChangeSignalSelf(void) int utcDaliActorVisibilityChangeSignalChildren(void) { TestApplication application; - tet_infoline( "Check that the visibility change signal is called for the children when the visibility changes for the parent" ); + tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent"); Actor parent = Actor::New(); - Actor child = Actor::New(); - parent.Add( child ); + Actor child = Actor::New(); + parent.Add(child); Actor grandChild = Actor::New(); - child.Add( grandChild ); + child.Add(grandChild); VisibilityChangedFunctorData parentData; VisibilityChangedFunctorData childData; VisibilityChangedFunctorData grandChildData; - tet_infoline( "Only connect the child and grandchild, ensure they are called and not the parent" ); - DevelActor::VisibilityChangedSignal( child ).Connect( &application, VisibilityChangedFunctor( childData ) ); - DevelActor::VisibilityChangedSignal( grandChild ).Connect( &application, VisibilityChangedFunctor( grandChildData ) ); + tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent"); + DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData)); + DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData)); - parent.SetProperty( Actor::Property::VISIBLE, false ); - parentData.Check( false /* not called */, TEST_LOCATION ); - childData.Check( true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION ); - grandChildData.Check( true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION ); + parent.SetProperty(Actor::Property::VISIBLE, false); + parentData.Check(false /* not called */, TEST_LOCATION); + childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION); + grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION); - tet_infoline( "Connect to the parent's signal as well and ensure all three are called" ); + tet_infoline("Connect to the parent's signal as well and ensure all three are called"); parentData.Reset(); childData.Reset(); grandChildData.Reset(); - DevelActor::VisibilityChangedSignal( parent ).Connect( &application, VisibilityChangedFunctor( parentData ) ); + DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData)); - parent.SetProperty( Actor::Property::VISIBLE, true ); - parentData.Check( true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); - childData.Check( true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION ); - grandChildData.Check( true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION ); + parent.SetProperty(Actor::Property::VISIBLE, true); + parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION); + childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION); + grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION); - tet_infoline( "Ensure none of the functors are called if we attempt to change the visibility to what it already is at" ); + tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at"); parentData.Reset(); childData.Reset(); grandChildData.Reset(); - parent.SetProperty( Actor::Property::VISIBLE, true ); - parentData.Check( false /* not called */, TEST_LOCATION ); - childData.Check( false /* not called */, TEST_LOCATION ); - grandChildData.Check( false /* not called */, TEST_LOCATION ); + parent.SetProperty(Actor::Property::VISIBLE, true); + parentData.Check(false /* not called */, TEST_LOCATION); + childData.Check(false /* not called */, TEST_LOCATION); + grandChildData.Check(false /* not called */, TEST_LOCATION); END_TEST; } @@ -6727,75 +6726,73 @@ int utcDaliActorVisibilityChangeSignalChildren(void) int utcDaliActorVisibilityChangeSignalAfterAnimation(void) { TestApplication application; - tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" ); + tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts"); Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); VisibilityChangedFunctorData data; - DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) ); + DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data)); - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false); - data.Check( false, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + data.Check(false, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); - tet_infoline( "Play the animation and check the property value" ); + tet_infoline("Play the animation and check the property value"); animation.Play(); - data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); - tet_infoline( "Animation not currently finished, so the current visibility should still be true" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + tet_infoline("Animation not currently finished, so the current visibility should still be true"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); END_TEST; } - int utcDaliActorVisibilityChangeSignalByName(void) { TestApplication application; - tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" ); + tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself"); Actor actor = Actor::New(); - bool signalCalled=false; - actor.ConnectSignal( &application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled) ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); - actor.SetProperty( Actor::Property::VISIBLE, false ); - DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + bool signalCalled = false; + actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled)); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); + actor.SetProperty(Actor::Property::VISIBLE, false); + DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION); - tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" ); + tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at"); signalCalled = false; - actor.SetProperty( Actor::Property::VISIBLE, false ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.SetProperty(Actor::Property::VISIBLE, false); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); - tet_infoline( "Change the visibility using properties, ensure called" ); - actor.SetProperty( Actor::Property::VISIBLE, true ); - DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + tet_infoline("Change the visibility using properties, ensure called"); + actor.SetProperty(Actor::Property::VISIBLE, true); + DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION); - tet_infoline( "Set the visibility to current using properties, ensure not called" ); + tet_infoline("Set the visibility to current using properties, ensure not called"); signalCalled = false; - actor.SetProperty( Actor::Property::VISIBLE, true ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.SetProperty(Actor::Property::VISIBLE, true); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); END_TEST; } - -static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type ) +static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type) { gLayoutDirectionType = type; } @@ -6803,101 +6800,100 @@ static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type ) int UtcDaliActorLayoutDirectionProperty(void) { TestApplication application; - tet_infoline( "Check layout direction property" ); + tet_infoline("Check layout direction property"); Actor actor0 = Actor::New(); - DALI_TEST_EQUALS( actor0.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - application.GetScene().Add( actor0 ); + DALI_TEST_EQUALS(actor0.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + application.GetScene().Add(actor0); application.SendNotification(); application.Render(); Actor actor1 = Actor::New(); - DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor1.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor2 = Actor::New(); - DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor2.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor3 = Actor::New(); - DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor3.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor4 = Actor::New(); - DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor4.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor5 = Actor::New(); - DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor5.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor6 = Actor::New(); - DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor6.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor7 = Actor::New(); - DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor7.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor8 = Actor::New(); - DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); Actor actor9 = Actor::New(); - DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor9.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); - actor1.Add( actor2 ); + actor1.Add(actor2); gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT; - actor2.LayoutDirectionChangedSignal().Connect( LayoutDirectionChanged ); + actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged); - DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); - actor1.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); - DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor1.GetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION); + actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT); + DALI_TEST_EQUALS(actor1.GetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION); - DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(actor1.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor2.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION); - actor1.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true ); - actor0.Add( actor1 ); - DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true); + actor0.Add(actor1); + DALI_TEST_EQUALS(actor1.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor2.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); - application.GetScene().Add( actor3 ); - actor3.Add( actor4 ); - actor4.Add( actor5 ); - actor5.Add( actor6 ); - actor5.Add( actor7 ); - actor7.Add( actor8 ); - actor8.Add( actor9 ); - actor3.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); - actor5.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); + application.GetScene().Add(actor3); + actor3.Add(actor4); + actor4.Add(actor5); + actor5.Add(actor6); + actor5.Add(actor7); + actor7.Add(actor8); + actor8.Add(actor9); + actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT"); + actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT); - DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); - actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, false ); - DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION); + actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION); - actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); + actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT"); - DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor3.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor4.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor5.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor6.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor7.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor9.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); - actor8.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT"); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor9.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); - actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); - DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT); + DALI_TEST_EQUALS(actor7.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); + DALI_TEST_EQUALS(actor9.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION); - actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true); + DALI_TEST_EQUALS(actor8.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actor9.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); END_TEST; } - struct LayoutDirectionFunctor { LayoutDirectionFunctor(bool& signalCalled) - : mSignalCalled( signalCalled ) + : mSignalCalled(signalCalled) { } LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs) - : mSignalCalled( rhs.mSignalCalled ) + : mSignalCalled(rhs.mSignalCalled) { } @@ -6912,107 +6908,106 @@ struct LayoutDirectionFunctor int UtcDaliActorLayoutDirectionSignal(void) { TestApplication application; - tet_infoline( "Check changing layout direction property sends a signal" ); + tet_infoline("Check changing layout direction property sends a signal"); Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); - application.GetScene().Add( actor ); - bool signalCalled = false; + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::LAYOUT_DIRECTION), static_cast(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION); + application.GetScene().Add(actor); + bool signalCalled = false; LayoutDirectionFunctor layoutDirectionFunctor(signalCalled); - actor.ConnectSignal( &application, "layoutDirectionChanged", layoutDirectionFunctor ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); // Test that writing the same value doesn't send a signal - actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); // Test that writing a different value sends the signal signalCalled = false; - actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); - DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT); + DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION); signalCalled = false; - actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); - DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION ); + actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT); + DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION); END_TEST; } struct ChildAddedSignalCheck { - ChildAddedSignalCheck( bool& signalReceived, Actor& childHandle ) - : mSignalReceived( signalReceived ), - mChildHandle( childHandle ) + ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle) + : mSignalReceived(signalReceived), + mChildHandle(childHandle) { } - void operator() ( Actor childHandle ) + void operator()(Actor childHandle) { mSignalReceived = true; - mChildHandle = childHandle; + mChildHandle = childHandle; } - void operator() () + void operator()() { mSignalReceived = true; - mChildHandle = Actor(); + mChildHandle = Actor(); } - bool& mSignalReceived; + bool& mSignalReceived; Actor& mChildHandle; }; int UtcDaliChildAddedSignalP1(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildAddedSignalCheck signal( signalReceived, childActor ); - DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + ChildAddedSignalCheck signal(signalReceived, childActor); + DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); + stage.Add(actorA); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION); signalReceived = false; auto actorB = Actor::New(); - stage.Add( actorB ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION ); + stage.Add(actorB); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION); END_TEST; } - int UtcDaliChildAddedSignalP2(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildAddedSignalCheck signal( signalReceived, childActor ); - tet_infoline( "Connect to childAdded signal by name" ); + ChildAddedSignalCheck signal(signalReceived, childActor); + tet_infoline("Connect to childAdded signal by name"); - stage.GetRootLayer().ConnectSignal( &application, "childAdded", signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + stage.Add(actorA); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); // Can't test which actor was added; signal signature is void() when connecting via name. signalReceived = false; auto actorB = Actor::New(); - stage.Add( actorB ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + stage.Add(actorB); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); END_TEST; } @@ -7020,80 +7015,79 @@ int UtcDaliChildAddedSignalP2(void) int UtcDaliChildAddedSignalN(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildAddedSignalCheck signal( signalReceived, childActor ); - DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + ChildAddedSignalCheck signal(signalReceived, childActor); + DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); + stage.Add(actorA); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION); signalReceived = false; auto actorB = Actor::New(); - actorA.Add( actorB ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + actorA.Add(actorB); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); END_TEST; } - struct ChildRemovedSignalCheck { - ChildRemovedSignalCheck( bool& signalReceived, Actor& childHandle ) - : mSignalReceived( signalReceived ), - mChildHandle( childHandle ) + ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle) + : mSignalReceived(signalReceived), + mChildHandle(childHandle) { } - void operator() ( Actor childHandle ) + void operator()(Actor childHandle) { mSignalReceived = true; - mChildHandle = childHandle; + mChildHandle = childHandle; } - void operator() () + void operator()() { mSignalReceived = true; } - bool& mSignalReceived; + bool& mSignalReceived; Actor& mChildHandle; }; int UtcDaliChildRemovedSignalP1(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildRemovedSignalCheck signal( signalReceived, childActor ); - DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + ChildRemovedSignalCheck signal(signalReceived, childActor); + DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); - DALI_TEST_CHECK( !childActor ); + stage.Add(actorA); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); + DALI_TEST_CHECK(!childActor); - stage.Remove( actorA ); - DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + stage.Remove(actorA); + DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); signalReceived = false; - auto actorB = Actor::New(); - stage.Add( actorB ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + auto actorB = Actor::New(); + stage.Add(actorB); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); - stage.Remove( actorB ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION ); + stage.Remove(actorB); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION); END_TEST; } @@ -7101,104 +7095,102 @@ int UtcDaliChildRemovedSignalP1(void) int UtcDaliChildRemovedSignalP2(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildAddedSignalCheck signal( signalReceived, childActor ); - tet_infoline( "Connect to childRemoved signal by name" ); + ChildAddedSignalCheck signal(signalReceived, childActor); + tet_infoline("Connect to childRemoved signal by name"); - stage.GetRootLayer().ConnectSignal( &application, "childRemoved", signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + stage.Add(actorA); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); - stage.Remove( actorA ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + stage.Remove(actorA); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); signalReceived = false; - auto actorB = Actor::New(); - stage.Add( actorB ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + auto actorB = Actor::New(); + stage.Add(actorB); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); - stage.Remove( actorB ); - DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION ); + stage.Remove(actorB); + DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION); END_TEST; } - int UtcDaliChildRemovedSignalN(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool signalReceived=false; + bool signalReceived = false; Actor childActor; - ChildRemovedSignalCheck signal( signalReceived, childActor ); - DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + ChildRemovedSignalCheck signal(signalReceived, childActor); + DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); auto actorA = Actor::New(); - stage.Add( actorA ); + stage.Add(actorA); auto actorB = Actor::New(); - actorA.Add( actorB ); + actorA.Add(actorB); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); - DALI_TEST_CHECK( ! childActor ); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); + DALI_TEST_CHECK(!childActor); - actorA.Remove( actorB ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + actorA.Remove(actorB); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); END_TEST; } - int UtcDaliChildMovedSignalP(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - bool addedASignalReceived = false; - bool removedASignalReceived = false; - bool addedBSignalReceived = false; - bool removedBSignalReceived = false; + bool addedASignalReceived = false; + bool removedASignalReceived = false; + bool addedBSignalReceived = false; + bool removedBSignalReceived = false; Actor childActor; auto actorA = Actor::New(); auto actorB = Actor::New(); - stage.Add( actorA ); - stage.Add( actorB ); + stage.Add(actorA); + stage.Add(actorB); - ChildAddedSignalCheck addedSignalA( addedASignalReceived, childActor ); - ChildRemovedSignalCheck removedSignalA( removedASignalReceived, childActor ); - ChildAddedSignalCheck addedSignalB( addedBSignalReceived, childActor ); - ChildRemovedSignalCheck removedSignalB( removedBSignalReceived, childActor ); + ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor); + ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor); + ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor); + ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor); - DevelActor::ChildAddedSignal( actorA ).Connect( &application, addedSignalA ); - DevelActor::ChildRemovedSignal( actorA ).Connect( &application, removedSignalA ); - DevelActor::ChildAddedSignal( actorB ).Connect( &application, addedSignalB ); - DevelActor::ChildRemovedSignal( actorB ).Connect( &application, removedSignalB ); + DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA); + DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA); + DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB); + DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB); - DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION); // Create a child of A auto child = Actor::New(); - actorA.Add( child ); + actorA.Add(child); - DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor, child, TEST_LOCATION ); + DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(childActor, child, TEST_LOCATION); // Move child to B: addedASignalReceived = false; @@ -7206,11 +7198,11 @@ int UtcDaliChildMovedSignalP(void) removedASignalReceived = false; removedBSignalReceived = false; - actorB.Add( child ); // Expect this child to be re-parented - DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( removedASignalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( addedBSignalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION ); + actorB.Add(child); // Expect this child to be re-parented + DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION); // Move child back to A: addedASignalReceived = false; @@ -7218,12 +7210,11 @@ int UtcDaliChildMovedSignalP(void) removedASignalReceived = false; removedBSignalReceived = false; - actorA.Add( child ); // Expect this child to be re-parented - DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION ); - DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION ); - DALI_TEST_EQUALS( removedBSignalReceived, true, TEST_LOCATION ); - + actorA.Add(child); // Expect this child to be re-parented + DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION); + DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION); + DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION); END_TEST; } @@ -7231,46 +7222,46 @@ int UtcDaliChildMovedSignalP(void) int utcDaliActorCulled(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - tet_infoline( "Check that the actor is culled if the actor is out of the screen" ); + tet_infoline("Check that the actor is culled if the actor is out of the screen"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); - stage.Add( actor ); + stage.Add(actor); application.SendNotification(); - application.Render( 0 ); + application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::CULLED ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::CULLED), false, TEST_LOCATION); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::CULLED, LessThanCondition( 0.5f ) ); - notification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f)); + notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED); // Connect NotifySignal - bool propertyNotificationSignal( false ); - PropertyNotification source; - CulledPropertyNotificationFunctor f( propertyNotificationSignal, source ); - notification.NotifySignal().Connect( &application, f ) ; + bool propertyNotificationSignal(false); + PropertyNotification source; + CulledPropertyNotificationFunctor f(propertyNotificationSignal, source); + notification.NotifySignal().Connect(&application, f); - actor.SetProperty( Actor::Property::POSITION, Vector2( 1000.0f, 1000.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f)); application.SendNotification(); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::CULLED ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::CULLED), true, TEST_LOCATION); - DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION ); - DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( Actor::Property::CULLED ), TEST_LOCATION ); - DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION); + DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast(Actor::Property::CULLED), TEST_LOCATION); + DALI_TEST_EQUALS(source.GetTarget().GetProperty(source.GetTargetProperty()), true, TEST_LOCATION); END_TEST; } @@ -7278,18 +7269,18 @@ int utcDaliActorCulled(void) int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - tet_infoline( "Ensure we clear the screen when the last actor is removed" ); + tet_infoline("Ensure we clear the screen when the last actor is removed"); Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - stage.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + stage.Add(actor); application.SendNotification(); application.Render(); - auto& glAbstraction = application.GetGlAbstraction(); + auto& glAbstraction = application.GetGlAbstraction(); const auto clearCountBefore = glAbstraction.GetClearCountCalled(); actor.Unparent(); @@ -7297,7 +7288,7 @@ int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION); END_TEST; } @@ -7305,26 +7296,26 @@ int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void) int utcDaliEnsureRenderWhenMakingLastActorInvisible(void) { TestApplication application; - auto stage = application.GetScene(); + auto stage = application.GetScene(); - tet_infoline( "Ensure we clear the screen when the last actor is made invisible" ); + tet_infoline("Ensure we clear the screen when the last actor is made invisible"); Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - stage.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + stage.Add(actor); application.SendNotification(); application.Render(); - auto& glAbstraction = application.GetGlAbstraction(); + auto& glAbstraction = application.GetGlAbstraction(); const auto clearCountBefore = glAbstraction.GetClearCountCalled(); - actor.SetProperty( Actor::Property::VISIBLE, false ); + actor.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION); END_TEST; } @@ -7332,197 +7323,197 @@ int utcDaliEnsureRenderWhenMakingLastActorInvisible(void) int utcDaliActorGetSizeAfterAnimation(void) { TestApplication application; - tet_infoline( "Check the actor size before / after an animation is finished" ); + tet_infoline("Check the actor size before / after an animation is finished"); - Vector3 actorSize( 100.0f, 100.0f, 0.0f ); + Vector3 actorSize(100.0f, 100.0f, 0.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, actorSize ); - actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, actorSize); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(actor); // Size should be updated without rendering. - Vector3 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); application.SendNotification(); application.Render(); // Size and current size should be updated. - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); - - Vector3 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorSize.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); + + Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); // Set size again - actorSize = Vector3( 200.0f, 200.0f, 0.0f ); - actor.SetProperty( Actor::Property::SIZE, actorSize ); + actorSize = Vector3(200.0f, 200.0f, 0.0f); + actor.SetProperty(Actor::Property::SIZE, actorSize); - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); - Vector3 targetValue( 10.0f, 20.0f, 0.0f ); + Vector3 targetValue(10.0f, 20.0f, 0.0f); - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue); animation.Play(); // Size should be updated without rendering. - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); targetValue.width = 50.0f; animation.Clear(); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetValue.width ); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width); animation.Play(); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); targetValue.height = 70.0f; animation.Clear(); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetValue.height ); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height); animation.Play(); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - Vector3 offset( 10.0f, 20.0f, 0.0f ); + Vector3 offset(10.0f, 20.0f, 0.0f); animation.Clear(); - animation.AnimateBy( Property( actor, Actor::Property::SIZE ), offset ); + animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset); animation.Play(); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation targetValue += offset; - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); offset.width = 20.0f; animation.Clear(); - animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), offset.width ); + animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width); animation.Play(); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation targetValue.width += offset.width; - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); offset.height = 10.0f; animation.Clear(); - animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), offset.height ); + animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height); animation.Play(); application.SendNotification(); - application.Render( 1100 ); // After the animation + application.Render(1100); // After the animation targetValue.height += offset.height; - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); - DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty(Actor::Property::SIZE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty(Actor::Property::SIZE_HEIGHT), TEST_LOCATION); + DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty(Actor::Property::SIZE_DEPTH), TEST_LOCATION); // Set size again - actorSize = Vector3( 300.0f, 300.0f, 0.0f ); + actorSize = Vector3(300.0f, 300.0f, 0.0f); - actor.SetProperty( Actor::Property::SIZE, actorSize ); + actor.SetProperty(Actor::Property::SIZE, actorSize); - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION); application.SendNotification(); application.Render(); - size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + size = actor.GetProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); - currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(); - DALI_TEST_EQUALS( currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get(); + DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -7539,10 +7530,10 @@ int utcDaliActorPartialUpdate(void) tet_infoline("Check the damaged area"); - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); std::vector> damagedRects; - Rect clippingRect; + Rect clippingRect; application.SendNotification(); application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects); @@ -7644,10 +7635,10 @@ int utcDaliActorPartialUpdateSetColor(void) tet_infoline("Check uniform update"); - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); std::vector> damagedRects; - Rect clippingRect; + Rect clippingRect; application.SendNotification(); application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects); @@ -7737,12 +7728,12 @@ int utcDaliActorPartialUpdateSetProperty(void) true, true); - tet_infoline( "Set/Update property with partial update" ); + tet_infoline("Set/Update property with partial update"); const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); std::vector> damagedRects; - Rect clippingRect; + Rect clippingRect; application.SendNotification(); application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects); @@ -7751,7 +7742,7 @@ int utcDaliActorPartialUpdateSetProperty(void) application.RenderWithPartialUpdate(damagedRects, clippingRect); Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); - Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE); + Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE); actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f)); actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f)); @@ -7774,7 +7765,7 @@ int utcDaliActorPartialUpdateSetProperty(void) DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION); DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION); - Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex( SHADER_SHADOW_COLOR_PROPERTY_NAME ); + Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME); actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f)); damagedRects.clear(); @@ -7819,7 +7810,7 @@ int utcDaliActorPartialUpdateTwoActors(void) tet_infoline("Check the damaged rects with partial update and two actors"); - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); Actor actor = CreateRenderableActor(); actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f)); @@ -7863,9 +7854,9 @@ int utcDaliActorPartialUpdateActorsWithSizeHint(void) true, true); - tet_infoline( "Check the damaged rect with partial update and actor size hint" ); + tet_infoline("Check the damaged rect with partial update and actor size hint"); - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); Actor actor = CreateRenderableActor(); actor.SetProperty(Actor::Property::POSITION, Vector3(75.0f, 150.0f, 0.0f)); @@ -7928,7 +7919,7 @@ int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void) } catch(...) { - tet_result(TET_FAIL); + tet_result(TET_FAIL); } END_TEST; } @@ -7936,7 +7927,7 @@ int UtcDaliActorCaptureAllTouchAfterStartPropertyN(void) int UtcDaliActorLowerBelowNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Actor arg1; @@ -7953,7 +7944,7 @@ int UtcDaliActorLowerBelowNegative(void) int UtcDaliActorRaiseAboveNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Actor arg1; @@ -7970,7 +7961,7 @@ int UtcDaliActorRaiseAboveNegative(void) int UtcDaliActorRaiseToTopNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.RaiseToTop(); @@ -7986,7 +7977,7 @@ int UtcDaliActorRaiseToTopNegative(void) int UtcDaliActorAddRendererNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Renderer arg1; @@ -8003,7 +7994,7 @@ int UtcDaliActorAddRendererNegative(void) int UtcDaliActorTouchedSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.TouchedSignal(); @@ -8019,7 +8010,7 @@ int UtcDaliActorTouchedSignalNegative(void) int UtcDaliActorTranslateByNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Vector3 arg1; @@ -8036,7 +8027,7 @@ int UtcDaliActorTranslateByNegative(void) int UtcDaliActorFindChildByIdNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { unsigned int arg1 = 0u; @@ -8053,7 +8044,7 @@ int UtcDaliActorFindChildByIdNegative(void) int UtcDaliActorGetRendererAtNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { unsigned int arg1 = 0u; @@ -8070,7 +8061,7 @@ int UtcDaliActorGetRendererAtNegative(void) int UtcDaliActorHoveredSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.HoveredSignal(); @@ -8086,7 +8077,7 @@ int UtcDaliActorHoveredSignalNegative(void) int UtcDaliActorLowerToBottomNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.LowerToBottom(); @@ -8102,7 +8093,7 @@ int UtcDaliActorLowerToBottomNegative(void) int UtcDaliActorOnSceneSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.OnSceneSignal(); @@ -8118,7 +8109,7 @@ int UtcDaliActorOnSceneSignalNegative(void) int UtcDaliActorOffSceneSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.OffSceneSignal(); @@ -8134,7 +8125,7 @@ int UtcDaliActorOffSceneSignalNegative(void) int UtcDaliActorRemoveRendererNegative01(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { unsigned int arg1 = 0u; @@ -8151,7 +8142,7 @@ int UtcDaliActorRemoveRendererNegative01(void) int UtcDaliActorRemoveRendererNegative02(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Renderer arg1; @@ -8168,7 +8159,7 @@ int UtcDaliActorRemoveRendererNegative02(void) int UtcDaliActorFindChildByNameNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { std::string arg1; @@ -8185,12 +8176,12 @@ int UtcDaliActorFindChildByNameNegative(void) int UtcDaliActorSetResizePolicyNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE; - Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS; - instance.SetResizePolicy(arg1,arg2); + Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS; + instance.SetResizePolicy(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -8203,7 +8194,7 @@ int UtcDaliActorSetResizePolicyNegative(void) int UtcDaliActorOnRelayoutSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.OnRelayoutSignal(); @@ -8219,7 +8210,7 @@ int UtcDaliActorOnRelayoutSignalNegative(void) int UtcDaliActorWheelEventSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.WheelEventSignal(); @@ -8235,7 +8226,7 @@ int UtcDaliActorWheelEventSignalNegative(void) int UtcDaliActorGetHeightForWidthNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { float arg1 = 0.0f; @@ -8252,7 +8243,7 @@ int UtcDaliActorGetHeightForWidthNegative(void) int UtcDaliActorGetWidthForHeightNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { float arg1 = 0.0f; @@ -8269,7 +8260,7 @@ int UtcDaliActorGetWidthForHeightNegative(void) int UtcDaliActorLayoutDirectionChangedSignalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.LayoutDirectionChangedSignal(); @@ -8285,7 +8276,7 @@ int UtcDaliActorLayoutDirectionChangedSignalNegative(void) int UtcDaliActorAddNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Actor arg1; @@ -8302,7 +8293,7 @@ int UtcDaliActorAddNegative(void) int UtcDaliActorLowerNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.Lower(); @@ -8318,7 +8309,7 @@ int UtcDaliActorLowerNegative(void) int UtcDaliActorRaiseNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.Raise(); @@ -8334,7 +8325,7 @@ int UtcDaliActorRaiseNegative(void) int UtcDaliActorRemoveNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Actor arg1; @@ -8351,7 +8342,7 @@ int UtcDaliActorRemoveNegative(void) int UtcDaliActorScaleByNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Vector3 arg1; @@ -8368,7 +8359,7 @@ int UtcDaliActorScaleByNegative(void) int UtcDaliActorGetLayerNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetLayer(); @@ -8384,7 +8375,7 @@ int UtcDaliActorGetLayerNegative(void) int UtcDaliActorRotateByNegative01(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Quaternion arg1; @@ -8401,12 +8392,12 @@ int UtcDaliActorRotateByNegative01(void) int UtcDaliActorRotateByNegative02(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { - Dali::Radian arg1; + Dali::Radian arg1; Dali::Vector3 arg2; - instance.RotateBy(arg1,arg2); + instance.RotateBy(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -8419,7 +8410,7 @@ int UtcDaliActorRotateByNegative02(void) int UtcDaliActorUnparentNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.Unparent(); @@ -8435,7 +8426,7 @@ int UtcDaliActorUnparentNegative(void) int UtcDaliActorGetChildAtNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { unsigned int arg1 = 0u; @@ -8452,7 +8443,7 @@ int UtcDaliActorGetChildAtNegative(void) int UtcDaliActorGetChildCountNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetChildCount(); @@ -8468,7 +8459,7 @@ int UtcDaliActorGetChildCountNegative(void) int UtcDaliActorGetTargetSizeNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetTargetSize(); @@ -8484,14 +8475,14 @@ int UtcDaliActorGetTargetSizeNegative(void) int UtcDaliActorScreenToLocalNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { float arg1 = 0.0f; float arg2 = 0.0f; float arg3 = 0.0f; float arg4 = 0.0f; - instance.ScreenToLocal(arg1,arg2,arg3,arg4); + instance.ScreenToLocal(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -8504,7 +8495,7 @@ int UtcDaliActorScreenToLocalNegative(void) int UtcDaliActorGetNaturalSizeNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetNaturalSize(); @@ -8520,7 +8511,7 @@ int UtcDaliActorGetNaturalSizeNegative(void) int UtcDaliActorGetRelayoutSizeNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Dimension::Type arg1 = Dimension::HEIGHT; @@ -8537,7 +8528,7 @@ int UtcDaliActorGetRelayoutSizeNegative(void) int UtcDaliActorGetResizePolicyNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS; @@ -8554,7 +8545,7 @@ int UtcDaliActorGetResizePolicyNegative(void) int UtcDaliActorGetRendererCountNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetRendererCount(); @@ -8570,7 +8561,7 @@ int UtcDaliActorGetRendererCountNegative(void) int UtcDaliActorGetParentNegative(void) { TestApplication application; - Dali::Actor instance; + Dali::Actor instance; try { instance.GetParent(); diff --git a/automated-tests/src/dali/utc-Dali-AddOn.cpp b/automated-tests/src/dali/utc-Dali-AddOn.cpp index 3d2355d..da5afbb 100644 --- a/automated-tests/src/dali/utc-Dali-AddOn.cpp +++ b/automated-tests/src/dali/utc-Dali-AddOn.cpp @@ -17,18 +17,21 @@ #include #include + #include "dali-test-suite-utils/test-addon-manager.h" struct DummyAddOn : public Dali::AddOn::AddOnBinder { - DummyAddOn() : Dali::AddOn::AddOnBinder( "SampleAddOn" ) - {} + DummyAddOn() + : Dali::AddOn::AddOnBinder("SampleAddOn") + { + } ~DummyAddOn() override = default; - ADDON_BIND_FUNCTION( DoSum, int(int, int) ); + ADDON_BIND_FUNCTION(DoSum, int(int, int)); - ADDON_BIND_FUNCTION( StringLen, int() ); + ADDON_BIND_FUNCTION(StringLen, int()); }; int UtcDaliAddOnBinderP(void) @@ -42,15 +45,15 @@ int UtcDaliAddOnBinderP(void) DummyAddOn addon; // Test whether library handle is non-null - DALI_TEST_EQUALS( addon.GetHandle(), (void*)1, TEST_LOCATION ); + DALI_TEST_EQUALS(addon.GetHandle(), (void*)1, TEST_LOCATION); // Test whether addon is valid auto isValid = addon.IsValid(); - DALI_TEST_EQUALS( isValid, true, TEST_LOCATION ); + DALI_TEST_EQUALS(isValid, true, TEST_LOCATION); // Test AddOnInfo const auto& info = addon.GetAddOnInfo(); - DALI_TEST_EQUALS( info.name, "SampleAddOn", TEST_LOCATION ); + DALI_TEST_EQUALS(info.name, "SampleAddOn", TEST_LOCATION); delete addOnManager; @@ -65,16 +68,16 @@ int UtcDaliAddOnManagerNotSupportedP(void) // Not supported using VoidPtr = void*; - DALI_TEST_EQUALS( VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION ); + DALI_TEST_EQUALS(VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION); DummyAddOn addon{}; // Test whether library handle is non-null - DALI_TEST_EQUALS( addon.GetHandle(), (void*)0, TEST_LOCATION ); + DALI_TEST_EQUALS(addon.GetHandle(), (void*)0, TEST_LOCATION); // Test whether addon is valid auto isValid = addon.IsValid(); - DALI_TEST_EQUALS( isValid, false, TEST_LOCATION ); + DALI_TEST_EQUALS(isValid, false, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-AlphaFunction.cpp b/automated-tests/src/dali/utc-Dali-AlphaFunction.cpp index d59258c..4caa599 100644 --- a/automated-tests/src/dali/utc-Dali-AlphaFunction.cpp +++ b/automated-tests/src/dali/utc-Dali-AlphaFunction.cpp @@ -15,15 +15,15 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; -float customAlphaFunction( float progress ) +float customAlphaFunction(float progress) { return progress; } @@ -41,13 +41,13 @@ void utc_dali_alpha_function_cleanup(void) int UtcDaliAlphaFunctionDefaultConstructorP(void) { TestApplication application; - AlphaFunction alpha; + AlphaFunction alpha; //Should return the default alpha function - DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); //Check the mode is BUILTIN_FUNCTION - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); END_TEST; } @@ -57,13 +57,13 @@ int UtcDaliAlphaFunctionConstructorFromBuiltinP(void) TestApplication application; //Construct the alpha function with a built-in function - AlphaFunction alpha( AlphaFunction::EASE_IN_OUT); + AlphaFunction alpha(AlphaFunction::EASE_IN_OUT); //Check if the built-in alpha function is EASE_IN_OUT - DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN_OUT, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN_OUT, TEST_LOCATION); //Check the mode is BUILTIN_FUNCTION - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); END_TEST; } @@ -73,14 +73,13 @@ int UtcDaliAlphaFunctionConstructorFromFunctionPointerdP(void) TestApplication application; //Construct the alpha function with a function pointer - AlphaFunction alpha( &customAlphaFunction ); + AlphaFunction alpha(&customAlphaFunction); //Check that the custom function points to the custom alpha function - DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION); //Check the mode is CUSTOM_FUNCTION - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); - + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); END_TEST; } @@ -90,17 +89,17 @@ int UtcDaliAlphaFunctionConstructorFromControlPointsP(void) TestApplication application; //Construct the alpha function with two control points - Vector2 controlPoint0 = Vector2(0.0f,1.0f); - Vector2 controlPoint1 = Vector2(1.0f,0.0f); - AlphaFunction alpha(controlPoint0,controlPoint1); + Vector2 controlPoint0 = Vector2(0.0f, 1.0f); + Vector2 controlPoint1 = Vector2(1.0f, 0.0f); + AlphaFunction alpha(controlPoint0, controlPoint1); //Check if the control points have the correct value Vector4 controlPoints = alpha.GetBezierControlPoints(); - DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), controlPoint0, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), controlPoint1, TEST_LOCATION); //Check the mode is BEZIER - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); END_TEST; } @@ -110,17 +109,17 @@ int UtcDaliAlphaFunctionConstructorFromControlPointsN(void) TestApplication application; //Construct the alpha function with two control points - Vector2 controlPoint0 = Vector2(-10.0f,1.0f); - Vector2 controlPoint1 = Vector2(10.0f,0.0f); - AlphaFunction alpha(controlPoint0,controlPoint1); + Vector2 controlPoint0 = Vector2(-10.0f, 1.0f); + Vector2 controlPoint1 = Vector2(10.0f, 0.0f); + AlphaFunction alpha(controlPoint0, controlPoint1); //x components of the control points should have been clamped to [0,1] to ensure the curve is monotonic Vector4 controlPoints = alpha.GetBezierControlPoints(); - DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), Vector2(0.0f,1.0f), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), Vector2(1.0f,0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), Vector2(0.0f, 1.0f), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), Vector2(1.0f, 0.0f), TEST_LOCATION); //Check the mode is BEZIER - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); END_TEST; } @@ -128,13 +127,13 @@ int UtcDaliAlphaFunctionConstructorFromControlPointsN(void) int UtcDaliAlphaFunctionGetBuiltinFunctionP(void) { TestApplication application; - AlphaFunction alpha( AlphaFunction::EASE_IN); + AlphaFunction alpha(AlphaFunction::EASE_IN); //Check if the builtin alpha function is EASE_IN - DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); //Check the mode is BUILTIN_FUNCTION - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); END_TEST; } @@ -142,13 +141,13 @@ int UtcDaliAlphaFunctionGetBuiltinFunctionP(void) int UtcDaliAlphaFunctionGetCustomFunctionP(void) { TestApplication application; - AlphaFunction alpha( &customAlphaFunction ); + AlphaFunction alpha(&customAlphaFunction); //Check that the custom function points to the custom alpha function - DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION); //Check the mode is CUSTOM_FUNCTION - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); END_TEST; } @@ -157,17 +156,17 @@ int UtcDaliAlphaFunctionGetControlPointsFunctionP(void) { TestApplication application; - Vector2 controlPoint0 = Vector2(0.0f,1.0f); - Vector2 controlPoint1 = Vector2(1.0f,0.0f); - AlphaFunction alpha( controlPoint0,controlPoint1 ); + Vector2 controlPoint0 = Vector2(0.0f, 1.0f); + Vector2 controlPoint1 = Vector2(1.0f, 0.0f); + AlphaFunction alpha(controlPoint0, controlPoint1); //Check if the control points have the correct value Vector4 controlPoints = alpha.GetBezierControlPoints(); - DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), controlPoint0, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), controlPoint1, TEST_LOCATION); //Check the mode is BEZIER - DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); + DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); END_TEST; } @@ -177,22 +176,22 @@ int UtcDaliAlphaFunctionGetModeP(void) TestApplication application; //Create alpha function using a built-in function - AlphaFunction alphaBuiltin( AlphaFunction::EASE_IN); + AlphaFunction alphaBuiltin(AlphaFunction::EASE_IN); //Check the mode is BUILTIN_FUNCTION - DALI_TEST_EQUALS( alphaBuiltin.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alphaBuiltin.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION); //Create alpha function with pointer to function - AlphaFunction alphaCustom( &customAlphaFunction ); + AlphaFunction alphaCustom(&customAlphaFunction); //Check the mode is CUSTOM_FUNCTION - DALI_TEST_EQUALS( alphaCustom.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); + DALI_TEST_EQUALS(alphaCustom.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION); //Create alpha function with control points - Vector2 controlPoint0 = Vector2(0.0f,1.0f); - Vector2 controlPoint1 = Vector2(1.0f,0.0f); - AlphaFunction alphaBezier( controlPoint0,controlPoint1 ); + Vector2 controlPoint0 = Vector2(0.0f, 1.0f); + Vector2 controlPoint1 = Vector2(1.0f, 0.0f); + AlphaFunction alphaBezier(controlPoint0, controlPoint1); //Check the mode is BEZIER - DALI_TEST_EQUALS( alphaBezier.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); + DALI_TEST_EQUALS(alphaBezier.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION); END_TEST; } @@ -204,49 +203,48 @@ int UtcDaliAlphaFunctionBezier(void) Actor actor = Actor::New(); // Register a float property - float startValue(0.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(0.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(1.0f); + float targetValue(1.0f); - Vector2 controlPoint0 = Vector2(0.25f,0.5f); - Vector2 controlPoint1 = Vector2(0.75f,0.5f); - animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction(controlPoint0,controlPoint1)); + Vector2 controlPoint0 = Vector2(0.25f, 0.5f); + Vector2 controlPoint1 = Vector2(0.75f, 0.5f); + animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction(controlPoint0, controlPoint1)); // Start the animation animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); application.SendNotification(); float epsilon(0.01f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.271964f, epsilon, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 0.271964f, epsilon, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*40% progress*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*40% progress*/); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.432387f, epsilon, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 0.432387f, epsilon, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*60% progress*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*60% progress*/); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.567613f, epsilon, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 0.567613f, epsilon, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*80% progress*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*80% progress*/); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.728037f, epsilon, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 0.728037f, epsilon, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-AngleAxis.cpp b/automated-tests/src/dali/utc-Dali-AngleAxis.cpp index dcd9ba8..9005289 100644 --- a/automated-tests/src/dali/utc-Dali-AngleAxis.cpp +++ b/automated-tests/src/dali/utc-Dali-AngleAxis.cpp @@ -15,10 +15,11 @@ * */ -#include -#include -#include #include +#include +#include + +#include void utc_dali_angle_axis_startup(void) { @@ -30,8 +31,6 @@ void utc_dali_angle_axis_cleanup(void) test_return_value = TET_PASS; } - - int UtcDaliAngleAxisNew01(void) { TestApplication application; @@ -42,13 +41,11 @@ int UtcDaliAngleAxisNew01(void) END_TEST; } - - int UtcDaliAngleAxisNew02(void) { TestApplication application; - Degree d(75.0f); + Degree d(75.0f); AngleAxis a(d, Vector3::XAXIS); DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION); @@ -56,12 +53,11 @@ int UtcDaliAngleAxisNew02(void) END_TEST; } - int UtcDaliAngleAxisNew03(void) { TestApplication application; - Radian r(Math::PI_2); + Radian r(Math::PI_2); AngleAxis a(r, Vector3::ZAXIS); // AngleAxis stores its angle as a degree, so should only do degree comparison. @@ -74,7 +70,7 @@ int UtcDaliAngleAxisAssign(void) { TestApplication application; - Radian r(Math::PI_2); + Radian r(Math::PI_2); AngleAxis a(r, Vector3::ZAXIS); AngleAxis b = a; @@ -89,13 +85,13 @@ int UtcDaliAngleAxisCopyConstructor(void) { TestApplication application; - Radian r( Math::PI_2 ); - AngleAxis a( r, Vector3::ZAXIS ); - AngleAxis b( a ); + Radian r(Math::PI_2); + AngleAxis a(r, Vector3::ZAXIS); + AngleAxis b(a); // AngleAxis stores its angle as a degree, so should only do degree comparison. - DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION); END_TEST; } @@ -103,13 +99,13 @@ int UtcDaliAngleAxisMoveConstructor(void) { TestApplication application; - Radian r( Math::PI_2 ); - AngleAxis a( r, Vector3::ZAXIS ); - AngleAxis b = std::move( a ); + Radian r(Math::PI_2); + AngleAxis a(r, Vector3::ZAXIS); + AngleAxis b = std::move(a); // AngleAxis stores its angle as a degree, so should only do degree comparison. - DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION); END_TEST; } @@ -117,14 +113,14 @@ int UtcDaliAngleAxisCopyAssignmwent(void) { TestApplication application; - Radian r( Math::PI_2 ); - AngleAxis a( r, Vector3::ZAXIS ); + Radian r(Math::PI_2); + AngleAxis a(r, Vector3::ZAXIS); AngleAxis b; b = a; // AngleAxis stores its angle as a degree, so should only do degree comparison. - DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION); END_TEST; } @@ -132,14 +128,14 @@ int UtcDaliAngleAxisMoveAssignmwent(void) { TestApplication application; - Radian r( Math::PI_2 ); - AngleAxis a( r, Vector3::ZAXIS ); + Radian r(Math::PI_2); + AngleAxis a(r, Vector3::ZAXIS); AngleAxis b; - b = std::move( a ); + b = std::move(a); // AngleAxis stores its angle as a degree, so should only do degree comparison. - DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION); END_TEST; } @@ -147,7 +143,7 @@ int UtcDaliAngleAxisEqual(void) { TestApplication application; - Radian r(Math::PI_2); + Radian r(Math::PI_2); AngleAxis a(r, Vector3::ZAXIS); AngleAxis b(a); diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index da1cd92..629d3e4 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -15,14 +15,14 @@ * */ -#include -#include - -#include -#include -#include #include +#include #include +#include +#include + +#include +#include using std::max; using namespace Dali; @@ -39,10 +39,9 @@ void utc_dali_animation_cleanuP(void) namespace { - static const float ROTATION_EPSILON = 0.0001f; -static const float VECTOR4_EPSILON = 0.0001f; -static const float VECTOR3_EPSILON = 0.0001f; +static const float VECTOR4_EPSILON = 0.0001f; +static const float VECTOR3_EPSILON = 0.0001f; // Functor to test whether a Finish signal is emitted struct AnimationFinishCheck @@ -64,7 +63,7 @@ struct AnimationFinishCheck void CheckSignalReceived() { - if (!mSignalReceived) + if(!mSignalReceived) { tet_printf("Expected Finish signal was not received\n"); tet_result(TET_FAIL); @@ -77,7 +76,7 @@ struct AnimationFinishCheck void CheckSignalNotReceived() { - if (mSignalReceived) + if(mSignalReceived) { tet_printf("Unexpected Finish signal was received\n"); tet_result(TET_FAIL); @@ -96,7 +95,7 @@ struct AnimationProgressCheck { AnimationProgressCheck(bool& signalReceived, std::string name = " ") : mSignalReceived(signalReceived), - mName( name ) + mName(name) { } @@ -112,9 +111,9 @@ struct AnimationProgressCheck void CheckSignalReceived() { - if (!mSignalReceived) + if(!mSignalReceived) { - tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() ); + tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str()); tet_result(TET_FAIL); } else @@ -125,7 +124,7 @@ struct AnimationProgressCheck void CheckSignalNotReceived() { - if (mSignalReceived) + if(mSignalReceived) { tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str()); tet_result(TET_FAIL); @@ -136,11 +135,11 @@ struct AnimationProgressCheck } } - bool& mSignalReceived; // owned by individual tests + bool& mSignalReceived; // owned by individual tests std::string mName; }; -} // anon namespace +} // namespace int UtcDaliAnimationConstructorP(void) { @@ -148,7 +147,7 @@ int UtcDaliAnimationConstructorP(void) Animation animation; - DALI_TEST_CHECK( !animation ); + DALI_TEST_CHECK(!animation); END_TEST; } @@ -156,7 +155,7 @@ int UtcDaliAnimationNewP(void) { TestApplication application; - Animation animation = Animation::New( 1.0f ); + Animation animation = Animation::New(1.0f); DALI_TEST_CHECK(animation); END_TEST; @@ -166,7 +165,7 @@ int UtcDaliAnimationNewN(void) { TestApplication application; - Animation animation = Animation::New( -1.0f ); + Animation animation = Animation::New(-1.0f); DALI_TEST_CHECK(animation); DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION); @@ -179,7 +178,7 @@ int UtcDaliAnimationDownCastP(void) tet_infoline("Testing Dali::Animation::DownCast()"); - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); BaseHandle object(animation); @@ -187,7 +186,7 @@ int UtcDaliAnimationDownCastP(void) Animation animation2 = Animation::DownCast(object); DALI_TEST_CHECK(animation2); - Animation animation3 = DownCast< Animation >(object); + Animation animation3 = DownCast(object); DALI_TEST_CHECK(animation3); END_TEST; } @@ -198,11 +197,11 @@ int UtcDaliAnimationDownCastN(void) BaseHandle unInitializedObject; - Animation animation1 = Animation::DownCast( unInitializedObject ); - DALI_TEST_CHECK( !animation1 ); + Animation animation1 = Animation::DownCast(unInitializedObject); + DALI_TEST_CHECK(!animation1); - Animation animation2 = DownCast< Animation >( unInitializedObject ); - DALI_TEST_CHECK( !animation2 ); + Animation animation2 = DownCast(unInitializedObject); + DALI_TEST_CHECK(!animation2); END_TEST; } @@ -211,12 +210,12 @@ int UtcDaliAnimationCopyConstructorP(void) TestApplication application; // Initialize an object, ref count == 1 - Animation animation = Animation::New( 1.0f ); + Animation animation = Animation::New(1.0f); - Animation copy( animation ); - DALI_TEST_CHECK( copy ); + Animation copy(animation); + DALI_TEST_CHECK(copy); - DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() ); + DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration()); END_TEST; } @@ -224,14 +223,14 @@ int UtcDaliAnimationAssignmentOperatorP(void) { TestApplication application; - Animation animation = Animation::New( 1.0f ); + Animation animation = Animation::New(1.0f); Animation copy = animation; - DALI_TEST_CHECK( copy ); + DALI_TEST_CHECK(copy); - DALI_TEST_CHECK( animation == copy ); + DALI_TEST_CHECK(animation == copy); - DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() ); + DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration()); END_TEST; } @@ -241,33 +240,33 @@ int UtcDaliAnimationMoveConstructor(void) //Animation - Animation animation = Animation::New( 1.0f ); - DALI_TEST_CHECK( animation ); - DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION ); + Animation animation = Animation::New(1.0f); + DALI_TEST_CHECK(animation); + DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION); - Animation movedAnimation = std::move( animation ); - DALI_TEST_CHECK( movedAnimation ); - DALI_TEST_EQUALS( 1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION ); - DALI_TEST_CHECK( !animation ); + Animation movedAnimation = std::move(animation); + DALI_TEST_CHECK(movedAnimation); + DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION); + DALI_TEST_CHECK(!animation); // KeyFrames KeyFrames keyframes = KeyFrames::New(); - DALI_TEST_CHECK( keyframes ); - DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION ); + DALI_TEST_CHECK(keyframes); + DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION); - keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) ); - keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) ); - DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION ); + keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f)); + keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f)); + DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION); - KeyFrames movedKeyFrames = std::move( keyframes ); - DALI_TEST_CHECK( movedKeyFrames ); - DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION ); - DALI_TEST_CHECK( !keyframes ); + KeyFrames movedKeyFrames = std::move(keyframes); + DALI_TEST_CHECK(movedKeyFrames); + DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION); + DALI_TEST_CHECK(!keyframes); END_TEST; } @@ -278,35 +277,35 @@ int UtcDaliAnimationMoveAssignment(void) // Animation - Animation animation = Animation::New( 1.0f ); - DALI_TEST_CHECK( animation ); - DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION ); + Animation animation = Animation::New(1.0f); + DALI_TEST_CHECK(animation); + DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION); Animation move; - move = std::move( animation ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, move.GetDuration(), 0.001f, TEST_LOCATION ); - DALI_TEST_CHECK( !animation ); + move = std::move(animation); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION); + DALI_TEST_CHECK(!animation); // KeyFrames KeyFrames keyframes = KeyFrames::New(); - DALI_TEST_CHECK( keyframes ); - DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION ); + DALI_TEST_CHECK(keyframes); + DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION); - keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) ); - keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) ); - DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION ); + keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f)); + keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f)); + DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION); KeyFrames movedKeyFrames; - movedKeyFrames = std::move( keyframes ); - DALI_TEST_CHECK( movedKeyFrames ); - DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION ); - DALI_TEST_CHECK( !keyframes ); + movedKeyFrames = std::move(keyframes); + DALI_TEST_CHECK(movedKeyFrames); + DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION); + DALI_TEST_CHECK(!keyframes); END_TEST; } @@ -319,7 +318,7 @@ int UtcDaliAnimationSetDurationP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION); @@ -328,51 +327,51 @@ int UtcDaliAnimationSetDurationP(void) animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(2u/*just beyond the animation duration*/); + application.Render(2u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Restart the animation, with a different duration finishCheck.Reset(); - actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO ); + actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO); durationSeconds = 3.5f; animation.SetDuration(durationSeconds); DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(2u/*just beyond the animation duration*/); + application.Render(2u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -380,11 +379,11 @@ int UtcDaliAnimationSetDurationN(void) { TestApplication application; - Animation animation = Animation::New( 1.0f ); - DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION ); + Animation animation = Animation::New(1.0f); + DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION); - animation.SetDuration( -1.0f ); - DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION ); + animation.SetDuration(-1.0f); + DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION); END_TEST; } @@ -408,9 +407,9 @@ int UtcDaliAnimationSetLoopingP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation @@ -418,7 +417,7 @@ int UtcDaliAnimationSetLoopingP(void) DALI_TEST_CHECK(animation.IsLooping()); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -426,15 +425,15 @@ int UtcDaliAnimationSetLoopingP(void) // Loop 5 times float intervalSeconds = 0.25f; - float progress = 0.0f; - for (int iterations = 0; iterations < 5;) + float progress = 0.0f; + for(int iterations = 0; iterations < 5;) { - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); progress += intervalSeconds; - DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty(Actor::Property::POSITION), 0.001f, TEST_LOCATION); - if (progress >= 1.0f) + if(progress >= 1.0f) { progress = progress - 1.0f; ++iterations; @@ -449,18 +448,18 @@ int UtcDaliAnimationSetLoopingP(void) DALI_TEST_CHECK(!animation.IsLooping()); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -472,9 +471,9 @@ int UtcDaliAnimationSetLoopCountP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation @@ -482,7 +481,7 @@ int UtcDaliAnimationSetLoopCountP(void) DALI_TEST_CHECK(animation.IsLooping()); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -498,8 +497,8 @@ int UtcDaliAnimationSetLoopCountP(void) // Loop float intervalSeconds = 3.0f; - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.Render(0); application.SendNotification(); @@ -511,22 +510,22 @@ int UtcDaliAnimationSetLoopCountP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); finishCheck.Reset(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); @@ -545,9 +544,9 @@ int UtcDaliAnimationSetLoopCountP2(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.SetEndAction(Animation::DISCARD); @@ -556,18 +555,18 @@ int UtcDaliAnimationSetLoopCountP2(void) DALI_TEST_CHECK(animation.IsLooping()); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); float intervalSeconds = 3.0f; application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); application.SendNotification(); @@ -579,17 +578,17 @@ int UtcDaliAnimationSetLoopCountP2(void) animation.SetLooping(true); DALI_TEST_CHECK(animation.IsLooping()); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); application.SendNotification(); finishCheck.CheckSignalNotReceived(); @@ -602,13 +601,13 @@ int UtcDaliAnimationSetLoopCountP2(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); @@ -618,17 +617,17 @@ int UtcDaliAnimationSetLoopCountP2(void) animation.SetLooping(true); DALI_TEST_CHECK(animation.IsLooping()); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); @@ -639,19 +638,18 @@ int UtcDaliAnimationSetLoopCountP2(void) DALI_TEST_CHECK(animation.IsLooping()); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // we never hit play finishCheck.Reset(); - END_TEST; } @@ -666,15 +664,15 @@ int UtcDaliAnimationSetLoopCountP3(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.SetEndAction(Animation::DISCARD); float intervalSeconds = 3.0f; - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -682,17 +680,17 @@ int UtcDaliAnimationSetLoopCountP3(void) animation.SetLooping(true); DALI_TEST_CHECK(animation.IsLooping()); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); @@ -703,19 +701,18 @@ int UtcDaliAnimationSetLoopCountP3(void) DALI_TEST_CHECK(animation.IsLooping()); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // we never hit play finishCheck.Reset(); - END_TEST; } @@ -730,15 +727,15 @@ int UtcDaliAnimationSetLoopCountP4(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.SetEndAction(Animation::BAKE); float intervalSeconds = 3.0f; - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -748,12 +745,12 @@ int UtcDaliAnimationSetLoopCountP4(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); finishCheck.Reset(); @@ -762,11 +759,11 @@ int UtcDaliAnimationSetLoopCountP4(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -779,9 +776,9 @@ int UtcDaliAnimationGetLoopCountP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); DALI_TEST_CHECK(1 == animation.GetLoopCount()); @@ -799,13 +796,13 @@ int UtcDaliAnimationGetLoopCountP(void) // Loop float intervalSeconds = 3.0f; - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.Render(0); application.SendNotification(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); animation.SetLoopCount(0); @@ -819,7 +816,6 @@ int UtcDaliAnimationGetLoopCountP(void) END_TEST; } - int UtcDaliAnimationGetCurrentLoopP(void) { TestApplication application; @@ -828,9 +824,9 @@ int UtcDaliAnimationGetCurrentLoopP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation @@ -839,7 +835,7 @@ int UtcDaliAnimationGetCurrentLoopP(void) DALI_TEST_CHECK(0 == animation.GetCurrentLoop()); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -848,14 +844,14 @@ int UtcDaliAnimationGetCurrentLoopP(void) // Loop float intervalSeconds = 3.0f; - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_CHECK(2 == animation.GetCurrentLoop()); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); @@ -864,15 +860,15 @@ int UtcDaliAnimationGetCurrentLoopP(void) finishCheck.Reset(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_CHECK(3 == animation.GetCurrentLoop()); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_CHECK(3 == animation.GetCurrentLoop()); @@ -900,7 +896,7 @@ int UtcDaliAnimationSetEndActionN(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE); @@ -910,23 +906,23 @@ int UtcDaliAnimationSetEndActionN(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Go back to the start - actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO ); + actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Test BakeFinal, animate again, for half the duration finishCheck.Reset(); @@ -935,7 +931,7 @@ int UtcDaliAnimationSetEndActionN(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/); // Stop the animation early animation.Stop(); @@ -943,17 +939,17 @@ int UtcDaliAnimationSetEndActionN(void) // We did NOT expect the animation to finish application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION); // The position should be same with target position in the next frame application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Go back to the start - actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO ); + actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Test EndAction::Discard, animate again, but don't bake this time finishCheck.Reset(); @@ -962,22 +958,22 @@ int UtcDaliAnimationSetEndActionN(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // The position should be discarded in the next frame application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -999,8 +995,8 @@ int UtcDaliAnimationGetEndActionP(void) int UtcDaliAnimationSetDisconnectActionP(void) { - TestApplication application; - Integration::Scene stage( application.GetScene() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); // Default: BakeFinal { @@ -1008,7 +1004,7 @@ int UtcDaliAnimationSetDisconnectActionP(void) stage.Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); @@ -1019,14 +1015,14 @@ int UtcDaliAnimationSetDisconnectActionP(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/); actor.Unparent(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } // Bake @@ -1035,9 +1031,9 @@ int UtcDaliAnimationSetDisconnectActionP(void) stage.Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::BAKE ); + animation.SetDisconnectAction(Animation::BAKE); Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); @@ -1046,14 +1042,14 @@ int UtcDaliAnimationSetDisconnectActionP(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/); actor.Unparent(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition*0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION); } // Discard @@ -1062,9 +1058,9 @@ int UtcDaliAnimationSetDisconnectActionP(void) stage.Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::DISCARD ); + animation.SetDisconnectAction(Animation::DISCARD); Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); @@ -1073,14 +1069,14 @@ int UtcDaliAnimationSetDisconnectActionP(void) animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/); actor.Unparent(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); } // Don't play the animation: disconnect action should not be applied @@ -1089,21 +1085,21 @@ int UtcDaliAnimationSetDisconnectActionP(void) stage.Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/); actor.Unparent(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); } END_TEST; @@ -1112,7 +1108,7 @@ int UtcDaliAnimationSetDisconnectActionP(void) int UtcDaliAnimationGetDisconnectActionP(void) { TestApplication application; - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default! animation.SetDisconnectAction(Animation::DISCARD); @@ -1128,8 +1124,8 @@ int UtcDaliAnimationSetDefaultAlphaFunctionP(void) { TestApplication application; - Animation animation = Animation::New(1.0f); - AlphaFunction func = animation.GetDefaultAlphaFunction(); + Animation animation = Animation::New(1.0f); + AlphaFunction func = animation.GetDefaultAlphaFunction(); DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); @@ -1142,8 +1138,8 @@ int UtcDaliAnimationGetDefaultAlphaFunctionP(void) { TestApplication application; - Animation animation = Animation::New(1.0f); - AlphaFunction func = animation.GetDefaultAlphaFunction(); + Animation animation = Animation::New(1.0f); + AlphaFunction func = animation.GetDefaultAlphaFunction(); // Test that the default is linear DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); @@ -1169,7 +1165,7 @@ int UtcDaliAnimationSetCurrentProgressP(void) float durationSeconds(1.0f); animation.SetDuration(durationSeconds); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -1178,43 +1174,43 @@ int UtcDaliAnimationSetCurrentProgressP(void) animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation from 40% progress - animation.SetCurrentProgress( 0.4f ); + animation.SetCurrentProgress(0.4f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); + DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); //Set the progress to 70% - animation.SetCurrentProgress( 0.7f ); + animation.SetCurrentProgress(0.7f); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 100.0f) /* 80% progress */); + DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); + DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -1232,7 +1228,7 @@ int UtcDaliAnimationSetCurrentProgressN(void) float durationSeconds(1.0f); animation.SetDuration(durationSeconds); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -1241,13 +1237,13 @@ int UtcDaliAnimationSetCurrentProgressN(void) animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); //Trying to set the current cursor outside the range [0..1] is ignored - animation.SetCurrentProgress( -1.0f); + animation.SetCurrentProgress(-1.0f); application.SendNotification(); - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); - animation.SetCurrentProgress( 100.0f); + animation.SetCurrentProgress(100.0f); application.SendNotification(); - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); END_TEST; } @@ -1263,21 +1259,21 @@ int UtcDaliAnimationGetCurrentProgressP(void) animation.Play(); //Test GetCurrentProgress return 0.0 as the duration is 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); - animation.SetCurrentProgress( 0.5f ); + animation.SetCurrentProgress(0.5f); application.SendNotification(); application.Render(static_cast(100.0f)); //Progress should still be 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); //Set duration float durationSeconds(1.0f); animation.SetDuration(durationSeconds); application.SendNotification(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -1286,31 +1282,31 @@ int UtcDaliAnimationGetCurrentProgressP(void) animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation from 40% progress - animation.SetCurrentProgress( 0.4f ); + animation.SetCurrentProgress(0.4f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); //Set the progress to 70% - animation.SetCurrentProgress( 0.7f ); + animation.SetCurrentProgress(0.7f); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 100.0f) /* 80% progress */); + DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); @@ -1327,16 +1323,16 @@ int UtcDaliAnimationSetSpeedFactorP1(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); const Vector3 initialPosition(0.0f, 0.0f, 0.0f); const Vector3 targetPosition(100.0f, 100.0f, 100.0f); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f, initialPosition); - keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(0.0f, initialPosition); + keyframes.Add(1.0f, targetPosition); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); //Set speed to be x2 animation.SetSpeedFactor(2.0f); @@ -1344,37 +1340,37 @@ int UtcDaliAnimationSetSpeedFactorP1(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f) + 1u/*just beyond half the duration*/); + application.Render(static_cast(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -1387,68 +1383,68 @@ int UtcDaliAnimationSetSpeedFactorP2(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); const Vector3 initialPosition(0.0f, 0.0f, 0.0f); const Vector3 targetPosition(100.0f, 100.0f, 100.0f); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f, initialPosition); - keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(0.0f, initialPosition); + keyframes.Add(1.0f, targetPosition); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n"); - animation.SetSpeedFactor( -1.0f ); + animation.SetSpeedFactor(-1.0f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), initialPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -1461,75 +1457,74 @@ int UtcDaliAnimationSetSpeedFactorP3(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); const Vector3 initialPosition(0.0f, 0.0f, 0.0f); const Vector3 targetPosition(100.0f, 100.0f, 100.0f); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f, initialPosition); - keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(0.0f, initialPosition); + keyframes.Add(1.0f, targetPosition); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); tet_printf("Test half speed factor. Animation will take twice the duration\n"); //Set speed to be half of normal speed - animation.SetSpeedFactor( 0.5f ); + animation.SetSpeedFactor(0.5f); // Start the animation animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 30% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } - int UtcDaliAnimationSetSpeedFactorP4(void) { TestApplication application; @@ -1538,18 +1533,18 @@ int UtcDaliAnimationSetSpeedFactorP4(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); const Vector3 initialPosition(0.0f, 0.0f, 0.0f); const Vector3 targetPosition(100.0f, 100.0f, 100.0f); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f, initialPosition); - keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(0.0f, initialPosition); + keyframes.Add(1.0f, targetPosition); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -1557,64 +1552,64 @@ int UtcDaliAnimationSetSpeedFactorP4(void) tet_printf("Set speed to be half of normal speed\n"); tet_printf("SetSpeedFactor(0.5f)\n"); - animation.SetSpeedFactor( 0.5f ); + animation.SetSpeedFactor(0.5f); // Start the animation animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 30% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION); tet_printf("Reverse direction of animation whilst playing\n"); tet_printf("SetSpeedFactor(-0.5f)\n"); animation.SetSpeedFactor(-0.5f); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), 0.0001, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), initialPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -1638,150 +1633,202 @@ int UtcDaliAnimationSetSpeedFactorAndRange(void) /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - { 0.0f, 1.0f, // TimePeriod - 0.0f, 100.0f, // POS - {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ - /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */ - /**/ 50.0f, - /**/ 40.0f, - /**/ 30.0f, - /**/ 70.0f, - /**/ 60.0f, - /**/ 50.0f, + {0.0f, 1.0f, // TimePeriod + 0.0f, + 100.0f, // POS + { + /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ + /**/ 30.0f, + 40.0f, + 50.0f, + 60.0f, /* Reverse direction */ + /**/ 50.0f, + /**/ 40.0f, + /**/ 30.0f, + /**/ 70.0f, + /**/ 60.0f, + /**/ 50.0f, /**/ - } - }, + }}, // ACTOR 1 - Across start of range /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - { 0.2f, 0.5f, // TimePeriod - 20.0f, 50.0f, // POS - {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */ - /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */ - /**/ 50.0f, - /**/ 40.0f, - /**/ 30.0f, - /**/ 50.0f, - /**/ 50.0f, - /**/ 50.0f - } - }, + {0.2f, 0.5f, // TimePeriod + 20.0f, + 50.0f, // POS + {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */ + /**/ 30.0f, + 40.0f, + 50.0f, + 50.0f, /* Reverse direction @ frame #9 */ + /**/ 50.0f, + /**/ 40.0f, + /**/ 30.0f, + /**/ 50.0f, + /**/ 50.0f, + /**/ 50.0f}}, // ACTOR 2 - Across end of range /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - {/**/ 0.5f, 0.9f, // TimePeriod - /**/ 50.0f, 90.0f, // POS - { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */ - /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */ - /**/ 50.0f, - /**/ 50.0f, - /**/ 50.0f, 70.0f, - /**/ 60.0f, - /**/ 50.0f, - } - }, + {/**/ 0.5f, 0.9f, // TimePeriod + /**/ 50.0f, + 90.0f, // POS + { + /**/ 50.0f, + 50.0f, + 50.0f, + 60.0f, + 70.0f, /* Loop */ + /**/ 50.0f, + 50.0f, + 50.0f, + 60.0f, /* Reverse direction @ frame #9 */ + /**/ 50.0f, + /**/ 50.0f, + /**/ 50.0f, + 70.0f, + /**/ 60.0f, + /**/ 50.0f, + }}, // ACTOR 3 - Before beginning of range /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - {/**/ 0.1f, 0.25f, // TimePeriod - /**/ 10.0f, 25.0f, // POS - { /**/ - /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f + {/**/ 0.1f, 0.25f, // TimePeriod + /**/ 10.0f, + 25.0f, // POS + { /**/ - } - }, + /**/ 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f, + 25.0f + /**/ + }}, // ACTOR 4 - After end of range /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - {/**/ 0.85f, 1.0f, // TimePeriod - /**/ 85.0f, 100.0f, // POS - { /**/ - /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f + {/**/ 0.85f, 1.0f, // TimePeriod + /**/ 85.0f, + 100.0f, // POS + { /**/ - } - }, + /**/ 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f, + 85.0f + /**/ + }}, // Actor 5 - Middle of range /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ /* | reverse */ - {/**/ 0.4f, 0.65f, // Time Period - /**/ 40.0f, 65.0f, // Position - { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f, - /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse - /**/ 50.0f, - /**/ 40.0f, - /**/ 40.0f, - /**/ 65.0f, - /**/ 60.0f, - /**/ 50.0f, - } - } - }; - - const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData)); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - bool signalReceived(false); + {/**/ 0.4f, 0.65f, // Time Period + /**/ 40.0f, + 65.0f, // Position + { + /**/ 40.0f, + 40.0f, + 50.0f, + 60.0f, + 65.0f, + /**/ 40.0f, + 40.0f, + 50.0f, + 60.0f, // Reverse + /**/ 50.0f, + /**/ 40.0f, + /**/ 40.0f, + /**/ 65.0f, + /**/ 60.0f, + /**/ 50.0f, + }}}; + + const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData)); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); std::vector actors; - for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex ) + for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex) { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector3( testData[actorIndex].startX, 0, 0 ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0)); actors.push_back(actor); application.GetScene().Add(actor); - if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 ) + if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1) { KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0)); - keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0)); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0)); + keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0)); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); } else { - animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime)); } } tet_printf("Test half speed factor. Animation will take twice the duration\n"); tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); tet_printf("SetSpeedFactor(0.5f)\n"); - animation.SetSpeedFactor( 0.5f ); - animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetSpeedFactor(0.5f); + animation.SetPlayRange(Vector2(0.3f, 0.8f)); animation.SetLooping(true); // Start the animation animation.Play(); application.SendNotification(); - application.Render(0); // Frame 0 tests initial values + application.Render(0); // Frame 0 tests initial values - for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame) { unsigned int actorIndex = 0u; - for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex ) + for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex) { - DALI_TEST_EQUALS( actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION ); - if( ! Equals(actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame]) ) + DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION); + if(!Equals(actors[actorIndex].GetCurrentProperty(Actor::Property::POSITION).x, testData[actorIndex].expected[frame])) { - tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex ); + tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex); } } - if( frame == 8 ) + if(frame == 8) { tet_printf("Reverse direction of animation whilst playing after frame 8\n"); tet_printf("SetSpeedFactor(-0.5f)\n"); @@ -1817,55 +1864,63 @@ int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void) // ACTOR 0 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ - { 0.0f, 1.0f, // TimePeriod - 0.0f, 100.0f, // POS - {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ - /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, - /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, + {0.0f, 1.0f, // TimePeriod + 0.0f, + 100.0f, // POS + { + /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ + /**/ 30.0f, + 40.0f, + 50.0f, + 60.0f, + 70.0f, + /**/ 30.0f, + 40.0f, + 50.0f, + 60.0f, + 70.0f, /**/ - } - }; - + }}; // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - bool signalReceived(false); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); std::vector actors; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0)); actors.push_back(actor); application.GetScene().Add(actor); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0)); - keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0)); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0)); + keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0)); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); tet_printf("Test half speed factor. Animation will take twice the duration\n"); tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); tet_printf("SetSpeedFactor(0.5f)\n"); tet_printf("SetLoopCount(3)\n"); - animation.SetSpeedFactor( 0.5f ); - animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetSpeedFactor(0.5f); + animation.SetPlayRange(Vector2(0.3f, 0.8f)); animation.SetLoopCount(3); // Start the animation animation.Play(); application.SendNotification(); - application.Render(0); // Frame 0 tests initial values + application.Render(0); // Frame 0 tests initial values - for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame) { - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION); application.Render(200); // 200 ms at half speed corresponds to 0.1 s - if( frame < NUM_FRAMES-1 ) + if(frame < NUM_FRAMES - 1) { // We didn't expect the animation to finish yet application.SendNotification(); @@ -1876,7 +1931,7 @@ int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 80.0f, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION); END_TEST; } @@ -1900,54 +1955,66 @@ int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void) // ACTOR 0 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ /* |----------PlayRange---------------| */ - { 0.0f, 1.0f, // TimePeriod - 0.0f, 100.0f, // POS - {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, - /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, - /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, - } - }; - - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - bool signalReceived(false); + {0.0f, 1.0f, // TimePeriod + 0.0f, + 100.0f, // POS + { + /**/ 80.0f, + 70.0f, + 60.0f, + 50.0f, + 40.0f, + /**/ 80.0f, + 70.0f, + 60.0f, + 50.0f, + 40.0f, + /**/ 80.0f, + 70.0f, + 60.0f, + 50.0f, + 40.0f, + }}; + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); std::vector actors; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0)); actors.push_back(actor); application.GetScene().Add(actor); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0)); - keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0)); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0)); + keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0)); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); tet_printf("Test reverse half speed factor. Animation will take twice the duration\n"); tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); tet_printf("SetSpeedFactor(-0.5f)\n"); tet_printf("SetLoopCount(3)\n"); - animation.SetSpeedFactor( -0.5f ); - animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetSpeedFactor(-0.5f); + animation.SetPlayRange(Vector2(0.3f, 0.8f)); animation.SetLoopCount(3); // Start the animation animation.Play(); application.SendNotification(); - application.Render(0); // Frame 0 tests initial values + application.Render(0); // Frame 0 tests initial values - for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame) { - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION); application.Render(200); // 200 ms at half speed corresponds to 0.1 s - if( frame < NUM_FRAMES-1 ) + if(frame < NUM_FRAMES - 1) { // We didn't expect the animation to finish yet application.SendNotification(); @@ -1958,12 +2025,11 @@ int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 30.0f, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION); END_TEST; } - int UtcDaliAnimationGetSpeedFactorP(void) { TestApplication application; @@ -1982,50 +2048,50 @@ int UtcDaliAnimationSetPlayRangeP(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Build the animation - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); // Set range between 0.4 and 0.8 - animation.SetPlayRange( Vector2( 0.4f, 0.9f ) ); + animation.SetPlayRange(Vector2(0.4f, 0.9f)); application.SendNotification(); - DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation from 40% progress animation.Play(); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ ); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.6f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ ); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.8f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); END_TEST; } @@ -2041,17 +2107,17 @@ int UtcDaliAnimationSetPlayRangeN(void) application.SendNotification(); //PlayRange out of bounds - animation.SetPlayRange( Vector2(-1.0f,1.0f) ); + animation.SetPlayRange(Vector2(-1.0f, 1.0f)); application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); - animation.SetPlayRange( Vector2(0.0f,2.0f) ); + DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION); + animation.SetPlayRange(Vector2(0.0f, 2.0f)); application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION); //If playRange is not in the correct order it has to be ordered - animation.SetPlayRange( Vector2(0.8f,0.2f) ); + animation.SetPlayRange(Vector2(0.8f, 0.2f)); application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION); END_TEST; } @@ -2061,19 +2127,19 @@ int UtcDaliAnimationGetPlayRangeP(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Build the animation - Animation animation = Animation::New( 1.0f ); + Animation animation = Animation::New(1.0f); application.SendNotification(); //If PlayRange not specified it should be 0.0-1.0 by default - DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION); // Set range between 0.4 and 0.8 - animation.SetPlayRange( Vector2( 0.4f, 0.8f ) ); + animation.SetPlayRange(Vector2(0.4f, 0.8f)); application.SendNotification(); - DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION); END_TEST; } @@ -2086,67 +2152,67 @@ int UtcDaliAnimationPlayP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2158,88 +2224,87 @@ int UtcDaliAnimationPlayOffSceneDiscardP(void) TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 basePosition(Vector3::ZERO); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), basePosition, TEST_LOCATION); // Not added to the stage yet! // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::DISCARD ); + animation.SetDisconnectAction(Animation::DISCARD); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION); // Add to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION); // Remove from the stage application.GetScene().Remove(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Add to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(80,80,80), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); - + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2251,79 +2316,79 @@ int UtcDaliAnimationPlayOffSceneBakeFinalP(void) TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 basePosition(Vector3::ZERO); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), basePosition, TEST_LOCATION); // Not added to the stage! // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION); // Add to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION); // Remove from the stage application.GetScene().Remove(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION); // Add to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final removed the */, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2335,77 +2400,77 @@ int UtcDaliAnimationPlayOffSceneBakeP(void) TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 basePosition(Vector3::ZERO); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), basePosition, TEST_LOCATION); // Not added to the stage! // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::BAKE ); + animation.SetDisconnectAction(Animation::BAKE); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION); // Add to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION); // Remove from the stage application.GetScene().Remove(actor); // baked here application.SendNotification(); // this render is a no-op in this case as animator is disabled while off stage - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40) /*baked value*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION); // Add back to the stage application.GetScene().Add(actor); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION ); - application.Render(static_cast(0.0f) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION ); - application.Render(static_cast(0.0f) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION); + application.Render(static_cast(0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION); + application.Render(static_cast(0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION); // Remove from the stage application.GetScene().Remove(actor); // baked here application.SendNotification(); // this render is a no-op in this case as animator is disabled while off stage - application.Render(static_cast(durationSeconds*200.0f)/* 100% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION ); - application.Render(static_cast(0.0f) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION ); - application.Render(static_cast(0.0f) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 100% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION); + application.Render(static_cast(0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION); + application.Render(static_cast(0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION); // Add back to the stage application.GetScene().Add(actor); @@ -2413,22 +2478,22 @@ int UtcDaliAnimationPlayOffSceneBakeP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) , TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2440,12 +2505,12 @@ int UtcDaliAnimationPlayDiscardHandleP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -2455,53 +2520,53 @@ int UtcDaliAnimationPlayDiscardHandleP(void) // This is a test of the "Fire and Forget" behaviour // Discard the animation handle! animation.Reset(); - DALI_TEST_CHECK( !animation ); + DALI_TEST_CHECK(!animation); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2513,64 +2578,64 @@ int UtcDaliAnimationPlayStopDiscardHandleP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); // This is a test of the "Fire and Forget" behaviour // Stop the animation, and Discard the animation handle! animation.Stop(); animation.Reset(); - DALI_TEST_CHECK( !animation ); + DALI_TEST_CHECK(!animation); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); // We expect the animation to finish at 20% progress application.SendNotification(); finishCheck.CheckSignalReceived(); finishCheck.Reset(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // Check that nothing has changed application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // Check that nothing has changed application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 100% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 100% progress */); // Check that nothing has changed application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION); END_TEST; } @@ -2582,97 +2647,95 @@ int UtcDaliAnimationPlayRangeP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) ); - keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) ); + keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f)); + keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f)); - animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes ); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes); // Set range between 0.4 and 0.8 - animation.SetPlayRange( Vector2(0.4f,0.8f) ); + animation.SetPlayRange(Vector2(0.4f, 0.8f)); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); //Test that setting progress outside the range doesn't work - animation.SetCurrentProgress( 0.9f ); + animation.SetCurrentProgress(0.9f); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION ); - animation.SetCurrentProgress( 0.2f ); + DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION); + animation.SetCurrentProgress(0.2f); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /* 80% progress */); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); - + DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); //Loop inside the range finishCheck.Reset(); - animation.SetLooping( true ); + animation.SetLooping(true); animation.Play(); application.SendNotification(); float intervalSeconds = 0.1f; - float progress = 0.4f; - for (int iterations = 0; iterations < 10; ++iterations ) + float progress = 0.4f; + for(int iterations = 0; iterations < 10; ++iterations) { - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); progress += intervalSeconds; - if (progress > 0.8f) + if(progress > 0.8f) { progress = progress - 0.4f; } - DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty(Actor::Property::POSITION), 0.001f, TEST_LOCATION); } // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - //Test change range on the fly - animation.SetPlayRange( Vector2( 0.2f, 0.9f ) ); + animation.SetPlayRange(Vector2(0.2f, 0.9f)); application.SendNotification(); - for (int iterations = 0; iterations < 10; ++iterations ) + for(int iterations = 0; iterations < 10; ++iterations) { - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); progress += intervalSeconds; - if (progress > 0.9f) + if(progress > 0.9f) { progress = progress - 0.7f; } - DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty(Actor::Property::POSITION), 0.001f, TEST_LOCATION); } END_TEST; @@ -2685,52 +2748,52 @@ int UtcDaliAnimationPlayFromP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation from 40% progress - animation.PlayFrom( 0.4f ); + animation.PlayFrom(0.4f); // Target value should be updated straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION); animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } @@ -2742,19 +2805,19 @@ int UtcDaliAnimationPlayFromN(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); //PlayFrom with an argument outside the range [0..1] will be ignored animation.PlayFrom(-1.0f); application.SendNotification(); - DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); animation.PlayFrom(100.0f); application.SendNotification(); - DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); END_TEST; } @@ -2766,9 +2829,9 @@ int UtcDaliAnimationPauseP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -2776,59 +2839,58 @@ int UtcDaliAnimationPauseP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION); // Pause the animation animation.Pause(); application.SendNotification(); // Loop 5 times - for (int i=0; i<5; ++i) + for(int i = 0; i < 5; ++i) { - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION); } // Keep going animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)/*slightly less than the animation duration*/); + application.Render(static_cast(durationSeconds * 490.0f) /*slightly less than the animation duration*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); END_TEST; } - int UtcDaliAnimationGetStateP(void) { TestApplication application; @@ -2837,87 +2899,86 @@ int UtcDaliAnimationGetStateP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION); Vector3 fiftyPercentProgress(targetPosition * 0.5f); // Start the animation animation.Play(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION); // Pause the animation animation.Pause(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION); application.SendNotification(); application.Render(0.f); // Loop 5 times - for (int i=0; i<5; ++i) + for(int i = 0; i < 5; ++i) { - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION); } // Keep going finishCheck.Reset(); animation.Play(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)/*slightly less than the animation duration*/); + application.Render(static_cast(durationSeconds * 490.0f) /*slightly less than the animation duration*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION); // re-play finishCheck.Reset(); animation.Play(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)/*slightly less than the animation duration*/); + application.Render(static_cast(durationSeconds * 490.0f) /*slightly less than the animation duration*/); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); - + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); END_TEST; } @@ -2930,9 +2991,9 @@ int UtcDaliAnimationStopP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -2940,31 +3001,31 @@ int UtcDaliAnimationStopP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION); // Stop the animation animation.Stop(); application.SendNotification(); // Loop 5 times - for (int i=0; i<5; ++i) + for(int i = 0; i < 5; ++i) { - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION); } END_TEST; } @@ -2980,9 +3041,9 @@ int UtcDaliAnimationStopSetPositionP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -2990,33 +3051,33 @@ int UtcDaliAnimationStopSetPositionP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION); // Stop the animation animation.Stop(); Vector3 positionSet(2.0f, 3.0f, 4.0f); - actor.SetProperty( Actor::Property::POSITION, positionSet ); + actor.SetProperty(Actor::Property::POSITION, positionSet); application.SendNotification(); // Loop 5 times - for (int i=0; i<5; ++i) + for(int i = 0; i < 5; ++i) { - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), positionSet/*Animation should not interfere with this*/, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION); } END_TEST; } @@ -3029,9 +3090,9 @@ int UtcDaliAnimationClearP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -3039,52 +3100,52 @@ int UtcDaliAnimationClearP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION); // Clear the animation animation.Clear(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We don't expect the animation to finish now application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION); // Restart as a scale animation; this should not move the actor's position finishCheck.Reset(); - actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO ); + actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO); Vector3 targetScale(3.0f, 3.0f, 3.0f); - animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); END_TEST; } @@ -3093,16 +3154,16 @@ int UtcDaliAnimationFinishedSignalP(void) TestApplication application; // Start the empty animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); @@ -3117,50 +3178,50 @@ int UtcDaliAnimationAnimateByBooleanP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); - Animation animation = Animation::New(durationSeconds); + float durationSeconds(2.0f); + Animation animation = Animation::New(durationSeconds); const bool relativeValue(true); - const bool finalValue( false || relativeValue ); + const bool finalValue(false || relativeValue); animation.AnimateBy(Property(actor, index), relativeValue); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), finalValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Repeat with relative value "false" - this should be an NOOP animation = Animation::New(durationSeconds); @@ -3174,26 +3235,26 @@ int UtcDaliAnimationAnimateByBooleanP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -3204,47 +3265,47 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool relativeValue(true); - bool finalValue( false || relativeValue ); + bool relativeValue(true); + bool finalValue(false || relativeValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Repeat with relative value "false" - this should be an NOOP animation = Animation::New(durationSeconds); @@ -3258,20 +3319,20 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -3282,60 +3343,60 @@ int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool relativeValue(true); - bool finalValue( false || relativeValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateBy( Property(actor, index), - relativeValue, - TimePeriod( animatorDurationSeconds ) ); + bool relativeValue(true); + bool finalValue(false || relativeValue); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateBy(Property(actor, index), + relativeValue, + TimePeriod(animatorDurationSeconds)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% animator progress */); + application.Render(static_cast(animatorDurationSeconds * 950.0f) /* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); + application.Render(static_cast(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/); // We didn't expect the animation to finish yet... application.SendNotification(); finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -3346,61 +3407,61 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool relativeValue(true); - bool finalValue( false || relativeValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateBy( Property(actor, index), - relativeValue, - AlphaFunction::EASE_IN_OUT, - TimePeriod( animatorDurationSeconds ) ); + bool relativeValue(true); + bool finalValue(false || relativeValue); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateBy(Property(actor, index), + relativeValue, + AlphaFunction::EASE_IN_OUT, + TimePeriod(animatorDurationSeconds)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% animator progress */); + application.Render(static_cast(animatorDurationSeconds * 950.0f) /* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); + application.Render(static_cast(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/); // We didn't expect the animation to finish yet... application.SendNotification(); finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -3411,52 +3472,52 @@ int UtcDaliAnimationAnimateByFloatP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(50.0f); - float relativeValue(targetValue - startValue); + float targetValue(50.0f); + float relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue); - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3467,52 +3528,52 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(90.0f); - float relativeValue(targetValue - startValue); + float targetValue(90.0f); + float relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - float current( actor.GetCurrentProperty< float >( index ) ); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + float current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current > ninetyFivePercentProgress); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3523,18 +3584,18 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; + float targetValue(30.0f); + float relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, TimePeriod(delay, durationSeconds - delay)); @@ -3542,39 +3603,39 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3585,18 +3646,18 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; + float targetValue(30.0f); + float relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::LINEAR, @@ -3605,39 +3666,39 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3648,52 +3709,52 @@ int UtcDaliAnimationAnimateByIntegerP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(1); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(1); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(50); - int relativeValue(targetValue - startValue); + int targetValue(50); + int relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue); - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue * 0.95f + 0.5f)); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3704,52 +3765,52 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(1); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(1); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(90); - int relativeValue(targetValue - startValue); + int targetValue(90); + int relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue * 0.95f + 0.5f)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - int current( actor.GetCurrentProperty< int >( index ) ); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + int current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current > ninetyFivePercentProgress); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3760,18 +3821,18 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; + int targetValue(30); + int relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, TimePeriod(delay, durationSeconds - delay)); @@ -3779,39 +3840,39 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), static_cast(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3822,18 +3883,18 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; + int targetValue(30); + int relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::LINEAR, @@ -3842,39 +3903,39 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), static_cast(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3885,33 +3946,33 @@ int UtcDaliAnimationAnimateByQuaternionP(void) Actor actor = Actor::New(); // Register a quaternion property - const Quaternion startValue( Degree( 90 ), Vector3::XAXIS ); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + const Quaternion startValue(Degree(90), Vector3::XAXIS); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); - Animation animation = Animation::New(durationSeconds); - const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS ); - const Quaternion finalValue( startValue * relativeValue ); + float durationSeconds(2.0f); + Animation animation = Animation::New(durationSeconds); + const Quaternion relativeValue(Degree(90), Vector3::ZAXIS); + const Quaternion finalValue(startValue * relativeValue); animation.AnimateBy(Property(actor, index), relativeValue); - DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == finalValue); application.SendNotification(); - application.Render( 2000 ); // animation complete + application.Render(2000); // animation complete - DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == finalValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -3923,52 +3984,52 @@ int UtcDaliAnimationAnimateByVector2P(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(60.0f, 60.0f); - Vector2 relativeValue(targetValue - startValue); + Vector2 targetValue(60.0f, 60.0f); + Vector2 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -3979,53 +4040,53 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(100.0f, 100.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(20.0f, 20.0f); - Vector2 relativeValue(targetValue - startValue); + Vector2 targetValue(20.0f, 20.0f); + Vector2 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) ); - DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); + Vector2 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4036,18 +4097,18 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(30.0f, 30.0f); - Vector2 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector2 targetValue(30.0f, 30.0f); + Vector2 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, TimePeriod(delay, durationSeconds - delay)); @@ -4055,39 +4116,39 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4098,18 +4159,18 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(5.0f, 5.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(10.0f, 10.0f); - Vector2 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector2 targetValue(10.0f, 10.0f); + Vector2 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::LINEAR, @@ -4118,39 +4179,39 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4161,52 +4222,52 @@ int UtcDaliAnimationAnimateByVector3P(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(60.0f, 60.0f, 60.0f); - Vector3 relativeValue(targetValue - startValue); + Vector3 targetValue(60.0f, 60.0f, 60.0f); + Vector3 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4217,54 +4278,54 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(100.0f, 100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(100.0f, 100.0f, 100.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(20.0f, 20.0f, 20.0f); - Vector3 relativeValue(targetValue - startValue); + Vector3 targetValue(20.0f, 20.0f, 20.0f); + Vector3 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( index )); - DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y); + DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4275,18 +4336,18 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(30.0f, 30.0f, 30.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector3 targetValue(30.0f, 30.0f, 30.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, TimePeriod(delay, durationSeconds - delay)); @@ -4294,39 +4355,39 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4337,18 +4398,18 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(5.0f, 5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(5.0f, 5.0f, 5.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(10.0f, 10.0f, 10.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector3 targetValue(10.0f, 10.0f, 10.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::LINEAR, @@ -4357,39 +4418,39 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4400,52 +4461,52 @@ int UtcDaliAnimationAnimateByVector4P(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f); - Vector4 relativeValue(targetValue - startValue); + Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f); + Vector4 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue); - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4456,55 +4517,55 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f); - Vector4 relativeValue(targetValue - startValue); + Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f); + Vector4 relativeValue(targetValue - startValue); animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) ); - DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z ); - DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w ); + Vector4 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y); + DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z); + DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4515,18 +4576,18 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); - Vector4 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, TimePeriod(delay, durationSeconds - delay)); @@ -4534,39 +4595,39 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4577,18 +4638,18 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f); - Vector4 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::LINEAR, @@ -4597,39 +4658,39 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -4637,54 +4698,54 @@ int UtcDaliAnimationAnimateByActorPositionP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetProperty( Actor::Property::POSITION, startPosition ); + actor.SetProperty(Actor::Property::POSITION, startPosition); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); + Vector3 targetPosition(20.0f, 20.0f, 20.0f); + Vector3 relativePosition(targetPosition - startPosition); animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -4694,35 +4755,35 @@ int UtcDaliAnimationAnimateByActorPositionComponentsP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 300.0f, 400.0f); - Vector3 relativePosition(targetPosition - Vector3::ZERO); - animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x ); - animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y ); - animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z ); + Vector3 targetPosition(200.0f, 300.0f, 400.0f); + Vector3 relativePosition(targetPosition - Vector3::ZERO); + animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x); + animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y); + animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -4731,56 +4792,56 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetProperty( Actor::Property::POSITION, startPosition ); + actor.SetProperty(Actor::Property::POSITION, startPosition); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); + Vector3 targetPosition(20.0f, 20.0f, 20.0f); + Vector3 relativePosition(targetPosition - startPosition); animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::POSITION)); + DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y); + DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -4788,54 +4849,54 @@ int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetProperty( Actor::Property::POSITION, startPosition ); + actor.SetProperty(Actor::Property::POSITION, startPosition); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); - float delay = 0.5f; + Vector3 targetPosition(20.0f, 20.0f, 20.0f); + Vector3 relativePosition(targetPosition - startPosition); + float delay = 0.5f; animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, TimePeriod(delay, durationSeconds - delay)); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -4843,55 +4904,55 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetProperty( Actor::Property::POSITION, startPosition ); + actor.SetProperty(Actor::Property::POSITION, startPosition); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); - float delay = 0.5f; + Vector3 targetPosition(20.0f, 20.0f, 20.0f); + Vector3 relativePosition(targetPosition - startPosition); + float delay = 0.5f; animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), startPosition, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -4900,58 +4961,58 @@ int UtcDaliAnimationAnimateByActorOrientationP1(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) ); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS)); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -4962,60 +5023,59 @@ int UtcDaliAnimationAnimateByActorOrientationP2(void) tet_printf("Testing that rotation angle > 360 performs full rotations\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(710.0f); - Radian relativeRotationRadians(relativeRotationDegrees); + Degree relativeRotationDegrees(710.0f); + Radian relativeRotationRadians(relativeRotationDegrees); - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) ); + animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } - int UtcDaliAnimationAnimateByActorOrientationP3(void) { TestApplication application; @@ -5023,117 +5083,116 @@ int UtcDaliAnimationAnimateByActorOrientationP3(void) tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n"); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(730.0f); - Radian relativeRotationRadians(relativeRotationDegrees); + Degree relativeRotationDegrees(730.0f); + Radian relativeRotationRadians(relativeRotationDegrees); - Radian actualRotationRadians( Degree(10.0f) ); + Radian actualRotationRadians(Degree(10.0f)); - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) ); + animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } - int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN ); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -5142,60 +5201,59 @@ int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - float delay = 0.3f; - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), - AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) ); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + float delay = 0.3f; + animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -5205,109 +5263,109 @@ int UtcDaliAnimationAnimateByActorScaleP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 2.0f, 2.0f); - Vector3 relativeScale(targetScale - Vector3::ONE); - animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) ); + Vector3 targetScale(2.0f, 2.0f, 2.0f); + Vector3 relativeScale(targetScale - Vector3::ONE); + animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z)); - Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f); + Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SCALE,Vector3::ONE); + actor.SetProperty(Actor::Property::SCALE, Vector3::ONE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN ); + animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The scale should have grown less, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); - DALI_TEST_CHECK( current.x > 1.0f ); - DALI_TEST_CHECK( current.y > 1.0f ); - DALI_TEST_CHECK( current.z > 1.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::SCALE)); + DALI_TEST_CHECK(current.x > 1.0f); + DALI_TEST_CHECK(current.y > 1.0f); + DALI_TEST_CHECK(current.z > 1.0f); + DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y); + DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SCALE,Vector3::ONE); + actor.SetProperty(Actor::Property::SCALE, Vector3::ONE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Repeat with a delay float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); + animation = Animation::New(durationSeconds); + animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); END_TEST; } @@ -5317,35 +5375,35 @@ int UtcDaliAnimationAnimateByActorScaleComponentsP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 3.0f, 4.0f); - Vector3 relativeScale(targetScale - Vector3::ONE); - animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x ); - animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y ); - animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z ); + Vector3 targetScale(2.0f, 3.0f, 4.0f); + Vector3 relativeScale(targetScale - Vector3::ONE); + animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x); + animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y); + animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); END_TEST; } @@ -5356,34 +5414,34 @@ int UtcDaliAnimationAnimateByActorColorP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f ); - Vector4 relativeColor( targetColor - Color::WHITE ); - animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor ); + Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f); + Vector4 relativeColor(targetColor - Color::WHITE); + animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); END_TEST; } @@ -5394,37 +5452,37 @@ int UtcDaliAnimationAnimateByActorColorComponentsP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f ); - Vector4 relativeColor( targetColor - Color::WHITE ); - animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r ); - animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g ); - animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b ); - animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a ); + Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f); + Vector4 relativeColor(targetColor - Color::WHITE); + animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r); + animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g); + animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b); + animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); END_TEST; } @@ -5435,33 +5493,33 @@ int UtcDaliAnimationAnimateByActorSizeP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetSize( 100.0f, 200.0f, 300.0f ); - Vector3 relativeSize( targetSize - Vector3::ZERO ); - animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize ); + Vector3 targetSize(100.0f, 200.0f, 300.0f); + Vector3 relativeSize(targetSize - Vector3::ZERO); + animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); END_TEST; } @@ -5472,35 +5530,35 @@ int UtcDaliAnimationAnimateByActorSizeComponentsP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetSize( 100.0f, 200.0f, 300.0f ); - Vector3 relativeSize( targetSize - Vector3::ZERO ); - animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width ); - animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height ); - animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth ); + Vector3 targetSize(100.0f, 200.0f, 300.0f); + Vector3 relativeSize(targetSize - Vector3::ZERO); + animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width); + animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height); + animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); END_TEST; } @@ -5511,35 +5569,35 @@ int UtcDaliAnimationAnimateByActorVisibilityP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); - actor.SetProperty( Actor::Property::VISIBLE, false ); + actor.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool targetVisibility( true ); - bool relativeVisibility( targetVisibility ); - animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility ); + bool targetVisibility(true); + bool relativeVisibility(targetVisibility); + animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility); - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); // Not changed yet + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet application.SendNotification(); - application.Render( 1000 ); // 1 second progress + application.Render(1000); // 1 second progress - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); END_TEST; } @@ -5551,50 +5609,50 @@ int UtcDaliAnimationAnimateToBooleanP(void) Actor actor = Actor::New(); // Register a boolean property - const bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + const bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); - Animation animation = Animation::New(durationSeconds); - const bool targetValue( !startValue ); + float durationSeconds(2.0f); + Animation animation = Animation::New(durationSeconds); + const bool targetValue(!startValue); animation.AnimateTo(Property(actor, index), targetValue); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); // Repeat with target value "false" animation = Animation::New(durationSeconds); - const bool finalValue( !targetValue ); + const bool finalValue(!targetValue); animation.AnimateTo(Property(actor, index), finalValue); // Start the animation @@ -5604,26 +5662,26 @@ int UtcDaliAnimationAnimateToBooleanP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -5634,50 +5692,50 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) Actor actor = Actor::New(); // Register a boolean property - const bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + const bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); - Animation animation = Animation::New(durationSeconds); - const bool targetValue( !startValue ); + float durationSeconds(2.0f); + Animation animation = Animation::New(durationSeconds); + const bool targetValue(!startValue); animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); // Repeat with target value "false" animation = Animation::New(durationSeconds); - const bool finalValue( !targetValue ); + const bool finalValue(!targetValue); animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT); // Start the animation @@ -5687,26 +5745,26 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == targetValue); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -5717,59 +5775,59 @@ int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool finalValue( !startValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateTo( Property(actor, index), - finalValue, - TimePeriod( animatorDurationSeconds ) ); + bool finalValue(!startValue); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateTo(Property(actor, index), + finalValue, + TimePeriod(animatorDurationSeconds)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% animator progress */); + application.Render(static_cast(animatorDurationSeconds * 950.0f) /* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); + application.Render(static_cast(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/); // We didn't expect the animation to finish yet... application.SendNotification(); finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -5780,60 +5838,60 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + bool startValue(false); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetProperty(index) == startValue); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool finalValue( !startValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateTo( Property(actor, index), - finalValue, - AlphaFunction::LINEAR, - TimePeriod( animatorDurationSeconds ) ); + bool finalValue(!startValue); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateTo(Property(actor, index), + finalValue, + AlphaFunction::LINEAR, + TimePeriod(animatorDurationSeconds)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% animator progress */); + application.Render(static_cast(animatorDurationSeconds * 950.0f) /* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == startValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); + application.Render(static_cast(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/); // We didn't expect the animation to finish yet... application.SendNotification(); finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); application.Render(0); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue ); + DALI_TEST_CHECK(actor.GetCurrentProperty(index) == finalValue); END_TEST; } @@ -5844,43 +5902,43 @@ int UtcDaliAnimationAnimateToFloatP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(50.0f); - float relativeValue(targetValue - startValue); + float targetValue(50.0f); + float relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, "testProperty"), targetValue); - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -5891,46 +5949,46 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(90.0f); - float relativeValue(targetValue - startValue); + float targetValue(90.0f); + float relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - float current( actor.GetCurrentProperty< float >( index ) ); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + float current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current > ninetyFivePercentProgress); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -5941,18 +5999,18 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; + float targetValue(30.0f); + float relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(delay, durationSeconds - delay)); @@ -5960,33 +6018,33 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -5997,18 +6055,18 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; + float targetValue(30.0f); + float relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::LINEAR, @@ -6017,33 +6075,33 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6054,43 +6112,43 @@ int UtcDaliAnimationAnimateToIntegerP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(50); - int relativeValue(targetValue - startValue); + int targetValue(50); + int relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, "testProperty"), targetValue); - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue * 0.95f + 0.5f)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6101,46 +6159,46 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(90); - int relativeValue(targetValue - startValue); + int targetValue(90); + int relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue * 0.95f + 0.5f)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - int current( actor.GetCurrentProperty< int >( index ) ); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + int current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current > ninetyFivePercentProgress); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6151,18 +6209,18 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; + int targetValue(30); + int relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(delay, durationSeconds - delay)); @@ -6170,33 +6228,33 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), static_cast(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6207,18 +6265,18 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(10); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; + int targetValue(30); + int relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::LINEAR, @@ -6227,33 +6285,33 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), static_cast(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6264,43 +6322,43 @@ int UtcDaliAnimationAnimateToVector2P(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(-50.0f, -50.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(-50.0f, -50.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(50.0f, 50.0f); - Vector2 relativeValue(targetValue - startValue); + Vector2 targetValue(50.0f, 50.0f); + Vector2 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6311,47 +6369,47 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(1000.0f, 1000.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(9000.0f, 9000.0f); - Vector2 relativeValue(targetValue - startValue); + Vector2 targetValue(9000.0f, 9000.0f); + Vector2 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) ); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); + Vector2 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6362,18 +6420,18 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(-10.0f, 20.0f); - Vector2 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector2 targetValue(-10.0f, 20.0f); + Vector2 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(delay, durationSeconds - delay)); @@ -6381,33 +6439,33 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6418,18 +6476,18 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector2 startValue(10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(30.0f, 30.0f); - Vector2 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector2 targetValue(30.0f, 30.0f); + Vector2 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::LINEAR, @@ -6438,35 +6496,35 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet, but cached value should be the final one application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6477,43 +6535,43 @@ int UtcDaliAnimationAnimateToVector3P(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(-50.0f, -50.0f, -50.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(-50.0f, -50.0f, -50.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(50.0f, 50.0f, 50.0f); - Vector3 relativeValue(targetValue - startValue); + Vector3 targetValue(50.0f, 50.0f, 50.0f); + Vector3 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6524,48 +6582,48 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(1000.0f, 1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(1000.0f, 1000.0f, 1000.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(9000.0f, 9000.0f, 9000.0f); - Vector3 relativeValue(targetValue - startValue); + Vector3 targetValue(9000.0f, 9000.0f, 9000.0f); + Vector3 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) ); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y); + DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6576,18 +6634,18 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(-10.0f, 20.0f, 100.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector3 targetValue(-10.0f, 20.0f, 100.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(delay, durationSeconds - delay)); @@ -6595,33 +6653,33 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6632,18 +6690,18 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(30.0f, 30.0f, 30.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector3 targetValue(30.0f, 30.0f, 30.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::LINEAR, @@ -6652,33 +6710,33 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6689,19 +6747,19 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) Actor actor = Actor::New(); // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(30.0f, 30.0f, 10.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, "testProperty", 0), + Vector3 targetValue(30.0f, 30.0f, 10.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, "testProperty", 0), 30.0f, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); @@ -6713,33 +6771,33 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6750,43 +6808,43 @@ int UtcDaliAnimationAnimateToVector4P(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f); - Vector4 relativeValue(targetValue - startValue); + Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f); + Vector4 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue); - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), ninetyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6797,49 +6855,49 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f); - Vector4 relativeValue(targetValue - startValue); + Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f); + Vector4 relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds * 950.0f) /* 95% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) ); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); - DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w ); + Vector4 current(actor.GetCurrentProperty(index)); + DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x); + DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y); + DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z); + DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6850,18 +6908,18 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, VECTOR4_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f); - Vector4 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(delay, durationSeconds - delay)); @@ -6869,33 +6927,33 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, VECTOR4_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION); END_TEST; } @@ -6906,18 +6964,18 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); // Register a Vector4 property - Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); - Vector4 relativeValue(targetValue - startValue); - float delay = 0.5f; + Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::LINEAR, @@ -6926,33 +6984,33 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -6962,17 +7020,18 @@ int UtcDaliAnimationAnimateToActorParentOriginP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); + Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin); + }, + "Property is not animatable"); END_TEST; } @@ -6984,18 +7043,19 @@ int UtcDaliAnimationAnimateToActorParentOriginXN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); + float targetX(1.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX); + }, + "Property is not animatable"); END_TEST; } @@ -7007,18 +7067,19 @@ int UtcDaliAnimationAnimateToActorParentOriginYN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(1.0f); + float targetY(1.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY); + }, + "Property is not animatable"); END_TEST; } @@ -7030,18 +7091,19 @@ int UtcDaliAnimationAnimateToActorParentOriginZN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(1.0f); + float targetZ(1.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ); + }, + "Property is not animatable"); END_TEST; } @@ -7052,17 +7114,18 @@ int UtcDaliAnimationAnimateToActorAnchorPointN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); + Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint); + }, + "Property is not animatable"); END_TEST; } @@ -7074,18 +7137,19 @@ int UtcDaliAnimationAnimateToActorAnchorPointXN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); + float targetX(1.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX); + }, + "Property is not animatable"); END_TEST; } @@ -7097,18 +7161,19 @@ int UtcDaliAnimationAnimateToActorAnchorPointYN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(0.0f); + float targetY(0.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY); + }, + "Property is not animatable"); END_TEST; } @@ -7120,18 +7185,19 @@ int UtcDaliAnimationAnimateToActorAnchorPointZN(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(100.0f); + float targetZ(100.0f); DALI_TEST_ASSERTION( - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ ); - }, "Property is not animatable" ); + { + animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ); + }, + "Property is not animatable"); END_TEST; } @@ -7142,117 +7208,117 @@ int UtcDaliAnimationAnimateToActorSizeP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetSize(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize ); + Vector3 targetSize(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize); Vector3 ninetyNinePercentProgress(targetSize * 0.99f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO); + actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The size should have travelled less, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); - DALI_TEST_CHECK( current.x > 0.0f ); - DALI_TEST_CHECK( current.y > 0.0f ); - DALI_TEST_CHECK( current.z > 0.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::SIZE)); + DALI_TEST_CHECK(current.x > 0.0f); + DALI_TEST_CHECK(current.y > 0.0f); + DALI_TEST_CHECK(current.z > 0.0f); + DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y); + DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO); + actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Repeat with a delay float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation = Animation::New(durationSeconds); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); END_TEST; } @@ -7263,48 +7329,48 @@ int UtcDaliAnimationAnimateToActorSizeWidthP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).width, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetWidth(10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth ); + float targetWidth(10.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth); - float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, targetWidth, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION); END_TEST; } @@ -7315,48 +7381,48 @@ int UtcDaliAnimationAnimateToActorSizeHeightP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).height, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetHeight(-10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight ); + float targetHeight(-10.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight); - float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, targetHeight, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION); END_TEST; } @@ -7367,48 +7433,48 @@ int UtcDaliAnimationAnimateToActorSizeDepthP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).depth, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetDepth(-10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth ); + float targetDepth(-10.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth); - float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, targetDepth, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION); END_TEST; } @@ -7418,107 +7484,107 @@ int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetSize(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize ); + Vector3 targetSize(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize); Vector3 ninetyNinePercentProgress(targetSize * 0.99f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), targetSize, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO); + actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN ); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The size should have travelled less, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE )); - DALI_TEST_CHECK( current.x > 0.0f ); - DALI_TEST_CHECK( current.y > 0.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::SIZE)); + DALI_TEST_CHECK(current.x > 0.0f); + DALI_TEST_CHECK(current.y > 0.0f); + DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO); + actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Repeat with a delay float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); + animation = Animation::New(durationSeconds); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION); END_TEST; } @@ -7528,50 +7594,50 @@ int UtcDaliAnimationAnimateToActorPositionP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 750.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -7582,52 +7648,52 @@ int UtcDaliAnimationAnimateToActorPositionXP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX ); + float targetX(1.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX); - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetX, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).x, targetX, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetX, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); END_TEST; } @@ -7638,52 +7704,52 @@ int UtcDaliAnimationAnimateToActorPositionYP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).y, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(10.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY ); + float targetY(10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY); - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetY, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).y, targetY, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetY, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); END_TEST; } @@ -7694,52 +7760,52 @@ int UtcDaliAnimationAnimateToActorPositionZP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).z, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(-5.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ ); + float targetZ(-5.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ); - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f); // Should return the initial properties before play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION); // Start the animation animation.Play(); // Should return the target property after play - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, targetZ, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).z, targetZ, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION); END_TEST; } @@ -7749,12 +7815,12 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN); Vector3 seventyFivePercentProgress(targetPosition * 0.75f); @@ -7762,33 +7828,33 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 750.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The position should have moved less, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION )); - DALI_TEST_CHECK( current.x > Vector3::ZERO.x ); - DALI_TEST_CHECK( current.y > Vector3::ZERO.y ); - DALI_TEST_CHECK( current.z > Vector3::ZERO.z ); - DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::POSITION)); + DALI_TEST_CHECK(current.x > Vector3::ZERO.x); + DALI_TEST_CHECK(current.y > Vector3::ZERO.y); + DALI_TEST_CHECK(current.z > Vector3::ZERO.z); + DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x); + DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y); + DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -7798,49 +7864,49 @@ int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.AnimateTo( Property(actor, Actor::Property::POSITION), - targetPosition, - TimePeriod( delay, durationSeconds - delay ) ); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + float delay = 0.5f; + animation.AnimateTo(Property(actor, Actor::Property::POSITION), + targetPosition, + TimePeriod(delay, durationSeconds - delay)); Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); + application.Render(static_cast(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -7850,50 +7916,50 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.AnimateTo( Property(actor, Actor::Property::POSITION), - targetPosition, - AlphaFunction::LINEAR, - TimePeriod( delay, durationSeconds - delay ) ); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + float delay = 0.5f; + animation.AnimateTo(Property(actor, Actor::Property::POSITION), + targetPosition, + AlphaFunction::LINEAR, + TimePeriod(delay, durationSeconds - delay)); Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); + application.Render(static_cast(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -7902,58 +7968,58 @@ int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) ); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS)); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -7962,56 +8028,56 @@ int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation ); + animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -8020,55 +8086,55 @@ int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -8077,59 +8143,59 @@ int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay)); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + float delay(0.1f); + animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -8138,59 +8204,59 @@ int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay)); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + float delay(0.1f); + animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION); END_TEST; } @@ -8200,111 +8266,111 @@ int UtcDaliAnimationAnimateToActorScaleP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 2.0f, 2.0f); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale ); + Vector3 targetScale(2.0f, 2.0f, 2.0f); + animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale); - Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); + Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SCALE,Vector3::ONE); + actor.SetProperty(Actor::Property::SCALE, Vector3::ONE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN); + animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds * 990.0f) /* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The scale should have grown less, than with a linear alpha function - Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE )); - DALI_TEST_CHECK( current.x > 1.0f ); - DALI_TEST_CHECK( current.y > 1.0f ); - DALI_TEST_CHECK( current.z > 1.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); + Vector3 current(actor.GetCurrentProperty(Actor::Property::SCALE)); + DALI_TEST_CHECK(current.x > 1.0f); + DALI_TEST_CHECK(current.y > 1.0f); + DALI_TEST_CHECK(current.z > 1.0f); + DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x); + DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y); + DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::SCALE,Vector3::ONE); + actor.SetProperty(Actor::Property::SCALE, Vector3::ONE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Repeat with a delay float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation = Animation::New(durationSeconds); + animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE), targetScale, TEST_LOCATION); END_TEST; } @@ -8315,54 +8381,54 @@ int UtcDaliAnimationAnimateToActorScaleXP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).x, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX ); + float targetX(10.0f); + animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX); - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), targetX, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).x, targetX, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), targetX, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); END_TEST; } @@ -8373,54 +8439,54 @@ int UtcDaliAnimationAnimateToActorScaleYP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).y, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(1000.0f); - animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY ); + float targetY(1000.0f); + animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY); - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), targetY, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).y, targetY, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), targetY, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); END_TEST; } @@ -8431,54 +8497,54 @@ int UtcDaliAnimationAnimateToActorScaleZP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).z, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(-1000.0f); - animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ ); + float targetZ(-1000.0f); + animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ); - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, targetZ, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).z, targetZ, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION); END_TEST; } @@ -8488,13 +8554,13 @@ int UtcDaliAnimationAnimateToActorColorP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetColor(Color::RED); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor ); + Vector4 targetColor(Color::RED); + animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor); Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f)); Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f)); @@ -8503,107 +8569,107 @@ int UtcDaliAnimationAnimateToActorColorP(void) animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetColor.a, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), tenPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::COLOR,Color::WHITE); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN); + animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); // The color should have changed less, than with a linear alpha function - Vector4 current(actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR )); - DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change - DALI_TEST_CHECK( current.y < 1.0f ); - DALI_TEST_CHECK( current.y > tenPercentProgress.y ); - DALI_TEST_CHECK( current.z < 1.0f ); - DALI_TEST_CHECK( current.z > tenPercentProgress.z ); - DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change + Vector4 current(actor.GetCurrentProperty(Actor::Property::COLOR)); + DALI_TEST_CHECK(current.x == 1.0f); // doesn't change + DALI_TEST_CHECK(current.y < 1.0f); + DALI_TEST_CHECK(current.y > tenPercentProgress.y); + DALI_TEST_CHECK(current.z < 1.0f); + DALI_TEST_CHECK(current.z > tenPercentProgress.z); + DALI_TEST_CHECK(current.w == 1.0f); // doesn't change application.SendNotification(); - application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); // Reset everything finishCheck.Reset(); - actor.SetProperty( Actor::Property::COLOR,Color::WHITE); + actor.SetProperty(Actor::Property::COLOR, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Repeat with a shorter animator duration float animatorDuration = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration)); + animation = Animation::New(durationSeconds); + animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration)); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), twentyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */); + application.Render(static_cast(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), targetColor, TEST_LOCATION); END_TEST; } @@ -8614,58 +8680,58 @@ int UtcDaliAnimationAnimateToActorColorRedP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).r, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetRed(0.5f); - animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed ); + float targetRed(0.5f); + animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed); - float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).r, targetRed, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); END_TEST; } @@ -8676,58 +8742,58 @@ int UtcDaliAnimationAnimateToActorColorGreenP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).g, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetGreen(0.5f); - animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen ); + float targetGreen(0.5f); + animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen); - float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); END_TEST; } @@ -8738,58 +8804,58 @@ int UtcDaliAnimationAnimateToActorColorBlueP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).b, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetBlue(0.5f); - animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue ); + float targetBlue(0.5f); + animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue); - float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); END_TEST; } @@ -8800,59 +8866,59 @@ int UtcDaliAnimationAnimateToActorColorAlphaP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetAlpha(0.5f); - animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha ); + float targetAlpha(0.5f); + animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha); - float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, targetAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION); END_TEST; } @@ -8867,17 +8933,17 @@ int UtcDaliAnimationKeyFrames01P(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION); - KeyFrames keyFrames2( keyFrames); - DALI_TEST_CHECK( keyFrames2 ); + KeyFrames keyFrames2(keyFrames); + DALI_TEST_CHECK(keyFrames2); DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION); KeyFrames keyFrames3 = KeyFrames::New(); keyFrames3.Add(0.6f, true); - DALI_TEST_CHECK( keyFrames3 ); + DALI_TEST_CHECK(keyFrames3); DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION); keyFrames3 = keyFrames; - DALI_TEST_CHECK( keyFrames3 ); + DALI_TEST_CHECK(keyFrames3); DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION); END_TEST; @@ -8900,9 +8966,10 @@ int UtcDaliAnimationKeyFrames02N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(1.9f, false); - }, "mType == value.GetType()" ); + { + keyFrames.Add(1.9f, false); + }, + "mType == value.GetType()"); END_TEST; } @@ -8924,9 +8991,10 @@ int UtcDaliAnimationKeyFrames03N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f)); - }, "mType == value.GetType()" ); + { + keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f)); + }, + "mType == value.GetType()"); END_TEST; } @@ -8948,9 +9016,10 @@ int UtcDaliAnimationKeyFrames04N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f)); - }, "mType == value.GetType()" ); + { + keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f)); + }, + "mType == value.GetType()"); END_TEST; } @@ -8972,9 +9041,10 @@ int UtcDaliAnimationKeyFrames05N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(0.7f, 1.0f); - }, "mType == value.GetType()" ); + { + keyFrames.Add(0.7f, 1.0f); + }, + "mType == value.GetType()"); END_TEST; } @@ -8996,9 +9066,10 @@ int UtcDaliAnimationKeyFrames06N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS)); - }, "mType == value.GetType()" ); + { + keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS)); + }, + "mType == value.GetType()"); END_TEST; } @@ -9020,9 +9091,10 @@ int UtcDaliAnimationKeyFrames07N(void) DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION); DALI_TEST_ASSERTION( - { - keyFrames.Add(0.7f, 1.1f); - }, "mType == value.GetType()" ); + { + keyFrames.Add(0.7f, 1.1f); + }, + "mType == value.GetType()"); END_TEST; } @@ -9033,21 +9105,21 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9058,70 +9130,70 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void) keyFrames.Add(0.8f, 0.7f); keyFrames.Add(1.0f, 0.9f); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames); // Start the animation animation.Play(); // Final key frame value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 10% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 30% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.25f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 40% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 400.0f) /* 80% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 90% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 100.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9135,21 +9207,21 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9160,67 +9232,67 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) keyFrames.Add(0.8f, 0.7f); keyFrames.Add(1.0f, 0.9f); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 10% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.36f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 30% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.21f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 40% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 400.0f) /* 80% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 90% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.76f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*100.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 100.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9234,21 +9306,21 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9256,50 +9328,50 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9313,21 +9385,21 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9335,50 +9407,50 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9390,18 +9462,18 @@ int UtcDaliAnimationAnimateBetweenActorVisibleP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9411,25 +9483,25 @@ int UtcDaliAnimationAnimateBetweenActorVisibleP(void) keyFrames.Add(0.8f, false); keyFrames.Add(1.0f, true); - animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames ); + animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames); // Start the animation animation.Play(); // Final key frame value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + application.Render(static_cast(durationSeconds * 500.0f) + 1); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } @@ -9438,18 +9510,18 @@ int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9460,22 +9532,22 @@ int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void) keyFrames.Add(1.0f, true); //Cubic interpolation for boolean values should be ignored - animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + application.Render(static_cast(durationSeconds * 500.0f) + 1); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } @@ -9484,44 +9556,44 @@ int UtcDaliAnimationAnimateBetweenActorOrientation01P(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); + animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames); // Start the animation animation.Play(); // Final key frame value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + application.Render(static_cast(durationSeconds * 500.0f) + 1); application.SendNotification(); - Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + Quaternion check(Radian(Degree(60)), Vector3::ZAXIS); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } @@ -9530,18 +9602,18 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.SendNotification(); application.Render(0); application.GetScene().Add(actor); Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9549,12 +9621,12 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS)); keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); + animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -9563,27 +9635,27 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) finishCheck.CheckSignalNotReceived(); Quaternion check(Radian(Degree(60)), Vector3::XAXIS); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(90)), Vector3::XAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(120)), Vector3::XAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(120)), Vector3::YAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); // We did expect the animation to finish @@ -9595,42 +9667,42 @@ int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); //Cubic interpolation should be ignored for quaternions - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + application.Render(static_cast(durationSeconds * 500.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + application.Render(static_cast(durationSeconds * 500.0f) + 1); application.SendNotification(); - Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + Quaternion check(Radian(Degree(60)), Vector3::ZAXIS); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } @@ -9639,18 +9711,18 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis)); application.SendNotification(); application.Render(0); application.GetScene().Add(actor); Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9659,12 +9731,12 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); //Cubic interpolation should be ignored for quaternions - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -9673,27 +9745,27 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) finishCheck.CheckSignalNotReceived(); Quaternion check(Radian(Degree(60)), Vector3::XAXIS); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(90)), Vector3::XAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(120)), Vector3::XAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f)); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION ); + check = Quaternion(Radian(Degree(120)), Vector3::YAXIS); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION); // We did expect the animation to finish @@ -9707,21 +9779,21 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9729,50 +9801,50 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9786,21 +9858,21 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9808,50 +9880,50 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9865,22 +9937,22 @@ int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); - float delay = 0.5f; + float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9888,51 +9960,51 @@ int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(delay*1000.0f)/* 0% progress */); + application.Render(static_cast(delay * 1000.0f) /* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -9946,22 +10018,22 @@ int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); - float delay = 0.5f; + float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -9969,51 +10041,51 @@ int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(delay*1000.0f)/* 0% progress */); + application.Render(static_cast(delay * 1000.0f) /* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -10028,21 +10100,21 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void) float startValue(1.0f); float delay = 0.5f; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -10050,51 +10122,51 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(delay*1000.0f)/* 0% progress */); + application.Render(static_cast(delay * 1000.0f) /* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -10108,23 +10180,22 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void) float startValue(1.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue)); + actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue)); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); - + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); - float delay = 0.5f; + float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -10132,51 +10203,51 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void) keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::CUBIC ); + animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(delay*1000.0f)/* 0% progress */); + application.Render(static_cast(delay * 1000.0f) /* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) /* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.Render(static_cast((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION); // We did expect the animation to finish @@ -10192,9 +10263,9 @@ int UtcDaliAnimationAnimateP(void) application.GetScene().Add(actor); //Build the path - Vector3 position0( 30.0, 80.0, 0.0); - Vector3 position1( 70.0, 120.0, 0.0); - Vector3 position2( 100.0, 100.0, 0.0); + Vector3 position0(30.0, 80.0, 0.0); + Vector3 position1(70.0, 120.0, 0.0); + Vector3 position2(100.0, 100.0, 0.0); Dali::Path path = Dali::Path::New(); path.AddPoint(position0); @@ -10202,62 +10273,62 @@ int UtcDaliAnimationAnimateP(void) path.AddPoint(position2); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); // Build the animation - float durationSeconds( 1.0f ); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); animation.Animate(actor, path, Vector3::XAXIS); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - Vector3 position, tangent; + Vector3 position, tangent; Quaternion rotation; - path.Sample( 0.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - path.Sample( 0.25f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.25f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - path.Sample( 0.5f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.5f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - path.Sample( 0.75f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.75f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - path.Sample( 1.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(1.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; @@ -10271,9 +10342,9 @@ int UtcDaliAnimationAnimateAlphaFunctionP(void) application.GetScene().Add(actor); //Build the path - Vector3 position0( 30.0, 80.0, 0.0); - Vector3 position1( 70.0, 120.0, 0.0); - Vector3 position2( 100.0, 100.0, 0.0); + Vector3 position0(30.0, 80.0, 0.0); + Vector3 position1(70.0, 120.0, 0.0); + Vector3 position2(100.0, 100.0, 0.0); Dali::Path path = Dali::Path::New(); path.AddPoint(position0); @@ -10281,62 +10352,62 @@ int UtcDaliAnimationAnimateAlphaFunctionP(void) path.AddPoint(position2); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); // Build the animation - float durationSeconds( 1.0f ); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - Vector3 position, tangent; + Vector3 position, tangent; Quaternion rotation; - path.Sample( 0.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - path.Sample( 0.25f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.25f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - path.Sample( 0.5f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.5f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - path.Sample( 0.75f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.75f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - path.Sample( 1.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(1.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; @@ -10350,9 +10421,9 @@ int UtcDaliAnimationAnimateTimePeriodP(void) application.GetScene().Add(actor); //Build the path - Vector3 position0( 30.0, 80.0, 0.0); - Vector3 position1( 70.0, 120.0, 0.0); - Vector3 position2( 100.0, 100.0, 0.0); + Vector3 position0(30.0, 80.0, 0.0); + Vector3 position1(70.0, 120.0, 0.0); + Vector3 position2(100.0, 100.0, 0.0); Dali::Path path = Dali::Path::New(); path.AddPoint(position0); @@ -10360,62 +10431,62 @@ int UtcDaliAnimationAnimateTimePeriodP(void) path.AddPoint(position2); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); // Build the animation - float durationSeconds( 1.0f ); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - Vector3 position, tangent; + Vector3 position, tangent; Quaternion rotation; - path.Sample( 0.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - path.Sample( 0.25f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.25f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - path.Sample( 0.5f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.5f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - path.Sample( 0.75f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.75f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - path.Sample( 1.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(1.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; @@ -10429,9 +10500,9 @@ int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void) application.GetScene().Add(actor); //Build the path - Vector3 position0( 30.0, 80.0, 0.0); - Vector3 position1( 70.0, 120.0, 0.0); - Vector3 position2( 100.0, 100.0, 0.0); + Vector3 position0(30.0, 80.0, 0.0); + Vector3 position1(70.0, 120.0, 0.0); + Vector3 position2(100.0, 100.0, 0.0); Dali::Path path = Dali::Path::New(); path.AddPoint(position0); @@ -10439,62 +10510,62 @@ int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void) path.AddPoint(position2); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); // Build the animation - float durationSeconds( 1.0f ); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f)); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - Vector3 position, tangent; + Vector3 position, tangent; Quaternion rotation; - path.Sample( 0.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); application.SendNotification(); - path.Sample( 0.25f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.25f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); application.SendNotification(); - path.Sample( 0.5f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.5f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); application.SendNotification(); - path.Sample( 0.75f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(0.75f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds * 250.0f) + 1 /* 100% progress */); application.SendNotification(); - path.Sample( 1.0f, position, tangent ); - rotation = Quaternion( Vector3::XAXIS, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION ); + path.Sample(1.0f, position, tangent); + rotation = Quaternion(Vector3::XAXIS, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::ORIENTATION), rotation, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; @@ -10505,45 +10576,45 @@ int UtcDaliAnimationShowP(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(!actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.GetScene().Add(actor); // Start the animation - float durationSeconds(10.0f); + float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds*0.5f); + animation.Show(actor, durationSeconds * 0.5f); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); + application.Render(static_cast(durationSeconds * 490.0f)); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(!actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f)/*Should be shown now*/); + application.Render(static_cast(durationSeconds * 10.0f) /*Should be shown now*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); END_TEST; } @@ -10552,42 +10623,42 @@ int UtcDaliAnimationHideP(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.GetScene().Add(actor); // Start the animation - float durationSeconds(10.0f); + float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds*0.5f); + animation.Hide(actor, durationSeconds * 0.5f); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); + application.Render(static_cast(durationSeconds * 490.0f)); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f)/*Should be hidden now*/); + application.Render(static_cast(durationSeconds * 10.0f) /*Should be hidden now*/); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(!actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(!actor.GetCurrentProperty(Actor::Property::VISIBLE)); END_TEST; } @@ -10599,40 +10670,40 @@ int UtcDaliAnimationShowHideAtEndP(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); application.GetScene().Add(actor); // Start Hide animation - float durationSeconds(10.0f); + float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds/*Hide at end*/); + animation.Hide(actor, durationSeconds /*Hide at end*/); animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(!actor.GetCurrentProperty(Actor::Property::VISIBLE)); // Start Show animation animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds/*Show at end*/); + animation.Show(actor, durationSeconds /*Show at end*/); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE)); END_TEST; } @@ -10642,7 +10713,7 @@ int UtcDaliKeyFramesCreateDestroyP(void) KeyFrames* keyFrames = new KeyFrames; delete keyFrames; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -10651,20 +10722,20 @@ int UtcDaliKeyFramesDownCastP(void) TestApplication application; tet_infoline("Testing Dali::Animation::KeyFramesDownCast()"); - KeyFrames keyFrames = KeyFrames::New(); + KeyFrames keyFrames = KeyFrames::New(); BaseHandle object(keyFrames); KeyFrames keyFrames2 = KeyFrames::DownCast(object); DALI_TEST_CHECK(keyFrames2); - KeyFrames keyFrames3 = DownCast< KeyFrames >(object); + KeyFrames keyFrames3 = DownCast(object); DALI_TEST_CHECK(keyFrames3); BaseHandle unInitializedObject; - KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); + KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); DALI_TEST_CHECK(!keyFrames4); - KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject); + KeyFrames keyFrames5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!keyFrames5); END_TEST; } @@ -10672,8 +10743,8 @@ int UtcDaliKeyFramesDownCastP(void) int UtcDaliAnimationCreateDestroyP(void) { TestApplication application; - Animation* animation = new Animation; - DALI_TEST_CHECK( animation ); + Animation* animation = new Animation; + DALI_TEST_CHECK(animation); delete animation; END_TEST; } @@ -10685,9 +10756,9 @@ struct UpdateManagerTestConstraint { } - void operator()( Vector3& current, const PropertyInputContainer& /* inputs */) + void operator()(Vector3& current, const PropertyInputContainer& /* inputs */) { - mApplication.SendNotification(); // Process events + mApplication.SendNotification(); // Process events } TestApplication& mApplication; @@ -10698,32 +10769,32 @@ int UtcDaliAnimationUpdateManagerP(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Build the animation - Animation animation = Animation::New( 0.0f ); + Animation animation = Animation::New(0.0f); - bool signalReceived = false; - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived = false; + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - Vector3 startValue(1.0f, 1.0f, 1.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - Constraint constraint = Constraint::New( actor, index, UpdateManagerTestConstraint( application ) ); + Vector3 startValue(1.0f, 1.0f, 1.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); + Constraint constraint = Constraint::New(actor, index, UpdateManagerTestConstraint(application)); constraint.Apply(); // Apply animation to actor - animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR ); - animation.AnimateTo( Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR); + animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR); animation.Play(); application.SendNotification(); - application.UpdateOnly( 16 ); + application.UpdateOnly(16); finishCheck.CheckSignalNotReceived(); - application.SendNotification(); // Process events + application.SendNotification(); // Process events finishCheck.CheckSignalReceived(); @@ -10735,50 +10806,50 @@ int UtcDaliAnimationSignalOrderP(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Build the animations - Animation animation1 = Animation::New( 0.0f ); // finishes first frame - Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms + Animation animation1 = Animation::New(0.0f); // finishes first frame + Animation animation2 = Animation::New(0.02f); // finishes in 20 ms bool signal1Received = false; - animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) ); + animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received)); bool signal2Received = false; - animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) ); + animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received)); // Apply animations to actor - animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR ); + animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR); animation1.Play(); - animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR ); + animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR); animation2.Play(); - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION); + DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION); application.SendNotification(); - application.UpdateOnly( 10 ); // 10ms progress + application.UpdateOnly(10); // 10ms progress // no notifications yet - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION); + DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION); application.SendNotification(); // first completed - DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION); + DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION); signal1Received = false; // 1st animation is complete now, do another update with no ProcessEvents in between - application.UpdateOnly( 20 ); // 20ms progress + application.UpdateOnly(20); // 20ms progress // ProcessEvents application.SendNotification(); // 2nd should complete now - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION ); + DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION); + DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION); END_TEST; } @@ -10790,60 +10861,60 @@ int UtcDaliAnimationExtendDurationP(void) Actor actor = Actor::New(); // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + float startValue(10.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); // Build the animation - float initialDurationSeconds(1.0f); - float animatorDelay = 5.0f; - float animatorDurationSeconds(5.0f); - float extendedDurationSeconds(animatorDelay+animatorDurationSeconds); + float initialDurationSeconds(1.0f); + float animatorDelay = 5.0f; + float animatorDurationSeconds(5.0f); + float extendedDurationSeconds(animatorDelay + animatorDurationSeconds); Animation animation = Animation::New(initialDurationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); + float targetValue(30.0f); + float relativeValue(targetValue - startValue); animation.AnimateTo(Property(actor, index), targetValue, TimePeriod(animatorDelay, animatorDurationSeconds)); // The duration should have been extended - DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION); // Start the animation animation.Play(); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet, but cached value should be the final one application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue + (relativeValue * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index), targetValue, TEST_LOCATION); END_TEST; } @@ -10855,41 +10926,41 @@ int UtcDaliAnimationCustomIntProperty(void) application.GetScene().Add(actor); int startValue(0u); - Property::Index index = actor.RegisterProperty("anIndex", startValue); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION ); + Property::Index index = actor.RegisterProperty("anIndex", startValue); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, index), 20 ); + animation.AnimateTo(Property(actor, index), 20); // Start the animation animation.Play(); // Target value should be retrievable straight away - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), 20, TEST_LOCATION); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 10, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 20, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index), 20, TEST_LOCATION); END_TEST; } @@ -10900,16 +10971,16 @@ int UtcDaliAnimationDuration(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - Animation animation = Animation::New( 0.0f ); - DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION ); + Animation animation = Animation::New(0.0f); + DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION); // The animation duration should automatically increase depending on the animator time period - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) ); - DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f)); + DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) ); - DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f)); + DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION); END_TEST; } @@ -10921,24 +10992,24 @@ int UtcDaliAnimationAnimateByNonAnimateableTypeN(void) Actor actor = Actor::New(); // Register an integer property - int startValue(1); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(1); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); DALI_TEST_ASSERTION( - { - // Build the animation - Animation animation = Animation::New( 2.0f ); - std::string relativeValue = "relative string"; - animation.AnimateBy( Property(actor, index), relativeValue ); - tet_result(TET_FAIL); - }, "Target value is not animatable" ); + { + // Build the animation + Animation animation = Animation::New(2.0f); + std::string relativeValue = "relative string"; + animation.AnimateBy(Property(actor, index), relativeValue); + tet_result(TET_FAIL); + }, + "Target value is not animatable"); END_TEST; } - int UtcDaliAnimationAnimateToNonAnimateableTypeN(void) { TestApplication application; @@ -10946,18 +11017,19 @@ int UtcDaliAnimationAnimateToNonAnimateableTypeN(void) Actor actor = Actor::New(); // Register an integer property - int startValue(1); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(1); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); DALI_TEST_ASSERTION( - { - // Build the animation - Animation animation = Animation::New( 2.0f ); - std::string relativeValue = "relative string"; - animation.AnimateTo( Property(actor, index), relativeValue ); - }, "Target value is not animatable" ); + { + // Build the animation + Animation animation = Animation::New(2.0f); + std::string relativeValue = "relative string"; + animation.AnimateTo(Property(actor, index), relativeValue); + }, + "Target value is not animatable"); END_TEST; } @@ -10969,19 +11041,20 @@ int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void) Actor actor = Actor::New(); // Register an integer property - int startValue(1); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + int startValue(1); + Property::Index index = actor.RegisterProperty("testProperty", startValue); application.GetScene().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); DALI_TEST_ASSERTION( - { - // Build the animation - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add( 0.0f, std::string("relative string1") ); - keyFrames.Add( 1.0f, std::string("relative string2") ); - // no need to really create the animation as keyframes do the check - }, "Property type is not animatable" ); + { + // Build the animation + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, std::string("relative string1")); + keyFrames.Add(1.0f, std::string("relative string2")); + // no need to really create the animation as keyframes do the check + }, + "Property type is not animatable"); END_TEST; } @@ -10997,14 +11070,14 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayP(void) Actor actor = Actor::New(); application.GetScene().Add(actor); Vector3 initialPosition(0.0f, 0.0f, 0.0f); - actor.SetProperty( Actor::Property::POSITION, initialPosition ); + actor.SetProperty(Actor::Property::POSITION, initialPosition); // Build the animation Animation animation = Animation::New(2.0f); //Test GetCurrentProgress return 0.0 as the duration is 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); tet_infoline("Set target position in animation without intiating play"); @@ -11016,9 +11089,9 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayP(void) tet_infoline("Ensure position of actor is still at intial value"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION); tet_infoline("Play animation and ensure actor position is now target"); @@ -11028,19 +11101,19 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayP(void) tet_infoline("Ensure position of actor is at target value when aninmation half way"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION); - tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x ); + tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty(Actor::Property::POSITION).x); application.Render(2000u); tet_infoline("Ensure position of actor is still at target value when aninmation complete"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION); END_TEST; } @@ -11053,27 +11126,27 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void) std::vector targetPositions; - targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); - targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) ); - targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) ); + targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f)); + targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f)); + targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f)); tet_infoline("Set initial position and set up animation to re-position actor"); Actor actor = Actor::New(); application.GetScene().Add(actor); Vector3 initialPosition(0.0f, 0.0f, 0.0f); - actor.SetProperty( Actor::Property::POSITION, initialPosition ); + actor.SetProperty(Actor::Property::POSITION, initialPosition); // Build the animation Animation animation = Animation::New(2.0f); //Test GetCurrentProgress return 0.0 as the duration is 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); tet_infoline("Set target position in animation without intiating play"); - for ( unsigned int i = 0; i < targetPositions.size(); i++ ) + for(unsigned int i = 0; i < targetPositions.size(); i++) { animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR); } @@ -11083,9 +11156,9 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void) tet_infoline("Ensure position of actor is still at intial value"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION); tet_infoline("Play animation and ensure actor position is now target"); @@ -11095,19 +11168,19 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void) tet_infoline("Ensure position of actor is at target value when aninmation half way"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION); - tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x ); + tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty(Actor::Property::POSITION).x); application.Render(2000u); tet_infoline("Ensure position of actor is still at target value when aninmation complete"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION); END_TEST; } @@ -11121,20 +11194,20 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(v std::vector targetSizes; std::vector targetPositions; - targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); - targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) ); + targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f)); + targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f)); - targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) ); + targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f)); tet_infoline("Set initial position and set up animation to re-position actor"); Actor actor = Actor::New(); application.GetScene().Add(actor); - Vector3 initialSize( 10.0f, 10.0f, 10.0f); + Vector3 initialSize(10.0f, 10.0f, 10.0f); Vector3 initialPosition(10.0f, 10.0f, 10.0f); - actor.SetProperty( Actor::Property::SIZE, initialSize ); - actor.SetProperty( Actor::Property::POSITION, initialPosition ); + actor.SetProperty(Actor::Property::SIZE, initialSize); + actor.SetProperty(Actor::Property::POSITION, initialPosition); // Build the animation Animation animation = Animation::New(2.0f); @@ -11150,13 +11223,13 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(v tet_infoline("Ensure position of actor is still at intial size and position"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION); tet_infoline("Play animation and ensure actor position and size is now matches targets"); @@ -11166,13 +11239,13 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(v tet_infoline("Ensure position and size of actor is at target value when aninmation playing"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION); END_TEST; } @@ -11184,20 +11257,20 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol TestApplication application; std::vector targetSizes; - std::vector targetColors; + std::vector targetColors; - targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); - targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) ); + targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f)); + targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f)); - targetColors.push_back( 1.0f ); + targetColors.push_back(1.0f); tet_infoline("Set initial position and set up animation to re-position actor"); Actor actor = Actor::New(); application.GetScene().Add(actor); - Vector3 initialSize( 10.0f, 5.0f, 10.0f); + Vector3 initialSize(10.0f, 5.0f, 10.0f); - actor.SetProperty( Actor::Property::SIZE, initialSize ); + actor.SetProperty(Actor::Property::SIZE, initialSize); // Build the animation Animation animation = Animation::New(2.0f); @@ -11213,9 +11286,9 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol tet_infoline("Ensure position of actor is still at initial size and position"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION); tet_infoline("Play animation and ensure actor position and size is now matches targets"); @@ -11225,164 +11298,164 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol tet_infoline("Ensure position and size of actor is at target value when animation playing"); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION); END_TEST; } int UtcDaliAnimationTimePeriodOrder(void) { - tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" ); + tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place"); TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); ////////////////////////////////////////////////////////////////////////////////// - tet_infoline( "With two AnimateTo calls" ); + tet_infoline("With two AnimateTo calls"); - Animation animation = Animation::New( 0.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); + Animation animation = Animation::New(0.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f)); animation.Play(); - tet_infoline( "The target position should change instantly" ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + tet_infoline("The target position should change instantly"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION); application.SendNotification(); application.Render(5000); // After the animation is complete - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION); ////////////////////////////////////////////////////////////////////////////////// - tet_infoline( "Same animation again but in a different order - should yield the same result" ); + tet_infoline("Same animation again but in a different order - should yield the same result"); - actor.SetProperty( Actor::Property::POSITION_X, 0.0f ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + actor.SetProperty(Actor::Property::POSITION_X, 0.0f); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); - animation = Animation::New( 0.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); + animation = Animation::New(0.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f)); animation.Play(); - tet_infoline( "The target position should change instantly" ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + tet_infoline("The target position should change instantly"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION); application.SendNotification(); application.Render(5000); // After the animation is complete - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION); END_TEST; } int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void) { - tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" ); + tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls"); TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); ////////////////////////////////////////////////////////////////////////////////// - tet_infoline( "" ); + tet_infoline(""); - Animation animation = Animation::New( 0.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); + Animation animation = Animation::New(0.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f)); animation.Play(); - tet_infoline( "The target position should change instantly" ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + tet_infoline("The target position should change instantly"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION); application.SendNotification(); application.Render(14000); // After the animation is complete - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION); ////////////////////////////////////////////////////////////////////////////////// - tet_infoline( "Same animation again but in a different order - should end up at the same point" ); + tet_infoline("Same animation again but in a different order - should end up at the same point"); - actor.SetProperty( Actor::Property::POSITION_X, 0.0f ); + actor.SetProperty(Actor::Property::POSITION_X, 0.0f); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION); - animation = Animation::New( 0.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); + animation = Animation::New(0.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f)); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f)); animation.Play(); - tet_infoline( "The target position should change instantly" ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + tet_infoline("The target position should change instantly"); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION); application.SendNotification(); application.Render(14000); // After the animation is complete - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION); END_TEST; } @@ -11391,18 +11464,18 @@ int UtcDaliAnimationAnimateBetweenIntegerP(void) { TestApplication application; - int startValue(1); - Actor actor = Actor::New(); - const Property::Index index = actor.RegisterProperty("customProperty", startValue ); + int startValue(1); + Actor actor = Actor::New(); + const Property::Index index = actor.RegisterProperty("customProperty", startValue); application.GetScene().Add(actor); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); @@ -11413,13 +11486,13 @@ int UtcDaliAnimationAnimateBetweenIntegerP(void) keyFrames.Add(0.8f, 50); keyFrames.Add(1.0f, 60); - animation.AnimateBetween( Property(actor, index ), keyFrames ); + animation.AnimateBetween(Property(actor, index), keyFrames); // Start the animation animation.Play(); // Target value should change to the last key-frame's value straight away - DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), 60, TEST_LOCATION); END_TEST; } @@ -11428,35 +11501,35 @@ int UtcDaliAnimationAnimateBetweenVector2P(void) { TestApplication application; - Vector2 startValue( 10.0f, 20.0f ); - Actor actor = Actor::New(); - const Property::Index index = actor.RegisterProperty("customProperty", startValue ); + Vector2 startValue(10.0f, 20.0f); + Actor actor = Actor::New(); + const Property::Index index = actor.RegisterProperty("customProperty", startValue); application.GetScene().Add(actor); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) ); - keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) ); - keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) ); - keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) ); - keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) ); - keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) ); + keyFrames.Add(0.0f, Vector2(0.0f, 5.0f)); + keyFrames.Add(0.2f, Vector2(30.0f, 25.0f)); + keyFrames.Add(0.4f, Vector2(40.0f, 35.0f)); + keyFrames.Add(0.6f, Vector2(50.0f, 45.0f)); + keyFrames.Add(0.8f, Vector2(60.0f, 55.0f)); + keyFrames.Add(1.0f, Vector2(70.0f, 65.0f)); - animation.AnimateBetween( Property(actor, index ), keyFrames ); + animation.AnimateBetween(Property(actor, index), keyFrames); // Start the animation animation.Play(); // Target value should change to the last key-frame's value straight away - DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), Vector2(70.0f, 65.0f), TEST_LOCATION); END_TEST; } @@ -11482,73 +11555,73 @@ int UtcDaliAnimationProgressCallbackP(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress notification set to 30%" ); - DevelAnimation::SetProgressNotification( animation, 0.3f ); + tet_infoline("Animation Progress notification set to 30%"); + DevelAnimation::SetProgressNotification(animation, 0.3f); application.SendNotification(); - application.Render( ); + application.Render(); - DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION ); + DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); // Start the animation from 10% progress - animation.SetCurrentProgress( 0.1f ); + animation.SetCurrentProgress(0.1f); animation.Play(); - tet_infoline( "Animation Playing from 10%" ); + tet_infoline("Animation Playing from 10%"); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*100.0f ); // 20% progress + application.Render(0); // start animation + application.Render(durationSeconds * 100.0f); // 20% progress - tet_infoline( "Animation at 20%" ); + tet_infoline("Animation at 20%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*200.0f ); // 40% progress + application.Render(durationSeconds * 200.0f); // 40% progress application.SendNotification(); - tet_infoline( "Animation at 40%" ); - DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 40%"); + DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*100.0f ); // 50% progress - tet_infoline( "Animation at 50%" ); + application.Render(durationSeconds * 100.0f); // 50% progress + tet_infoline("Animation at 50%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*100.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 60% progress */); application.SendNotification(); - tet_infoline( "Animation at 60%" ); + tet_infoline("Animation at 60%"); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); application.SendNotification(); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); - tet_infoline( "Animation at 80%" ); + DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION); + tet_infoline("Animation at 80%"); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - tet_infoline( "Animation finished" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + tet_infoline("Animation finished"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -11564,52 +11637,52 @@ int UtcDaliAnimationPlayAfterP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // Play animation after the initial delay time - animation.PlayAfter( 0.2f ); + animation.PlayAfter(0.2f); application.SendNotification(); application.Render(0); // start animation - application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter + application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } tet_printf("Testing that playing after 2 seconds with negative speedfactor\n"); @@ -11619,53 +11692,53 @@ int UtcDaliAnimationPlayAfterP(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0 + animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0 - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // Play animation after the initial delay time - animation.PlayAfter( 0.2f ); + animation.PlayAfter(0.2f); application.SendNotification(); application.Render(0); // start animation - application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter + application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position. + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position. - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION); } END_TEST; @@ -11682,64 +11755,64 @@ int UtcDaliAnimationPlayAfterP2(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetLooping( true ); + animation.SetLooping(true); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // Play animation after the initial delay time - animation.PlayAfter( 0.2f ); + animation.PlayAfter(0.2f); application.SendNotification(); application.Render(0); // start animation - for( int iterations = 0; iterations < 3; ++iterations ) + for(int iterations = 0; iterations < 3; ++iterations) { // The initial delay time of PlayAfter() applies only once in looping mode. - if( iterations == 0 ) + if(iterations == 0) { - application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter + application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move } - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% progress */); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } animation.SetLooping(false); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n"); @@ -11749,65 +11822,65 @@ int UtcDaliAnimationPlayAfterP2(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.SetLooping( true ); - animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0 + animation.SetLooping(true); + animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0 - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // Play animation after the initial delay time - animation.PlayAfter( 0.2f ); + animation.PlayAfter(0.2f); application.SendNotification(); application.Render(0); // start animation - for( int iterations = 0; iterations < 3; ++iterations ) + for(int iterations = 0; iterations < 3; ++iterations) { // The initial delay time of PlayAfter() applies only once in looping mode. - if( iterations == 0 ) + if(iterations == 0) { - application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter + application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position. + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position. } - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 100% progress */); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second } animation.SetLooping(false); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION); } END_TEST; @@ -11823,47 +11896,47 @@ int UtcDaliAnimationPlayAfterP3(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // When the delay time is negative value, it would treat as play immediately. - animation.PlayAfter( -2.0f ); + animation.PlayAfter(-2.0f); application.SendNotification(); application.Render(0); // start animation - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } @@ -11877,211 +11950,211 @@ int UtcDaliAnimationPlayAfterP4(void) application.GetScene().Add(actor); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s. - animation.PlayAfter( durationSeconds * 0.3f ); + animation.PlayAfter(durationSeconds * 0.3f); application.SendNotification(); application.Render(0); // start animation - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } int UtcDaliAnimationSetLoopingModeP(void) { // Test Loop forever and Loop mode being set - TestApplication application; - Integration::Scene stage( application.GetScene() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); // Default: LoopingMode::RESTART { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); // Start the animation animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/); actor.Unparent(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } // LoopingMode::AUTO_REVERSE { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); - animation.SetLooping( true ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + animation.SetLooping(true); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); application.SendNotification(); application.Render(0); - for( int iterations = 0; iterations < 3; ++iterations ) + for(int iterations = 0; iterations < 3; ++iterations) { - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% time progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition, // and arrives at the beginning. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 100% time progress */); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); } - animation.SetLooping( false ); + animation.SetLooping(false); application.SendNotification(); - application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); } // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); - animation.SetLooping( true ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + animation.SetLooping(true); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); // Specify a negative multiplier to play the animation in reverse - animation.SetSpeedFactor( -1.0f ); + animation.SetSpeedFactor(-1.0f); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); application.SendNotification(); application.Render(0); - for( int iterations = 0; iterations < 3; ++iterations ) + for(int iterations = 0; iterations < 3; ++iterations) { - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 50% time progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // Setting a negative speed factor is to play the animation in reverse. // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time, // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ ); + application.Render(static_cast(durationSeconds * 500.0f) /* 100% time progress */); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } - animation.SetLooping( false ); + animation.SetLooping(false); application.SendNotification(); - application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); } END_TEST; @@ -12090,29 +12163,29 @@ int UtcDaliAnimationSetLoopingModeP(void) int UtcDaliAnimationSetLoopingModeP2(void) { // Test Loop Count and Loop mode being set - TestApplication application; - Integration::Scene stage( application.GetScene() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); // LoopingMode::AUTO_REVERSE { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); animation.SetLoopCount(3); DALI_TEST_CHECK(animation.IsLooping()); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); @@ -12129,12 +12202,12 @@ int UtcDaliAnimationSetLoopingModeP2(void) // Loop float intervalSeconds = 3.0f; - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition, // and arrives at the beginning. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.Render(0); application.SendNotification(); @@ -12146,11 +12219,11 @@ int UtcDaliAnimationSetLoopingModeP2(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); finishCheck.Reset(); } @@ -12158,26 +12231,26 @@ int UtcDaliAnimationSetLoopingModeP2(void) // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); animation.SetLoopCount(3); DALI_TEST_CHECK(animation.IsLooping()); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); // Specify a negative multiplier to play the animation in reverse - animation.SetSpeedFactor( -1.0f ); + animation.SetSpeedFactor(-1.0f); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); @@ -12194,13 +12267,13 @@ int UtcDaliAnimationSetLoopingModeP2(void) // Loop float intervalSeconds = 3.0f; - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); // Setting a negative speed factor is to play the animation in reverse. // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time, // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.Render(0); application.SendNotification(); @@ -12212,11 +12285,11 @@ int UtcDaliAnimationSetLoopingModeP2(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds * intervalSeconds * 1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); finishCheck.Reset(); } @@ -12227,50 +12300,50 @@ int UtcDaliAnimationSetLoopingModeP2(void) int UtcDaliAnimationSetLoopingModeP3(void) { // Test Loop Count is 1 (== default) and Loop mode being set - TestApplication application; - Integration::Scene stage( application.GetScene() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); // LoopingMode::AUTO_REVERSE { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); DALI_TEST_CHECK(1 == animation.GetLoopCount()); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); application.Render(0); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ ); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition, // and arrives at the beginning. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ ); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); application.Render(0); @@ -12278,7 +12351,7 @@ int UtcDaliAnimationSetLoopingModeP3(void) finishCheck.CheckSignalReceived(); // After all animation finished, arrives at the beginning. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); finishCheck.Reset(); } @@ -12286,48 +12359,48 @@ int UtcDaliAnimationSetLoopingModeP3(void) // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end { Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - float durationSeconds( 1.0f ); - Animation animation = Animation::New( durationSeconds ); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); DALI_TEST_CHECK(1 == animation.GetLoopCount()); - bool signalReceived( false ); - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); // Specify a negative multiplier to play the animation in reverse - animation.SetSpeedFactor( -1.0f ); + animation.SetSpeedFactor(-1.0f); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); // Start the animation animation.Play(); application.Render(0); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ ); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); // Setting a negative speed factor is to play the animation in reverse. // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time, // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ ); + application.Render(static_cast(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); application.SendNotification(); - application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ ); + application.Render(static_cast(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); application.Render(0); @@ -12335,7 +12408,7 @@ int UtcDaliAnimationSetLoopingModeP3(void) finishCheck.CheckSignalReceived(); // After all animation finished, arrives at the target. - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); finishCheck.Reset(); } @@ -12350,10 +12423,10 @@ int UtcDaliAnimationGetLoopingModeP(void) Animation animation = Animation::New(1.0f); // default mode - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART ); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART); - animation.SetLoopingMode( Animation::AUTO_REVERSE ); - DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); + animation.SetLoopingMode(Animation::AUTO_REVERSE); + DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE); END_TEST; } @@ -12362,7 +12435,7 @@ int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void) { TestApplication application; - tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" ); + tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker"); Actor actor = Actor::New(); application.GetScene().Add(actor); @@ -12380,8 +12453,8 @@ int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void) AnimationFinishCheck finishCheck(finishedSignalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - AnimationProgressCheck progressCheck( progressSignalReceived ); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + AnimationProgressCheck progressCheck(progressSignalReceived); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); @@ -12392,26 +12465,26 @@ int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void) animation.Play(); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*100.0f ); // 10% progress + application.Render(0); // start animation + application.Render(durationSeconds * 100.0f); // 10% progress application.SendNotification(); - tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" ); + tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted"); progressCheck.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); finishCheck.CheckSignalReceived(); - tet_infoline( "Animation finished" ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + tet_infoline("Animation finished"); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); END_TEST; } int UtcDaliAnimationMultipleProgressSignalsP(void) { - tet_infoline( "Multiple animations with different progress markers" ); + tet_infoline("Multiple animations with different progress markers"); TestApplication application; @@ -12420,7 +12493,7 @@ int UtcDaliAnimationMultipleProgressSignalsP(void) // Build the animation Animation animationAlpha = Animation::New(0.0f); - Animation animationBeta = Animation::New(0.0f); + Animation animationBeta = Animation::New(0.0f); //Set duration float durationSeconds(1.0f); @@ -12431,95 +12504,95 @@ int UtcDaliAnimationMultipleProgressSignalsP(void) bool progressSignalReceivedBeta(false); AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha"); - AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" ); + AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta"); - DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha ); - DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta); + DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha); + DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "AnimationAlpha Progress notification set to 30%" ); - DevelAnimation::SetProgressNotification( animationAlpha, 0.3f ); + tet_infoline("AnimationAlpha Progress notification set to 30%"); + DevelAnimation::SetProgressNotification(animationAlpha, 0.3f); - tet_infoline( "AnimationBeta Progress notification set to 50%" ); - DevelAnimation::SetProgressNotification( animationBeta, 0.5f ); + tet_infoline("AnimationBeta Progress notification set to 50%"); + DevelAnimation::SetProgressNotification(animationBeta, 0.5f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); // Start the animations from 10% progress - animationAlpha.SetCurrentProgress( 0.1f ); - animationBeta.SetCurrentProgress( 0.1f ); + animationAlpha.SetCurrentProgress(0.1f); + animationBeta.SetCurrentProgress(0.1f); animationAlpha.Play(); animationBeta.Play(); - tet_infoline( "Animation Playing from 10%" ); + tet_infoline("Animation Playing from 10%"); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*100.0f ); // 20% progress + application.Render(0); // start animation + application.Render(durationSeconds * 100.0f); // 20% progress - tet_infoline( "Animation at 20% - No signals to be received" ); + tet_infoline("Animation at 20% - No signals to be received"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*200.0f ); // 40% progress + application.Render(durationSeconds * 200.0f); // 40% progress application.SendNotification(); - tet_infoline( "Animation at 40% - Alpha signal should be received" ); - DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 40% - Alpha signal should be received"); + DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION); progressCheckAlpha.CheckSignalReceived(); progressCheckBeta.CheckSignalNotReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); - application.Render(durationSeconds*100.0f ); // 50% progress - tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" ); + application.Render(durationSeconds * 100.0f); // 50% progress + tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not"); application.SendNotification(); - DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); - application.Render(static_cast(durationSeconds*100.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 100.0f) /* 60% progress */); application.SendNotification(); - tet_infoline( "Animation at 60%" ); + tet_infoline("Animation at 60%"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); application.SendNotification(); - tet_infoline( "Animation at 80%" ); + tet_infoline("Animation at 80%"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish - tet_infoline( "Animation finished" ); + tet_infoline("Animation finished"); END_TEST; } int UtcDaliAnimationMultipleProgressSignalsP2(void) { - tet_infoline( "Multiple animations with different progress markers and big step time" ); + tet_infoline("Multiple animations with different progress markers and big step time"); TestApplication application; @@ -12528,7 +12601,7 @@ int UtcDaliAnimationMultipleProgressSignalsP2(void) // Build the animation Animation animationAlpha = Animation::New(0.0f); - Animation animationBeta = Animation::New(0.0f); + Animation animationBeta = Animation::New(0.0f); //Set duration const float durationSeconds(1.0f); @@ -12539,102 +12612,102 @@ int UtcDaliAnimationMultipleProgressSignalsP2(void) bool progressSignalReceivedBeta(false); AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha"); - AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" ); + AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta"); - DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha ); - DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta); + DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha); + DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "AnimationAlpha Progress notification set to 1%" ); - DevelAnimation::SetProgressNotification( animationAlpha, 0.01f ); + tet_infoline("AnimationAlpha Progress notification set to 1%"); + DevelAnimation::SetProgressNotification(animationAlpha, 0.01f); - tet_infoline( "AnimationBeta Progress notification set to 99%" ); - DevelAnimation::SetProgressNotification( animationBeta, 0.99f ); + tet_infoline("AnimationBeta Progress notification set to 99%"); + DevelAnimation::SetProgressNotification(animationBeta, 0.99f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); // Start the animations unlimited looping - animationAlpha.SetLooping( true ); - animationBeta.SetLooping( true ); + animationAlpha.SetLooping(true); + animationBeta.SetLooping(true); animationAlpha.Play(); animationBeta.Play(); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*20.0f ); // 2% progress + application.Render(0); // start animation + application.Render(durationSeconds * 20.0f); // 2% progress application.SendNotification(); - DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." ); + tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not."); progressCheckAlpha.CheckSignalReceived(); progressCheckBeta.CheckSignalNotReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); application.SendNotification(); - application.Render(durationSeconds*960.0f ); // 98% progress + application.Render(durationSeconds * 960.0f); // 98% progress application.SendNotification(); - tet_infoline( "Animation at 98% - No signal received" ); - DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 98% - No signal received"); + DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*40.0f ); // 2% progress + application.Render(durationSeconds * 40.0f); // 2% progress application.SendNotification(); - tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" ); + tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal"); application.SendNotification(); - DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION); progressCheckAlpha.CheckSignalReceived(); progressCheckBeta.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); application.SendNotification(); - application.Render(durationSeconds*980.0f ); // 100% progress + application.Render(durationSeconds * 980.0f); // 100% progress application.SendNotification(); - tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" ); + tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not"); application.SendNotification(); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); - animationAlpha.SetLooping( false ); - animationBeta.SetLooping( false ); + animationAlpha.SetLooping(false); + animationBeta.SetLooping(false); application.SendNotification(); - application.Render(static_cast(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/); application.SendNotification(); // We did expect the animation to finish - tet_infoline( "Animation finished" ); + tet_infoline("Animation finished"); END_TEST; } int UtcDaliAnimationProgressSignalWithPlayAfterP(void) { - tet_infoline( "Multiple animations with different progress markers" ); + tet_infoline("Multiple animations with different progress markers"); TestApplication application; @@ -12643,7 +12716,7 @@ int UtcDaliAnimationProgressSignalWithPlayAfterP(void) // Build the animation Animation animationAlpha = Animation::New(0.0f); - Animation animationBeta = Animation::New(0.0f); + Animation animationBeta = Animation::New(0.0f); //Set duration float durationSeconds(1.0f); @@ -12655,24 +12728,24 @@ int UtcDaliAnimationProgressSignalWithPlayAfterP(void) bool progressSignalReceivedBeta(false); AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha"); - AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" ); + AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta"); - DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha ); - DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta); + DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha); + DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "AnimationAlpha Progress notification set to 30%" ); - DevelAnimation::SetProgressNotification( animationAlpha, 0.3f ); + tet_infoline("AnimationAlpha Progress notification set to 30%"); + DevelAnimation::SetProgressNotification(animationAlpha, 0.3f); - tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" ); - DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 ); + tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)"); + DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1); application.SendNotification(); - application.Render( ); + application.Render(); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); @@ -12682,65 +12755,65 @@ int UtcDaliAnimationProgressSignalWithPlayAfterP(void) animationBeta.PlayAfter(delaySeconds); application.SendNotification(); - application.Render(0); // start animation - application.Render(delaySeconds * 500.0f ); // 50% wait progress + application.Render(0); // start animation + application.Render(delaySeconds * 500.0f); // 50% wait progress - tet_infoline( "Delay at 50% - No signals to be received" ); + tet_infoline("Delay at 50% - No signals to be received"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); application.SendNotification(); - application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress + application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress application.SendNotification(); - tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" ); - DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received"); + DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION); progressCheckBeta.CheckSignalReceived(); progressCheckAlpha.CheckSignalNotReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); - application.Render(durationSeconds * 200.0f ); // 25% progress - tet_infoline( "Animation at 25% - No signals to be received" ); + application.Render(durationSeconds * 200.0f); // 25% progress + tet_infoline("Animation at 25% - No signals to be received"); application.SendNotification(); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); - application.Render(durationSeconds * 200.0f ); // 45% progress - tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" ); + application.Render(durationSeconds * 200.0f); // 45% progress + tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not"); application.SendNotification(); - DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION); progressCheckAlpha.CheckSignalReceived(); progressCheckBeta.CheckSignalNotReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheckAlpha.Reset(); progressCheckBeta.Reset(); - application.Render(static_cast(durationSeconds*150.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds * 150.0f) /* 60% progress */); application.SendNotification(); - tet_infoline( "Animation at 60%" ); + tet_infoline("Animation at 60%"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); application.SendNotification(); - tet_infoline( "Animation at 80%" ); + tet_infoline("Animation at 80%"); progressCheckAlpha.CheckSignalNotReceived(); progressCheckBeta.CheckSignalNotReceived(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/); // We did expect the animation to finish - tet_infoline( "Animation finished" ); + tet_infoline("Animation finished"); END_TEST; } @@ -12760,8 +12833,8 @@ int UtcDaliAnimationProgressCallbackWithLoopingP(void) animation.SetDuration(durationSeconds); // Set Looping Count - const int loopCount( 4 ); - animation.SetLoopCount( loopCount ); + const int loopCount(4); + animation.SetLoopCount(loopCount); bool finishedSignalReceived(false); bool progressSignalReceived(false); @@ -12770,17 +12843,17 @@ int UtcDaliAnimationProgressCallbackWithLoopingP(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress notification set to 50% with looping count 4" ); - DevelAnimation::SetProgressNotification( animation, 0.5f ); + tet_infoline("Animation Progress notification set to 50% with looping count 4"); + DevelAnimation::SetProgressNotification(animation, 0.5f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheck.CheckSignalNotReceived(); @@ -12789,35 +12862,35 @@ int UtcDaliAnimationProgressCallbackWithLoopingP(void) for(int count = 0; count < loopCount; count++) { application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*0.25*1000.0f ); // 25% progress - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(0); // start animation + application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 25%" ); + tet_infoline("Animation at 25%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 50% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress application.SendNotification(); - tet_infoline( "Animation at 50%" ); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 50%"); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*0.25*1000.0f ); // 75% progress - tet_infoline( "Animation at 75%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress + tet_infoline("Animation at 75%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 100% progress - tet_infoline( "Animation at 100%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress + tet_infoline("Animation at 100%"); application.SendNotification(); //Nothing check at 100% progress. cause It can be both 100% and 0%. @@ -12848,7 +12921,7 @@ int UtcDaliAnimationProgressCallbackWithLoopingP2(void) animation.SetDuration(durationSeconds); // Set Looping Unlmited - animation.SetLooping( true ); + animation.SetLooping(true); bool finishedSignalReceived(false); bool progressSignalReceived(false); @@ -12857,17 +12930,17 @@ int UtcDaliAnimationProgressCallbackWithLoopingP2(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress notification set to 50% with unlimited looping" ); - DevelAnimation::SetProgressNotification( animation, 0.5f ); + tet_infoline("Animation Progress notification set to 50% with unlimited looping"); + DevelAnimation::SetProgressNotification(animation, 0.5f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheck.CheckSignalNotReceived(); @@ -12876,35 +12949,35 @@ int UtcDaliAnimationProgressCallbackWithLoopingP2(void) for(int count = 0; count < 4; count++) { application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*0.25*1000.0f ); // 25% progress - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(0); // start animation + application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 25%" ); + tet_infoline("Animation at 25%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 50% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress application.SendNotification(); - tet_infoline( "Animation at 50%" ); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 50%"); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*0.25*1000.0f ); // 75% progress - tet_infoline( "Animation at 75%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress + tet_infoline("Animation at 75%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 100% progress - tet_infoline( "Animation at 100%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress + tet_infoline("Animation at 100%"); application.SendNotification(); //Nothing check at 100% progress. cause It can be both 100% and 0%. @@ -12913,7 +12986,7 @@ int UtcDaliAnimationProgressCallbackWithLoopingP2(void) } finishCheck.CheckSignalNotReceived(); - animation.SetLooping( false ); + animation.SetLooping(false); application.Render(0u); application.SendNotification(); application.Render(static_cast(durationSeconds * 1000.0f) + 10u); @@ -12941,10 +13014,10 @@ int UtcDaliAnimationProgressCallbackNegativeSpeed(void) animation.SetDuration(durationSeconds); //Set speed negative - animation.SetSpeedFactor( -1.0f ); + animation.SetSpeedFactor(-1.0f); // Set Looping Unlmited - animation.SetLooping( true ); + animation.SetLooping(true); bool finishedSignalReceived(false); bool progressSignalReceived(false); @@ -12953,17 +13026,17 @@ int UtcDaliAnimationProgressCallbackNegativeSpeed(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress notification set to 50%" ); - DevelAnimation::SetProgressNotification( animation, 0.5f ); + tet_infoline("Animation Progress notification set to 50%"); + DevelAnimation::SetProgressNotification(animation, 0.5f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheck.CheckSignalNotReceived(); @@ -12976,34 +13049,34 @@ int UtcDaliAnimationProgressCallbackNegativeSpeed(void) progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 25% progress - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 25%" ); + tet_infoline("Animation at 25%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 50% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress application.SendNotification(); - tet_infoline( "Animation at 50%" ); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 50%"); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*0.25*1000.0f ); // 75% progress - tet_infoline( "Animation at 75%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress + tet_infoline("Animation at 75%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 100% progress - tet_infoline( "Animation at 100%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress + tet_infoline("Animation at 100%"); application.SendNotification(); //Nothing check at 100% progress. cause It can be both 100% and 0%. @@ -13013,8 +13086,8 @@ int UtcDaliAnimationProgressCallbackNegativeSpeed(void) finishCheck.CheckSignalNotReceived(); animation.Stop(); - animation.SetLooping( false ); - animation.SetLoopCount( 4 ); + animation.SetLooping(false); + animation.SetLoopCount(4); animation.Play(); application.Render(0u); application.SendNotification(); @@ -13026,34 +13099,34 @@ int UtcDaliAnimationProgressCallbackNegativeSpeed(void) progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 25% progress - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 25%" ); + tet_infoline("Animation at 25%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 50% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress application.SendNotification(); - tet_infoline( "Animation at 50%" ); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 50%"); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*0.25*1000.0f ); // 75% progress - tet_infoline( "Animation at 75%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress + tet_infoline("Animation at 75%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 100% progress - tet_infoline( "Animation at 100%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress + tet_infoline("Animation at 100%"); application.SendNotification(); //Nothing check at 100% progress. cause It can be both 100% and 0%. @@ -13090,52 +13163,52 @@ int UtcDaliAnimationProgressCallbackInvalidSignalN(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" ); - animation.SetPlayRange( Vector2( 0.1f, 0.9f ) ); + tet_infoline("Animation Progress PlayRange as 10% ~ 90%"); + animation.SetPlayRange(Vector2(0.1f, 0.9f)); - tet_infoline( "Animation Progress notification set to >90% that never can notificated" ); - DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 ); + tet_infoline("Animation Progress notification set to >90% that never can notificated"); + DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1); application.SendNotification(); - application.Render( ); + application.Render(); progressCheck.CheckSignalNotReceived(); animation.Play(); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*0.25*1000.0f ); // 35% progress - DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(0); // start animation + application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress + DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 35%" ); + tet_infoline("Animation at 35%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 60% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress application.SendNotification(); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 60%" ); + tet_infoline("Animation at 60%"); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 85% progress - tet_infoline( "Animation at 85%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress + tet_infoline("Animation at 85%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); - application.Render(durationSeconds*0.25*1000.0f ); // 90% progress - tet_infoline( "Animation over 90%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress + tet_infoline("Animation over 90%"); application.SendNotification(); // progress never signaled because playrange is 90% @@ -13165,47 +13238,47 @@ int UtcDaliAnimationProgressCallbackLongDurationP(void) animation.FinishedSignal().Connect(&application, finishCheck); AnimationProgressCheck progressCheck(progressSignalReceived); - DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck); + DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck); application.SendNotification(); Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - tet_infoline( "Animation Progress notification set to 50%" ); - DevelAnimation::SetProgressNotification( animation, 0.5f ); + tet_infoline("Animation Progress notification set to 50%"); + DevelAnimation::SetProgressNotification(animation, 0.5f); application.SendNotification(); - application.Render( ); + application.Render(); progressCheck.CheckSignalNotReceived(); animation.Play(); application.SendNotification(); - application.Render(0); // start animation - application.Render(durationSeconds*0.25*1000.0f ); // 25% progress - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(0); // start animation + application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); - tet_infoline( "Animation at 25%" ); + tet_infoline("Animation at 25%"); progressCheck.CheckSignalNotReceived(); application.SendNotification(); - application.Render(durationSeconds*0.25*1000.0f ); // 50% progress + application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress application.SendNotification(); - tet_infoline( "Animation at 50%" ); - DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION ); + tet_infoline("Animation at 50%"); + DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalReceived(); - tet_infoline( "Progress check reset" ); + tet_infoline("Progress check reset"); progressCheck.Reset(); - application.Render(durationSeconds*0.25*1000.0f ); // 75% progress - tet_infoline( "Animation at 75%" ); + application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress + tet_infoline("Animation at 75%"); application.SendNotification(); - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); progressCheck.CheckSignalNotReceived(); @@ -13223,48 +13296,55 @@ int UtcDaliAnimationAnimateByInvalidParameters(void) Animation animation = Animation::New(1.0f); DALI_TEST_ASSERTION( - { - // non animateable property (STRING) - animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) ); - }, "Property type is not animatable" ); + { + // non animateable property (STRING) + animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction")); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable property (MATRIX) - Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE ); - animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) ); - }, "Property type is not animatable" ); + { + // non animateable property (MATRIX) + Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE); + animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX)); + }, + "Property type is not animatable"); // AnimateBy DALI_TEST_ASSERTION( - { - // non animateable target (NONE) - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() ); - }, "Target value is not animatable" ); + { + // non animateable target (NONE) + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value()); + }, + "Target value is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (STRING) - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") ); - }, "Target value is not animatable" ); + { + // non animateable target (STRING) + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo")); + }, + "Target value is not animatable"); DALI_TEST_ASSERTION( - { - // not mathing properties (VECTOR3, FLOAT) - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) ); - }, "Property and target types don't match" ); + { + // not mathing properties (VECTOR3, FLOAT) + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f)); + }, + "Property and target types don't match"); DALI_TEST_ASSERTION( - { - // not mathing properties (VECTOR3.A, VECTOR2) - animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) ); - }, "Property and target types don't match" ); + { + // not mathing properties (VECTOR3.A, VECTOR2) + animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2)); + }, + "Property and target types don't match"); DALI_TEST_ASSERTION( - { - // negative duration - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) ); - }, "Duration must be >=0" ); + { + // negative duration + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1)); + }, + "Duration must be >=0"); END_TEST; } @@ -13281,47 +13361,54 @@ int UtcDaliAnimationAnimateToInvalidParameters(void) // AnimateTo DALI_TEST_ASSERTION( - { - // non animateable property (MAP) - Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE ); - animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) ); - }, "Property type is not animatable" ); + { + // non animateable property (MAP) + Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE); + animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP)); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (NONE) - animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() ); - }, "Property type is not animatable" ); + { + // non animateable target (NONE) + animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value()); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (ARRAY) - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) ); - }, "Target value is not animatable" ); + { + // non animateable target (ARRAY) + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY)); + }, + "Target value is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (RECTANGLE) - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect() ) ); - }, "Target value is not animatable" ); + { + // non animateable target (RECTANGLE) + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect())); + }, + "Target value is not animatable"); DALI_TEST_ASSERTION( - { - // not mathing properties (FLOAT, INT) - animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) ); - }, "Property and target types don't match" ); + { + // not mathing properties (FLOAT, INT) + animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10)); + }, + "Property and target types don't match"); DALI_TEST_ASSERTION( - { - // not mathing properties (VECTOR3, VECTOR2) - animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) ); - }, "Property and target types don't match" ); + { + // not mathing properties (VECTOR3, VECTOR2) + animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2)); + }, + "Property and target types don't match"); DALI_TEST_ASSERTION( - { - // negative duration - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) ); - }, "Duration must be >=0" ); + { + // negative duration + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1)); + }, + "Duration must be >=0"); END_TEST; } @@ -13338,53 +13425,59 @@ int UtcDaliAnimationAnimateBetweenInvalidParameters(void) // AnimateBetween DALI_TEST_ASSERTION( - { - // non animateable property (ARRAY) - Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE ); - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) ); - animation.AnimateBetween( Property( actor, index ), keyframes ); - }, "Property type is not animatable" ); + { + // non animateable property (ARRAY) + Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE); + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value(Property::ARRAY)); + animation.AnimateBetween(Property(actor, index), keyframes); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (NONE) - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value() ); - animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes ); - }, "Property type is not animatable" ); + { + // non animateable target (NONE) + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value()); + animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (EXTENTS) - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws - animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes ); - }, "Property type is not animatable" ); + { + // non animateable target (EXTENTS) + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // non animateable target (RECTANGLE) - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws - animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes ); - }, "Property type is not animatable" ); + { + // non animateable target (RECTANGLE) + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes); + }, + "Property type is not animatable"); DALI_TEST_ASSERTION( - { - // not mathing properties (VECTOR2, VECTOR4) - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) ); - animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes ); - }, "Property and target types don't match" ); + { + // not mathing properties (VECTOR2, VECTOR4) + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4))); + animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes); + }, + "Property and target types don't match"); DALI_TEST_ASSERTION( - { - // negative duration - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) ); - animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) ); - }, "Duration must be >=0" ); + { + // negative duration + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3))); + animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1)); + }, + "Duration must be >=0"); END_TEST; } @@ -13397,34 +13490,34 @@ enum TestFunction CLEAR }; -void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, const char * testName ) +void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName) { - tet_printf( "Testing %s\n", testName ); + tet_printf("Testing %s\n", testName); // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately // This test checks that that is being done - const float durationSeconds( 1.0f ); - unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) ); - const Vector3 originalPosition( Vector3::ZERO ); - const Vector3 targetPosition( 10.0f, 10.0f, 10.0f ); - const Vector3 halfWayToTarget( targetPosition * 0.5f ); + const float durationSeconds(1.0f); + unsigned int halfAnimationDuration(static_cast(durationSeconds * 1000.0f * 0.5f)); + const Vector3 originalPosition(Vector3::ZERO); + const Vector3 targetPosition(10.0f, 10.0f, 10.0f); + const Vector3 halfWayToTarget(targetPosition * 0.5f); struct ExpectedValue { Animation::EndAction endAction; - Vector3 expectedGetPropertyValue; + Vector3 expectedGetPropertyValue; }; ExpectedValue expectedValueTable[] = - { - { Animation::BAKE, halfWayToTarget }, // When baking, the current value is the final value. - { Animation::BAKE_FINAL, targetPosition }, // When BakeFinal, we should jump to the final value when clearing or stopping. - { Animation::DISCARD, originalPosition }, // When discarding, we should jump back to the original value when clearing or stopping. - }; - const auto expectedValueTableCount = sizeof( expectedValueTable ) / sizeof( ExpectedValue ); + { + {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value. + {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping. + {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping. + }; + const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue); - for( auto i = 0u; i < expectedValueTableCount; ++i ) + for(auto i = 0u; i < expectedValueTableCount; ++i) { TestApplication application; @@ -13432,18 +13525,18 @@ void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, application.GetScene().Add(actor); // Build the animation - Animation animation = Animation::New( durationSeconds ); - animation.SetEndAction( expectedValueTable[ i ].endAction ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR ); + Animation animation = Animation::New(durationSeconds); + animation.SetEndAction(expectedValueTable[i].endAction); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); application.SendNotification(); - application.Render( halfAnimationDuration ); + application.Render(halfAnimationDuration); // Stop or Clear the animation early, both have the same effect - if( functionToTest == TestFunction::STOP ) + if(functionToTest == TestFunction::STOP) { animation.Stop(); } @@ -13453,49 +13546,49 @@ void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, } // The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION); // After one frame, both values should match regardless of the End Action application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION); } } } // unnamed namespace int UtcDaliAnimationStopPropertyValue(void) { - CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::STOP, "UtcDaliAnimationStopPropertyValue" ); + CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue"); END_TEST; } int UtcDaliAnimationClearPropertyValue(void) { - CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue" ); + CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue"); END_TEST; } int UtcDaliAnimationPausePropertyValue(void) { - const float durationSeconds( 1.0f ); - unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) ); - const Vector3 originalPosition( Vector3::ZERO ); - const Vector3 targetPosition( 10.0f, 10.0f, 10.0f ); - const Vector3 halfWayToTarget( targetPosition * 0.5f ); + const float durationSeconds(1.0f); + unsigned int halfAnimationDuration(static_cast(durationSeconds * 1000.0f * 0.5f)); + const Vector3 originalPosition(Vector3::ZERO); + const Vector3 targetPosition(10.0f, 10.0f, 10.0f); + const Vector3 halfWayToTarget(targetPosition * 0.5f); Animation::EndAction endActions[] = - { - Animation::BAKE, - Animation::BAKE_FINAL, - Animation::DISCARD, - }; - const auto endActionCount = sizeof( endActions ) / sizeof( endActions[0] ); + { + Animation::BAKE, + Animation::BAKE_FINAL, + Animation::DISCARD, + }; + const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]); // For all end actions, when pausing, we stay at the current value - for( auto i = 0u; i < endActionCount; ++i ) + for(auto i = 0u; i < endActionCount; ++i) { TestApplication application; @@ -13503,29 +13596,29 @@ int UtcDaliAnimationPausePropertyValue(void) application.GetScene().Add(actor); // Build the animation - Animation animation = Animation::New( durationSeconds ); - animation.SetEndAction( endActions[ i ] ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR ); + Animation animation = Animation::New(durationSeconds); + animation.SetEndAction(endActions[i]); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); application.SendNotification(); - application.Render( halfAnimationDuration ); + application.Render(halfAnimationDuration); // Puase the animation early animation.Pause(); // The event side property should be set the current value immediately, the update side property will still only be halfway - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION); // After one frame, both values should match regardless of the End Action application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION); } END_TEST; @@ -13536,106 +13629,106 @@ int UtcDaliAnimationPlayFromWithLoopCount(void) TestApplication application; auto actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - auto animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f ); - animation.SetLoopCount( 2 ); + auto animation = Animation::New(1.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f); + animation.SetLoopCount(2); animation.Play(); application.SendNotification(); - application.Render( 1001 ); + application.Render(1001); // One loop completed - application.Render( 2005 ); + application.Render(2005); application.SendNotification(); // 2 loops should have completed - DALI_TEST_EQUALS( animation.GetCurrentLoop(), 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION); // Another render needs to occur after all the loops end application.SendNotification(); - application.Render( 1000 ); + application.Render(1000); // Stop the animation and use PlayFrom, previously we got an Assert here animation.Stop(); - animation.PlayFrom( 0.5f ); + animation.PlayFrom(0.5f); application.SendNotification(); - application.Render( 1000 ); + application.Render(1000); - DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION); END_TEST; } int UtcDaliAnimationCombineToAndByWithStop(void) { - tet_infoline( "Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy"); + tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy"); TestApplication application; auto actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + application.GetScene().Add(actor); - auto animation = Animation::New( 1.0f ); - const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >(); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) ); - animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( -30.0f, 0.0f, 0.0f ), TimePeriod( 1.0f, 1.0f ) ); + auto animation = Animation::New(1.0f); + const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get(); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f)); + animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f)); animation.Play(); application.SendNotification(); - application.Render( 500 ); + application.Render(500); application.SendNotification(); - application.Render( 500 ); + application.Render(500); application.SendNotification(); - application.Render( 500 ); + application.Render(500); // Stop and clear the animation using the current values animation.Stop(); animation.Clear(); // Check the y position, it should be the same as before - DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION_Y).Get< float >(), origY, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get(), origY, TEST_LOCATION); END_TEST; } int UtcDaliAnimationCountAndGetAnimationAt(void) { - tet_infoline( "UtcDaliAnimationCountAndGetAnimationAt"); + tet_infoline("UtcDaliAnimationCountAndGetAnimationAt"); TestApplication application; auto actor = Actor::New(); - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + application.GetScene().Add(actor); - auto animation = Animation::New( 1.0f ); - const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >(); - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) ); + auto animation = Animation::New(1.0f); + const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get(); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f)); animation.Play(); application.SendNotification(); - application.Render( 500 ); + application.Render(500); uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount(); - DALI_TEST_EQUALS( animationCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION); - DALI_TEST_CHECK( !Dali::DevelAnimation::GetAnimationAt( 5 ) ); + DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5)); - Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt( 0 ); - DALI_TEST_EQUALS( animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION ); + Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0); + DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION); - DALI_TEST_EQUALS( animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION ); - DALI_TEST_EQUALS( animation.GetState(), animationReturned.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION); + DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION); + DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION); // Stop and clear the animation using the current values animation.Stop(); @@ -13749,12 +13842,12 @@ int UtcDaliAnimationAnimateBetweenNegative01(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::KeyFrames arg2; - instance.AnimateBetween(arg1,arg2); + instance.AnimateBetween(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13768,13 +13861,13 @@ int UtcDaliAnimationAnimateBetweenNegative02(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; Dali::Animation::Interpolation arg3(Animation::LINEAR); - instance.AnimateBetween(arg1,arg2,arg3); + instance.AnimateBetween(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13788,13 +13881,13 @@ int UtcDaliAnimationAnimateBetweenNegative03(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; Dali::TimePeriod arg3(1.0f); - instance.AnimateBetween(arg1,arg2,arg3); + instance.AnimateBetween(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13808,14 +13901,14 @@ int UtcDaliAnimationAnimateBetweenNegative04(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; - Dali::TimePeriod arg3(1.0f); + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; + Dali::TimePeriod arg3(1.0f); Dali::Animation::Interpolation arg4(Animation::LINEAR); - instance.AnimateBetween(arg1,arg2,arg3,arg4); + instance.AnimateBetween(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13829,13 +13922,13 @@ int UtcDaliAnimationAnimateBetweenNegative05(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; Dali::AlphaFunction arg3; - instance.AnimateBetween(arg1,arg2,arg3); + instance.AnimateBetween(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13849,14 +13942,14 @@ int UtcDaliAnimationAnimateBetweenNegative06(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; - Dali::AlphaFunction arg3; + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; + Dali::AlphaFunction arg3; Dali::Animation::Interpolation arg4(Animation::LINEAR); - instance.AnimateBetween(arg1,arg2,arg3,arg4); + instance.AnimateBetween(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13870,14 +13963,14 @@ int UtcDaliAnimationAnimateBetweenNegative07(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; Dali::AlphaFunction arg3; - Dali::TimePeriod arg4(1.0f); - instance.AnimateBetween(arg1,arg2,arg3,arg4); + Dali::TimePeriod arg4(1.0f); + instance.AnimateBetween(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -13891,15 +13984,15 @@ int UtcDaliAnimationAnimateBetweenNegative08(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); - Dali::KeyFrames arg2; - Dali::AlphaFunction arg3; - Dali::TimePeriod arg4(1.0f); + Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::KeyFrames arg2; + Dali::AlphaFunction arg3; + Dali::TimePeriod arg4(1.0f); Dali::Animation::Interpolation arg5(Animation::LINEAR); - instance.AnimateBetween(arg1,arg2,arg3,arg4,arg5); + instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14049,8 +14142,8 @@ int UtcDaliAnimationHideNegative(void) try { Dali::Actor arg1; - float arg2(0.0f); - instance.Hide(arg1,arg2); + float arg2(0.0f); + instance.Hide(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14083,8 +14176,8 @@ int UtcDaliAnimationShowNegative(void) try { Dali::Actor arg1; - float arg2(0.0f); - instance.Show(arg1,arg2); + float arg2(0.0f); + instance.Show(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14148,10 +14241,10 @@ int UtcDaliAnimationAnimateNegative01(void) Dali::Animation instance; try { - Dali::Actor arg1; - Dali::Path arg2; + Dali::Actor arg1; + Dali::Path arg2; Dali::Vector3 arg3; - instance.Animate(arg1,arg2,arg3); + instance.Animate(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14167,11 +14260,11 @@ int UtcDaliAnimationAnimateNegative02(void) Dali::Animation instance; try { - Dali::Actor arg1; - Dali::Path arg2; - Dali::Vector3 arg3; + Dali::Actor arg1; + Dali::Path arg2; + Dali::Vector3 arg3; Dali::TimePeriod arg4(1.0f); - instance.Animate(arg1,arg2,arg3,arg4); + instance.Animate(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14187,11 +14280,11 @@ int UtcDaliAnimationAnimateNegative03(void) Dali::Animation instance; try { - Dali::Actor arg1; - Dali::Path arg2; - Dali::Vector3 arg3; + Dali::Actor arg1; + Dali::Path arg2; + Dali::Vector3 arg3; Dali::AlphaFunction arg4; - instance.Animate(arg1,arg2,arg3,arg4); + instance.Animate(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14207,12 +14300,12 @@ int UtcDaliAnimationAnimateNegative04(void) Dali::Animation instance; try { - Dali::Actor arg1; - Dali::Path arg2; - Dali::Vector3 arg3; + Dali::Actor arg1; + Dali::Path arg2; + Dali::Vector3 arg3; Dali::AlphaFunction arg4; - Dali::TimePeriod arg5(1.0f); - instance.Animate(arg1,arg2,arg3,arg4,arg5); + Dali::TimePeriod arg5(1.0f); + instance.Animate(arg1, arg2, arg3, arg4, arg5); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14243,12 +14336,12 @@ int UtcDaliAnimationAnimateByNegative01(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - instance.AnimateBy(arg1,arg2); + instance.AnimateBy(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14262,13 +14355,13 @@ int UtcDaliAnimationAnimateByNegative02(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::TimePeriod arg3(1.0f); - instance.AnimateBy(arg1,arg2,arg3); + Dali::TimePeriod arg3(1.0f); + instance.AnimateBy(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14282,13 +14375,13 @@ int UtcDaliAnimationAnimateByNegative03(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::AlphaFunction arg3; - instance.AnimateBy(arg1,arg2,arg3); + Dali::AlphaFunction arg3; + instance.AnimateBy(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14302,14 +14395,14 @@ int UtcDaliAnimationAnimateByNegative04(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::AlphaFunction arg3; - Dali::TimePeriod arg4(1.0f); - instance.AnimateBy(arg1,arg2,arg3,arg4); + Dali::AlphaFunction arg3; + Dali::TimePeriod arg4(1.0f); + instance.AnimateBy(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14322,13 +14415,13 @@ int UtcDaliAnimationAnimateByNegative04(void) int UtcDaliAnimationAnimateToNegative01(void) { TestApplication application; - Dali::Actor actor; + Dali::Actor actor; Dali::Animation instance; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - instance.AnimateTo(arg1,arg2); + instance.AnimateTo(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14342,13 +14435,13 @@ int UtcDaliAnimationAnimateToNegative02(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::TimePeriod arg3(1.0f); - instance.AnimateTo(arg1,arg2,arg3); + Dali::TimePeriod arg3(1.0f); + instance.AnimateTo(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14362,13 +14455,13 @@ int UtcDaliAnimationAnimateToNegative03(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::AlphaFunction arg3; - instance.AnimateTo(arg1,arg2,arg3); + Dali::AlphaFunction arg3; + instance.AnimateTo(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14382,14 +14475,14 @@ int UtcDaliAnimationAnimateToNegative04(void) { TestApplication application; Dali::Animation instance; - Dali::Actor actor; + Dali::Actor actor; try { - Dali::Property arg1(actor, Actor::Property::POSITION); + Dali::Property arg1(actor, Actor::Property::POSITION); Dali::Property::Value arg2; - Dali::AlphaFunction arg3; - Dali::TimePeriod arg4(1.0f); - instance.AnimateTo(arg1,arg2,arg3,arg4); + Dali::AlphaFunction arg3; + Dali::TimePeriod arg4(1.0f); + instance.AnimateTo(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14566,9 +14659,9 @@ int UtcDaliKeyFramesAddNegative01(void) Dali::KeyFrames instance; try { - float arg1(0.0f); + float arg1(0.0f); Dali::Property::Value arg2; - instance.Add(arg1,arg2); + instance.Add(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -14584,10 +14677,10 @@ int UtcDaliKeyFramesAddNegative02(void) Dali::KeyFrames instance; try { - float arg1(0.0f); + float arg1(0.0f); Dali::Property::Value arg2; - Dali::AlphaFunction arg3; - instance.Add(arg1,arg2,arg3); + Dali::AlphaFunction arg3; + instance.Add(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) diff --git a/automated-tests/src/dali/utc-Dali-Any.cpp b/automated-tests/src/dali/utc-Dali-Any.cpp index 843bc8a..39bc2f4 100644 --- a/automated-tests/src/dali/utc-Dali-Any.cpp +++ b/automated-tests/src/dali/utc-Dali-Any.cpp @@ -15,11 +15,11 @@ * */ -#include +#include +#include #include -#include -#include +#include // Temp include #include @@ -29,32 +29,35 @@ namespace struct MyStruct { MyStruct() - : mFloatValue( 0.f ), - mIntValue( 0 ) - {} + : mFloatValue(0.f), + mIntValue(0) + { + } - MyStruct( float fValue, int iValue ) - : mFloatValue( fValue ), - mIntValue( iValue ) - {} + MyStruct(float fValue, int iValue) + : mFloatValue(fValue), + mIntValue(iValue) + { + } - MyStruct( const MyStruct& myStruct ) - : mFloatValue( myStruct.mFloatValue ), - mIntValue( myStruct.mIntValue ) - {} + MyStruct(const MyStruct& myStruct) + : mFloatValue(myStruct.mFloatValue), + mIntValue(myStruct.mIntValue) + { + } - MyStruct& operator=( const MyStruct& myStruct ) + MyStruct& operator=(const MyStruct& myStruct) { mFloatValue = myStruct.mFloatValue; - mIntValue = myStruct.mIntValue; + mIntValue = myStruct.mIntValue; return *this; } float mFloatValue; - int mIntValue; + int mIntValue; }; -} +} // namespace using namespace Dali; @@ -77,7 +80,7 @@ int UtcDaliAnyConstructors(void) // Test default constructor. Any value; - DALI_TEST_CHECK( typeid( void ) == value.GetType() ); + DALI_TEST_CHECK(typeid(void) == value.GetType()); // Test constructor Any( const Type& ) Any value1 = 4u; @@ -88,16 +91,16 @@ int UtcDaliAnyConstructors(void) // Test constructor Any( const Any& ) with a non initialized Any Any value3 = value; - DALI_TEST_CHECK( typeid( unsigned int ) == value1.GetType() ); - DALI_TEST_CHECK( typeid( unsigned int ) == value2.GetType() ); - DALI_TEST_CHECK( typeid( void ) == value3.GetType() ); + DALI_TEST_CHECK(typeid(unsigned int) == value1.GetType()); + DALI_TEST_CHECK(typeid(unsigned int) == value2.GetType()); + DALI_TEST_CHECK(typeid(void) == value3.GetType()); unsigned int uiValue1 = 0u; unsigned int uiValue2 = 0u; - value1.Get( uiValue1 ); - value2.Get( uiValue2 ); + value1.Get(uiValue1); + value2.Get(uiValue2); - DALI_TEST_EQUALS( uiValue1, uiValue2, TEST_LOCATION ); + DALI_TEST_EQUALS(uiValue1, uiValue2, TEST_LOCATION); END_TEST; } @@ -113,57 +116,56 @@ int UtcDaliAnyAssignmentOperators(void) value1 = 4.f; // Test operator=( const Type& ) when current object is not initialized. - value1.Get( fValue ); + value1.Get(fValue); - DALI_TEST_EQUALS( fValue, 4.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 4.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); value1 = 9.f; // Test operator=( const Type& ). - value1.Get( fValue ); + value1.Get(fValue); - DALI_TEST_EQUALS( fValue, 9.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 9.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); Any value3 = 5.f; value1 = value3; // Test operator=( const Any& ). - value1.Get( fValue ); + value1.Get(fValue); - DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); Any value4; value4 = value3; // Test operator=( const Any& ) when current object is not initialized. - value4.Get( fValue ); + value4.Get(fValue); - DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); // Test assign a value to value3 doesn't modify value1. value3 = 3.f; - value1.Get( fValue ); + value1.Get(fValue); - DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); - value3.Get( fValue ); + value3.Get(fValue); - DALI_TEST_EQUALS( fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); // Test the branch when copying the same object. - Any value5 = 3.f; - Any& value6( value5 ); + Any value5 = 3.f; + Any& value6(value5); value6 = value5; - value6.Get( fValue ); - DALI_TEST_EQUALS( fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + value6.Get(fValue); + DALI_TEST_EQUALS(fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); // test assignment for non-empty Any = empty Any Any value7; value6 = value7; - DALI_TEST_CHECK( value6.Empty() ); - + DALI_TEST_CHECK(value6.Empty()); END_TEST; } @@ -183,19 +185,19 @@ int UtcDaliAnyNegativeAssignmentOperators(void) { value1 = value2; // Test operator=( const Any& ); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); assert = true; } - if( assert ) + if(assert) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } else { - tet_result( TET_FAIL ); + tet_result(TET_FAIL); } END_TEST; } @@ -208,11 +210,11 @@ int UtcDaliAnyGetType(void) Any value; - DALI_TEST_CHECK( typeid( void ) == value.GetType() ); + DALI_TEST_CHECK(typeid(void) == value.GetType()); value = 5.f; - DALI_TEST_CHECK( typeid( float ) == value.GetType() ); + DALI_TEST_CHECK(typeid(float) == value.GetType()); END_TEST; } @@ -222,86 +224,86 @@ int UtcDaliAnyGet(void) tet_infoline("Test Get()."); - Any value1( 5.f ); + Any value1(5.f); float fValue = value1.Get(); - DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); fValue = 0.f; - value1.Get( fValue ); - DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + value1.Get(fValue); + DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); class MyClass { public: - MyClass( float fValue, int iValue ) - : mAny( MyStruct( fValue, iValue ) ) + MyClass(float fValue, int iValue) + : mAny(MyStruct(fValue, iValue)) { } const MyStruct& Get() const { - return AnyCastReference( mAny ); + return AnyCastReference(mAny); } MyStruct* GetPointer() { - return AnyCast( &mAny ); + return AnyCast(&mAny); } const MyStruct* GetPointer() const { - return AnyCast( &mAny ); + return AnyCast(&mAny); } private: Dali::Any mAny; }; - MyClass myClass( 3.25f, 3 ); + MyClass myClass(3.25f, 3); - MyStruct myStruct1 = myClass.Get(); + MyStruct myStruct1 = myClass.Get(); const MyStruct& myStruct2 = myClass.Get(); - MyStruct* myStruct3 = myClass.GetPointer(); + MyStruct* myStruct3 = myClass.GetPointer(); const MyStruct* myStruct4 = myClass.GetPointer(); - if( myStruct3 == NULL ) + if(myStruct3 == NULL) { - tet_result( TET_FAIL ); + tet_result(TET_FAIL); END_TEST; } - if( myStruct4 == NULL ) + if(myStruct4 == NULL) { - tet_result( TET_FAIL ); + tet_result(TET_FAIL); END_TEST; } - DALI_TEST_EQUALS( myStruct1.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct2.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct3->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct4->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct1.mIntValue, 3, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct2.mIntValue, 3, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct3->mIntValue, 3, TEST_LOCATION ); - DALI_TEST_EQUALS( myStruct4->mIntValue, 3, TEST_LOCATION ); + DALI_TEST_EQUALS(myStruct1.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct2.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct3->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct4->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct1.mIntValue, 3, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct2.mIntValue, 3, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct3->mIntValue, 3, TEST_LOCATION); + DALI_TEST_EQUALS(myStruct4->mIntValue, 3, TEST_LOCATION); // Test on empty any object Dali::Any myAny; - float* f = myAny.GetPointer(); - DALI_TEST_CHECK( f == NULL ); + float* f = myAny.GetPointer(); + DALI_TEST_CHECK(f == NULL); // Test on getting wrong type myAny = 1.f; try { myAny.GetPointer(); - tet_result( TET_FAIL ); + tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); } END_TEST; @@ -313,7 +315,7 @@ int UtcDaliAnyNegativeGet(void) tet_infoline("Test Get()."); Any value1; - Any value2( 5.f ); + Any value2(5.f); bool assert1 = false; bool assert2 = false; @@ -322,34 +324,34 @@ int UtcDaliAnyNegativeGet(void) try { - uiValue = value1.Get< unsigned int >(); + uiValue = value1.Get(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); assert1 = true; } try { - uiValue = value2.Get< unsigned int >(); + uiValue = value2.Get(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); assert2 = true; } - if( assert1 && assert2 ) + if(assert1 && assert2) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } else { - tet_result( TET_FAIL ); + tet_result(TET_FAIL); } - uiValue++; // supresss warning from unused variable + uiValue++; // supresss warning from unused variable END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-BaseHandle.cpp b/automated-tests/src/dali/utc-Dali-BaseHandle.cpp index 6623b87..5b3d622 100644 --- a/automated-tests/src/dali/utc-Dali-BaseHandle.cpp +++ b/automated-tests/src/dali/utc-Dali-BaseHandle.cpp @@ -15,17 +15,16 @@ * */ -#include - -#include -#include #include +#include +#include + +#include #include "dali-test-suite-utils/dali-test-suite-utils.h" using namespace Dali; - void utc_base_handle_startup(void) { test_return_value = TET_UNDEF; @@ -39,7 +38,6 @@ void utc_base_handle_cleanup(void) namespace { - // Functor to test whether an animation finish signal is emitted struct AnimationFinishCheck { @@ -60,7 +58,7 @@ struct AnimationFinishCheck void CheckSignalReceived() { - if (!mSignalReceived) + if(!mSignalReceived) { tet_printf("Expected Finish signal was not received\n"); tet_result(TET_FAIL); @@ -78,7 +76,7 @@ BaseHandle ImplicitCopyConstructor(BaseHandle passedByValue) { // object + copy + passedByValue, ref count == 3 DALI_TEST_CHECK(passedByValue); - if (passedByValue) + if(passedByValue) { DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -101,16 +99,15 @@ class FakeObject : public BaseObject { }; // used for testing ThisIsSaferThanReturningVoidStar -class FakeHandle : public BaseHandle +class FakeHandle : public BaseHandle { public: - void RunTest() { return ThisIsSaferThanReturningVoidStar(); } }; -} // anon namespace +} // namespace int UtcDaliBaseHandleConstructorVoid(void) { @@ -136,7 +133,7 @@ int UtcDaliBaseHandleCopyConstructor(void) // Copy the object, ref count == 2 BaseHandle copy(object); DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -146,7 +143,7 @@ int UtcDaliBaseHandleCopyConstructor(void) BaseHandle anotherCopy = ImplicitCopyConstructor(copy); DALI_TEST_CHECK(anotherCopy); - if (anotherCopy) + if(anotherCopy) { DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -154,7 +151,7 @@ int UtcDaliBaseHandleCopyConstructor(void) // anotherCopy out of scope, ref count == 2 DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -169,7 +166,7 @@ int UtcDaliBaseHandleAssignmentOperator(void) BaseHandle object = Actor::New(); DALI_TEST_CHECK(object); - if (object) + if(object) { DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -177,7 +174,7 @@ int UtcDaliBaseHandleAssignmentOperator(void) BaseHandle copy = object; DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -191,18 +188,18 @@ int UtcDaliBaseHandleMoveConstructor(void) // Initialize an object, ref count == 1 BaseHandle object = Actor::New(); - DALI_TEST_EQUALS( 1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); // Move the object, ref count == 1 - BaseHandle move = std::move( object ); - DALI_TEST_CHECK( move ); + BaseHandle move = std::move(object); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - if ( move ) + if(move) { - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); } - DALI_TEST_CHECK( !object ); + DALI_TEST_CHECK(!object); END_TEST; } @@ -214,19 +211,19 @@ int UtcDaliBaseHandleMoveAssignment(void) // Initialize an object, ref count == 1 BaseHandle object = Actor::New(); - DALI_TEST_EQUALS( 1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); // Move the object, ref count == 1 BaseHandle move; - move = std::move( object ); - DALI_TEST_CHECK( move ); + move = std::move(object); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - if ( move ) + if(move) { - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); } - DALI_TEST_CHECK( !object ); + DALI_TEST_CHECK(!object); END_TEST; } @@ -329,24 +326,24 @@ int UtcDaliBaseHandleStlVector(void) std::vector myVector; - for (int i=0; i(myVector.size()), TEST_LOCATION); - DALI_TEST_CHECK(myVector[0].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 1"); - DALI_TEST_CHECK(myVector[1].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 2"); - DALI_TEST_CHECK(myVector[2].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 3"); - DALI_TEST_CHECK(myVector[3].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 4"); - DALI_TEST_CHECK(myVector[4].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 5"); + DALI_TEST_CHECK(myVector[0].GetProperty(Actor::Property::NAME) == "Actor 1"); + DALI_TEST_CHECK(myVector[1].GetProperty(Actor::Property::NAME) == "Actor 2"); + DALI_TEST_CHECK(myVector[2].GetProperty(Actor::Property::NAME) == "Actor 3"); + DALI_TEST_CHECK(myVector[3].GetProperty(Actor::Property::NAME) == "Actor 4"); + DALI_TEST_CHECK(myVector[4].GetProperty(Actor::Property::NAME) == "Actor 5"); END_TEST; } @@ -355,7 +352,7 @@ int UtcDaliBaseHandleDoAction(void) TestApplication application; tet_infoline("Positive Test Dali::BaseHandle::UtcDaliBaseHandleDoAction"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); BaseHandle actorObject = actor; DALI_TEST_CHECK(actorObject); @@ -365,8 +362,8 @@ int UtcDaliBaseHandleDoAction(void) DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false); // Check that the actor is visible - actor.SetProperty( Actor::Property::VISIBLE,true); - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + actor.SetProperty(Actor::Property::VISIBLE, true); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == true); // Check the actor performed an action to hide itself DALI_TEST_CHECK(actorObject.DoAction("hide", attributes) == true); @@ -376,7 +373,7 @@ int UtcDaliBaseHandleDoAction(void) application.Render(); // Check that the actor is now invisible - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == false); // Check the actor performed an action to show itself DALI_TEST_CHECK(actorObject.DoAction("show", attributes) == true); @@ -386,13 +383,13 @@ int UtcDaliBaseHandleDoAction(void) application.Render(); // Check that the actor is now visible - DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::VISIBLE) == true); application.GetScene().Add(actor); // Build an animation with initial duration of 1 second - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); BaseHandle animationObject = animation; DALI_TEST_CHECK(animationObject); @@ -404,40 +401,40 @@ int UtcDaliBaseHandleDoAction(void) animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Set the new duration to be 2 seconds - float newDurationSeconds(2.0f); - Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds ); - attributes["duration"] = newDurationSecondsValue; + float newDurationSeconds(2.0f); + Property::Value newDurationSecondsValue = Property::Value(newDurationSeconds); + attributes["duration"] = newDurationSecondsValue; // Check the animation performed an action to play itself with the specified duration of 2 seconds animationObject.DoAction("play", attributes); - bool signalReceived(false); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); // use the handle API to connect the signal - animation.ConnectSignal( &application, "finished", finishCheck ); + animation.ConnectSignal(&application, "finished", finishCheck); // just for coverage connect to non-existant signal as well - animation.ConnectSignal( &application, "foo", finishCheck ); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + animation.ConnectSignal(&application, "foo", finishCheck); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); application.SendNotification(); application.Render(static_cast(newDurationSeconds * 500.0f) /* half of time */); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); // pause animationObject.DoAction("pause", attributes); application.SendNotification(); - application.Render(static_cast(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + application.Render(static_cast(newDurationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); // continue animationObject.DoAction("play", attributes); application.SendNotification(); - application.Render(static_cast(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(newDurationSeconds * 500.0f) + 1u /*just beyond the animation duration*/); // We expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), targetPosition, TEST_LOCATION); // play again signalReceived = false; @@ -448,14 +445,13 @@ int UtcDaliBaseHandleDoAction(void) animationObject.DoAction("stop", attributes); application.SendNotification(); application.Render(static_cast(newDurationSeconds * 1000.0f) /* full time */); - DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION ); + DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION); // Check the new animation duration is 2 seconds DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION); END_TEST; } - int UtcDaliBaseHandleConnectSignal(void) { TestApplication application; @@ -465,17 +461,17 @@ int UtcDaliBaseHandleConnectSignal(void) // get the root layer Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 )); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::POSITION, Vector2(240, 400)); + actor.SetProperty(Actor::Property::SIZE, Vector2(100, 100)); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - DALI_TEST_CHECK( gTouchCallBackCalled == false ); + DALI_TEST_CHECK(gTouchCallBackCalled == false); // connect to its touch signal - actor.ConnectSignal( &application, "touched", TestCallback() ); + actor.ConnectSignal(&application, "touched", TestCallback()); application.SendNotification(); application.Render(1000); @@ -484,27 +480,27 @@ int UtcDaliBaseHandleConnectSignal(void) // simulate a touch event Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 240, 400 ) ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(240, 400)); Dali::Integration::TouchEvent event; - event.AddPoint( point ); - application.ProcessEvent( event ); + event.AddPoint(point); + application.ProcessEvent(event); application.SendNotification(); application.Render(1000); application.SendNotification(); application.Render(1000); - DALI_TEST_CHECK( application.GetConnectionCount() > 0 ); - DALI_TEST_CHECK( gTouchCallBackCalled == true ); + DALI_TEST_CHECK(application.GetConnectionCount() > 0); + DALI_TEST_CHECK(gTouchCallBackCalled == true); gTouchCallBackCalled = false; application.DisconnectAll(); // simulate another touch event - application.ProcessEvent( event ); + application.ProcessEvent(event); - DALI_TEST_CHECK( gTouchCallBackCalled == false ); + DALI_TEST_CHECK(gTouchCallBackCalled == false); END_TEST; } @@ -518,20 +514,19 @@ int UtcDaliBaseHandleGetTypeNameP(void) std::string typeName = actor.GetTypeName(); - DALI_TEST_CHECK( typeName.size() ); - DALI_TEST_CHECK( typeName == std::string("Actor") ); + DALI_TEST_CHECK(typeName.size()); + DALI_TEST_CHECK(typeName == std::string("Actor")); END_TEST; } int UtcDaliBaseHandleGetTypeNameN(void) { - TestApplication application; tet_infoline("Testing Dali::BaseObject::GetTypeName"); - FakeObject object; + FakeObject object; std::string typeName = object.GetTypeName(); - DALI_TEST_CHECK( typeName.empty() ); + DALI_TEST_CHECK(typeName.empty()); END_TEST; } @@ -541,10 +536,10 @@ int UtcDaliBaseHandleGetTypeInfoP(void) tet_infoline("Testing Dali::BaseHandle::GetTypeInfo"); Dali::TypeInfo info; - Actor actor = Actor::New(); + Actor actor = Actor::New(); - bool ok = actor.GetTypeInfo( info ); - DALI_TEST_CHECK( ok ); + bool ok = actor.GetTypeInfo(info); + DALI_TEST_CHECK(ok); END_TEST; } @@ -556,7 +551,6 @@ int UtcDaliBaseHandleThisIsSaferThanReturningVoidStar(void) handle.RunTest(); tet_result(TET_PASS); END_TEST; - } int UtcDaliBaseHandleGetTypeInfoN(void) @@ -565,10 +559,10 @@ int UtcDaliBaseHandleGetTypeInfoN(void) tet_infoline("Testing Dali::BaseHandle::GetTypeInfo"); Dali::TypeInfo info; - FakeObject object; + FakeObject object; - bool ok = object.GetTypeInfo( info ); - DALI_TEST_CHECK( !ok ); + bool ok = object.GetTypeInfo(info); + DALI_TEST_CHECK(!ok); END_TEST; } @@ -582,7 +576,7 @@ int UtcDaliBaseHandleGetObjectPtr(void) Dali::RefObject* p = actor.GetObjectPtr(); - DALI_TEST_CHECK( p != NULL ); + DALI_TEST_CHECK(p != NULL); END_TEST; } @@ -594,30 +588,30 @@ int UtcDaliBaseHandleBooleanCast(void) // get the root layer BaseHandle handle = Actor::New(); - DALI_TEST_CHECK( static_cast( handle ) ); + DALI_TEST_CHECK(static_cast(handle)); END_TEST; } int UtcDaliBaseHandleCompareOperatorN(void) { TestApplication application; - BaseHandle handle1 = Actor::New(); - BaseHandle handle2 = handle1; + BaseHandle handle1 = Actor::New(); + BaseHandle handle2 = handle1; - DALI_TEST_CHECK( (handle1 < handle2) == false ); + DALI_TEST_CHECK((handle1 < handle2) == false); END_TEST; } int UtcDaliBaseHandleDoActionNegative(void) { - TestApplication application; + TestApplication application; Dali::BaseHandle instance; try { - std::string arg1; + std::string arg1; Dali::Property::Map arg2; - instance.DoAction(arg1,arg2); + instance.DoAction(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -629,7 +623,7 @@ int UtcDaliBaseHandleDoActionNegative(void) int UtcDaliBaseHandleGetTypeInfoNegative(void) { - TestApplication application; + TestApplication application; Dali::BaseHandle instance; try { @@ -646,7 +640,7 @@ int UtcDaliBaseHandleGetTypeInfoNegative(void) int UtcDaliBaseHandleGetTypeNameNegative(void) { - TestApplication application; + TestApplication application; Dali::BaseHandle instance; try { diff --git a/automated-tests/src/dali/utc-Dali-CSharp-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-CSharp-TypeRegistry.cpp index 10f60a2..bf4a348 100644 --- a/automated-tests/src/dali/utc-Dali-CSharp-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-CSharp-TypeRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,26 +15,23 @@ * */ -#include -#include -#include -#include #include #include #include #include +#include #include -using namespace Dali; +#include +#include +#include +using namespace Dali; namespace { - - static bool CreateCustomNamedInitCalled = false; - -BaseHandle* CreateCustomNamedInit(const char* const typeName ) +BaseHandle* CreateCustomNamedInit(const char* const typeName) { CreateCustomNamedInitCalled = true; @@ -46,53 +43,50 @@ BaseHandle* CreateCustomNamedInit(const char* const typeName ) // Property Registration bool setPropertyCalled = false; bool getPropertyCalled = false; -int intPropertyValue = 0; +int intPropertyValue = 0; -void SetProperty( BaseObject* object, const char* const propertyName , Property::Value* value ) +void SetProperty(BaseObject* object, const char* const propertyName, Property::Value* value) { - - value->Get( intPropertyValue ); + value->Get(intPropertyValue); setPropertyCalled = true; } -Property::Value* GetProperty( BaseObject* object, const char* const propertyName ) +Property::Value* GetProperty(BaseObject* object, const char* const propertyName) { - getPropertyCalled = true; - Property::Value* x = new Property::Value( 10 ); + getPropertyCalled = true; + Property::Value* x = new Property::Value(10); return x; } -} +} // namespace int UtcDaliRegisterCSharpTypeP(void) { - TestApplication application; - CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit ); + CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit); - Dali::TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo( "CSharpControl" ); + Dali::TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo("CSharpControl"); info.CreateInstance(); - DALI_TEST_EQUALS( CreateCustomNamedInitCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(CreateCustomNamedInitCalled, true, TEST_LOCATION); END_TEST; } int UtcDaliRegisterCSharpTypeNoInitP(void) { - TestApplication application; CreateCustomNamedInitCalled = false; - CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit ); + CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit); GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions(); - DALI_TEST_EQUALS( CreateCustomNamedInitCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(CreateCustomNamedInitCalled, false, TEST_LOCATION); END_TEST; } @@ -101,17 +95,17 @@ int UtcDaliRegisterCSharpTypeN(void) { TestApplication application; - CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit ); + CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit); // should cause an assert because we're registering same type twice try { - CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit ); - tet_result( TET_FAIL ); + CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Duplicate type name in Type Registration", TEST_LOCATION); } END_TEST; @@ -119,78 +113,69 @@ int UtcDaliRegisterCSharpTypeN(void) int UtcDaliRegisterCSharpTypeCreateP(void) { - TestApplication application; CreateCustomNamedInitCalled = false; - CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit ); - + CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit); - TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo( "CSharpControl"); + TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo("CSharpControl"); BaseHandle handle = info.CreateInstance(); - DALI_TEST_EQUALS( CreateCustomNamedInitCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(CreateCustomNamedInitCalled, true, TEST_LOCATION); END_TEST; } - - int UtcDaliRegisterCSharpPropertyP(void) { TestApplication application; - CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit ); - + CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit); - bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - 10000 + 1, - Property::INTEGER, - SetProperty, - GetProperty ); - - DALI_TEST_EQUALS( registered, true, TEST_LOCATION ); + bool registered = CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + 10000 + 1, + Property::INTEGER, + SetProperty, + GetProperty); + DALI_TEST_EQUALS(registered, true, TEST_LOCATION); END_TEST; } - int UtcDaliRegisterCSharpPropertyN(void) { TestApplication application; // register the same property twice - CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit ); - - - bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - 10000 + 1, - Property::INTEGER, - SetProperty, - GetProperty ); + CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit); - DALI_TEST_EQUALS( registered, true, TEST_LOCATION ); + bool registered = CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + 10000 + 1, + Property::INTEGER, + SetProperty, + GetProperty); + DALI_TEST_EQUALS(registered, true, TEST_LOCATION); // should fail second time with an assert as the property is already registered try { - registered = CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - 10000 + 1, - Property::INTEGER, - SetProperty, - GetProperty ); - - tet_result( TET_FAIL ); + registered = CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + 10000 + 1, + Property::INTEGER, + SetProperty, + GetProperty); + + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Property index already added to Type", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property index already added to Type", TEST_LOCATION); } END_TEST; @@ -200,84 +185,82 @@ int UtcDaliRegisterCSharpPropertySetP(void) { TestApplication application; - // register the same property twice - CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit );; - - Property::Index index(100001); + // register the same property twice + CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit); + ; - CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - index, - Property::INTEGER, - SetProperty, - GetProperty ); + Property::Index index(100001); - TypeRegistry typeRegistry = TypeRegistry::Get(); + CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + index, + Property::INTEGER, + SetProperty, + GetProperty); - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "DateControl" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("DateControl"); - // Check the property is writable in the type registry - Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); + // Check the property is writable in the type registry + Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo); - Property::Value value(25); + Property::Value value(25); - typeInfoImpl.SetProperty( NULL, index, value ); + typeInfoImpl.SetProperty(NULL, index, value); - DALI_TEST_EQUALS( 25, intPropertyValue , TEST_LOCATION ); + DALI_TEST_EQUALS(25, intPropertyValue, TEST_LOCATION); - Property::Value value2(50); + Property::Value value2(50); - typeInfoImpl.SetProperty( NULL, "year", value2 ); + typeInfoImpl.SetProperty(NULL, "year", value2); - DALI_TEST_EQUALS( 50, intPropertyValue , TEST_LOCATION ); + DALI_TEST_EQUALS(50, intPropertyValue, TEST_LOCATION); - DALI_TEST_EQUALS( setPropertyCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(setPropertyCalled, true, TEST_LOCATION); - END_TEST; + END_TEST; } - int UtcDaliRegisterCSharpPropertyGetP(void) { TestApplication application; - // register the same property twice - CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit ); - - Property::Index index(100001); + // register the same property twice + CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit); - CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - index, - Property::INTEGER, - SetProperty, - GetProperty ); + Property::Index index(100001); - TypeRegistry typeRegistry = TypeRegistry::Get(); + CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + index, + Property::INTEGER, + SetProperty, + GetProperty); - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "DateControl" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("DateControl"); - // Check the property is writable in the type registry - Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); + // Check the property is writable in the type registry + Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo); - Property::Value value(1); + Property::Value value(1); - value = typeInfoImpl.GetProperty( NULL, index ); + value = typeInfoImpl.GetProperty(NULL, index); - int propValue; - value.Get( propValue ); + int propValue; + value.Get(propValue); - DALI_TEST_EQUALS( getPropertyCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( propValue, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(getPropertyCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(propValue, 10, TEST_LOCATION); - value = typeInfoImpl.GetProperty( NULL, "year"); - value.Get( propValue ); + value = typeInfoImpl.GetProperty(NULL, "year"); + value.Get(propValue); - DALI_TEST_EQUALS( propValue, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(propValue, 10, TEST_LOCATION); - END_TEST; + END_TEST; } int UtcDaliRegisterCSharpPropertyNotRegisteredN(void) @@ -285,15 +268,14 @@ int UtcDaliRegisterCSharpPropertyNotRegisteredN(void) TestApplication application; // control not registered, should fail - bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl", - "year", - 10000 + 1, - Property::INTEGER, - SetProperty, - GetProperty ); + bool registered = CSharpTypeRegistry::RegisterProperty("DateControl", + "year", + 10000 + 1, + Property::INTEGER, + SetProperty, + GetProperty); - DALI_TEST_EQUALS( registered, false, TEST_LOCATION ); + DALI_TEST_EQUALS(registered, false, TEST_LOCATION); END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-CameraActor.cpp b/automated-tests/src/dali/utc-Dali-CameraActor.cpp index f3ca7b0..3352ee9 100644 --- a/automated-tests/src/dali/utc-Dali-CameraActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CameraActor.cpp @@ -15,13 +15,14 @@ * */ -#include - -#include -#include #include + #include #include +#include + +#include +#include #include "dali-test-suite-utils/dali-test-suite-utils.h" @@ -39,15 +40,14 @@ void camera_actor_test_cleanup(void) namespace { - -const float FLOAT_EPSILON = 0.001f; -const float TEST_ASPECT_RATIO = 0.123f; -const float TEST_FIELD_OF_VIEW = Radian(Degree(40.0f)); +const float FLOAT_EPSILON = 0.001f; +const float TEST_ASPECT_RATIO = 0.123f; +const float TEST_FIELD_OF_VIEW = Radian(Degree(40.0f)); const float TEST_NEAR_PLANE_DISTANCE = 0.23f; -const float TEST_FAR_PLANE_DISTANCE = 0.973f; +const float TEST_FAR_PLANE_DISTANCE = 0.973f; -const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME( "uLightCameraProjectionMatrix" ); -const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME( "uLightCameraViewMatrix" ); +const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix"); +const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix"); const char* const RENDER_SHADOW_VERTEX_SOURCE = " uniform mediump mat4 uLightCameraProjectionMatrix;\n" " uniform mediump mat4 uLightCameraViewMatrix;\n" @@ -70,25 +70,24 @@ const char* const RENDER_SHADOW_FRAGMENT_SOURCE = struct PropertyDetails { - std::string name; ///< The name of the property. - Property::Type type; ///< The property type. - bool writable; ///< Whether the property is writable - bool animatable; ///< Whether the property is animatable. - bool constraintInput; ///< Whether the property can be used as an input to a constraint. - Property::Index enumIndex; ///< Used to check the index is correct within a debug build. + std::string name; ///< The name of the property. + Property::Type type; ///< The property type. + bool writable; ///< Whether the property is writable + bool animatable; ///< Whether the property is animatable. + bool constraintInput; ///< Whether the property can be used as an input to a constraint. + Property::Index enumIndex; ///< Used to check the index is correct within a debug build. }; } // Anonymous namespace - int UtcDaliCameraActorConstructorP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::CameraActor()" ); + tet_infoline("Testing Dali::CameraActor::CameraActor()"); CameraActor actor; - DALI_TEST_CHECK( !actor ); + DALI_TEST_CHECK(!actor); END_TEST; } @@ -97,12 +96,12 @@ int UtcDaliCameraActorConstructorP(void) int UtcDaliCameraActorDestructorP(void) { TestApplication application; - tet_infoline( "Testing Dali::~CameraActor (P)" ); + tet_infoline("Testing Dali::~CameraActor (P)"); CameraActor* actor = new CameraActor(); delete actor; actor = NULL; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -111,13 +110,13 @@ int UtcDaliCameraActorDestructorP(void) int UtcDaliCameraActorCopyConstructorP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Copy Constructor (P)" ); + tet_infoline("Testing Dali::CameraActor Copy Constructor (P)"); CameraActor actor = CameraActor::New(); - CameraActor copyActor( actor ); + CameraActor copyActor(actor); - DALI_TEST_CHECK( copyActor ); - DALI_TEST_CHECK( copyActor == actor ); + DALI_TEST_CHECK(copyActor); + DALI_TEST_CHECK(copyActor == actor); END_TEST; } @@ -125,12 +124,12 @@ int UtcDaliCameraActorCopyConstructorP(void) int UtcDaliCameraActorCopyConstructorN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Copy Constructor (N)" ); + tet_infoline("Testing Dali::CameraActor Copy Constructor (N)"); CameraActor actor; - CameraActor copyActor( actor ); + CameraActor copyActor(actor); - DALI_TEST_CHECK( !copyActor ); + DALI_TEST_CHECK(!copyActor); END_TEST; } @@ -138,13 +137,13 @@ int UtcDaliCameraActorCopyConstructorN(void) int UtcDaliCameraActorAssignmentOperatorP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Assignment Operator (P)" ); + tet_infoline("Testing Dali::CameraActor Assignment Operator (P)"); const CameraActor actor = CameraActor::New(); CameraActor copyActor = actor; - DALI_TEST_CHECK( copyActor ); - DALI_TEST_CHECK( copyActor == actor ); + DALI_TEST_CHECK(copyActor); + DALI_TEST_CHECK(copyActor == actor); END_TEST; } @@ -152,12 +151,12 @@ int UtcDaliCameraActorAssignmentOperatorP(void) int UtcDaliCameraActorAssignmentOperatorN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor = (N)" ); + tet_infoline("Testing Dali::CameraActor = (N)"); CameraActor actor; CameraActor copyActor = actor; - DALI_TEST_CHECK( !copyActor ); + DALI_TEST_CHECK(!copyActor); END_TEST; } @@ -165,55 +164,55 @@ int UtcDaliCameraActorAssignmentOperatorN(void) int UtcDaliCameraActorNewP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::New (P)" ); + tet_infoline("Testing Dali::CameraActor::New (P)"); CameraActor actor = CameraActor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); actor.Reset(); - DALI_TEST_CHECK( !actor ); + DALI_TEST_CHECK(!actor); END_TEST; } int UtcDaliCameraActorNewDefaultPerspectiveProjection(void) { TestApplication application; - tet_infoline( "Test the perspective projection of a camera actor is set appropriately when not passing in a size" ); + tet_infoline("Test the perspective projection of a camera actor is set appropriately when not passing in a size"); CameraActor actor = CameraActor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); // All the properties should still be the default values // Defaults taken from scene-graph-camera.cpp - DALI_TEST_EQUALS( 4.0f/3.0f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 45.0f*(Math::PI/180.0f), actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 3.0f * 800.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 0.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(4.0f / 3.0f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(45.0f * (Math::PI / 180.0f), actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(3.0f * 800.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(0.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); // Add it to the stage, then the values should be updated to reflect a 480.0f by 800.0f scene (default stage size) - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); // Ensure the values stay the same after update/render application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); END_TEST; } @@ -223,43 +222,43 @@ int UtcDaliCameraActorNewDefaultPerspectiveProjection(void) int UtcDaliCameraActorDownCastP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::DownCast (P)" ); + tet_infoline("Testing Dali::CameraActor::DownCast (P)"); - CameraActor camera = CameraActor::New(); - Actor anActor = Actor::New(); - anActor.Add( camera ); + CameraActor camera = CameraActor::New(); + Actor anActor = Actor::New(); + anActor.Add(camera); - Actor child = anActor.GetChildAt( 0 ); - CameraActor cameraActor = CameraActor::DownCast( child ); - DALI_TEST_CHECK( cameraActor ); + Actor child = anActor.GetChildAt(0); + CameraActor cameraActor = CameraActor::DownCast(child); + DALI_TEST_CHECK(cameraActor); cameraActor.Reset(); - DALI_TEST_CHECK( !cameraActor ); + DALI_TEST_CHECK(!cameraActor); - cameraActor = DownCast< CameraActor >( child ); - DALI_TEST_CHECK( cameraActor ); + cameraActor = DownCast(child); + DALI_TEST_CHECK(cameraActor); END_TEST; } int UtcDaliCameraActorDownCastN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::DownCast (N)" ); + tet_infoline("Testing Dali::CameraActor::DownCast (N)"); - Actor actor1 = Actor::New(); + Actor actor1 = Actor::New(); Actor anActor = Actor::New(); - anActor.Add( actor1 ); + anActor.Add(actor1); - Actor child = anActor.GetChildAt( 0 ); - CameraActor cameraActor = CameraActor::DownCast( child ); - DALI_TEST_CHECK( !cameraActor ); + Actor child = anActor.GetChildAt(0); + CameraActor cameraActor = CameraActor::DownCast(child); + DALI_TEST_CHECK(!cameraActor); Actor unInitialzedActor; - cameraActor = CameraActor::DownCast( unInitialzedActor ); - DALI_TEST_CHECK( !cameraActor ); + cameraActor = CameraActor::DownCast(unInitialzedActor); + DALI_TEST_CHECK(!cameraActor); - cameraActor = DownCast< CameraActor >( unInitialzedActor ); - DALI_TEST_CHECK( !cameraActor ); + cameraActor = DownCast(unInitialzedActor); + DALI_TEST_CHECK(!cameraActor); END_TEST; } @@ -268,23 +267,23 @@ int UtcDaliCameraActorDownCastN(void) int UtcDaliCameraActorSetGetTypeP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor GetType (P)" ); + tet_infoline("Testing Dali::CameraActor GetType (P)"); CameraActor actor = CameraActor::New(); - DALI_TEST_EQUALS( actor.GetType(), Dali::Camera::FREE_LOOK, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetType(), Dali::Camera::FREE_LOOK, TEST_LOCATION); - actor.SetType( Dali::Camera::LOOK_AT_TARGET ); - DALI_TEST_EQUALS( actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION ); + actor.SetType(Dali::Camera::LOOK_AT_TARGET); + DALI_TEST_EQUALS(actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION); - DALI_TEST_EQUALS( "LOOK_AT_TARGET", actor.GetProperty< std::string >( CameraActor::Property::TYPE ), TEST_LOCATION ); - DALI_TEST_EQUALS( "LOOK_AT_TARGET", actor.GetCurrentProperty< std::string >( CameraActor::Property::TYPE ), TEST_LOCATION ); + DALI_TEST_EQUALS("LOOK_AT_TARGET", actor.GetProperty(CameraActor::Property::TYPE), TEST_LOCATION); + DALI_TEST_EQUALS("LOOK_AT_TARGET", actor.GetCurrentProperty(CameraActor::Property::TYPE), TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetGetTypeN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor GetType (N)" ); + tet_infoline("Testing Dali::CameraActor GetType (N)"); CameraActor actor; @@ -293,10 +292,10 @@ int UtcDaliCameraActorSetGetTypeN(void) { cameraType = actor.GetType(); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera", TEST_LOCATION); } const CameraActor aConstActor; @@ -305,82 +304,82 @@ int UtcDaliCameraActorSetGetTypeN(void) { cameraType = aConstActor.GetType(); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera", TEST_LOCATION); } - DALI_TEST_EQUALS( cameraType, Dali::Camera::FREE_LOOK, TEST_LOCATION ); + DALI_TEST_EQUALS(cameraType, Dali::Camera::FREE_LOOK, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetFieldOfViewP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Field of view (P)" ); + tet_infoline("Testing Dali::CameraActor Set Field of view (P)"); - CameraActor defaultCamera = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); + CameraActor defaultCamera = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); const float defaultFieldOfView = defaultCamera.GetFieldOfView(); - CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - DALI_TEST_EQUALS( actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION ); + CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + DALI_TEST_EQUALS(actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION); float fieldOfView = Math::PI / 3.0f; - actor.SetFieldOfView( fieldOfView ); - DALI_TEST_EQUALS( actor.GetFieldOfView(), fieldOfView, TEST_LOCATION ); + actor.SetFieldOfView(fieldOfView); + DALI_TEST_EQUALS(actor.GetFieldOfView(), fieldOfView, TEST_LOCATION); float value; - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetFieldOfViewN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Field of view (N)" ); + tet_infoline("Testing Dali::CameraActor Set Field of view (N)"); - CameraActor defaultCamera = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); + CameraActor defaultCamera = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); const float defaultFieldOfView = defaultCamera.GetFieldOfView(); - CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - DALI_TEST_EQUALS( actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION ); + CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + DALI_TEST_EQUALS(actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION); float fieldOfView = Math::PI / 3.0f; - actor.SetFieldOfView( fieldOfView ); - DALI_TEST_EQUALS( actor.GetFieldOfView(), fieldOfView, TEST_LOCATION ); + actor.SetFieldOfView(fieldOfView); + DALI_TEST_EQUALS(actor.GetFieldOfView(), fieldOfView, TEST_LOCATION); float value; - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetFieldOfViewP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Field of view (P)" ); - const Vector2 size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ); + tet_infoline("Testing Dali::CameraActor Get Field of view (P)"); + const Vector2 size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT); - CameraActor defaultCamera = CameraActor::New( size ); + CameraActor defaultCamera = CameraActor::New(size); - const float cameraZ = 2.0f * std::max( size.width, size.height ); - const float expectedFieldOfView = 2.0f * std::atan( size.height * 0.5f / cameraZ ); + const float cameraZ = 2.0f * std::max(size.width, size.height); + const float expectedFieldOfView = 2.0f * std::atan(size.height * 0.5f / cameraZ); - CameraActor actor = CameraActor::New( size ); - DALI_TEST_EQUALS( actor.GetFieldOfView(), expectedFieldOfView, TEST_LOCATION ); + CameraActor actor = CameraActor::New(size); + DALI_TEST_EQUALS(actor.GetFieldOfView(), expectedFieldOfView, TEST_LOCATION); float value; - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( expectedFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(expectedFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetFieldOfViewN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Field of view (N)" ); + tet_infoline("Testing Dali::CameraActor Get Field of view (N)"); CameraActor defaultCamera = CameraActor::New(); @@ -389,13 +388,13 @@ int UtcDaliCameraActorGetFieldOfViewN(void) { defaultCamera.GetFieldOfView(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -403,19 +402,19 @@ int UtcDaliCameraActorGetFieldOfViewN(void) int UtcDaliCameraActorSetAspectRatioP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Aspect Ratio (P)" ); + tet_infoline("Testing Dali::CameraActor Set Aspect Ratio (P)"); - CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - DALI_TEST_EQUALS( actor.GetAspectRatio(), static_cast( TestApplication::DEFAULT_SURFACE_WIDTH ) / static_cast( TestApplication::DEFAULT_SURFACE_HEIGHT ), TEST_LOCATION ); + CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + DALI_TEST_EQUALS(actor.GetAspectRatio(), static_cast(TestApplication::DEFAULT_SURFACE_WIDTH) / static_cast(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION); // Set an initial value to confirm a further set changes it. float aspect = 4.0f / 3.0f; - actor.SetAspectRatio( aspect ); - DALI_TEST_EQUALS( actor.GetAspectRatio(), aspect, TEST_LOCATION ); + actor.SetAspectRatio(aspect); + DALI_TEST_EQUALS(actor.GetAspectRatio(), aspect, TEST_LOCATION); aspect = 16.0f / 9.0f; - actor.SetAspectRatio( aspect ); - DALI_TEST_EQUALS( actor.GetAspectRatio(), aspect, TEST_LOCATION ); + actor.SetAspectRatio(aspect); + DALI_TEST_EQUALS(actor.GetAspectRatio(), aspect, TEST_LOCATION); END_TEST; } @@ -423,22 +422,22 @@ int UtcDaliCameraActorSetAspectRatioP(void) int UtcDaliCameraActorSetAspectRatioN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Aspect Ratio (N)" ); + tet_infoline("Testing Dali::CameraActor Set Aspect Ratio (N)"); CameraActor actor; bool asserted = true; try { - actor.SetAspectRatio( 16.0f / 9.0f ); + actor.SetAspectRatio(16.0f / 9.0f); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -448,14 +447,14 @@ int UtcDaliCameraActorGetAspectRatioP(void) TestApplication application; tet_infoline("Testing Dali::CameraActor Get Aspect Ratio"); - CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - float defaultAspect = static_cast( TestApplication::DEFAULT_SURFACE_WIDTH ) / static_cast( TestApplication::DEFAULT_SURFACE_HEIGHT ); + CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + float defaultAspect = static_cast(TestApplication::DEFAULT_SURFACE_WIDTH) / static_cast(TestApplication::DEFAULT_SURFACE_HEIGHT); - DALI_TEST_EQUALS( actor.GetAspectRatio(), defaultAspect, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetAspectRatio(), defaultAspect, TEST_LOCATION); float value = 0.0f; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( defaultAspect, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(defaultAspect, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } @@ -463,7 +462,7 @@ int UtcDaliCameraActorGetAspectRatioP(void) int UtcDaliCameraActorGetAspectRatioN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Aspect Ratio (N)" ); + tet_infoline("Testing Dali::CameraActor Get Aspect Ratio (N)"); CameraActor actor; @@ -472,14 +471,14 @@ int UtcDaliCameraActorGetAspectRatioN(void) { actor.GetAspectRatio(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -487,43 +486,43 @@ int UtcDaliCameraActorGetAspectRatioN(void) int UtcDaliCameraActorSetNearClippingPlaneP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Near clipping plane (P)" ); + tet_infoline("Testing Dali::CameraActor Set Near clipping plane (P)"); CameraActor actor = CameraActor::New(); // Set a value so we are not relying on a particular default for this test case. - actor.SetNearClippingPlane( 200.0f ); - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, TEST_LOCATION ); + actor.SetNearClippingPlane(200.0f); + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, TEST_LOCATION); - actor.SetNearClippingPlane( 400.0f ); - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 400.0f, TEST_LOCATION ); + actor.SetNearClippingPlane(400.0f); + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 400.0f, TEST_LOCATION); // Check setting the property. - actor.SetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE, Property::Value( 300.0f ) ); - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 300.0f, FLOAT_EPSILON, TEST_LOCATION ); + actor.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, Property::Value(300.0f)); + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 300.0f, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetNearClippingPlaneN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Near clipping plane (N)" ); + tet_infoline("Testing Dali::CameraActor Set Near clipping plane (N)"); CameraActor actor; bool asserted = true; try { - actor.SetNearClippingPlane( 200.0f ); + actor.SetNearClippingPlane(200.0f); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -531,39 +530,39 @@ int UtcDaliCameraActorSetNearClippingPlaneN(void) int UtcDaliCameraActorGetNearClippingPlaneP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Near clipping plane (P)" ); + tet_infoline("Testing Dali::CameraActor Get Near clipping plane (P)"); // Check the default value. - CameraActor actor = CameraActor::New(); - float defaultValue = 800.0f; - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), defaultValue, TEST_LOCATION ); + CameraActor actor = CameraActor::New(); + float defaultValue = 800.0f; + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), defaultValue, TEST_LOCATION); // Check getting the property. float value; - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetNearClippingPlaneN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Near clipping plane (N)" ); + tet_infoline("Testing Dali::CameraActor Get Near clipping plane (N)"); CameraActor actor; - bool asserted = true; + bool asserted = true; try { actor.GetNearClippingPlane(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -571,43 +570,43 @@ int UtcDaliCameraActorGetNearClippingPlaneN(void) int UtcDaliCameraActorSetFarClippingPlaneP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Far clipping plane (P)" ); + tet_infoline("Testing Dali::CameraActor Set Far clipping plane (P)"); CameraActor actor = CameraActor::New(); // Set a value so we are not relying on a particular default for this test case. - actor.SetFarClippingPlane( 2000.0f ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 2000.0f, TEST_LOCATION ); + actor.SetFarClippingPlane(2000.0f); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 2000.0f, TEST_LOCATION); - actor.SetFarClippingPlane( 4000.0f ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 4000.0f, TEST_LOCATION ); + actor.SetFarClippingPlane(4000.0f); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 4000.0f, TEST_LOCATION); // Check setting the property. - actor.SetProperty( CameraActor::Property::FAR_PLANE_DISTANCE, 2000.0f ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 2000.0f, FLOAT_EPSILON, TEST_LOCATION ); + actor.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, 2000.0f); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 2000.0f, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetFarClippingPlaneN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Far clipping plane (N)" ); + tet_infoline("Testing Dali::CameraActor Set Far clipping plane (N)"); CameraActor actor; bool asserted = true; try { - actor.SetFarClippingPlane( 2000.0f ); + actor.SetFarClippingPlane(2000.0f); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -615,23 +614,23 @@ int UtcDaliCameraActorSetFarClippingPlaneN(void) int UtcDaliCameraActorGetFarClippingPlaneP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Far clipping plane (P)" ); + tet_infoline("Testing Dali::CameraActor Get Far clipping plane (P)"); - CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - float defaultValue = 800.0f + ( 0xFFFF >> 4 ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), defaultValue, TEST_LOCATION ); + CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + float defaultValue = 800.0f + (0xFFFF >> 4); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), defaultValue, TEST_LOCATION); // Check getting the property. float value; - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetFarClippingPlaneN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Far clipping plane (N)" ); + tet_infoline("Testing Dali::CameraActor Get Far clipping plane (N)"); CameraActor actor; @@ -640,14 +639,14 @@ int UtcDaliCameraActorGetFarClippingPlaneN(void) { actor.GetFarClippingPlane(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -655,45 +654,45 @@ int UtcDaliCameraActorGetFarClippingPlaneN(void) int UtcDaliCameraActorSetTargetPositionP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Target Position (P)" ); + tet_infoline("Testing Dali::CameraActor Set Target Position (P)"); CameraActor actor = CameraActor::New(); - Vector3 target1( 10.0f, 20.0f, 30.0f ); - Vector3 target2( 15.0f, 25.0f, 35.0f ); + Vector3 target1(10.0f, 20.0f, 30.0f); + Vector3 target2(15.0f, 25.0f, 35.0f); // Set a value so we are not relying on a particular default for this test case. - actor.SetTargetPosition( target1 ); - DALI_TEST_EQUALS( actor.GetTargetPosition(), target1, TEST_LOCATION ); + actor.SetTargetPosition(target1); + DALI_TEST_EQUALS(actor.GetTargetPosition(), target1, TEST_LOCATION); - actor.SetTargetPosition( target2 ); - DALI_TEST_EQUALS( actor.GetTargetPosition(), target2, TEST_LOCATION ); + actor.SetTargetPosition(target2); + DALI_TEST_EQUALS(actor.GetTargetPosition(), target2, TEST_LOCATION); // Check setting the property. - actor.SetProperty( CameraActor::Property::TARGET_POSITION, target1 ); - DALI_TEST_EQUALS( actor.GetTargetPosition(), target1, FLOAT_EPSILON, TEST_LOCATION ); + actor.SetProperty(CameraActor::Property::TARGET_POSITION, target1); + DALI_TEST_EQUALS(actor.GetTargetPosition(), target1, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetTargetPositionN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set Target Position (N)" ); + tet_infoline("Testing Dali::CameraActor Set Target Position (N)"); CameraActor actor; bool asserted = true; try { - actor.SetTargetPosition( Vector3( 10.0f, 20.0f, 30.0f ) ); + actor.SetTargetPosition(Vector3(10.0f, 20.0f, 30.0f)); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -701,23 +700,23 @@ int UtcDaliCameraActorSetTargetPositionN(void) int UtcDaliCameraActorGetTargetPositionP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Target Position (P)" ); + tet_infoline("Testing Dali::CameraActor Get Target Position (P)"); CameraActor actor = CameraActor::New(); - Vector3 defaultValue( Vector3::ZERO ); - DALI_TEST_EQUALS( actor.GetTargetPosition(), defaultValue, TEST_LOCATION ); + Vector3 defaultValue(Vector3::ZERO); + DALI_TEST_EQUALS(actor.GetTargetPosition(), defaultValue, TEST_LOCATION); // Check getting the property. Vector3 value; - actor.GetProperty( CameraActor::Property::TARGET_POSITION ).Get( value ); - DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::TARGET_POSITION).Get(value); + DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetTargetPositionN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get Target Position (N)" ); + tet_infoline("Testing Dali::CameraActor Get Target Position (N)"); CameraActor actor; @@ -726,13 +725,13 @@ int UtcDaliCameraActorGetTargetPositionN(void) { actor.GetTargetPosition(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -740,64 +739,64 @@ int UtcDaliCameraActorGetTargetPositionN(void) int UtcDaliCameraActorSetInvertYAxisP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set InvertYAxis (P)" ); + tet_infoline("Testing Dali::CameraActor Set InvertYAxis (P)"); CameraActor actor = CameraActor::New(); // Set a value so we are not relying on a particular default for this test case. - actor.SetInvertYAxis( false ); - DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION ); + actor.SetInvertYAxis(false); + DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION); - actor.SetInvertYAxis( true ); - DALI_TEST_EQUALS( actor.GetInvertYAxis(), true, TEST_LOCATION ); + actor.SetInvertYAxis(true); + DALI_TEST_EQUALS(actor.GetInvertYAxis(), true, TEST_LOCATION); - actor.SetProperty( CameraActor::Property::INVERT_Y_AXIS, false ); - DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION ); + actor.SetProperty(CameraActor::Property::INVERT_Y_AXIS, false); + DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetInvertYAxisN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Set InvertYAxis (N)" ); + tet_infoline("Testing Dali::CameraActor Set InvertYAxis (N)"); CameraActor actor; bool asserted = true; try { - actor.SetInvertYAxis( false ); + actor.SetInvertYAxis(false); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } int UtcDaliCameraActorGetInvertYAxisP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get InvertYAxis (P)" ); + tet_infoline("Testing Dali::CameraActor Get InvertYAxis (P)"); // Check the default value. CameraActor actor = CameraActor::New(); - DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION); // Check getting the property. bool bValue; - actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue ); - DALI_TEST_EQUALS( false, bValue, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue); + DALI_TEST_EQUALS(false, bValue, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetInvertYAxisN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Get InvertYAxis (N)" ); + tet_infoline("Testing Dali::CameraActor Get InvertYAxis (N)"); CameraActor actor; @@ -806,61 +805,61 @@ int UtcDaliCameraActorGetInvertYAxisN(void) { actor.GetInvertYAxis(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } int UtcDaliCameraActorSetPerspectiveProjectionP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetPerspectiveProjection (P)" ); + tet_infoline("Testing Dali::CameraActor::SetPerspectiveProjection (P)"); CameraActor actor = CameraActor::New(); - actor.SetPerspectiveProjection( Size( 100.f, 150.f ) ); + actor.SetPerspectiveProjection(Size(100.f, 150.f)); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); float value; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( 0.666666f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( 0.489957f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 150.f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 4245.f, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(0.666666f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(0.489957f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(150.f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(4245.f, value, FLOAT_EPSILON, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); // Ensure these values persist after adding to the stage and an update/render pass - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( 0.666666f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( 0.489957f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 150.f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 4245.f, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(0.666666f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(0.489957f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(150.f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(4245.f, value, FLOAT_EPSILON, TEST_LOCATION); // Call method with a ZERO size, this should reset the perspective projection using the size of the scene we've been added to - actor.SetPerspectiveProjection( Vector2::ZERO ); + actor.SetPerspectiveProjection(Vector2::ZERO); - DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); END_TEST; } @@ -868,20 +867,20 @@ int UtcDaliCameraActorSetPerspectiveProjectionP(void) int UtcDaliCameraActorSetPerspectiveProjectionN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetPerspectiveProjection (N)" ); + tet_infoline("Testing Dali::CameraActor::SetPerspectiveProjection (N)"); CameraActor actor = CameraActor::New(); // Check that setting perspective projection without a size does not do anything. - actor.SetPerspectiveProjection( Size::ZERO ); + actor.SetPerspectiveProjection(Size::ZERO); // So the default values should be the same as defined in CameraActor float nearClippingPlane = 800.0f; - float farClippingPlane = nearClippingPlane + 2.0f * nearClippingPlane; + float farClippingPlane = nearClippingPlane + 2.0f * nearClippingPlane; - DALI_TEST_EQUALS( nearClippingPlane, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( farClippingPlane, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(nearClippingPlane, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(farClippingPlane, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); END_TEST; } @@ -889,16 +888,16 @@ int UtcDaliCameraActorSetPerspectiveProjectionN(void) int UtcDaliCameraActorSetOrthographicProjectionP1(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,1)" ); + tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,1)"); - CameraActor actor = CameraActor::New( Size( 1080.0f, 1920.0f ) ); - DALI_TEST_CHECK( actor ); + CameraActor actor = CameraActor::New(Size(1080.0f, 1920.0f)); + DALI_TEST_CHECK(actor); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.SetOrthographicProjection( Size( 1080.0f, 1920.0f ) ); + actor.SetOrthographicProjection(Size(1080.0f, 1920.0f)); application.SendNotification(); - application.Render( 0 ); + application.Render(0); application.Render(); application.SendNotification(); @@ -906,106 +905,106 @@ int UtcDaliCameraActorSetOrthographicProjectionP1(void) float defaultFieldOfView; float defaultNearPlaneDistance; float defaultFarPlaneDistance; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance ); - Vector3 defaultPos = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance); + Vector3 defaultPos = actor.GetCurrentProperty(Actor::Property::POSITION); - actor.SetOrthographicProjection( Size( 1080.0f, 1920.0f ) ); + actor.SetOrthographicProjection(Size(1080.0f, 1920.0f)); application.SendNotification(); - application.Render( 0 ); + application.Render(0); application.Render(); application.SendNotification(); float value; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION); - actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -540.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 540.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 960.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -960.0f, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-540.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(540.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(960.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-960.0f, value, FLOAT_EPSILON, TEST_LOCATION); - Vector3 pos = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); - DALI_TEST_EQUALS( defaultPos.z, pos.z, 0.001f, TEST_LOCATION ); + Vector3 pos = actor.GetCurrentProperty(Actor::Property::POSITION); + DALI_TEST_EQUALS(defaultPos.z, pos.z, 0.001f, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetOrthographicProjectionN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (N)" ); + tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (N)"); CameraActor actor; - bool asserted = true; + bool asserted = true; try { actor.GetProjectionMode(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } int UtcDaliCameraActorSetOrthographicProjectionP2(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,2)" ); + tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,2)"); CameraActor actor = CameraActor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); float defaultAspectRatio; float defaultFieldOfView; float defaultNearPlaneDistance; float defaultFarPlaneDistance; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance); // Check setting with specific near and far plane distances. - actor.SetOrthographicProjection( -100.0f, 200.0f, -300.0f, 500.0f, 400.0f, 4000.0f ); + actor.SetOrthographicProjection(-100.0f, 200.0f, -300.0f, 500.0f, 400.0f, 4000.0f); float value; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 400.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 4000.0f, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION); - actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -100.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 200.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -300.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 500.0f, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION); END_TEST; } @@ -1013,131 +1012,131 @@ int UtcDaliCameraActorSetOrthographicProjectionP2(void) int UtcDaliCameraActorSetOrthographicProjectionP3(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,3)" ); + tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,3)"); CameraActor actor = CameraActor::New(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); float defaultAspectRatio; float defaultFieldOfView; float defaultNearPlaneDistance; float defaultFarPlaneDistance; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance); - actor.SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION ); + actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); - actor.SetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE, -100.0f ); - actor.SetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE, 200.0f ); - actor.SetProperty( CameraActor::Property::TOP_PLANE_DISTANCE, -300.0f ); - actor.SetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE, 500.0f ); - actor.SetNearClippingPlane( 400.0f ); - actor.SetFarClippingPlane( 4000.0f ); + actor.SetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE, -100.0f); + actor.SetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE, 200.0f); + actor.SetProperty(CameraActor::Property::TOP_PLANE_DISTANCE, -300.0f); + actor.SetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE, 500.0f); + actor.SetNearClippingPlane(400.0f); + actor.SetFarClippingPlane(4000.0f); float value; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 400.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 4000.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - - actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -100.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 200.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( -300.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( 500.0f, value, FLOAT_EPSILON, TEST_LOCATION ); - - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION); + + actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION); + + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION); std::string stringValue; - actor.GetProperty( CameraActor::Property::PROJECTION_MODE ).Get( stringValue ); - DALI_TEST_EQUALS( stringValue, "ORTHOGRAPHIC_PROJECTION", TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(stringValue); + DALI_TEST_EQUALS(stringValue, "ORTHOGRAPHIC_PROJECTION", TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetProjectionModeP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetProjectionModeP (P)" ); + tet_infoline("Testing Dali::CameraActor::SetProjectionModeP (P)"); CameraActor actor = CameraActor::New(); // Check that changing the projection mode alone does not alter other presets. - actor.SetNearClippingPlane( 200.0f ); - actor.SetFarClippingPlane( 400.0f ); + actor.SetNearClippingPlane(200.0f); + actor.SetFarClippingPlane(400.0f); - actor.SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION ); + actor.SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION); - actor.SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION ); + actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION); // Check setting the property. Property::Value setValue = "PERSPECTIVE_PROJECTION"; - actor.SetProperty( CameraActor::Property::PROJECTION_MODE, setValue ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + actor.SetProperty(CameraActor::Property::PROJECTION_MODE, setValue); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetProjectionModeN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetProjectionModeP (N)" ); + tet_infoline("Testing Dali::CameraActor::SetProjectionModeP (N)"); CameraActor actor; bool asserted = true; try { - actor.SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION ); + actor.SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } int UtcDaliCameraActorGetProjectionModeP(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::GetPerspectiveProjection (P)" ); + tet_infoline("Testing Dali::CameraActor::GetPerspectiveProjection (P)"); CameraActor actor = CameraActor::New(); - actor.SetOrthographicProjection( Size::ONE ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION ); + actor.SetOrthographicProjection(Size::ONE); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION); - actor.SetPerspectiveProjection( Size( 100.f, 150.f ) ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); + actor.SetPerspectiveProjection(Size(100.f, 150.f)); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); // Check getting the property. std::string stringValue; - actor.GetProperty( CameraActor::Property::PROJECTION_MODE ).Get( stringValue ); - DALI_TEST_EQUALS( stringValue, "PERSPECTIVE_PROJECTION", TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(stringValue); + DALI_TEST_EQUALS(stringValue, "PERSPECTIVE_PROJECTION", TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetProjectionModeN(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::GetProjectionMode (N)" ); + tet_infoline("Testing Dali::CameraActor::GetProjectionMode (N)"); CameraActor actor; @@ -1146,75 +1145,75 @@ int UtcDaliCameraActorGetProjectionModeN(void) { actor.GetProjectionMode(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } int UtcDaliCameraActorSetCameraOffScene(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetCamera()" ); + tet_infoline("Testing Dali::CameraActor::SetCamera()"); CameraActor actor = CameraActor::New(); - actor.SetType( Camera::FREE_LOOK ); - actor.SetFieldOfView( TEST_FIELD_OF_VIEW ); - actor.SetAspectRatio( TEST_ASPECT_RATIO ); - actor.SetNearClippingPlane( TEST_NEAR_PLANE_DISTANCE ); - actor.SetFarClippingPlane( TEST_FAR_PLANE_DISTANCE ); - actor.SetProjectionMode( Camera::PERSPECTIVE_PROJECTION ); + actor.SetType(Camera::FREE_LOOK); + actor.SetFieldOfView(TEST_FIELD_OF_VIEW); + actor.SetAspectRatio(TEST_ASPECT_RATIO); + actor.SetNearClippingPlane(TEST_NEAR_PLANE_DISTANCE); + actor.SetFarClippingPlane(TEST_FAR_PLANE_DISTANCE); + actor.SetProjectionMode(Camera::PERSPECTIVE_PROJECTION); - actor.SetInvertYAxis( false ); + actor.SetInvertYAxis(false); - DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION );//change to machine epsilon - DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( Camera::PERSPECTIVE_PROJECTION, actor.GetProjectionMode(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION ); + DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION); //change to machine epsilon + DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(Camera::PERSPECTIVE_PROJECTION, actor.GetProjectionMode(), TEST_LOCATION); + DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION); - float value; + float value; std::string sValue; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO).Get( value ); - DALI_TEST_EQUALS( TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW).Get( value ); - DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE).Get( value ); - DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE).Get( value ); - DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::PROJECTION_MODE).Get( sValue ); - DALI_TEST_EQUALS( "PERSPECTIVE_PROJECTION", sValue, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(sValue); + DALI_TEST_EQUALS("PERSPECTIVE_PROJECTION", sValue, TEST_LOCATION); bool bValue; - actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS).Get( bValue ); - DALI_TEST_EQUALS( false, bValue, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue); + DALI_TEST_EQUALS(false, bValue, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorSetCameraOnScene(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::SetCamera()" ); + tet_infoline("Testing Dali::CameraActor::SetCamera()"); CameraActor actor = CameraActor::New(); - application.GetScene().Add( actor ); - application.Render( 0 ); + application.GetScene().Add(actor); + application.Render(0); application.SendNotification(); - actor.SetType( Camera::LOOK_AT_TARGET ); - actor.SetFieldOfView( TEST_FIELD_OF_VIEW ); - actor.SetAspectRatio( TEST_ASPECT_RATIO ); - actor.SetNearClippingPlane( TEST_NEAR_PLANE_DISTANCE ); - actor.SetFarClippingPlane( TEST_FAR_PLANE_DISTANCE ); - actor.SetInvertYAxis( false ); + actor.SetType(Camera::LOOK_AT_TARGET); + actor.SetFieldOfView(TEST_FIELD_OF_VIEW); + actor.SetAspectRatio(TEST_ASPECT_RATIO); + actor.SetNearClippingPlane(TEST_NEAR_PLANE_DISTANCE); + actor.SetFarClippingPlane(TEST_FAR_PLANE_DISTANCE); + actor.SetInvertYAxis(false); - DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION ); + DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION); // Will need 2 frames to ensure both buffers are set to same values: application.Render(); @@ -1222,243 +1221,242 @@ int UtcDaliCameraActorSetCameraOnScene(void) application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION ); + DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION); std::string sValue; - actor.GetProperty( CameraActor::Property::TYPE ).Get( sValue ); - DALI_TEST_EQUALS( sValue, "LOOK_AT_TARGET", TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::TYPE).Get(sValue); + DALI_TEST_EQUALS(sValue, "LOOK_AT_TARGET", TEST_LOCATION); float value; - actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value ); - DALI_TEST_EQUALS( TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value ); - DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value ); - DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION ); - actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value); - DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value); + DALI_TEST_EQUALS(TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value); + DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION); + actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value); + DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION); bool bValue; - actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue ); - DALI_TEST_EQUALS( false, bValue, TEST_LOCATION ); + actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue); + DALI_TEST_EQUALS(false, bValue, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetCamera(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::GetCamera()" ); + tet_infoline("Testing Dali::CameraActor::GetCamera()"); CameraActor actor = CameraActor::New(); - actor.SetAspectRatio( TEST_ASPECT_RATIO ); + actor.SetAspectRatio(TEST_ASPECT_RATIO); - DALI_TEST_EQUALS( actor.GetAspectRatio(), TEST_ASPECT_RATIO, FLOAT_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetAspectRatio(), TEST_ASPECT_RATIO, FLOAT_EPSILON, TEST_LOCATION); - actor.SetProperty( CameraActor::Property::TYPE, "FREE_LOOK" ); - actor.SetProperty( CameraActor::Property::ASPECT_RATIO, TEST_ASPECT_RATIO ); - actor.SetProperty( CameraActor::Property::FIELD_OF_VIEW, TEST_FIELD_OF_VIEW ); - actor.SetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE, TEST_NEAR_PLANE_DISTANCE ); - actor.SetProperty( CameraActor::Property::FAR_PLANE_DISTANCE, TEST_FAR_PLANE_DISTANCE ); + actor.SetProperty(CameraActor::Property::TYPE, "FREE_LOOK"); + actor.SetProperty(CameraActor::Property::ASPECT_RATIO, TEST_ASPECT_RATIO); + actor.SetProperty(CameraActor::Property::FIELD_OF_VIEW, TEST_FIELD_OF_VIEW); + actor.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, TEST_NEAR_PLANE_DISTANCE); + actor.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, TEST_FAR_PLANE_DISTANCE); - DALI_TEST_EQUALS( Camera::FREE_LOOK, actor.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(Camera::FREE_LOOK, actor.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); + DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorDefaultProperties(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor DefaultProperties" ); + tet_infoline("Testing Dali::CameraActor DefaultProperties"); - CameraActor actor = CameraActor::New(); + CameraActor actor = CameraActor::New(); Integration::Scene stage = application.GetScene(); stage.Add(actor); - stage.GetRenderTaskList().GetTask(0).SetCameraActor( actor ); + stage.GetRenderTaskList().GetTask(0).SetCameraActor(actor); - actor.SetAspectRatio( TEST_ASPECT_RATIO ); - application.GetScene().Add( actor ); - application.Render( 0 ); + actor.SetAspectRatio(TEST_ASPECT_RATIO); + application.GetScene().Add(actor); + application.Render(0); application.SendNotification(); bool bValue; - actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue ); - DALI_TEST_EQUALS( false, bValue, TEST_LOCATION ); - - std::vector indices ; - indices.push_back( CameraActor::Property::TYPE ); - indices.push_back( CameraActor::Property::PROJECTION_MODE ); - indices.push_back( CameraActor::Property::FIELD_OF_VIEW ); - indices.push_back( CameraActor::Property::ASPECT_RATIO ); - indices.push_back( CameraActor::Property::NEAR_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::FAR_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::LEFT_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::RIGHT_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::TOP_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::BOTTOM_PLANE_DISTANCE ); - indices.push_back( CameraActor::Property::TARGET_POSITION ); - indices.push_back( CameraActor::Property::PROJECTION_MATRIX ); - indices.push_back( CameraActor::Property::VIEW_MATRIX ); - indices.push_back( CameraActor::Property::INVERT_Y_AXIS ); - - DALI_TEST_CHECK( actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) ); - - for( std::vector::iterator iter = indices.begin(); iter != indices.end(); ++iter ) - { - DALI_TEST_EQUALS( *iter, actor.GetPropertyIndex( actor.GetPropertyName( *iter ) ), TEST_LOCATION); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( *iter ) ); - - if ( ( *iter == CameraActor::Property::PROJECTION_MATRIX ) || - ( *iter == CameraActor::Property::VIEW_MATRIX ) ) + actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue); + DALI_TEST_EQUALS(false, bValue, TEST_LOCATION); + + std::vector indices; + indices.push_back(CameraActor::Property::TYPE); + indices.push_back(CameraActor::Property::PROJECTION_MODE); + indices.push_back(CameraActor::Property::FIELD_OF_VIEW); + indices.push_back(CameraActor::Property::ASPECT_RATIO); + indices.push_back(CameraActor::Property::NEAR_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::FAR_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::LEFT_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::RIGHT_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::TOP_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::BOTTOM_PLANE_DISTANCE); + indices.push_back(CameraActor::Property::TARGET_POSITION); + indices.push_back(CameraActor::Property::PROJECTION_MATRIX); + indices.push_back(CameraActor::Property::VIEW_MATRIX); + indices.push_back(CameraActor::Property::INVERT_Y_AXIS); + + DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size())); + + for(std::vector::iterator iter = indices.begin(); iter != indices.end(); ++iter) + { + DALI_TEST_EQUALS(*iter, actor.GetPropertyIndex(actor.GetPropertyName(*iter)), TEST_LOCATION); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter)); + + if((*iter == CameraActor::Property::PROJECTION_MATRIX) || + (*iter == CameraActor::Property::VIEW_MATRIX)) { - DALI_TEST_CHECK( !actor.IsPropertyWritable( *iter ) ); + DALI_TEST_CHECK(!actor.IsPropertyWritable(*iter)); } else { - DALI_TEST_CHECK( actor.IsPropertyWritable( *iter ) ); + DALI_TEST_CHECK(actor.IsPropertyWritable(*iter)); } - DALI_TEST_CHECK( actor.GetPropertyType( *iter ) == actor.GetPropertyType( *iter ) ); // just checking call succeeds + DALI_TEST_CHECK(actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter)); // just checking call succeeds } // Set/Get one of them. const float newAspect = TEST_ASPECT_RATIO * 2.0f; - actor.SetProperty( CameraActor::Property::ASPECT_RATIO, Property::Value( newAspect ) ); + actor.SetProperty(CameraActor::Property::ASPECT_RATIO, Property::Value(newAspect)); application.Render(); application.SendNotification(); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetAspectRatio(), newAspect, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetAspectRatio(), newAspect, TEST_LOCATION); END_TEST; } -template< typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8> -void TEST_CAMERA_PROPERTY( P1 camera, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION ) +template +void TEST_CAMERA_PROPERTY(P1 camera, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION) { - DALI_TEST_EQUALS( camera.GetPropertyName( enumName ), stringName, LOCATION ); - DALI_TEST_EQUALS( camera.GetPropertyIndex( stringName ), static_cast(enumName), LOCATION ); - DALI_TEST_EQUALS( camera.GetPropertyType( enumName ), type, LOCATION ); - DALI_TEST_EQUALS( camera.IsPropertyWritable( enumName ), isWriteable, LOCATION ); - DALI_TEST_EQUALS( camera.IsPropertyAnimatable( enumName ), isAnimateable, LOCATION ); - DALI_TEST_EQUALS( camera.IsPropertyAConstraintInput( enumName ), isConstraintInput, LOCATION ); + DALI_TEST_EQUALS(camera.GetPropertyName(enumName), stringName, LOCATION); + DALI_TEST_EQUALS(camera.GetPropertyIndex(stringName), static_cast(enumName), LOCATION); + DALI_TEST_EQUALS(camera.GetPropertyType(enumName), type, LOCATION); + DALI_TEST_EQUALS(camera.IsPropertyWritable(enumName), isWriteable, LOCATION); + DALI_TEST_EQUALS(camera.IsPropertyAnimatable(enumName), isAnimateable, LOCATION); + DALI_TEST_EQUALS(camera.IsPropertyAConstraintInput(enumName), isConstraintInput, LOCATION); } int UtcDaliCameraActorDefaultPropertiesInherited(void) { TestApplication application; - CameraActor actor = CameraActor::New(); + CameraActor actor = CameraActor::New(); Integration::Scene stage = application.GetScene(); stage.Add(actor); - stage.GetRenderTaskList().GetTask(0).SetCameraActor( actor ); + stage.GetRenderTaskList().GetTask(0).SetCameraActor(actor); - application.GetScene().Add( actor ); - application.Render( 0 ); + application.GetScene().Add(actor); + application.Render(0); application.SendNotification(); const PropertyDetails CAMERA_DEFAULT_PROPERTY[] = - { -// actor - { "parentOrigin", Property::VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN }, - { "parentOriginX", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X }, - { "parentOriginY", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y }, - { "parentOriginZ", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z }, - { "anchorPoint", Property::VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT }, - { "anchorPointX", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X }, - { "anchorPointY", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y }, - { "anchorPointZ", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z }, - { "size", Property::VECTOR3, true, true, true, Dali::Actor::Property::SIZE }, - { "sizeWidth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH }, - { "sizeHeight", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT }, - { "sizeDepth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH }, - { "position", Property::VECTOR3, true, true, true, Dali::Actor::Property::POSITION }, - { "positionX", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_X }, - { "positionY", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y }, - { "positionZ", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z }, - { "worldPosition", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION }, - { "worldPositionX", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X }, - { "worldPositionY", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y }, - { "worldPositionZ", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z }, - { "orientation", Property::ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION }, - { "worldOrientation", Property::ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION }, - { "scale", Property::VECTOR3, true, true, true, Dali::Actor::Property::SCALE }, - { "scaleX", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_X }, - { "scaleY", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y }, - { "scaleZ", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z }, - { "worldScale", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE }, - { "visible", Property::BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE }, - { "color", Property::VECTOR4, true, true, true, Dali::Actor::Property::COLOR }, - { "colorRed", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED }, - { "colorGreen", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN }, - { "colorBlue", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE }, - { "colorAlpha", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA }, - { "worldColor", Property::VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR }, - { "worldMatrix", Property::MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX }, - { "name", Property::STRING, true, false, false, Dali::Actor::Property::NAME }, - { "sensitive", Property::BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE }, - { "leaveRequired", Property::BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED }, - { "inheritOrientation", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION }, - { "inheritScale", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE }, - { "colorMode", Property::INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE }, - { "drawMode", Property::INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE }, - { "sizeModeFactor", Property::VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR }, - { "widthResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY }, - { "heightResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY }, - { "sizeScalePolicy", Property::INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY }, - { "widthForHeight", Property::BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT }, - { "heightForWidth", Property::BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH }, - { "padding", Property::VECTOR4, true, false, false, Dali::Actor::Property::PADDING }, - { "minimumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE }, - { "maximumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE }, - { "inheritPosition", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION }, - { "clippingMode", Property::STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE }, - { "layoutDirection", Property::STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION }, - { "inheritLayoutDirection", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION }, - { "opacity", Property::FLOAT, true, true, true, Dali::Actor::Property::OPACITY }, - { "screenPosition", Property::VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION }, - { "positionUsesAnchorPoint",Property::BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT }, - { "culled", Property::BOOLEAN, false, false, true, Dali::Actor::Property::CULLED }, - { "id", Property::INTEGER, false, false, false, Dali::Actor::Property::ID }, - { "hierarchyDepth", Property::INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH }, - { "isRoot", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT }, - { "isLayer", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER }, - { "connectedToScene", Property::BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE }, - { "keyboardFocusable", Property::BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE }, - { "siblingOrder", Property::INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER }, -// camera own - { "type", Property::STRING, true, false, true, Dali::CameraActor::Property::TYPE }, - { "projectionMode", Property::STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE }, - { "fieldOfView", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW }, - { "aspectRatio", Property::FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO }, - { "nearPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE }, - { "farPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE }, - { "leftPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE }, - { "rightPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE }, - { "topPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE }, - { "bottomPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE }, - { "targetPosition", Property::VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION }, - { "projectionMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX }, - { "viewMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX }, - { "invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS } - }; - - for( uint32_t index = 0; index < (sizeof(CAMERA_DEFAULT_PROPERTY)/sizeof(PropertyDetails)); ++index ) - { - TEST_CAMERA_PROPERTY( actor, - CAMERA_DEFAULT_PROPERTY[ index ].name, - CAMERA_DEFAULT_PROPERTY[ index ].type, - CAMERA_DEFAULT_PROPERTY[ index ].writable, - CAMERA_DEFAULT_PROPERTY[ index ].animatable, - CAMERA_DEFAULT_PROPERTY[ index ].constraintInput, - CAMERA_DEFAULT_PROPERTY[ index ].enumIndex, - TEST_LOCATION ); + { + // actor + {"parentOrigin", Property::VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN}, + {"parentOriginX", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X}, + {"parentOriginY", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y}, + {"parentOriginZ", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z}, + {"anchorPoint", Property::VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT}, + {"anchorPointX", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X}, + {"anchorPointY", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y}, + {"anchorPointZ", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z}, + {"size", Property::VECTOR3, true, true, true, Dali::Actor::Property::SIZE}, + {"sizeWidth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH}, + {"sizeHeight", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT}, + {"sizeDepth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH}, + {"position", Property::VECTOR3, true, true, true, Dali::Actor::Property::POSITION}, + {"positionX", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_X}, + {"positionY", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y}, + {"positionZ", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z}, + {"worldPosition", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION}, + {"worldPositionX", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X}, + {"worldPositionY", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y}, + {"worldPositionZ", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z}, + {"orientation", Property::ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION}, + {"worldOrientation", Property::ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION}, + {"scale", Property::VECTOR3, true, true, true, Dali::Actor::Property::SCALE}, + {"scaleX", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_X}, + {"scaleY", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y}, + {"scaleZ", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z}, + {"worldScale", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE}, + {"visible", Property::BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE}, + {"color", Property::VECTOR4, true, true, true, Dali::Actor::Property::COLOR}, + {"colorRed", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED}, + {"colorGreen", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN}, + {"colorBlue", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE}, + {"colorAlpha", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA}, + {"worldColor", Property::VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR}, + {"worldMatrix", Property::MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX}, + {"name", Property::STRING, true, false, false, Dali::Actor::Property::NAME}, + {"sensitive", Property::BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE}, + {"leaveRequired", Property::BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED}, + {"inheritOrientation", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION}, + {"inheritScale", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE}, + {"colorMode", Property::INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE}, + {"drawMode", Property::INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE}, + {"sizeModeFactor", Property::VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR}, + {"widthResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY}, + {"heightResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY}, + {"sizeScalePolicy", Property::INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY}, + {"widthForHeight", Property::BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT}, + {"heightForWidth", Property::BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH}, + {"padding", Property::VECTOR4, true, false, false, Dali::Actor::Property::PADDING}, + {"minimumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE}, + {"maximumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE}, + {"inheritPosition", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION}, + {"clippingMode", Property::STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE}, + {"layoutDirection", Property::STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION}, + {"inheritLayoutDirection", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION}, + {"opacity", Property::FLOAT, true, true, true, Dali::Actor::Property::OPACITY}, + {"screenPosition", Property::VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION}, + {"positionUsesAnchorPoint", Property::BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT}, + {"culled", Property::BOOLEAN, false, false, true, Dali::Actor::Property::CULLED}, + {"id", Property::INTEGER, false, false, false, Dali::Actor::Property::ID}, + {"hierarchyDepth", Property::INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH}, + {"isRoot", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT}, + {"isLayer", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER}, + {"connectedToScene", Property::BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE}, + {"keyboardFocusable", Property::BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE}, + {"siblingOrder", Property::INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER}, + // camera own + {"type", Property::STRING, true, false, true, Dali::CameraActor::Property::TYPE}, + {"projectionMode", Property::STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE}, + {"fieldOfView", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW}, + {"aspectRatio", Property::FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO}, + {"nearPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE}, + {"farPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE}, + {"leftPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE}, + {"rightPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE}, + {"topPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE}, + {"bottomPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE}, + {"targetPosition", Property::VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION}, + {"projectionMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX}, + {"viewMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX}, + {"invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS}}; + + for(uint32_t index = 0; index < (sizeof(CAMERA_DEFAULT_PROPERTY) / sizeof(PropertyDetails)); ++index) + { + TEST_CAMERA_PROPERTY(actor, + CAMERA_DEFAULT_PROPERTY[index].name, + CAMERA_DEFAULT_PROPERTY[index].type, + CAMERA_DEFAULT_PROPERTY[index].writable, + CAMERA_DEFAULT_PROPERTY[index].animatable, + CAMERA_DEFAULT_PROPERTY[index].constraintInput, + CAMERA_DEFAULT_PROPERTY[index].enumIndex, + TEST_LOCATION); } END_TEST; } @@ -1466,64 +1464,64 @@ int UtcDaliCameraActorDefaultPropertiesInherited(void) int UtcDaliCameraActorModelView(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor Test view application" ); + tet_infoline("Testing Dali::CameraActor Test view application"); Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::POSITION, Vector3( 20.0f, 30.0f, 40.0f )); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(20.0f, 30.0f, 40.0f)); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + application.GetScene().Add(actor); application.SendNotification(); - application.Render( 0 ); + application.Render(0); application.Render(); application.SendNotification(); - Matrix resultMatrix( true ); - resultMatrix.SetTransformComponents( Vector3::ONE, Quaternion::IDENTITY, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) ); + Matrix resultMatrix(true); + resultMatrix.SetTransformComponents(Vector3::ONE, Quaternion::IDENTITY, actor.GetCurrentProperty(Actor::Property::POSITION)); - RenderTask task = application.GetScene().GetRenderTaskList().GetTask( 0 ); + RenderTask task = application.GetScene().GetRenderTaskList().GetTask(0); CameraActor cameraActor = task.GetCameraActor(); - Matrix viewMatrix( false ); - cameraActor.GetProperty( CameraActor::Property::VIEW_MATRIX ).Get( viewMatrix ); - Matrix::Multiply( resultMatrix, resultMatrix, viewMatrix ); + Matrix viewMatrix(false); + cameraActor.GetProperty(CameraActor::Property::VIEW_MATRIX).Get(viewMatrix); + Matrix::Multiply(resultMatrix, resultMatrix, viewMatrix); - DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( "uModelView", resultMatrix ) ); + DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue("uModelView", resultMatrix)); END_TEST; } int UtcDaliCameraActorReadProjectionMatrix(void) { TestApplication application; - tet_infoline( "Testing Dali::CameraActor::ReadProjectionMatrix()" ); + tet_infoline("Testing Dali::CameraActor::ReadProjectionMatrix()"); - CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor(); + CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor(); application.SendNotification(); - application.Render( 0 ); + application.Render(0); application.Render(); application.SendNotification(); Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); - Actor actor = CreateRenderableActor( image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - application.GetScene().Add( actor ); + Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + application.GetScene().Add(actor); Matrix projectionMatrix; Matrix viewMatrix; - camera.GetProperty( CameraActor::CameraActor::Property::PROJECTION_MATRIX ).Get( projectionMatrix ); - camera.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( viewMatrix ); + camera.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix); + camera.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(viewMatrix); - actor.RegisterProperty( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); - actor.RegisterProperty( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); + actor.RegisterProperty(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY); + actor.RegisterProperty(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY); - Property::Index projectionMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME ); - Property::Index viewMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME ); + Property::Index projectionMatrixPropertyIndex = actor.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME); + Property::Index viewMatrixPropertyIndex = actor.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME); - Constraint projectionMatrixConstraint = Constraint::New( actor, projectionMatrixPropertyIndex, EqualToConstraint() ); - projectionMatrixConstraint.AddSource( Source( camera, CameraActor::Property::PROJECTION_MATRIX ) ); - Constraint viewMatrixConstraint = Constraint::New( actor, viewMatrixPropertyIndex, EqualToConstraint() ); - viewMatrixConstraint.AddSource( Source( camera, CameraActor::Property::VIEW_MATRIX ) ); + Constraint projectionMatrixConstraint = Constraint::New(actor, projectionMatrixPropertyIndex, EqualToConstraint()); + projectionMatrixConstraint.AddSource(Source(camera, CameraActor::Property::PROJECTION_MATRIX)); + Constraint viewMatrixConstraint = Constraint::New(actor, viewMatrixPropertyIndex, EqualToConstraint()); + viewMatrixConstraint.AddSource(Source(camera, CameraActor::Property::VIEW_MATRIX)); projectionMatrixConstraint.Apply(); viewMatrixConstraint.Apply(); @@ -1532,90 +1530,90 @@ int UtcDaliCameraActorReadProjectionMatrix(void) application.Render(); // Test effects of Constraint. - DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME.c_str(), projectionMatrix) ); + DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME.c_str(), projectionMatrix)); - DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME.c_str(), viewMatrix ) ); + DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME.c_str(), viewMatrix)); END_TEST; } int UtcDaliCameraActorAnimatedProperties(void) { TestApplication application; - tet_infoline( "Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()" ); + tet_infoline("Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()"); - CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor(); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - application.GetScene().Add( actor ); + CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor(); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + application.GetScene().Add(actor); - Constraint constraint = Constraint::New( actor, Actor::Property::POSITION, EqualToConstraint() ); - constraint.AddSource( Source( camera, Actor::Property::POSITION ) ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, EqualToConstraint()); + constraint.AddSource(Source(camera, Actor::Property::POSITION)); constraint.Apply(); - camera.SetProperty( Actor::Property::POSITION, Vector3( 100.0f, 200.0f, 300.0f )); + camera.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 200.0f, 300.0f)); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 200.0f, 300.0f ), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3(100.0f, 200.0f, 300.0f), TEST_LOCATION); END_TEST; } int UtcDaliCameraActorPropertyIndices(void) { TestApplication application; - CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor(); + CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor(); - Actor basicActor = Actor::New(); + Actor basicActor = Actor::New(); Property::IndexContainer indices; - camera.GetPropertyIndices( indices ); - DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() ); - DALI_TEST_EQUALS( indices.Size(), camera.GetPropertyCount(), TEST_LOCATION ); + camera.GetPropertyIndices(indices); + DALI_TEST_CHECK(indices.Size() > basicActor.GetPropertyCount()); + DALI_TEST_EQUALS(indices.Size(), camera.GetPropertyCount(), TEST_LOCATION); END_TEST; } int UtcDaliCameraActorCheckLookAtAndFreeLookViews01(void) { - TestApplication application; - Integration::Scene stage = application.GetScene(); - Vector2 stageSize = stage.GetSize(); + TestApplication application; + Integration::Scene stage = application.GetScene(); + Vector2 stageSize = stage.GetSize(); - CameraActor freeLookCameraActor = CameraActor::New( stageSize ); - freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - freeLookCameraActor.SetType( Camera::FREE_LOOK ); + CameraActor freeLookCameraActor = CameraActor::New(stageSize); + freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + freeLookCameraActor.SetType(Camera::FREE_LOOK); - Vector3 targetPosition( 30.0f, 240.0f, -256.0f ); - Actor target = Actor::New(); - target.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - target.SetProperty( Actor::Property::POSITION, targetPosition ); + Vector3 targetPosition(30.0f, 240.0f, -256.0f); + Actor target = Actor::New(); + target.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + target.SetProperty(Actor::Property::POSITION, targetPosition); - Constraint cameraOrientationConstraint = Constraint::New ( freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt ); - cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_POSITION ) ); - cameraOrientationConstraint.AddSource( Source( freeLookCameraActor, Actor::Property::WORLD_POSITION ) ); - cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_ORIENTATION ) ); + Constraint cameraOrientationConstraint = Constraint::New(freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt); + cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_POSITION)); + cameraOrientationConstraint.AddSource(Source(freeLookCameraActor, Actor::Property::WORLD_POSITION)); + cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_ORIENTATION)); cameraOrientationConstraint.Apply(); - CameraActor lookAtCameraActor = CameraActor::New( stageSize ); - lookAtCameraActor.SetType( Camera::LOOK_AT_TARGET ); - lookAtCameraActor.SetTargetPosition( targetPosition ); - lookAtCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + CameraActor lookAtCameraActor = CameraActor::New(stageSize); + lookAtCameraActor.SetType(Camera::LOOK_AT_TARGET); + lookAtCameraActor.SetTargetPosition(targetPosition); + lookAtCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - stage.Add( target ); - stage.Add( freeLookCameraActor ); - stage.Add( lookAtCameraActor ); + stage.Add(target); + stage.Add(freeLookCameraActor); + stage.Add(lookAtCameraActor); // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { - Vector3 position( x, y, z ); + Vector3 position(x, y, z); position.Normalize(); position *= 200.0f; - freeLookCameraActor.SetProperty( Actor::Property::POSITION, position ); - lookAtCameraActor.SetProperty( Actor::Property::POSITION, position ); + freeLookCameraActor.SetProperty(Actor::Property::POSITION, position); + lookAtCameraActor.SetProperty(Actor::Property::POSITION, position); application.SendNotification(); application.Render(); @@ -1623,10 +1621,10 @@ int UtcDaliCameraActorCheckLookAtAndFreeLookViews01(void) application.Render(); Matrix freeLookViewMatrix; Matrix lookAtViewMatrix; - freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix ); - lookAtCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( lookAtViewMatrix ); + freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix); + lookAtCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(lookAtViewMatrix); - DALI_TEST_EQUALS( freeLookViewMatrix, lookAtViewMatrix, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS(freeLookViewMatrix, lookAtViewMatrix, 0.01, TEST_LOCATION); } } } @@ -1635,61 +1633,61 @@ int UtcDaliCameraActorCheckLookAtAndFreeLookViews01(void) int UtcDaliCameraActorCheckLookAtAndFreeLookViews02(void) { - TestApplication application; - Integration::Scene stage = application.GetScene(); - Vector2 stageSize = stage.GetSize(); + TestApplication application; + Integration::Scene stage = application.GetScene(); + Vector2 stageSize = stage.GetSize(); - CameraActor freeLookCameraActor = CameraActor::New( stageSize ); - freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - freeLookCameraActor.SetType( Camera::FREE_LOOK ); + CameraActor freeLookCameraActor = CameraActor::New(stageSize); + freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + freeLookCameraActor.SetType(Camera::FREE_LOOK); - Vector3 targetPosition( 30.0f, 240.0f, -256.0f ); - Actor target = Actor::New(); - target.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - target.SetProperty( Actor::Property::POSITION, targetPosition ); + Vector3 targetPosition(30.0f, 240.0f, -256.0f); + Actor target = Actor::New(); + target.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + target.SetProperty(Actor::Property::POSITION, targetPosition); - Constraint cameraOrientationConstraint = Constraint::New ( freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt ); - cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_POSITION ) ); - cameraOrientationConstraint.AddSource( Source( freeLookCameraActor, Actor::Property::WORLD_POSITION ) ); - cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_ORIENTATION ) ); + Constraint cameraOrientationConstraint = Constraint::New(freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt); + cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_POSITION)); + cameraOrientationConstraint.AddSource(Source(freeLookCameraActor, Actor::Property::WORLD_POSITION)); + cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_ORIENTATION)); cameraOrientationConstraint.Apply(); - CameraActor lookAtCameraActor = CameraActor::New( stageSize ); - lookAtCameraActor.SetType( Camera::LOOK_AT_TARGET ); - lookAtCameraActor.SetTargetPosition( targetPosition ); - lookAtCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + CameraActor lookAtCameraActor = CameraActor::New(stageSize); + lookAtCameraActor.SetType(Camera::LOOK_AT_TARGET); + lookAtCameraActor.SetTargetPosition(targetPosition); + lookAtCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - stage.Add( target ); - stage.Add( freeLookCameraActor ); - stage.Add( lookAtCameraActor ); - stage.GetRenderTaskList().GetTask(0).SetCameraActor( freeLookCameraActor ); + stage.Add(target); + stage.Add(freeLookCameraActor); + stage.Add(lookAtCameraActor); + stage.GetRenderTaskList().GetTask(0).SetCameraActor(freeLookCameraActor); // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { - Vector3 position( x, y, z ); + Vector3 position(x, y, z); position.Normalize(); position *= 200.0f; - freeLookCameraActor.SetProperty( Actor::Property::POSITION, position ); - lookAtCameraActor.SetProperty( Actor::Property::POSITION, position ); + freeLookCameraActor.SetProperty(Actor::Property::POSITION, position); + lookAtCameraActor.SetProperty(Actor::Property::POSITION, position); application.SendNotification(); application.Render(); application.SendNotification(); application.Render(); Matrix freeLookViewMatrix; - freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix ); + freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix); - Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ); + Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty(Actor::Property::WORLD_MATRIX); - Matrix freeLookTest( false ); - Matrix::Multiply( freeLookTest, freeLookViewMatrix, freeLookWorld ); - DALI_TEST_EQUALS( freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION ); + Matrix freeLookTest(false); + Matrix::Multiply(freeLookTest, freeLookViewMatrix, freeLookWorld); + DALI_TEST_EQUALS(freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION); } } } @@ -1699,32 +1697,32 @@ int UtcDaliCameraActorCheckLookAtAndFreeLookViews02(void) int UtcDaliCameraActorCheckLookAtAndFreeLookViews03(void) { - TestApplication application; - Integration::Scene stage = application.GetScene(); - Vector2 stageSize = stage.GetSize(); + TestApplication application; + Integration::Scene stage = application.GetScene(); + Vector2 stageSize = stage.GetSize(); - Vector3 targetPosition( Vector3::ZERO ); - Vector3 cameraOffset( 0.0f, 0.0f, 100.0f ); + Vector3 targetPosition(Vector3::ZERO); + Vector3 cameraOffset(0.0f, 0.0f, 100.0f); - CameraActor freeLookCameraActor = CameraActor::New( stageSize ); - freeLookCameraActor.SetType( Camera::FREE_LOOK ); - freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + CameraActor freeLookCameraActor = CameraActor::New(stageSize); + freeLookCameraActor.SetType(Camera::FREE_LOOK); + freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); - Quaternion cameraOrientation( Radian( Degree( 180.0f ) ), Vector3::YAXIS ); - freeLookCameraActor.SetProperty( Actor::Property::POSITION, cameraOffset ); - freeLookCameraActor.SetProperty( Actor::Property::ORIENTATION, cameraOrientation ); + Quaternion cameraOrientation(Radian(Degree(180.0f)), Vector3::YAXIS); + freeLookCameraActor.SetProperty(Actor::Property::POSITION, cameraOffset); + freeLookCameraActor.SetProperty(Actor::Property::ORIENTATION, cameraOrientation); Actor cameraAnchor = Actor::New(); - cameraAnchor.Add( freeLookCameraActor ); - stage.Add( cameraAnchor ); - stage.GetRenderTaskList().GetTask(0).SetCameraActor( freeLookCameraActor ); + cameraAnchor.Add(freeLookCameraActor); + stage.Add(cameraAnchor); + stage.GetRenderTaskList().GetTask(0).SetCameraActor(freeLookCameraActor); - for( float angle = 1.0f; angle <= 180.0f; angle += 1.0f ) + for(float angle = 1.0f; angle <= 180.0f; angle += 1.0f) { - Quaternion rotation( Radian( Degree( angle ) ), Vector3::YAXIS ); + Quaternion rotation(Radian(Degree(angle)), Vector3::YAXIS); - freeLookCameraActor.SetProperty( Actor::Property::POSITION, rotation.Rotate( cameraOffset ) ); - cameraAnchor.SetProperty( Actor::Property::ORIENTATION, rotation ); + freeLookCameraActor.SetProperty(Actor::Property::POSITION, rotation.Rotate(cameraOffset)); + cameraAnchor.SetProperty(Actor::Property::ORIENTATION, rotation); application.SendNotification(); application.Render(); @@ -1732,13 +1730,13 @@ int UtcDaliCameraActorCheckLookAtAndFreeLookViews03(void) application.Render(); Matrix freeLookViewMatrix; - freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix ); + freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix); - Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ); + Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty(Actor::Property::WORLD_MATRIX); - Matrix freeLookTest( false ); - Matrix::Multiply( freeLookTest, freeLookViewMatrix, freeLookWorld ); - DALI_TEST_EQUALS( freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION ); + Matrix freeLookTest(false); + Matrix::Multiply(freeLookTest, freeLookViewMatrix, freeLookWorld); + DALI_TEST_EQUALS(freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION); } END_TEST; } @@ -1749,15 +1747,15 @@ int UtcDaliCameraActorReflectionByPlane(void) Integration::Scene stage = application.GetScene(); - Vector3 targetPosition( Vector3::ZERO ); - Vector3 cameraOffset( 0.0f, 100.0f, 100.0f ); + Vector3 targetPosition(Vector3::ZERO); + Vector3 cameraOffset(0.0f, 100.0f, 100.0f); CameraActor freeLookCameraActor = stage.GetRenderTaskList().GetTask(0).GetCameraActor(); freeLookCameraActor.SetType(Camera::LOOK_AT_TARGET); - freeLookCameraActor.SetTargetPosition( targetPosition ); - freeLookCameraActor.SetProperty( Actor::Property::POSITION, cameraOffset ); + freeLookCameraActor.SetTargetPosition(targetPosition); + freeLookCameraActor.SetProperty(Actor::Property::POSITION, cameraOffset); - stage.GetRootLayer().SetProperty( Actor::Property::POSITION, Vector2( 1, 0 )); + stage.GetRootLayer().SetProperty(Actor::Property::POSITION, Vector2(1, 0)); application.SendNotification(); application.Render(); @@ -1765,29 +1763,29 @@ int UtcDaliCameraActorReflectionByPlane(void) application.Render(); Matrix matrixBefore, matrixAfter; - freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( matrixBefore ); - freeLookCameraActor.SetProperty( Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4( 0.0f, 1.0f, 0.0f, 0.0f)); - stage.GetRootLayer().SetProperty( Actor::Property::POSITION, Vector2( 0, 0 )); + freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(matrixBefore); + freeLookCameraActor.SetProperty(Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4(0.0f, 1.0f, 0.0f, 0.0f)); + stage.GetRootLayer().SetProperty(Actor::Property::POSITION, Vector2(0, 0)); application.SendNotification(); application.Render(); application.SendNotification(); application.Render(); - freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( matrixAfter ); + freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(matrixAfter); - Vector3 position, scale; + Vector3 position, scale; Quaternion rotation; - matrixAfter.GetTransformComponents( position, rotation, scale ); + matrixAfter.GetTransformComponents(position, rotation, scale); - Quaternion reflected( 0, 0, 1, 0 ); + Quaternion reflected(0, 0, 1, 0); - DALI_TEST_EQUALS( reflected, rotation, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(reflected, rotation, 0.01f, TEST_LOCATION); // Test Free Look camera freeLookCameraActor.SetType(Camera::FREE_LOOK); // Make sure the recalculation will take place - freeLookCameraActor.SetProperty( Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4( 0.0f, 1.0f, 0.0f, 0.0f)); + freeLookCameraActor.SetProperty(Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4(0.0f, 1.0f, 0.0f, 0.0f)); application.SendNotification(); application.Render(); @@ -1795,15 +1793,15 @@ int UtcDaliCameraActorReflectionByPlane(void) application.Render(); // Nothing should change despite of different camera type - matrixAfter.GetTransformComponents( position, rotation, scale ); - DALI_TEST_EQUALS( reflected, rotation, 0.01f, TEST_LOCATION ); + matrixAfter.GetTransformComponents(position, rotation, scale); + DALI_TEST_EQUALS(reflected, rotation, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliCameraActorGetAspectRatioNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1819,7 +1817,7 @@ int UtcDaliCameraActorGetAspectRatioNegative(void) int UtcDaliCameraActorGetFieldOfViewNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1835,7 +1833,7 @@ int UtcDaliCameraActorGetFieldOfViewNegative(void) int UtcDaliCameraActorGetInvertYAxisNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1851,7 +1849,7 @@ int UtcDaliCameraActorGetInvertYAxisNegative(void) int UtcDaliCameraActorSetAspectRatioNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1868,7 +1866,7 @@ int UtcDaliCameraActorSetAspectRatioNegative(void) int UtcDaliCameraActorSetFieldOfViewNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1885,7 +1883,7 @@ int UtcDaliCameraActorSetFieldOfViewNegative(void) int UtcDaliCameraActorSetInvertYAxisNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1902,7 +1900,7 @@ int UtcDaliCameraActorSetInvertYAxisNegative(void) int UtcDaliCameraActorSetProjectionModeNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1919,7 +1917,7 @@ int UtcDaliCameraActorSetProjectionModeNegative(void) int UtcDaliCameraActorSetTargetPositionNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1936,7 +1934,7 @@ int UtcDaliCameraActorSetTargetPositionNegative(void) int UtcDaliCameraActorGetFarClippingPlaneNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1952,7 +1950,7 @@ int UtcDaliCameraActorGetFarClippingPlaneNegative(void) int UtcDaliCameraActorSetFarClippingPlaneNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1969,7 +1967,7 @@ int UtcDaliCameraActorSetFarClippingPlaneNegative(void) int UtcDaliCameraActorGetNearClippingPlaneNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -1985,7 +1983,7 @@ int UtcDaliCameraActorGetNearClippingPlaneNegative(void) int UtcDaliCameraActorSetNearClippingPlaneNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2002,7 +2000,7 @@ int UtcDaliCameraActorSetNearClippingPlaneNegative(void) int UtcDaliCameraActorSetPerspectiveProjectionNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2019,7 +2017,7 @@ int UtcDaliCameraActorSetPerspectiveProjectionNegative(void) int UtcDaliCameraActorSetOrthographicProjectionNegative01(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2029,7 +2027,7 @@ int UtcDaliCameraActorSetOrthographicProjectionNegative01(void) float arg4(0.0f); float arg5(0.0f); float arg6(0.0f); - instance.SetOrthographicProjection(arg1,arg2,arg3,arg4,arg5,arg6); + instance.SetOrthographicProjection(arg1, arg2, arg3, arg4, arg5, arg6); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -2041,7 +2039,7 @@ int UtcDaliCameraActorSetOrthographicProjectionNegative01(void) int UtcDaliCameraActorSetOrthographicProjectionNegative02(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2058,7 +2056,7 @@ int UtcDaliCameraActorSetOrthographicProjectionNegative02(void) int UtcDaliCameraActorSetTypeNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2075,7 +2073,7 @@ int UtcDaliCameraActorSetTypeNegative(void) int UtcDaliCameraActorGetProjectionModeNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2091,7 +2089,7 @@ int UtcDaliCameraActorGetProjectionModeNegative(void) int UtcDaliCameraActorGetTargetPositionNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { @@ -2107,7 +2105,7 @@ int UtcDaliCameraActorGetTargetPositionNegative(void) int UtcDaliCameraActorGetTypeNegative(void) { - TestApplication application; + TestApplication application; Dali::CameraActor instance; try { diff --git a/automated-tests/src/dali/utc-Dali-CircularQueue.cpp b/automated-tests/src/dali/utc-Dali-CircularQueue.cpp index afebd05..3bf2a26 100644 --- a/automated-tests/src/dali/utc-Dali-CircularQueue.cpp +++ b/automated-tests/src/dali/utc-Dali-CircularQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,12 @@ #define ENABLE_VECTOR_ASSERTS -#include -#include -#include -#include #include +#include +#include +#include + +#include using namespace Dali; @@ -35,50 +36,48 @@ void utc_dali_circular_queue_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliCircularQueueNew(void) { - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); END_TEST; } - int UtcDaliCircularQueuePushBack01(void) { - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); - cQ.PushBack( 1 ); - DALI_TEST_EQUALS( cQ.Count(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + cQ.PushBack(1); + DALI_TEST_EQUALS(cQ.Count(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); - DALI_TEST_EQUALS( cQ[0], 1, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ[0], 1, TEST_LOCATION); - cQ.PushBack( 2 ); - DALI_TEST_EQUALS( cQ.Count(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + cQ.PushBack(2); + DALI_TEST_EQUALS(cQ.Count(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); - DALI_TEST_EQUALS( cQ[0], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ[1], 2, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ[0], 1, TEST_LOCATION); + DALI_TEST_EQUALS(cQ[1], 2, TEST_LOCATION); END_TEST; } int UtcDaliCircularQueuePushBack02(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<20; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } END_TEST; @@ -86,102 +85,99 @@ int UtcDaliCircularQueuePushBack02(void) int UtcDaliCircularQueuePushBack03(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<19; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 19; ++i) { - cQ.PushBack( i ); + cQ.PushBack(i); } cQ.PushBack(19); - DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION); - for( int i=0; i<10; ++i ) + for(int i = 0; i < 10; ++i) { - tet_infoline( "Test that the end marker wraps around"); + tet_infoline("Test that the end marker wraps around"); (void)cQ.PopFront(); - cQ.PushBack(20+i); - DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ[0], 1+i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ[19], 20+i, TEST_LOCATION ); + cQ.PushBack(20 + i); + DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION); + DALI_TEST_EQUALS(cQ[0], 1 + i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ[19], 20 + i, TEST_LOCATION); } END_TEST; } - int UtcDaliCircularQueuePushBack04(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<10; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 10; ++i) { - cQ.PushBack( i ); + cQ.PushBack(i); int v = cQ.PopFront(); - DALI_TEST_EQUALS( v, i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(v, i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); } - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); // Queue is empty cQ.PushBack(10); - DALI_TEST_EQUALS( cQ[0], 10, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Count(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ[0], 10, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Count(), 1, TEST_LOCATION); (void)cQ.PopFront(); - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); // Queue is empty, markers should be in middle - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); + cQ.PushBack(i); int v = cQ.PopFront(); - DALI_TEST_EQUALS( v, i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(v, i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); } END_TEST; } - int UtcDaliCircularQueuePushBackN(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<20; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } try { - cQ.PushBack( 20 ); - DALI_TEST_EQUALS( 0, 1, TEST_LOCATION );// Failure + cQ.PushBack(20); + DALI_TEST_EQUALS(0, 1, TEST_LOCATION); // Failure } - catch( DaliException e ) + catch(DaliException e) { - DALI_TEST_EQUALS( 1, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(1, 1, TEST_LOCATION); } END_TEST; } - int UtcDaliCircularQueueOperatorIndex01(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<20; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - DALI_TEST_EQUALS( cQ[i], i, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ[i], i, TEST_LOCATION); } END_TEST; @@ -189,14 +185,14 @@ int UtcDaliCircularQueueOperatorIndex01(void) int UtcDaliCircularQueueOperatorIndexN01(void) { - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); try { int v = cQ[0]; DALI_TEST_EQUALS(v, 1, TEST_LOCATION); } - catch( DaliException e ) + catch(DaliException e) { DALI_TEST_CHECK(true); } @@ -204,88 +200,85 @@ int UtcDaliCircularQueueOperatorIndexN01(void) END_TEST; } - int UtcDaliCircularQueuePopFront01(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<20; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { int v = cQ.PopFront(); - DALI_TEST_EQUALS( cQ.Count(), 19-i, TEST_LOCATION ); - DALI_TEST_EQUALS( v, i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), i<19?false:true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.Count(), 19 - i, TEST_LOCATION); + DALI_TEST_EQUALS(v, i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), i < 19 ? false : true, TEST_LOCATION); } END_TEST; } int UtcDaliCircularQueuePopFront02(void) { - CircularQueue cQ = CircularQueue( 20 ); - for( int i=0; i<10; ++i) + CircularQueue cQ = CircularQueue(20); + for(int i = 0; i < 10; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ[i], i, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ[i], i, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION); } - for( int i=0; i<10; ++i) + for(int i = 0; i < 10; ++i) { - DALI_TEST_EQUALS( cQ.PopFront(), i, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.PopFront(), i, TEST_LOCATION); } - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliCircularQueuePopFrontN01(void) { tet_infoline("Try popping from an empty queue"); - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); try { (void)cQ.PopFront(); - DALI_TEST_CHECK( false ); + DALI_TEST_CHECK(false); } - catch( DaliException e ) + catch(DaliException e) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; } - int UtcDaliCircularQueuePopFrontN02(void) { tet_infoline("Try popping from an empty queue"); - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); - for( int i=0; i<10; ++i) + for(int i = 0; i < 10; ++i) { - cQ.PushBack( i ); + cQ.PushBack(i); (void)cQ.PopFront(); } - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); try { (void)cQ.PopFront(); - DALI_TEST_CHECK( false ); + DALI_TEST_CHECK(false); } - catch( DaliException e ) + catch(DaliException e) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -293,13 +286,13 @@ int UtcDaliCircularQueuePopFrontN02(void) int UtcDaliCircularQueueCount(void) { - CircularQueue cQ = CircularQueue( 20 ); - DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION ); + CircularQueue cQ = CircularQueue(20); + DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION); } END_TEST; @@ -307,199 +300,196 @@ int UtcDaliCircularQueueCount(void) int UtcDaliCircularQueueIsEmpty(void) { - CircularQueue cQ = CircularQueue( 20 ); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + CircularQueue cQ = CircularQueue(20); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } // Pop off 19 elements - for( int i=0; i<19; ++i) + for(int i = 0; i < 19; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } // pop off last element - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); - tet_infoline( "Add half into queue, then remove"); + tet_infoline("Add half into queue, then remove"); - for( int i=0; i<10; ++i) + for(int i = 0; i < 10; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } - for( int i=0; i<9; ++i) + for(int i = 0; i < 9; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); tet_infoline("Markers should now be in the middle of the data structure. Try adding 20 again"); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } - for( int i=0; i<19; ++i) + for(int i = 0; i < 19; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); } - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); END_TEST; } - int UtcDaliCircularQueueIsFull(void) { - CircularQueue cQ = CircularQueue( 20 ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + CircularQueue cQ = CircularQueue(20); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } - DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); } - tet_infoline( "Add half into queue, then remove"); + tet_infoline("Add half into queue, then remove"); - for( int i=0; i<10; ++i) + for(int i = 0; i < 10; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); } - for( int i=0; i<10; ++i) + for(int i = 0; i < 10; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); } tet_infoline("Markers should now be in the middle of the data structure. Try adding 20 again"); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION); } - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); } END_TEST; } - int UtcDaliCircularQueueFront(void) { - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Front(), 0, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Front(), 0, TEST_LOCATION); } - for( int i=0; i<19; ++i) + for(int i = 0; i < 19; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.Front(), i+1, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.Front(), i + 1, TEST_LOCATION); } END_TEST; } int UtcDaliCircularQueueBack(void) { - CircularQueue cQ = CircularQueue( 20 ); + CircularQueue cQ = CircularQueue(20); - for( int i=0; i<20; ++i) + for(int i = 0; i < 20; ++i) { - cQ.PushBack( i ); - DALI_TEST_EQUALS( cQ.Back(), i, TEST_LOCATION ); + cQ.PushBack(i); + DALI_TEST_EQUALS(cQ.Back(), i, TEST_LOCATION); } - for( int i=0; i<19; ++i) + for(int i = 0; i < 19; ++i) { - (void) cQ.PopFront(); - DALI_TEST_EQUALS( cQ.Back(), 19, TEST_LOCATION ); + (void)cQ.PopFront(); + DALI_TEST_EQUALS(cQ.Back(), 19, TEST_LOCATION); } END_TEST; } int UtcDaliCircularQueueSize1(void) { - CircularQueue cQ = CircularQueue( 1 ); + CircularQueue cQ = CircularQueue(1); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); - cQ.PushBack( 5 ); - DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Front(), 5, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.Back(), 5, TEST_LOCATION ); + cQ.PushBack(5); + DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Front(), 5, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.Back(), 5, TEST_LOCATION); - DALI_TEST_EQUALS( cQ.PopFront(), 5, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(cQ.PopFront(), 5, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION); + DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION); END_TEST; } +// pushback +// . => [O] +// se se - // pushback - // . => [O] - // se se - - // [O] => [O] [O] - // se s e +// [O] => [O] [O] +// se s e - // [O] [O] [O] [O] [O] [ ] => [O] [O] [O] [O] [O] [O] - // s e s e +// [O] [O] [O] [O] [O] [ ] => [O] [O] [O] [O] [O] [O] +// s e s e - // [ ] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [O] - // s e e s +// [ ] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [O] +// s e e s - // [ ] [ ] [O] [ ] [ ] [ ] => [ ] [ ] [O] [O] [ ] [ ] - // se s e +// [ ] [ ] [O] [ ] [ ] [ ] => [ ] [ ] [O] [O] [ ] [ ] +// se s e - // [ ] [ ] [ ] [ ] [ ] [O] => [O] [ ] [ ] [ ] [ ] [O] - // se e s +// [ ] [ ] [ ] [ ] [ ] [O] => [O] [ ] [ ] [ ] [ ] [O] +// se e s - // [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [O] [ ] [ ] [ ] - // se se +// [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [O] [ ] [ ] [ ] +// se se - // [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [0] - // se se - // popfront - // [O] [O] [O] [O] [O] [O] => [ ] [O] [O] [O] [O] [O] - // s e s e +// [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [0] +// se se +// popfront +// [O] [O] [O] [O] [O] [O] => [ ] [O] [O] [O] [O] [O] +// s e s e - // [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [ ] [O] - // e s e s +// [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [ ] [O] +// e s e s - // [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [ ] - // e s s e +// [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [ ] +// e s s e - // [ ] [ ] [O] [O] [ ] [ ] => [ ] [ ] [ ] [O] [ ] [ ] - // s e se +// [ ] [ ] [O] [O] [ ] [ ] => [ ] [ ] [ ] [O] [ ] [ ] +// s e se - // [ ] [ ] [ ] [O] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [ ] - // se se +// [ ] [ ] [ ] [O] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [ ] +// se se diff --git a/automated-tests/src/dali/utc-Dali-ConditionalWait.cpp b/automated-tests/src/dali/utc-Dali-ConditionalWait.cpp index 3ab2f36..71fe305 100644 --- a/automated-tests/src/dali/utc-Dali-ConditionalWait.cpp +++ b/automated-tests/src/dali/utc-Dali-ConditionalWait.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,22 +15,28 @@ * */ -#include -#include -#include -#include #include #include #include +#include +#include + +#include +#include using Dali::ConditionalWait; using Dali::Thread; namespace // for local variables to avoid name clashes { -volatile int gGlobalValue = 0; +volatile int gGlobalValue = 0; volatile bool gWorkerThreadWait = true; -enum ThreadState { INIT, RUN, TERMINATE } volatile gWorkerThreadState = INIT; +enum ThreadState +{ + INIT, + RUN, + TERMINATE +} volatile gWorkerThreadState = INIT; ConditionalWait* volatile gConditionalWait; // volatile pointer to a ConditionalWait object class WorkerThreadNotify : public Thread @@ -38,12 +44,12 @@ class WorkerThreadNotify : public Thread virtual void Run() { gGlobalValue = -1; - while( gWorkerThreadWait ) // wait till we can exit + while(gWorkerThreadWait) // wait till we can exit { gWorkerThreadState = RUN; - usleep( 1 ); // 1 microseconds + usleep(1); // 1 microseconds } - usleep( 200 ); // give other thread time to get to Wait + usleep(200); // give other thread time to get to Wait gGlobalValue = 1; gConditionalWait->Notify(); gWorkerThreadState = TERMINATE; @@ -55,10 +61,10 @@ class WorkerThreadNotifyN : public Thread { virtual void Run() { - while( gNotifyCount > 0 ) + while(gNotifyCount > 0) { gConditionalWait->Notify(); - usleep( 10 ); // 10 microseconds between each notify + usleep(10); // 10 microseconds between each notify } } }; @@ -71,7 +77,7 @@ class WorkerThreadWaitN : public Thread } }; -} +} // namespace int UtcConditionalWait1P(void) { @@ -79,27 +85,27 @@ int UtcConditionalWait1P(void) WorkerThreadNotify thread1; // initialize values - gConditionalWait = new ConditionalWait(); + gConditionalWait = new ConditionalWait(); gWorkerThreadWait = true; - DALI_TEST_EQUALS( INIT, gWorkerThreadState, TEST_LOCATION ); - DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION ); + DALI_TEST_EQUALS(INIT, gWorkerThreadState, TEST_LOCATION); + DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION); thread1.Start(); // wait till the thread is in run state - while( RUN != gWorkerThreadState ) + while(RUN != gWorkerThreadState) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } // let worker continue and finish gWorkerThreadWait = false; gConditionalWait->Wait(); - DALI_TEST_EQUALS( 1, gGlobalValue, TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, gGlobalValue, TEST_LOCATION); + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); // wait till the thread is terminated state - while( TERMINATE != gWorkerThreadState ) + while(TERMINATE != gWorkerThreadState) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } thread1.Join(); @@ -113,33 +119,32 @@ int UtcConditionalWait2P(void) tet_infoline("Testing ConditionalWait - scenario: notify without wait"); ConditionalWait wait; - DALI_TEST_EQUALS( 0u, wait.GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, wait.GetWaitCount(), TEST_LOCATION); wait.Notify(); - DALI_TEST_EQUALS( 0u, wait.GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, wait.GetWaitCount(), TEST_LOCATION); END_TEST; } - int UtcConditionalWait3P(void) { tet_infoline("Testing ConditionalWait - scenario: wait - notify N times 2 threads"); // initialize values gConditionalWait = new ConditionalWait(); - gNotifyCount = 100; + gNotifyCount = 100; WorkerThreadNotifyN thread1; thread1.Start(); - while( gNotifyCount > 0 ) + while(gNotifyCount > 0) { gConditionalWait->Wait(); --gNotifyCount; - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); - usleep( 10 ); // 10 microseconds between each notify + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); + usleep(10); // 10 microseconds between each notify } - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); thread1.Join(); @@ -153,7 +158,7 @@ int UtcConditionalWait4P(void) // initialize values gConditionalWait = new ConditionalWait(); - gNotifyCount = 100; + gNotifyCount = 100; WorkerThreadNotifyN thread1; thread1.Start(); @@ -162,12 +167,12 @@ int UtcConditionalWait4P(void) WorkerThreadNotifyN thread3; thread3.Start(); - while( gNotifyCount > 0 ) + while(gNotifyCount > 0) { gConditionalWait->Wait(); --gNotifyCount; - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); - usleep( 10 ); // 10 microseconds between each notify + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); + usleep(10); // 10 microseconds between each notify } thread1.Join(); @@ -194,8 +199,9 @@ int UtcConditionalWait5P(void) WorkerThreadWaitN thread4; thread4.Start(); // wait till all child threads are waiting - while( gConditionalWait->GetWaitCount() < 4 ) - { } + while(gConditionalWait->GetWaitCount() < 4) + { + } // notify once, it will resume all threads gConditionalWait->Notify(); @@ -205,7 +211,7 @@ int UtcConditionalWait5P(void) thread3.Join(); thread4.Join(); - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); delete gConditionalWait; END_TEST; @@ -227,13 +233,14 @@ int UtcConditionalWait6P(void) WorkerThreadWaitN thread4; thread4.Start(); // wait till all child threads are waiting - while( gConditionalWait->GetWaitCount() < 4 ) - { } + while(gConditionalWait->GetWaitCount() < 4) + { + } // notify once but with a scoped lock, it will resume all threads { - ConditionalWait::ScopedLock lock( *gConditionalWait ); - gConditionalWait->Notify( lock ); + ConditionalWait::ScopedLock lock(*gConditionalWait); + gConditionalWait->Notify(lock); } thread1.Join(); @@ -241,7 +248,7 @@ int UtcConditionalWait6P(void) thread3.Join(); thread4.Join(); - DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION); delete gConditionalWait; END_TEST; @@ -251,10 +258,8 @@ int UtcConditionalWaitNonCopyable(void) { // we want to make sure that ConditionalWait is not copyable (its copy constructor is not defined) // this test will stop compiling if ConditionalWait has compiler generated copy constructor - static_assert( !__has_trivial_copy( ConditionalWait ), "ConditionalWait should NOT be copyable" ); + static_assert(!__has_trivial_copy(ConditionalWait), "ConditionalWait should NOT be copyable"); - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } - - diff --git a/automated-tests/src/dali/utc-Dali-ConnectionTracker.cpp b/automated-tests/src/dali/utc-Dali-ConnectionTracker.cpp index 00c28fd..56ed1cc 100644 --- a/automated-tests/src/dali/utc-Dali-ConnectionTracker.cpp +++ b/automated-tests/src/dali/utc-Dali-ConnectionTracker.cpp @@ -16,15 +16,15 @@ */ // EXTERNAL INCLUDES -#include #include +#include + // INTERNAL INCLUDES -#include #include +#include #include - using namespace Dali; void utc_dali_conenction_tracker_startup(void) @@ -37,11 +37,9 @@ void utc_dali_conenction_tracker_cleanup(void) test_return_value = TET_PASS; } -namespace { - - -} // anon namespace - +namespace +{ +} // namespace /******************************************* * @@ -57,7 +55,7 @@ int UtcConnectionTrackerConstructorP(void) ConnectionTracker tracker; - DALI_TEST_CHECK( tracker.GetConnectionCount() == 0 ); + DALI_TEST_CHECK(tracker.GetConnectionCount() == 0); END_TEST; } @@ -70,12 +68,12 @@ int UtcConnectionTrackerDestructorP(void) TestButton* button = new TestButton(1); { TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); - DALI_TEST_CHECK( testApp.GetConnectionCount() == 1 ); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( )== 1 ); + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); + DALI_TEST_CHECK(testApp.GetConnectionCount() == 1); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); } // testApp out of scope it should have been disconnected - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); delete button; @@ -87,14 +85,14 @@ int UtcConnectionTrackerDisconnectAllP(void) TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); + TestApp testApp; + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); testApp.DisconnectAll(); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); delete button; @@ -104,12 +102,12 @@ int UtcConnectionTrackerDisconnectAllP(void) int UtcConnectionTrackerDisconnectAllN(void) { TestApplication application; // Create core for debug logging - TestApp testApp; - TestButton* button = new TestButton(1); + TestApp testApp; + TestButton* button = new TestButton(1); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); testApp.DisconnectAll(); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); delete button; @@ -121,32 +119,31 @@ int UtcConnectionTrackerSignalConnectedP(void) TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); + TestApp testApp; + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); delete button; END_TEST; - } int UtcConnectionTrackerSignalConnectedN(void) { TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp* testApp( NULL ); + TestApp* testApp(NULL); try { // connect to a null connection tracker - button->DownSignal().Connect( testApp, &TestApp::OnButtonPress); + button->DownSignal().Connect(testApp, &TestApp::OnButtonPress); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { // Tests that a negative test of an assertion succeeds - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_PASS); } @@ -155,44 +152,42 @@ int UtcConnectionTrackerSignalConnectedN(void) END_TEST; } - int UtcConnectionTrackerSignalDisconnectP(void) { TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); + TestApp testApp; + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); - button->DownSignal().Disconnect(&testApp,&TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + button->DownSignal().Disconnect(&testApp, &TestApp::OnButtonPress); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); delete button; END_TEST; } - int UtcConnectionTrackerSignalDisconnectN(void) { TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); + TestApp testApp; + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); try { - application.SignalDisconnected( NULL, NULL ); - tet_result( TET_FAIL ); + application.SignalDisconnected(NULL, NULL); + tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } delete button; @@ -200,15 +195,14 @@ int UtcConnectionTrackerSignalDisconnectN(void) END_TEST; } - int UtcConnectionTrackerGetConnectionCountP(void) { TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - TestApp testApp; - button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 ); + TestApp testApp; + button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1); delete button; @@ -220,7 +214,7 @@ int UtcConnectionTrackerGetConnectionCountN(void) TestApplication application; // Create core for debug logging TestButton* button = new TestButton(1); - DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 ); + DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0); delete button; diff --git a/automated-tests/src/dali/utc-Dali-Constrainer.cpp b/automated-tests/src/dali/utc-Dali-Constrainer.cpp index 8390e6f..63c4ee8 100644 --- a/automated-tests/src/dali/utc-Dali-Constrainer.cpp +++ b/automated-tests/src/dali/utc-Dali-Constrainer.cpp @@ -15,64 +15,63 @@ * */ -#include - -#include -#include -#include #include +#include +#include +#include + +#include using namespace Dali; using namespace Dali::Internal; namespace { - -static void SetupPath( Dali::Path& path) +static void SetupPath(Dali::Path& path) { - path.AddPoint(Vector3( 30.0, 80.0, 0.0)); - path.AddPoint(Vector3( 70.0, 120.0, 0.0)); + path.AddPoint(Vector3(30.0, 80.0, 0.0)); + path.AddPoint(Vector3(70.0, 120.0, 0.0)); path.AddPoint(Vector3(100.0, 100.0, 0.0)); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0) ); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0) ); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); } -static void SetupPathConstrainer( Dali::PathConstrainer& PathConstrainer) +static void SetupPathConstrainer(Dali::PathConstrainer& PathConstrainer) { - PathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f,0.0f,0.0f) ); + PathConstrainer.SetProperty(Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f, 0.0f, 0.0f)); Dali::Property::Array points; points.Resize(3); - points[0] = Vector3( 30.0, 80.0, 0.0); - points[1] = Vector3( 70.0, 120.0, 0.0); + points[0] = Vector3(30.0, 80.0, 0.0); + points[1] = Vector3(70.0, 120.0, 0.0); points[2] = Vector3(100.0, 100.0, 0.0); - PathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points ); + PathConstrainer.SetProperty(Dali::PathConstrainer::Property::POINTS, points); points.Resize(4); - points[0] = Vector3( 39.0, 90.0, 0.0); - points[1] = Vector3( 56.0, 119.0, 0.0); - points[2] = Vector3( 78.0, 120.0, 0.0); - points[3] = Vector3( 93.0, 104.0, 0.0); - PathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points ); + points[0] = Vector3(39.0, 90.0, 0.0); + points[1] = Vector3(56.0, 119.0, 0.0); + points[2] = Vector3(78.0, 120.0, 0.0); + points[3] = Vector3(93.0, 104.0, 0.0); + PathConstrainer.SetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS, points); } -static void SetupLinearConstrainerUniformProgress( Dali::LinearConstrainer& linearConstrainer) +static void SetupLinearConstrainerUniformProgress(Dali::LinearConstrainer& linearConstrainer) { Dali::Property::Array points; points.Resize(3); points[0] = 0.0f; points[1] = 1.0f; points[2] = 0.0f; - linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points ); + linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points); } -static void VerifyLinearConstrainerUniformProgress( Dali::LinearConstrainer& linearConstrainer ) +static void VerifyLinearConstrainerUniformProgress(Dali::LinearConstrainer& linearConstrainer) { Dali::Property::Array points; points.Resize(3); @@ -80,30 +79,30 @@ static void VerifyLinearConstrainerUniformProgress( Dali::LinearConstrainer& lin points[1] = 1.0f; points[2] = 0.0f; - Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE ); + Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::VALUE); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } -static void SetupLinearConstrainerNonUniformProgress( Dali::LinearConstrainer& linearConstrainer) +static void SetupLinearConstrainerNonUniformProgress(Dali::LinearConstrainer& linearConstrainer) { Dali::Property::Array points; points.Resize(3); points[0] = 0.0f; points[1] = 1.0f; points[2] = 0.0f; - linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points ); + linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points); points[0] = 0.0f; points[1] = 0.25f; points[2] = 1.0f; - linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points ); + linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points); } } // anonymous namespace @@ -116,7 +115,7 @@ int UtcPathConstrainerApply(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); @@ -126,48 +125,48 @@ int UtcPathConstrainerApply(void) //Create a PathConstrainer Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); - SetupPathConstrainer( pathConstrainer ); + SetupPathConstrainer(pathConstrainer); //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range); //Create an animation to animate the custom property - float durationSeconds(1.0f); + float durationSeconds(1.0f); Dali::Animation animation = Dali::Animation::New(durationSeconds); - animation.AnimateTo(Dali::Property(actor,index),1.0f); + animation.AnimateTo(Dali::Property(actor, index), 1.0f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds * 200.0f) /* 20% progress */); Vector3 position, tangent; - path.Sample(0.2f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + path.Sample(0.2f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); - path.Sample(0.4f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 40% progress */); + path.Sample(0.4f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); - path.Sample(0.6f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 60% progress */); + path.Sample(0.6f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); - path.Sample(0.8f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 80% progress */); + path.Sample(0.8f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 100% progress */); - path.Sample(1.0f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* 100% progress */); + path.Sample(1.0f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* beyond the animation duration*/); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 200.0f) /* beyond the animation duration*/); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); END_TEST; } @@ -179,7 +178,7 @@ int UtcPathConstrainerApplyRange(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); //Create a Path @@ -188,64 +187,62 @@ int UtcPathConstrainerApplyRange(void) //Create a PathConstrainer Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); - SetupPathConstrainer( pathConstrainer ); + SetupPathConstrainer(pathConstrainer); //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 100.0f, 300.0f ); - pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range ); - + Vector2 range(100.0f, 300.0f); + pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range); //Create an animation to animate the custom property - float durationSeconds(1.0f); + float durationSeconds(1.0f); Dali::Animation animation = Dali::Animation::New(durationSeconds); - animation.AnimateTo(Dali::Property(actor,index),400.0f); + animation.AnimateTo(Dali::Property(actor, index), 400.0f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); - + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); Vector3 position, tangent; - float tValue; - actor.GetCurrentProperty( index ).Get(tValue); - float currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + float tValue; + actor.GetCurrentProperty(index).Get(tValue); + float currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - actor.GetCurrentProperty( index ).Get(tValue); - currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - path.Sample(0.5, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); + actor.GetCurrentProperty(index).Get(tValue); + currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + path.Sample(0.5, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - actor.GetCurrentProperty( index ).Get( tValue ); - currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); + actor.GetCurrentProperty(index).Get(tValue); + currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 100% progress */); - actor.GetCurrentProperty( index ).Get( tValue ); - currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% progress */); + actor.GetCurrentProperty(index).Get(tValue); + currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* beyond the animation duration*/); - actor.GetCurrentProperty( index ).Get( tValue ); - currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* beyond the animation duration*/); + actor.GetCurrentProperty(index).Get(tValue); + currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); // Ensure GetProperty also returns the final result - actor.GetProperty( index ).Get( tValue ); - currentCursor = ( tValue - range.x ) / (range.y-range.x); - path.Sample(currentCursor, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + actor.GetProperty(index).Get(tValue); + currentCursor = (tValue - range.x) / (range.y - range.x); + path.Sample(currentCursor, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); END_TEST; } @@ -257,7 +254,7 @@ int UtcPathConstrainerDestroy(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); { @@ -267,29 +264,28 @@ int UtcPathConstrainerDestroy(void) //Create a PathConstrainer Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); - SetupPathConstrainer( pathConstrainer ); + SetupPathConstrainer(pathConstrainer); //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range); //Test that the constraint is correctly applied - actor.SetProperty(index,0.5f); + actor.SetProperty(index, 0.5f); application.SendNotification(); application.Render(static_cast(1.0f)); Vector3 position, tangent; - path.Sample(0.5f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); - + path.Sample(0.5f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); } //PathConstrainer has been destroyed. Constraint in the actor should have been removed - actor.SetProperty(index,0.75f); + actor.SetProperty(index, 0.75f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); END_TEST; } @@ -301,7 +297,7 @@ int UtcPathConstrainerRemove(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); //Create a Path @@ -310,100 +306,100 @@ int UtcPathConstrainerRemove(void) //Create a PathConstrainer Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); - SetupPathConstrainer( pathConstrainer ); + SetupPathConstrainer(pathConstrainer); //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range); //Test that the constraint is correctly applied - actor.SetProperty(index,0.5f); + actor.SetProperty(index, 0.5f); application.SendNotification(); application.Render(static_cast(1.0f)); Vector3 position, tangent; - path.Sample(0.5f, position, tangent ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION ); + path.Sample(0.5f, position, tangent); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), position, TEST_LOCATION); //Remove constraint - pathConstrainer.Remove( actor ); - actor.SetProperty(index,0.75f); + pathConstrainer.Remove(actor); + actor.SetProperty(index, 0.75f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); END_TEST; } int UtcPathConstrainerProperties(void) { - TestApplication application; + TestApplication application; Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New(); - pathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3( 1.0f,0.0f,0.0f ) ); - DALI_TEST_EQUALS( pathConstrainer.GetProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( pathConstrainer.GetCurrentProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION ); + pathConstrainer.SetProperty(Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f, 0.0f, 0.0f)); + DALI_TEST_EQUALS(pathConstrainer.GetProperty(Dali::PathConstrainer::Property::FORWARD), Vector3(1.0f, 0.0f, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(pathConstrainer.GetCurrentProperty(Dali::PathConstrainer::Property::FORWARD), Vector3(1.0f, 0.0f, 0.0f), TEST_LOCATION); Dali::Property::Array points; points.Resize(3); - points[0] = Vector3( 30.0, 80.0, 0.0); - points[1] = Vector3( 70.0, 120.0, 0.0); + points[0] = Vector3(30.0, 80.0, 0.0); + points[1] = Vector3(70.0, 120.0, 0.0); points[2] = Vector3(100.0, 100.0, 0.0); - pathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points ); + pathConstrainer.SetProperty(Dali::PathConstrainer::Property::POINTS, points); { - Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::POINTS ); + Property::Value value = pathConstrainer.GetProperty(Dali::PathConstrainer::Property::POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = pathConstrainer.GetCurrentProperty( Dali::PathConstrainer::Property::POINTS ); + Property::Value value = pathConstrainer.GetCurrentProperty(Dali::PathConstrainer::Property::POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } points.Resize(4); - points[0] = Vector3( 39.0, 90.0, 0.0); - points[1] = Vector3( 56.0, 119.0, 0.0); - points[2] = Vector3( 78.0, 120.0, 0.0); - points[3] = Vector3( 93.0, 104.0, 0.0); - pathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points ); + points[0] = Vector3(39.0, 90.0, 0.0); + points[1] = Vector3(56.0, 119.0, 0.0); + points[2] = Vector3(78.0, 120.0, 0.0); + points[3] = Vector3(93.0, 104.0, 0.0); + pathConstrainer.SetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS, points); { - Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS ); + Property::Value value = pathConstrainer.GetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = pathConstrainer.GetCurrentProperty( Dali::PathConstrainer::Property::CONTROL_POINTS ); + Property::Value value = pathConstrainer.GetCurrentProperty(Dali::PathConstrainer::Property::CONTROL_POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } @@ -413,32 +409,32 @@ int UtcPathConstrainerProperties(void) //LinearConstrainer test cases int UtcLinearConstrainerDownCast(void) { - TestApplication application; + TestApplication application; Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - BaseHandle handle( linearConstrainer ); - Dali::LinearConstrainer linearConstrainer2 = Dali::LinearConstrainer::DownCast( handle ); - DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION ); + BaseHandle handle(linearConstrainer); + Dali::LinearConstrainer linearConstrainer2 = Dali::LinearConstrainer::DownCast(handle); + DALI_TEST_EQUALS((bool)linearConstrainer2, true, TEST_LOCATION); - BaseHandle handle2; - Dali:: LinearConstrainer linearConstrainer3 = Dali::LinearConstrainer::DownCast( handle2 ); - DALI_TEST_EQUALS( (bool)linearConstrainer3, false, TEST_LOCATION ); + BaseHandle handle2; + Dali::LinearConstrainer linearConstrainer3 = Dali::LinearConstrainer::DownCast(handle2); + DALI_TEST_EQUALS((bool)linearConstrainer3, false, TEST_LOCATION); END_TEST; } int UtcLinearConstrainerCopyConstructor(void) { - TestApplication application; + TestApplication application; Dali::LinearConstrainer linearConstrainer; - DALI_TEST_EQUALS( (bool)linearConstrainer, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)linearConstrainer, false, TEST_LOCATION); linearConstrainer = Dali::LinearConstrainer::New(); - DALI_TEST_EQUALS( (bool)linearConstrainer, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)linearConstrainer, true, TEST_LOCATION); // call the copy constructor - Dali::LinearConstrainer linearConstrainer2( linearConstrainer ); - DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION ); + Dali::LinearConstrainer linearConstrainer2(linearConstrainer); + DALI_TEST_EQUALS((bool)linearConstrainer2, true, TEST_LOCATION); END_TEST; } @@ -448,17 +444,17 @@ int UtcLinearConstrainerMoveConstructor(void) TestApplication application; Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - DALI_TEST_CHECK( linearConstrainer ); - DALI_TEST_EQUALS( 1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(linearConstrainer); + DALI_TEST_EQUALS(1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION); - SetupLinearConstrainerUniformProgress( linearConstrainer ); - VerifyLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); + VerifyLinearConstrainerUniformProgress(linearConstrainer); - Dali::LinearConstrainer moved = std::move( linearConstrainer ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - VerifyLinearConstrainerUniformProgress( moved ); - DALI_TEST_CHECK( !linearConstrainer ); + Dali::LinearConstrainer moved = std::move(linearConstrainer); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + VerifyLinearConstrainerUniformProgress(moved); + DALI_TEST_CHECK(!linearConstrainer); END_TEST; } @@ -468,18 +464,18 @@ int UtcLinearConstrainerMoveAssignment(void) TestApplication application; Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - DALI_TEST_CHECK( linearConstrainer ); - DALI_TEST_EQUALS( 1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(linearConstrainer); + DALI_TEST_EQUALS(1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION); - SetupLinearConstrainerUniformProgress( linearConstrainer ); - VerifyLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); + VerifyLinearConstrainerUniformProgress(linearConstrainer); Dali::LinearConstrainer moved; - moved = std::move( linearConstrainer ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - VerifyLinearConstrainerUniformProgress( moved ); - DALI_TEST_CHECK( !linearConstrainer ); + moved = std::move(linearConstrainer); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + VerifyLinearConstrainerUniformProgress(moved); + DALI_TEST_CHECK(!linearConstrainer); END_TEST; } @@ -491,73 +487,72 @@ int UtcLinearConstrainerApply(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); - //Create a LinearConstrainer without specifying progress for values Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - SetupLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range); //Create an animation to animate the custom property - float durationSeconds(1.0f); + float durationSeconds(1.0f); Dali::Animation animation = Dali::Animation::New(durationSeconds); - animation.AnimateTo(Dali::Property(actor,index),1.0f); + animation.AnimateTo(Dali::Property(actor, index), 1.0f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 100% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* beyond the animation duration*/); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* beyond the animation duration*/); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); //Setup a LinearConstrainer specifying the progress for each value linearConstrainer.Remove(actor); - SetupLinearConstrainerNonUniformProgress( linearConstrainer ); - linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range ); + SetupLinearConstrainerNonUniformProgress(linearConstrainer); + linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range); - actor.SetProperty(index,0.0f); + actor.SetProperty(index, 0.0f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 2.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 2.0f / 3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f / 3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 100% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* beyond the animation duration*/); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* beyond the animation duration*/); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); END_TEST; } @@ -569,44 +564,43 @@ int UtcLinearConstrainerApplyRange(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 100.0f ); + Property::Index index = actor.RegisterProperty("t", 100.0f); application.GetScene().Add(actor); //Create a LinearConstrainer Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - SetupLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 100.0f, 300.0f ); - linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range ); - + Vector2 range(100.0f, 300.0f); + linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range); //Create an animation to animate the custom property - float durationSeconds(1.0f); + float durationSeconds(1.0f); Dali::Animation animation = Dali::Animation::New(durationSeconds); - animation.AnimateTo(Dali::Property(actor,index),300.0f); + animation.AnimateTo(Dali::Property(actor, index), 300.0f); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds * 250.0f) /* 25% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 50% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 75% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 100% progress */); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* 100% progress */); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* beyond the animation duration*/); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds * 250.0f) /* beyond the animation duration*/); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); END_TEST; } @@ -618,33 +612,32 @@ int UtcLinearConstrainerDestroy(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); { //Create a LinearConstrainer Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - SetupLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); //Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range); //Test that the constraint is correctly applied - actor.SetProperty(index,0.5f); + actor.SetProperty(index, 0.5f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION ); - + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION); } //LinearConstrainer has been destroyed. Constraint in the actor should have been removed - actor.SetProperty(index,0.75f); + actor.SetProperty(index, 0.75f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); END_TEST; } @@ -656,31 +649,31 @@ int UtcLinearConstrainerRemove(void) Dali::Actor actor = Dali::Actor::New(); // Register a float property - Property::Index index = actor.RegisterProperty( "t", 0.0f ); + Property::Index index = actor.RegisterProperty("t", 0.0f); application.GetScene().Add(actor); //Create a LinearConstrainer Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New(); - SetupLinearConstrainerUniformProgress( linearConstrainer ); + SetupLinearConstrainerUniformProgress(linearConstrainer); //Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t" - Vector2 range( 0.0f, 1.0f ); - linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range ); + Vector2 range(0.0f, 1.0f); + linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range); //Test that the constraint is correctly applied - actor.SetProperty(index,0.5f); + actor.SetProperty(index, 0.5f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION); //Remove constraint - linearConstrainer.Remove( actor ); - actor.SetProperty(index,0.75f); + linearConstrainer.Remove(actor); + actor.SetProperty(index, 0.75f); application.SendNotification(); application.Render(static_cast(1.0f)); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION); END_TEST; } @@ -696,58 +689,58 @@ int UtcLinearConstrainerProperties(void) points[0] = 0.0f; points[1] = 1.0f; points[2] = 0.0f; - linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points ); + linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points); { - Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE ); + Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::VALUE); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = linearConstrainer.GetCurrentProperty( Dali::LinearConstrainer::Property::VALUE ); + Property::Value value = linearConstrainer.GetCurrentProperty(Dali::LinearConstrainer::Property::VALUE); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } points[0] = 0.0f; points[1] = 0.25f; points[2] = 1.0f; - linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points ); + linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points); { - Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::PROGRESS ); + Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::PROGRESS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = linearConstrainer.GetCurrentProperty( Dali::LinearConstrainer::Property::PROGRESS ); + Property::Value value = linearConstrainer.GetCurrentProperty(Dali::LinearConstrainer::Property::PROGRESS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } @@ -760,24 +753,24 @@ int UtcDaliLinearConstrainerDetectorRegisterProperty(void) Dali::LinearConstrainer constrainer = Dali::LinearConstrainer::New(); - Property::Index index = constrainer.RegisterProperty( "sceneProperty", 0 ); - DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 0, TEST_LOCATION ); + Property::Index index = constrainer.RegisterProperty("sceneProperty", 0); + DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(constrainer.GetProperty(index), 0, TEST_LOCATION); - constrainer.SetProperty( index, -123 ); - DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION ); + constrainer.SetProperty(index, -123); + DALI_TEST_EQUALS(constrainer.GetProperty(index), -123, TEST_LOCATION); using Dali::Animation; - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( constrainer, index ), 99 ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(constrainer, index), 99); - DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION ); + DALI_TEST_EQUALS(constrainer.GetProperty(index), -123, TEST_LOCATION); // Start the animation animation.Play(); application.SendNotification(); - application.Render( 1000 /* 100% progress */); - DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 99, TEST_LOCATION ); + application.Render(1000 /* 100% progress */); + DALI_TEST_EQUALS(constrainer.GetProperty(index), 99, TEST_LOCATION); END_TEST; } @@ -788,40 +781,40 @@ int UtcDaliPathConstrainerDetectorRegisterProperty(void) Dali::PathConstrainer constrainer = Dali::PathConstrainer::New(); - Property::Index index = constrainer.RegisterProperty( "pathProperty", Vector2() ); - DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(), TEST_LOCATION ); + Property::Index index = constrainer.RegisterProperty("pathProperty", Vector2()); + DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(constrainer.GetProperty(index), Vector2(), TEST_LOCATION); - constrainer.SetProperty( index, Vector2(1,2) ); - DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION ); + constrainer.SetProperty(index, Vector2(1, 2)); + DALI_TEST_EQUALS(constrainer.GetProperty(index), Vector2(1, 2), TEST_LOCATION); using Dali::Animation; - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( constrainer, index ), Vector2(3,4) ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(constrainer, index), Vector2(3, 4)); - DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION ); + DALI_TEST_EQUALS(constrainer.GetProperty(index), Vector2(1, 2), TEST_LOCATION); // Start the animation animation.Play(); application.SendNotification(); - application.Render( 1000 /* 100% progress */); - DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(3,4), TEST_LOCATION ); + application.Render(1000 /* 100% progress */); + DALI_TEST_EQUALS(constrainer.GetProperty(index), Vector2(3, 4), TEST_LOCATION); END_TEST; } int UtcDaliLinearConstrainerApplyNegative(void) { - TestApplication application; + TestApplication application; Dali::LinearConstrainer instance; - Dali::Actor actor; + Dali::Actor actor; try { Dali::Property arg1(actor, Dali::Actor::Property::POSITION); Dali::Property arg2(actor, Dali::Actor::Property::POSITION); - Dali::Vector2 arg3; - Dali::Vector2 arg4; - instance.Apply(arg1,arg2,arg3,arg4); + Dali::Vector2 arg3; + Dali::Vector2 arg4; + instance.Apply(arg1, arg2, arg3, arg4); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -833,7 +826,7 @@ int UtcDaliLinearConstrainerApplyNegative(void) int UtcDaliLinearConstrainerRemoveNegative(void) { - TestApplication application; + TestApplication application; Dali::LinearConstrainer instance; try { diff --git a/automated-tests/src/dali/utc-Dali-Constraint.cpp b/automated-tests/src/dali/utc-Dali-Constraint.cpp index 2e4b354..c215e84 100644 --- a/automated-tests/src/dali/utc-Dali-Constraint.cpp +++ b/automated-tests/src/dali/utc-Dali-Constraint.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -38,24 +38,26 @@ void utc_dali_constraint_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - /** * A function to use for a constraint, no data collected. */ -template< typename T > -void BasicFunction( T& /* current */, const PropertyInputContainer& /* inputs */ ) +template +void BasicFunction(T& /* current */, const PropertyInputContainer& /* inputs */) { } /** * A functor which sets a given boolean when the functor is called. */ -template< typename T > +template struct BasicCalledFunctor { - BasicCalledFunctor( bool& functorCalled ) : mCalled( functorCalled ) { } + BasicCalledFunctor(bool& functorCalled) + : mCalled(functorCalled) + { + } - void operator()( T& /* current */, const PropertyInputContainer& /* inputs */ ) + void operator()(T& /* current */, const PropertyInputContainer& /* inputs */) { mCalled = true; } @@ -66,12 +68,15 @@ struct BasicCalledFunctor /** * A functor which increments a given integer when the functor is called. */ -template< typename T > +template struct CalledCountFunctor { - CalledCountFunctor( int& callCount ) : mCallCount( callCount ) { } + CalledCountFunctor(int& callCount) + : mCallCount(callCount) + { + } - void operator()( T& /* current */, const PropertyInputContainer& /* inputs */ ) + void operator()(T& /* current */, const PropertyInputContainer& /* inputs */) { ++mCallCount; } @@ -82,12 +87,15 @@ struct CalledCountFunctor /** * A functor which sets the given value as the value required when the functor is called. */ -template< typename T > +template struct SetValueFunctor { - SetValueFunctor( const T& value ) : mValue( value ) { } + SetValueFunctor(const T& value) + : mValue(value) + { + } - void operator()( T& current, const PropertyInputContainer& /* inputs */ ) + void operator()(T& current, const PropertyInputContainer& /* inputs */) { current = mValue; } @@ -107,7 +115,7 @@ struct SetValueFunctor namespace UtcDaliConstraintNewFunction { bool gConstraintFunctionCalled = false; -void ConstraintFunction( Vector3& /* current */, const PropertyInputContainer& /* inputs */ ) +void ConstraintFunction(Vector3& /* current */, const PropertyInputContainer& /* inputs */) { gConstraintFunctionCalled = true; } @@ -121,22 +129,22 @@ int UtcDaliConstraintNewFunctionP(void) UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( UtcDaliConstraintNewFunction::gConstraintFunctionCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, false, TEST_LOCATION); // Add a constraint - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction); + DALI_TEST_CHECK(constraint); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( UtcDaliConstraintNewFunction::gConstraintFunctionCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, true, TEST_LOCATION); END_TEST; } @@ -150,19 +158,19 @@ int UtcDaliConstraintNewFunctionN(void) // Add a constraint with an uninitialised handle try { - Constraint constraint = Constraint::New< Vector3 >( Actor(), Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction ); - DALI_TEST_CHECK( false ); // Should not reach here + Constraint constraint = Constraint::New(Actor(), Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction); + DALI_TEST_CHECK(false); // Should not reach here } - catch ( ... ) + catch(...) { - DALI_TEST_CHECK( true ); // Should assert! + DALI_TEST_CHECK(true); // Should assert! } END_TEST; } // helper for next test -void StringConstraintFunction( std::string& /* current */, const PropertyInputContainer& /* inputs */ ) +void StringConstraintFunction(std::string& /* current */, const PropertyInputContainer& /* inputs */) { } @@ -174,7 +182,7 @@ int UtcDaliConstraintNewFunctionNonConstrainableTypeN(void) UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); @@ -182,14 +190,14 @@ int UtcDaliConstraintNewFunctionNonConstrainableTypeN(void) try { // Add a constraint - Constraint constraint = Constraint::New< std::string >( actor, Actor::Property::COLOR_MODE, &StringConstraintFunction ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New(actor, Actor::Property::COLOR_MODE, &StringConstraintFunction); + DALI_TEST_CHECK(constraint); constraint.Apply(); tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_ASSERT( e, "Property not constrainable", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property not constrainable", TEST_LOCATION); } END_TEST; @@ -208,25 +216,25 @@ int UtcDaliConstraintNewFunctorP(void) // Ensure that we can create a constraint using a functor and that it is called. TestApplication application; - bool functorCalled = false; + bool functorCalled = false; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Add a constraint - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); + DALI_TEST_CHECK(constraint); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); END_TEST; } @@ -236,17 +244,17 @@ int UtcDaliConstraintNewFunctorN(void) // Create a constraint with an uninitialised handle TestApplication application; - bool functorCalled = false; + bool functorCalled = false; // Add a constraint with an uninitialised handle try { - Constraint constraint = Constraint::New< Vector3 >( Actor(), Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); - DALI_TEST_CHECK( false ); // Should not reach here + Constraint constraint = Constraint::New(Actor(), Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); + DALI_TEST_CHECK(false); // Should not reach here } - catch ( ... ) + catch(...) { - DALI_TEST_CHECK( true ); // Should assert! + DALI_TEST_CHECK(true); // Should assert! } END_TEST; @@ -264,18 +272,18 @@ namespace UtcDaliConstraintNewFunctorMember { struct Functor { - Functor( bool& positionCalled, bool& scaleCalled ) - : mPositionCalled( positionCalled ), - mScaleCalled( scaleCalled ) + Functor(bool& positionCalled, bool& scaleCalled) + : mPositionCalled(positionCalled), + mScaleCalled(scaleCalled) { } - void Position( Vector3& /* current */, const PropertyInputContainer& /* inputs */ ) + void Position(Vector3& /* current */, const PropertyInputContainer& /* inputs */) { mPositionCalled = true; } - void Scale( Vector3& /* current */, const PropertyInputContainer& /* inputs */ ) + void Scale(Vector3& /* current */, const PropertyInputContainer& /* inputs */) { mScaleCalled = true; } @@ -290,47 +298,47 @@ int UtcDaliConstraintNewFunctorMemberP(void) // Ensure that we can create a constraint using a functor and that it is called. TestApplication application; - bool positionFunctorCalled = false; - bool sizeFunctorCalled = false; + bool positionFunctorCalled = false; + bool sizeFunctorCalled = false; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( positionFunctorCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( sizeFunctorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(positionFunctorCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION); // Add a constraint that calls Functor::Position - Constraint constraint = Constraint::New< Vector3 >( - actor, - Actor::Property::POSITION, - UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ), - &UtcDaliConstraintNewFunctorMember::Functor::Position ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New( + actor, + Actor::Property::POSITION, + UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled), + &UtcDaliConstraintNewFunctorMember::Functor::Position); + DALI_TEST_CHECK(constraint); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( positionFunctorCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( sizeFunctorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION); // Add another constraint that calls Functor::Size - Constraint constraint2 = Constraint::New< Vector3 >( - actor, - Actor::Property::SCALE, - UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ), - &UtcDaliConstraintNewFunctorMember::Functor::Scale ); - DALI_TEST_CHECK( constraint2 ); + Constraint constraint2 = Constraint::New( + actor, + Actor::Property::SCALE, + UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled), + &UtcDaliConstraintNewFunctorMember::Functor::Scale); + DALI_TEST_CHECK(constraint2); constraint2.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( positionFunctorCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( sizeFunctorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(sizeFunctorCalled, true, TEST_LOCATION); END_TEST; } @@ -340,22 +348,22 @@ int UtcDaliConstraintNewFunctorMemberN(void) // Create a constraint with an uninitialised handle TestApplication application; - bool positionFunctorCalled = false; - bool sizeFunctorCalled = false; + bool positionFunctorCalled = false; + bool sizeFunctorCalled = false; // Add a constraint with an uninitialised handle try { - Constraint constraint = Constraint::New< Vector3 >( - Actor(), - Actor::Property::POSITION, - UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ), - &UtcDaliConstraintNewFunctorMember::Functor::Position ); - DALI_TEST_CHECK( false ); // Should not reach here + Constraint constraint = Constraint::New( + Actor(), + Actor::Property::POSITION, + UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled), + &UtcDaliConstraintNewFunctorMember::Functor::Position); + DALI_TEST_CHECK(false); // Should not reach here } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_CHECK( true ); // Should assert! + DALI_TEST_CHECK(true); // Should assert! } END_TEST; @@ -370,32 +378,32 @@ int UtcDaliConstraintCloneP(void) // Ensure we can clone for another actor and it's called appropriately TestApplication application; - int calledCount = 0; + int calledCount = 0; Actor actor = Actor::New(); Actor clone = Actor::New(); Integration::Scene stage = application.GetScene(); - stage.Add( actor ); - stage.Add( clone ); + stage.Add(actor); + stage.Add(clone); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( calledCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(calledCount, 0, TEST_LOCATION); // Add a constraint to actor - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, CalledCountFunctor< Vector3 >( calledCount ) ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, CalledCountFunctor(calledCount)); + DALI_TEST_CHECK(constraint); constraint.Apply(); // Create a clone but don't apply - Constraint constraintClone = constraint.Clone( clone ); + Constraint constraintClone = constraint.Clone(clone); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION); // Reset calledCount = 0; @@ -403,7 +411,7 @@ int UtcDaliConstraintCloneP(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION); // Apply the clone constraint constraintClone.Apply(); @@ -412,20 +420,20 @@ int UtcDaliConstraintCloneP(void) application.Render(); // Should be called once for the new constraint clone and once for the original constraint - DALI_TEST_EQUALS( calledCount, 3, TEST_LOCATION ); + DALI_TEST_EQUALS(calledCount, 3, TEST_LOCATION); // Reset calledCount = 0; // Change the position of both actors - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - clone.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + clone.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); application.SendNotification(); application.Render(); // Functor should have been called twice - DALI_TEST_EQUALS( calledCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(calledCount, 2, TEST_LOCATION); END_TEST; } @@ -440,13 +448,13 @@ int UtcDaliConstraintCloneN(void) try { - Actor actor = Actor::New(); - Constraint clone = constraint.Clone( actor ); - DALI_TEST_CHECK( false ); + Actor actor = Actor::New(); + Constraint clone = constraint.Clone(actor); + DALI_TEST_CHECK(false); } - catch ( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -454,12 +462,12 @@ int UtcDaliConstraintCloneN(void) namespace UtcDaliConstraintClone { -void Function( Vector3& /* current */, const PropertyInputContainer& inputs ) +void Function(Vector3& /* current */, const PropertyInputContainer& inputs) { - DALI_TEST_EQUALS( inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION ); + DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION); } } // namespace UtcDaliConstraintClone @@ -473,30 +481,30 @@ int UtcDaliConstraintCloneCheckSourcesAndSetters(void) Actor clone = Actor::New(); Integration::Scene stage = application.GetScene(); - stage.Add( actor ); - stage.Add( clone ); + stage.Add(actor); + stage.Add(clone); application.SendNotification(); application.Render(); // Create a constraint, DON'T Apply it though - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintClone::Function ); - constraint.AddSource( LocalSource( Actor::Property::SIZE ) ); - constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) ); - constraint.AddSource( LocalSource( Actor::Property::COLOR ) ); - constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) ); - constraint.SetRemoveAction( Constraint::DISCARD ); - constraint.SetTag( 123 ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &UtcDaliConstraintClone::Function); + constraint.AddSource(LocalSource(Actor::Property::SIZE)); + constraint.AddSource(LocalSource(Actor::Property::ORIENTATION)); + constraint.AddSource(LocalSource(Actor::Property::COLOR)); + constraint.AddSource(LocalSource(Actor::Property::VISIBLE)); + constraint.SetRemoveAction(Constraint::DISCARD); + constraint.SetTag(123); // Clone the constraint & apply the clone - Constraint constraintClone = constraint.Clone( clone ); + Constraint constraintClone = constraint.Clone(clone); constraintClone.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( constraint.GetRemoveAction(), constraintClone.GetRemoveAction(), TEST_LOCATION ); - DALI_TEST_EQUALS( constraint.GetTag(), constraintClone.GetTag(), TEST_LOCATION ); + DALI_TEST_EQUALS(constraint.GetRemoveAction(), constraintClone.GetRemoveAction(), TEST_LOCATION); + DALI_TEST_EQUALS(constraint.GetTag(), constraintClone.GetTag(), TEST_LOCATION); END_TEST; } @@ -513,16 +521,16 @@ int UtcDaliConstraintCopyAndAssignment(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - Constraint copied( constraint ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + Constraint copied(constraint); Constraint assigned; - DALI_TEST_CHECK( constraint == copied ); - DALI_TEST_CHECK( copied != assigned ); + DALI_TEST_CHECK(constraint == copied); + DALI_TEST_CHECK(copied != assigned); assigned = constraint; - DALI_TEST_CHECK( constraint == assigned ); + DALI_TEST_CHECK(constraint == assigned); END_TEST; } @@ -535,18 +543,18 @@ int UtcDaliConstraintMoveConstructor(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_CHECK( constraint ); - DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( constraint.GetTargetObject() == actor ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_CHECK(constraint); + DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(constraint.GetTargetObject() == actor); - Constraint moved = std::move( constraint ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( moved.GetTargetObject() == actor ); - DALI_TEST_CHECK( !constraint ); + Constraint moved = std::move(constraint); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(moved.GetTargetObject() == actor); + DALI_TEST_CHECK(!constraint); END_TEST; } @@ -558,19 +566,19 @@ int UtcDaliConstraintMoveAssignment(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_CHECK( constraint ); - DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( constraint.GetTargetObject() == actor ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_CHECK(constraint); + DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(constraint.GetTargetObject() == actor); Constraint moved; - moved = std::move( constraint ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( moved.GetTargetObject() == actor ); - DALI_TEST_CHECK( !constraint ); + moved = std::move(constraint); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(moved.GetTargetObject() == actor); + DALI_TEST_CHECK(!constraint); END_TEST; } @@ -584,20 +592,20 @@ int UtcDaliConstraintDownCast(void) TestApplication application; - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); // Another BaseHandle type - Constraint downCast = Constraint::DownCast( actor ); - DALI_TEST_CHECK( ! downCast ); + Constraint downCast = Constraint::DownCast(actor); + DALI_TEST_CHECK(!downCast); // A constraint - downCast = Constraint::DownCast( constraint ); - DALI_TEST_CHECK( downCast ); + downCast = Constraint::DownCast(constraint); + DALI_TEST_CHECK(downCast); // An empty constraint - downCast = Constraint::DownCast( Constraint() ); - DALI_TEST_CHECK( ! downCast ); + downCast = Constraint::DownCast(Constraint()); + DALI_TEST_CHECK(!downCast); END_TEST; } @@ -610,12 +618,12 @@ int UtcDaliConstraintGetTargetObjectP(void) { TestApplication application; - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_CHECK( constraint.GetTargetObject() == actor ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_CHECK(constraint.GetTargetObject() == actor); Actor actor2 = Actor::New(); - DALI_TEST_CHECK( constraint.GetTargetObject() != actor2 ); + DALI_TEST_CHECK(constraint.GetTargetObject() != actor2); END_TEST; } @@ -630,11 +638,11 @@ int UtcDaliConstraintGetTargetObjectN(void) try { Handle handle = constraint.GetTargetObject(); - DALI_TEST_CHECK( false ); // Should not reach here! + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -648,9 +656,9 @@ int UtcDaliConstraintGetTargetPropertyP(void) { TestApplication application; - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_EQUALS( constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_EQUALS(constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION); END_TEST; } @@ -665,12 +673,12 @@ int UtcDaliConstraintGetTargetPropertyN(void) try { Property::Index propertyIndex = constraint.GetTargetProperty(); - ( void )propertyIndex; - DALI_TEST_CHECK( false ); // Should not reach here! + (void)propertyIndex; + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -685,13 +693,13 @@ int UtcDaliConstraintTagP(void) { TestApplication application; - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_EQUALS( constraint.GetTag(), 0u, TEST_LOCATION ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_EQUALS(constraint.GetTag(), 0u, TEST_LOCATION); const unsigned int tag = 123; - constraint.SetTag( tag ); - DALI_TEST_EQUALS( constraint.GetTag(), tag, TEST_LOCATION ); + constraint.SetTag(tag); + DALI_TEST_EQUALS(constraint.GetTag(), tag, TEST_LOCATION); END_TEST; } @@ -705,12 +713,12 @@ int UtcDaliConstraintSetTagN(void) Constraint constraint; try { - constraint.SetTag( 123 ); - DALI_TEST_CHECK( false ); // Should not reach here! + constraint.SetTag(123); + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -726,12 +734,12 @@ int UtcDaliConstraintGetTagN(void) try { int tag = constraint.GetTag(); - ( void )tag; - DALI_TEST_CHECK( false ); // Should not reach here! + (void)tag; + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -747,15 +755,15 @@ int UtcDaliConstraintRemoveActionP(void) { TestApplication application; - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > ); - DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &BasicFunction); + DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION); - constraint.SetRemoveAction( Constraint::DISCARD ); - DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION ); + constraint.SetRemoveAction(Constraint::DISCARD); + DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION); - constraint.SetRemoveAction( Constraint::BAKE ); - DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION ); + constraint.SetRemoveAction(Constraint::BAKE); + DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION); END_TEST; } @@ -769,12 +777,12 @@ int UtcDaliConstraintSetRemoveActionN(void) Constraint constraint; try { - constraint.SetRemoveAction( Constraint::DISCARD ); - DALI_TEST_CHECK( false ); // Should not reach here! + constraint.SetRemoveAction(Constraint::DISCARD); + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -790,12 +798,12 @@ int UtcDaliConstraintGetRemoveActionN(void) try { Constraint::RemoveAction removeAction = constraint.GetRemoveAction(); - ( void )removeAction; - DALI_TEST_CHECK( false ); // Should not reach here! + (void)removeAction; + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -808,24 +816,24 @@ int UtcDaliConstraintBakeRemoveAction(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); // Should not equal position by default - Vector3 position( 10.0f, 20.0f, 30.0f ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position ); + Vector3 position(10.0f, 20.0f, 30.0f); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::POSITION) != position); // Create a constraint that constrains to position - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) ); - constraint.SetRemoveAction( Constraint::BAKE ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, SetValueFunctor(position)); + constraint.SetRemoveAction(Constraint::BAKE); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); // Remove the constraint, it should still be at position constraint.Remove(); @@ -833,7 +841,7 @@ int UtcDaliConstraintBakeRemoveAction(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); END_TEST; } @@ -845,27 +853,27 @@ int UtcDaliConstraintDiscardRemoveAction(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); // Get and store current position - Vector3 originalPosition = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ); + Vector3 originalPosition = actor.GetCurrentProperty(Actor::Property::POSITION); // Should not equal position by default - Vector3 position( 10.0f, 20.0f, 30.0f ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position ); + Vector3 position(10.0f, 20.0f, 30.0f); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::POSITION) != position); // Create a constraint that constrains to position - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) ); - constraint.SetRemoveAction( Constraint::DISCARD ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, SetValueFunctor(position)); + constraint.SetRemoveAction(Constraint::DISCARD); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), position, TEST_LOCATION); // Remove the constraint, it should still be at position constraint.Remove(); @@ -873,8 +881,8 @@ int UtcDaliConstraintDiscardRemoveAction(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), originalPosition, TEST_LOCATION ); - DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), originalPosition, TEST_LOCATION); + DALI_TEST_CHECK(actor.GetCurrentProperty(Actor::Property::POSITION) != position); END_TEST; } @@ -890,24 +898,24 @@ int UtcDaliConstraintApplyRemove(void) // Ensure constraint functors are called appropriately TestApplication application; - bool functorCalled = false; + bool functorCalled = false; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Create a constraint and apply, functor should be called - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); // Reset functorCalled = false; @@ -918,7 +926,7 @@ int UtcDaliConstraintApplyRemove(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Re-apply the constraint, functor should be called again constraint.Apply(); @@ -926,7 +934,7 @@ int UtcDaliConstraintApplyRemove(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); END_TEST; } @@ -937,27 +945,27 @@ int UtcDaliConstraintApplyBeforeAddedToStage(void) // Constraint should be automatically applied when the actor is added to the stage and not before TestApplication application; - bool functorCalled = false; + bool functorCalled = false; // Create an actor and a constraint and apply, DON'T add to stage just yet - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); constraint.Apply(); application.SendNotification(); application.Render(); // Should NOT be called - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Add actor to stage - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); // Should now be called - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); END_TEST; } @@ -968,30 +976,30 @@ int UtcDaliConstraintApplyAndRemoveBeforeAddedToStage(void) // Constraint should NOT be called at all TestApplication application; - bool functorCalled = false; + bool functorCalled = false; // Create an actor and a constraint and apply, DON'T add to stage just yet - Actor actor = Actor::New(); - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); + Actor actor = Actor::New(); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); constraint.Apply(); application.SendNotification(); application.Render(); // Should NOT be called - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Remove the constraint constraint.Remove(); // Add actor to stage - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); // Still should NOT be called - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); END_TEST; } @@ -1002,43 +1010,43 @@ int UtcDaliConstraintApplyActorStagedUnstaged(void) // Functor should only be called while the actor is staged. TestApplication application; - bool functorCalled = false; + bool functorCalled = false; // Create an actor and add to stage - Actor actor = Actor::New(); + Actor actor = Actor::New(); Integration::Scene stage = application.GetScene(); - stage.Add( actor ); + stage.Add(actor); // Create a constraint and apply - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, BasicCalledFunctor(functorCalled)); constraint.Apply(); application.SendNotification(); application.Render(); // Constraint should be called - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); // Reset functorCalled = false; // Remove actor from stage - stage.Remove( actor ); + stage.Remove(actor); application.SendNotification(); application.Render(); // Constraint should NOT be called - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Re-add to stage - stage.Add( actor ); + stage.Add(actor); application.SendNotification(); application.Render(); // Constraint should be called - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); END_TEST; } @@ -1049,15 +1057,15 @@ int UtcDaliConstraintApplySeveralTimes(void) // Should not cause any problems (subsequent attempts should be no-ops) TestApplication application; - int count = 0; + int count = 0; // Create an actor and add to stage - Actor actor = Actor::New(); + Actor actor = Actor::New(); Integration::Scene stage = application.GetScene(); - stage.Add( actor ); + stage.Add(actor); // Create a constraint and apply - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, CalledCountFunctor< Vector3 >( count ) ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, CalledCountFunctor(count)); constraint.Apply(); // Apply again @@ -1067,7 +1075,7 @@ int UtcDaliConstraintApplySeveralTimes(void) application.Render(); // Should only have been called once - DALI_TEST_EQUALS( count, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(count, 1, TEST_LOCATION); // Reset count = 0; @@ -1078,20 +1086,20 @@ int UtcDaliConstraintApplySeveralTimes(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( count, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(count, 1, TEST_LOCATION); // Reset count = 0; // Change the position property, apply again - actor.SetProperty( Actor::Property::POSITION, Vector2( 10.0f, 10.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f)); constraint.Apply(); application.SendNotification(); application.Render(); // Constraint should have been called once - DALI_TEST_EQUALS( count, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(count, 1, TEST_LOCATION); END_TEST; } @@ -1103,13 +1111,13 @@ int UtcDaliConstraintApplySeveralTimes(void) /////////////////////////////////////////////////////////////////////////////// namespace UtcDaliConstraintAddSource { -void Function( Vector3& /* current */, const PropertyInputContainer& inputs ) +void Function(Vector3& /* current */, const PropertyInputContainer& inputs) { - DALI_TEST_EQUALS( inputs.Size(), 4u, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION ); - DALI_TEST_EQUALS( inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION ); + DALI_TEST_EQUALS(inputs.Size(), 4u, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION); + DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION); } } // namespace UtcDaliConstraintAddSource @@ -1120,14 +1128,14 @@ int UtcDaliConstraintAddSourceP(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Create a constraint, add sources - Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintAddSource::Function ); - constraint.AddSource( LocalSource( Actor::Property::SIZE ) ); - constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) ); - constraint.AddSource( LocalSource( Actor::Property::COLOR ) ); - constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) ); + Constraint constraint = Constraint::New(actor, Actor::Property::POSITION, &UtcDaliConstraintAddSource::Function); + constraint.AddSource(LocalSource(Actor::Property::SIZE)); + constraint.AddSource(LocalSource(Actor::Property::ORIENTATION)); + constraint.AddSource(LocalSource(Actor::Property::COLOR)); + constraint.AddSource(LocalSource(Actor::Property::VISIBLE)); constraint.Apply(); application.SendNotification(); @@ -1145,12 +1153,12 @@ int UtcDaliConstraintAddSourceN(void) Constraint constraint; try { - constraint.AddSource( LocalSource( Actor::Property::POSITION ) ); - DALI_TEST_CHECK( false ); // Should not reach here! + constraint.AddSource(LocalSource(Actor::Property::POSITION)); + DALI_TEST_CHECK(false); // Should not reach here! } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -1160,46 +1168,45 @@ int UtcDaliConstraintAddSourceN(void) /////////////////////////////////////////////////////////////////////////////// namespace TestChaining { - -const Vector3 gFunction1Output( Vector3::ONE ); -void Function1( Vector3& current, const PropertyInputContainer& /* inputs */ ) +const Vector3 gFunction1Output(Vector3::ONE); +void Function1(Vector3& current, const PropertyInputContainer& /* inputs */) { // current is original position - DALI_TEST_EQUALS( current, Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(current, Vector3::ZERO, TEST_LOCATION); current = gFunction1Output; } -const Vector3 gFunction2Output( 10.0f, 20.0f, 30.0f ); -void Function2( Vector3& current, const PropertyInputContainer& /* inputs */ ) +const Vector3 gFunction2Output(10.0f, 20.0f, 30.0f); +void Function2(Vector3& current, const PropertyInputContainer& /* inputs */) { // current is output from Function1 - DALI_TEST_EQUALS( current, gFunction1Output, TEST_LOCATION ); + DALI_TEST_EQUALS(current, gFunction1Output, TEST_LOCATION); current = gFunction2Output; } -const Vector3 gFunction3Output( 10.0f, 20.0f, 30.0f ); -void Function3( Vector3& current, const PropertyInputContainer& /* inputs */ ) +const Vector3 gFunction3Output(10.0f, 20.0f, 30.0f); +void Function3(Vector3& current, const PropertyInputContainer& /* inputs */) { // current is output from Function2 - DALI_TEST_EQUALS( current, gFunction2Output, TEST_LOCATION ); + DALI_TEST_EQUALS(current, gFunction2Output, TEST_LOCATION); current = gFunction3Output; } -const Vector3 gFunction4Output( 10.0f, 20.0f, 30.0f ); -void Function4( Vector3& current, const PropertyInputContainer& /* inputs */ ) +const Vector3 gFunction4Output(10.0f, 20.0f, 30.0f); +void Function4(Vector3& current, const PropertyInputContainer& /* inputs */) { // current is output from Function3 - DALI_TEST_EQUALS( current, gFunction3Output, TEST_LOCATION ); + DALI_TEST_EQUALS(current, gFunction3Output, TEST_LOCATION); current = gFunction4Output; } -void Function5( Vector3& current, const PropertyInputContainer& /* inputs */ ) +void Function5(Vector3& current, const PropertyInputContainer& /* inputs */) { // current is output from Function4 - DALI_TEST_EQUALS( current, gFunction4Output, TEST_LOCATION ); + DALI_TEST_EQUALS(current, gFunction4Output, TEST_LOCATION); current = Vector3::ZERO; } @@ -1213,13 +1220,13 @@ int UtcDaliConstraintChaining(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - Constraint constraint1 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function1 ); - Constraint constraint2 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function2 ); - Constraint constraint3 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function3 ); - Constraint constraint4 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function4 ); - Constraint constraint5 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function5 ); + Constraint constraint1 = Constraint::New(actor, Actor::Property::POSITION, &TestChaining::Function1); + Constraint constraint2 = Constraint::New(actor, Actor::Property::POSITION, &TestChaining::Function2); + Constraint constraint3 = Constraint::New(actor, Actor::Property::POSITION, &TestChaining::Function3); + Constraint constraint4 = Constraint::New(actor, Actor::Property::POSITION, &TestChaining::Function4); + Constraint constraint5 = Constraint::New(actor, Actor::Property::POSITION, &TestChaining::Function5); constraint1.Apply(); constraint2.Apply(); @@ -1237,47 +1244,47 @@ int UtcDaliConstraintChaining(void) /////////////////////////////////////////////////////////////////////////////// namespace TestPropertyTypes { -template< typename T > -void Execute( T value ) +template +void Execute(T value) { TestApplication application; - bool functorCalled = false; + bool functorCalled = false; - Actor actor = Actor::New(); - Property::Index index = actor.RegisterProperty( "TEMP_PROPERTY_NAME", value ); + Actor actor = Actor::New(); + Property::Index index = actor.RegisterProperty("TEMP_PROPERTY_NAME", value); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION); // Add a constraint - Constraint constraint = Constraint::New< T >( actor, index, BasicCalledFunctor< T >( functorCalled ) ); - DALI_TEST_CHECK( constraint ); + Constraint constraint = Constraint::New(actor, index, BasicCalledFunctor(functorCalled)); + DALI_TEST_CHECK(constraint); constraint.Apply(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } -} // namespace UtcDaliConstraintNewFunctor +} // namespace TestPropertyTypes int UtcDaliConstraintTestPropertyTypesP(void) { // Ensure we can use a constraint functor with all supported property types - TestPropertyTypes::Execute< bool >( false ); - TestPropertyTypes::Execute< int >( 0 ); - TestPropertyTypes::Execute< float >( 0.0f ); - TestPropertyTypes::Execute< Vector2 >( Vector2::ZERO ); - TestPropertyTypes::Execute< Vector3 >( Vector3::ZERO ); - TestPropertyTypes::Execute< Vector4 >( Vector4::ZERO ); - TestPropertyTypes::Execute< Quaternion >( Quaternion::IDENTITY ); - TestPropertyTypes::Execute< Matrix >( Matrix::IDENTITY ); - TestPropertyTypes::Execute< Matrix3 >( Matrix3::IDENTITY ); + TestPropertyTypes::Execute(false); + TestPropertyTypes::Execute(0); + TestPropertyTypes::Execute(0.0f); + TestPropertyTypes::Execute(Vector2::ZERO); + TestPropertyTypes::Execute(Vector3::ZERO); + TestPropertyTypes::Execute(Vector4::ZERO); + TestPropertyTypes::Execute(Quaternion::IDENTITY); + TestPropertyTypes::Execute(Matrix::IDENTITY); + TestPropertyTypes::Execute(Matrix3::IDENTITY); END_TEST; } @@ -1287,7 +1294,7 @@ int UtcDaliConstraintTestPropertyTypesP(void) /////////////////////////////////////////////////////////////////////////////// namespace { -void SetHalfOpacity( Vector4& current, const PropertyInputContainer& inputs ) +void SetHalfOpacity(Vector4& current, const PropertyInputContainer& inputs) { current.a = 0.5f; } @@ -1300,27 +1307,27 @@ int UtcDaliConstraintEnsureResetterAppliedOnSceneRemoval(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Check initial value is fully opaque application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Create a constraint whose value is discarded when it is removed - Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity ); - constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD ); + Constraint constraint = Constraint::New(actor, Actor::Property::COLOR, SetHalfOpacity); + constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD); constraint.Apply(); // Check value after one render, it should be constrained application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); // Render another frame, ensure the other value has also been updated application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); // Remove the actor from the stage and delete the constraint actor.Unparent(); @@ -1330,20 +1337,20 @@ int UtcDaliConstraintEnsureResetterAppliedOnSceneRemoval(void) // Check value while off-stage, it should be fully opaque application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Add the actor back to the stage and check the value, it should be fully opaque again - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Check value when back on-stage, it should be fully opaque as the constraint is no longer applied to it. application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Render for another frame to ensure both buffers have the correct value application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); END_TEST; } @@ -1355,27 +1362,27 @@ int UtcDaliConstraintOnActorAddedAndRemoved(void) TestApplication application; Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); // Check initial value is fully opaque application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Create a constraint whose value is discarded when it is removed - Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity ); - constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD ); + Constraint constraint = Constraint::New(actor, Actor::Property::COLOR, SetHalfOpacity); + constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD); constraint.Apply(); // Check value after one render, it should be constrained application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); // Render another frame, ensure the other value has also been updated application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); // Remove the actor from the stage actor.Unparent(); @@ -1383,23 +1390,23 @@ int UtcDaliConstraintOnActorAddedAndRemoved(void) // Check value while off-stage, the constraint is no longer being applied as it's off-stage application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Check the other buffer, the constraint should not be applied to this either. application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION); // Add the actor back to the stage and check the value, the constraint should have been re-applied - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); // Render for another frame to ensure both buffers have the correct value application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION); END_TEST; } @@ -1408,7 +1415,7 @@ int UtcDaliConstraintOnActorAddedAndRemoved(void) int UtcDaliConstraintGetTargetObjectNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1424,7 +1431,7 @@ int UtcDaliConstraintGetTargetObjectNegative(void) int UtcDaliConstraintSetRemoveActionNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1441,7 +1448,7 @@ int UtcDaliConstraintSetRemoveActionNegative(void) int UtcDaliConstraintGetTargetPropertyNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1457,7 +1464,7 @@ int UtcDaliConstraintGetTargetPropertyNegative(void) int UtcDaliConstraintApplyNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1473,7 +1480,7 @@ int UtcDaliConstraintApplyNegative(void) int UtcDaliConstraintCloneNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1490,7 +1497,7 @@ int UtcDaliConstraintCloneNegative(void) int UtcDaliConstraintRemoveNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1506,7 +1513,7 @@ int UtcDaliConstraintRemoveNegative(void) int UtcDaliConstraintSetTagNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1523,7 +1530,7 @@ int UtcDaliConstraintSetTagNegative(void) int UtcDaliConstraintGetRemoveActionNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { @@ -1539,7 +1546,7 @@ int UtcDaliConstraintGetRemoveActionNegative(void) int UtcDaliConstraintGetTagNegative(void) { - TestApplication application; + TestApplication application; Dali::Constraint instance; try { diff --git a/automated-tests/src/dali/utc-Dali-ConstraintFunction.cpp b/automated-tests/src/dali/utc-Dali-ConstraintFunction.cpp index 2b00329..74ca0a5 100644 --- a/automated-tests/src/dali/utc-Dali-ConstraintFunction.cpp +++ b/automated-tests/src/dali/utc-Dali-ConstraintFunction.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -40,18 +40,21 @@ namespace { bool gFunctionCalled = false; -template< typename T > -void TestCallbackFunction( T& /* current*/ , const PropertyInputContainer& /* inputs */ ) +template +void TestCallbackFunction(T& /* current*/, const PropertyInputContainer& /* inputs */) { gFunctionCalled = true; } -template< typename T > +template struct TestCallbackFunctor { - TestCallbackFunctor( bool& functorCalled ) : mFunctorCalled( functorCalled ) { } + TestCallbackFunctor(bool& functorCalled) + : mFunctorCalled(functorCalled) + { + } - void operator()( T& /* current*/ , const PropertyInputContainer& /* inputs */ ) + void operator()(T& /* current*/, const PropertyInputContainer& /* inputs */) { mFunctorCalled = true; } @@ -59,12 +62,15 @@ struct TestCallbackFunctor bool& mFunctorCalled; }; -template< typename T > +template struct TestFunctorMethod { - TestFunctorMethod( bool& functorCalled ) : mFunctorCalled( functorCalled ) { } + TestFunctorMethod(bool& functorCalled) + : mFunctorCalled(functorCalled) + { + } - void Method( T& /* current*/ , const PropertyInputContainer& /* inputs */ ) + void Method(T& /* current*/, const PropertyInputContainer& /* inputs */) { mFunctorCalled = true; } @@ -80,32 +86,32 @@ struct TestFunctorMethod /////////////////////////////////////////////////////////////////////////////// namespace { -template< typename T > +template void TestFunctionConstructor() { gFunctionCalled = false; - Constraint::Function< T > function( &TestCallbackFunction< T > ); - T current; - PropertyInputContainer inputs; + Constraint::Function function(&TestCallbackFunction); + T current; + PropertyInputContainer inputs; - DALI_TEST_EQUALS( gFunctionCalled, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( function, current, inputs ); - DALI_TEST_EQUALS( gFunctionCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(gFunctionCalled, false, TEST_LOCATION); + CallbackBase::Execute(function, current, inputs); + DALI_TEST_EQUALS(gFunctionCalled, true, TEST_LOCATION); } } // unnamed namespace int UtcDaliConstraintFunctionWithFunction(void) { - TestFunctionConstructor< bool >(); - TestFunctionConstructor< int >(); - TestFunctionConstructor< unsigned int >(); - TestFunctionConstructor< float >(); - TestFunctionConstructor< Vector2 >(); - TestFunctionConstructor< Vector3 >(); - TestFunctionConstructor< Vector4 >(); - TestFunctionConstructor< Quaternion >(); - TestFunctionConstructor< Matrix >(); - TestFunctionConstructor< Matrix3 >(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); + TestFunctionConstructor(); END_TEST; } /////////////////////////////////////////////////////////////////////////////// @@ -115,33 +121,33 @@ int UtcDaliConstraintFunctionWithFunction(void) /////////////////////////////////////////////////////////////////////////////// namespace { -template< typename T > +template void TestFunctorConstructor() { - bool called = false; - TestCallbackFunctor< T > functor( called ); - Constraint::Function< T > callback( functor ); - T current; - PropertyInputContainer inputs; - - DALI_TEST_EQUALS( called, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( callback, current, inputs ); - DALI_TEST_EQUALS( called, true, TEST_LOCATION ); + bool called = false; + TestCallbackFunctor functor(called); + Constraint::Function callback(functor); + T current; + PropertyInputContainer inputs; + + DALI_TEST_EQUALS(called, false, TEST_LOCATION); + CallbackBase::Execute(callback, current, inputs); + DALI_TEST_EQUALS(called, true, TEST_LOCATION); } } // unnamed namespace int UtcDaliConstraintFunctionWithFunctor(void) { - TestFunctorConstructor< bool >(); - TestFunctorConstructor< int >(); - TestFunctorConstructor< unsigned int >(); - TestFunctorConstructor< float >(); - TestFunctorConstructor< Vector2 >(); - TestFunctorConstructor< Vector3 >(); - TestFunctorConstructor< Vector4 >(); - TestFunctorConstructor< Quaternion >(); - TestFunctorConstructor< Matrix >(); - TestFunctorConstructor< Matrix3 >(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); + TestFunctorConstructor(); END_TEST; } /////////////////////////////////////////////////////////////////////////////// @@ -151,33 +157,33 @@ int UtcDaliConstraintFunctionWithFunctor(void) /////////////////////////////////////////////////////////////////////////////// namespace { -template< typename T > +template void TestFunctorMethodConstructor() { - bool called = false; - TestFunctorMethod< T > functor( called ); - Constraint::Function< T > callback( functor, &TestFunctorMethod< T >::Method ); - T current; - PropertyInputContainer inputs; - - DALI_TEST_EQUALS( called, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( callback, current, inputs ); - DALI_TEST_EQUALS( called, true, TEST_LOCATION ); + bool called = false; + TestFunctorMethod functor(called); + Constraint::Function callback(functor, &TestFunctorMethod::Method); + T current; + PropertyInputContainer inputs; + + DALI_TEST_EQUALS(called, false, TEST_LOCATION); + CallbackBase::Execute(callback, current, inputs); + DALI_TEST_EQUALS(called, true, TEST_LOCATION); } } // unnamed namespace int UtcDaliConstraintFunctionWithMethodFunctor(void) { - TestFunctorMethodConstructor< bool >(); - TestFunctorMethodConstructor< int >(); - TestFunctorMethodConstructor< unsigned int >(); - TestFunctorMethodConstructor< float >(); - TestFunctorMethodConstructor< Vector2 >(); - TestFunctorMethodConstructor< Vector3 >(); - TestFunctorMethodConstructor< Vector4 >(); - TestFunctorMethodConstructor< Quaternion >(); - TestFunctorMethodConstructor< Matrix >(); - TestFunctorMethodConstructor< Matrix3 >(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); + TestFunctorMethodConstructor(); END_TEST; } /////////////////////////////////////////////////////////////////////////////// @@ -187,53 +193,53 @@ int UtcDaliConstraintFunctionWithMethodFunctor(void) /////////////////////////////////////////////////////////////////////////////// namespace { -template< typename T > +template void TestFunctionClone() { gFunctionCalled = false; - Constraint::Function< T > callback( &TestCallbackFunction< T > ); - CallbackBase* clone = callback.Clone(); + Constraint::Function callback(&TestCallbackFunction); + CallbackBase* clone = callback.Clone(); - T current; + T current; PropertyInputContainer inputs; - DALI_TEST_EQUALS( gFunctionCalled, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs ); - DALI_TEST_EQUALS( gFunctionCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(gFunctionCalled, false, TEST_LOCATION); + CallbackBase::Execute(*clone, current, inputs); + DALI_TEST_EQUALS(gFunctionCalled, true, TEST_LOCATION); delete clone; } -template< typename T > +template void TestFunctorClone() { - bool called = false; - TestCallbackFunctor< T > functor( called ); - Constraint::Function< T > callback( functor ); - CallbackBase* clone = callback.Clone(); + bool called = false; + TestCallbackFunctor functor(called); + Constraint::Function callback(functor); + CallbackBase* clone = callback.Clone(); - T current; + T current; PropertyInputContainer inputs; - DALI_TEST_EQUALS( called, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs ); - DALI_TEST_EQUALS( called, true, TEST_LOCATION ); + DALI_TEST_EQUALS(called, false, TEST_LOCATION); + CallbackBase::Execute(*clone, current, inputs); + DALI_TEST_EQUALS(called, true, TEST_LOCATION); delete clone; } -template< typename T > +template void TestMethodFunctorClone() { - bool called = false; - TestFunctorMethod< T > functor( called ); - Constraint::Function< T > callback( functor, &TestFunctorMethod< T >::Method ); - CallbackBase* clone = callback.Clone(); + bool called = false; + TestFunctorMethod functor(called); + Constraint::Function callback(functor, &TestFunctorMethod::Method); + CallbackBase* clone = callback.Clone(); - T current; + T current; PropertyInputContainer inputs; - DALI_TEST_EQUALS( called, false, TEST_LOCATION ); - CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs ); - DALI_TEST_EQUALS( called, true, TEST_LOCATION ); + DALI_TEST_EQUALS(called, false, TEST_LOCATION); + CallbackBase::Execute(*clone, current, inputs); + DALI_TEST_EQUALS(called, true, TEST_LOCATION); delete clone; } @@ -241,46 +247,46 @@ void TestMethodFunctorClone() int UtcDaliConstraintFunctionFunctionClone(void) { - TestFunctionClone< bool >(); - TestFunctionClone< int >(); - TestFunctionClone< unsigned int >(); - TestFunctionClone< float >(); - TestFunctionClone< Vector2 >(); - TestFunctionClone< Vector3 >(); - TestFunctionClone< Vector4 >(); - TestFunctionClone< Quaternion >(); - TestFunctionClone< Matrix >(); - TestFunctionClone< Matrix3 >(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); + TestFunctionClone(); END_TEST; } int UtcDaliConstraintFunctionFunctorClone(void) { - TestFunctorClone< bool >(); - TestFunctorClone< int >(); - TestFunctorClone< unsigned int >(); - TestFunctorClone< float >(); - TestFunctorClone< Vector2 >(); - TestFunctorClone< Vector3 >(); - TestFunctorClone< Vector4 >(); - TestFunctorClone< Quaternion >(); - TestFunctorClone< Matrix >(); - TestFunctorClone< Matrix3 >(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); + TestFunctorClone(); END_TEST; } int UtcDaliConstraintFunctionMethodFunctorClone(void) { - TestMethodFunctorClone< bool >(); - TestMethodFunctorClone< int >(); - TestMethodFunctorClone< unsigned int >(); - TestMethodFunctorClone< float >(); - TestMethodFunctorClone< Vector2 >(); - TestMethodFunctorClone< Vector3 >(); - TestMethodFunctorClone< Vector4 >(); - TestMethodFunctorClone< Quaternion >(); - TestMethodFunctorClone< Matrix >(); - TestMethodFunctorClone< Matrix3 >(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); + TestMethodFunctorClone(); END_TEST; } /////////////////////////////////////////////////////////////////////////////// @@ -290,19 +296,19 @@ namespace { struct CountFunctor { - CountFunctor( int& count ) - : mCount( count ) + CountFunctor(int& count) + : mCount(count) { ++mCount; } - CountFunctor( const CountFunctor& other ) - : mCount( other.mCount ) + CountFunctor(const CountFunctor& other) + : mCount(other.mCount) { ++mCount; } - CountFunctor& operator=( const CountFunctor& other ) + CountFunctor& operator=(const CountFunctor& other) { this->mCount = other.mCount; ++mCount; @@ -314,7 +320,7 @@ struct CountFunctor --mCount; } - void operator()( bool& /* current*/ , const PropertyInputContainer& /* inputs */ ) + void operator()(bool& /* current*/, const PropertyInputContainer& /* inputs */) { } @@ -329,20 +335,20 @@ int UtcDaliConstraintFunctionEnsureMemoryCleanup(void) int count = 0; { - CountFunctor functor( count ); - Constraint::Function< bool > callback1( functor ); - Constraint::Function< bool > callback2( functor ); - Constraint::Function< bool > callback3( functor ); - Constraint::Function< bool > callback4( functor ); - Constraint::Function< bool > callback5( functor ); - Constraint::Function< bool > callback6( functor ); - Constraint::Function< bool > callback7( functor ); - Constraint::Function< bool > callback8( functor ); - Constraint::Function< bool > callback9( functor ); - DALI_TEST_EQUALS( count, 10, TEST_LOCATION ); + CountFunctor functor(count); + Constraint::Function callback1(functor); + Constraint::Function callback2(functor); + Constraint::Function callback3(functor); + Constraint::Function callback4(functor); + Constraint::Function callback5(functor); + Constraint::Function callback6(functor); + Constraint::Function callback7(functor); + Constraint::Function callback8(functor); + Constraint::Function callback9(functor); + DALI_TEST_EQUALS(count, 10, TEST_LOCATION); } - DALI_TEST_EQUALS( count, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(count, 0, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-ConstraintSource.cpp b/automated-tests/src/dali/utc-Dali-ConstraintSource.cpp index 59734b4..ebb4c8d 100644 --- a/automated-tests/src/dali/utc-Dali-ConstraintSource.cpp +++ b/automated-tests/src/dali/utc-Dali-ConstraintSource.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -40,9 +40,9 @@ void utc_dali_constraint_source_cleanup(void) /////////////////////////////////////////////////////////////////////////////// int UtcDaliLocalSource(void) { - LocalSource source( Actor::Property::POSITION ); + LocalSource source(Actor::Property::POSITION); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION ); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION); END_TEST; } @@ -54,9 +54,9 @@ int UtcDaliLocalSource(void) /////////////////////////////////////////////////////////////////////////////// int UtcDaliParentSource(void) { - ParentSource source( Actor::Property::POSITION ); + ParentSource source(Actor::Property::POSITION); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION ); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION); END_TEST; } @@ -68,11 +68,11 @@ int UtcDaliParentSource(void) /////////////////////////////////////////////////////////////////////////////// int UtcDaliSource1(void) { - Actor actor; - Source source( actor, Actor::Property::SIZE ); + Actor actor; + Source source(actor, Actor::Property::SIZE); - DALI_TEST_CHECK( ! source.object ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION ); + DALI_TEST_CHECK(!source.object); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION); END_TEST; } @@ -83,9 +83,9 @@ int UtcDaliSource2(void) Actor actor = Actor::New(); - Source source( actor, Actor::Property::SIZE ); - DALI_TEST_EQUALS( source.object, actor, TEST_LOCATION ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION ); + Source source(actor, Actor::Property::SIZE); + DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION); END_TEST; } @@ -98,10 +98,10 @@ int UtcDaliConstraintSourceWithSource1(void) { Actor actor; - ConstraintSource source( Source( actor, Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( ! source.object ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION ); - DALI_TEST_EQUALS( source.sourceType, OBJECT_PROPERTY, TEST_LOCATION ); + ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(!source.object); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION); + DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION); END_TEST; } @@ -112,10 +112,10 @@ int UtcDaliConstraintSourceWithSource2(void) Actor actor = Actor::New(); - ConstraintSource source( Source( actor, Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_EQUALS( source.object, actor, TEST_LOCATION ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION ); - DALI_TEST_EQUALS( source.sourceType, OBJECT_PROPERTY, TEST_LOCATION ); + ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN)); + DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION); + DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION); END_TEST; } @@ -124,10 +124,10 @@ int UtcDaliConstraintSourceWithLocalSource(void) { Actor actor; - ConstraintSource source( LocalSource( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( ! source.object ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION ); - DALI_TEST_EQUALS( source.sourceType, LOCAL_PROPERTY, TEST_LOCATION ); + ConstraintSource source(LocalSource(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(!source.object); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION); + DALI_TEST_EQUALS(source.sourceType, LOCAL_PROPERTY, TEST_LOCATION); END_TEST; } @@ -136,10 +136,10 @@ int UtcDaliConstraintSourceWithParentSource(void) { Actor actor; - ConstraintSource source( ParentSource( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( ! source.object ); - DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION ); - DALI_TEST_EQUALS( source.sourceType, PARENT_PROPERTY, TEST_LOCATION ); + ConstraintSource source(ParentSource(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(!source.object); + DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION); + DALI_TEST_EQUALS(source.sourceType, PARENT_PROPERTY, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Constraints.cpp b/automated-tests/src/dali/utc-Dali-Constraints.cpp index 9e0dfd2..23fb896 100644 --- a/automated-tests/src/dali/utc-Dali-Constraints.cpp +++ b/automated-tests/src/dali/utc-Dali-Constraints.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -38,64 +38,94 @@ void utc_dali_constraints_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - struct PropertyInputImpl : public PropertyInput { public: - // Constants - static const bool BOOLEAN_VALUE; - static const float FLOAT_VALUE; - static const int INTEGER_VALUE; - static const Vector2 VECTOR2_VALUE; - static const Vector3 VECTOR3_VALUE; - static const Vector4 VECTOR4_VALUE; - static const Matrix3 MATRIX3_VALUE; - static const Matrix MATRIX_VALUE; + static const bool BOOLEAN_VALUE; + static const float FLOAT_VALUE; + static const int INTEGER_VALUE; + static const Vector2 VECTOR2_VALUE; + static const Vector3 VECTOR3_VALUE; + static const Vector4 VECTOR4_VALUE; + static const Matrix3 MATRIX3_VALUE; + static const Matrix MATRIX_VALUE; static const Quaternion QUATERNION_VALUE; // Construction & Destruction - PropertyInputImpl( Property::Type type ) : mType( type ) { } - virtual ~PropertyInputImpl() { } + PropertyInputImpl(Property::Type type) + : mType(type) + { + } + virtual ~PropertyInputImpl() + { + } // Methods - Property::Type GetType() const { return mType; } + Property::Type GetType() const + { + return mType; + } // Virtual Methods - virtual const bool& GetBoolean() const { return BOOLEAN_VALUE; } - virtual const float& GetFloat() const { return FLOAT_VALUE; } - virtual const int& GetInteger() const { return INTEGER_VALUE; } - virtual const Vector2& GetVector2() const { return VECTOR2_VALUE; } - virtual const Vector3& GetVector3() const { return VECTOR3_VALUE; } - virtual const Vector4& GetVector4() const { return VECTOR4_VALUE; } - virtual const Matrix3& GetMatrix3() const { return MATRIX3_VALUE; } - virtual const Matrix& GetMatrix() const { return MATRIX_VALUE; } - virtual const Quaternion& GetQuaternion() const { return QUATERNION_VALUE; } + virtual const bool& GetBoolean() const + { + return BOOLEAN_VALUE; + } + virtual const float& GetFloat() const + { + return FLOAT_VALUE; + } + virtual const int& GetInteger() const + { + return INTEGER_VALUE; + } + virtual const Vector2& GetVector2() const + { + return VECTOR2_VALUE; + } + virtual const Vector3& GetVector3() const + { + return VECTOR3_VALUE; + } + virtual const Vector4& GetVector4() const + { + return VECTOR4_VALUE; + } + virtual const Matrix3& GetMatrix3() const + { + return MATRIX3_VALUE; + } + virtual const Matrix& GetMatrix() const + { + return MATRIX_VALUE; + } + virtual const Quaternion& GetQuaternion() const + { + return QUATERNION_VALUE; + } // Data Property::Type mType; }; -const bool PropertyInputImpl::BOOLEAN_VALUE = true; -const float PropertyInputImpl::FLOAT_VALUE = 123.0f; -const int PropertyInputImpl::INTEGER_VALUE = 456; -const Vector2 PropertyInputImpl::VECTOR2_VALUE = Vector2( 10.0f, 20.0f ); -const Vector3 PropertyInputImpl::VECTOR3_VALUE = Vector3( 30.0f, 40.0f, 50.0f ); -const Vector4 PropertyInputImpl::VECTOR4_VALUE = Vector4( 60.0f, 70.0f, 80.0f, 90.0f ); -const Matrix3 PropertyInputImpl::MATRIX3_VALUE ( 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, - 7.0f, 8.0f, 9.0f ); -const Matrix PropertyInputImpl::MATRIX_VALUE = Matrix::IDENTITY; -const Quaternion PropertyInputImpl::QUATERNION_VALUE ( 1.0f, 2.0f, 3.0f, 4.0f ); +const bool PropertyInputImpl::BOOLEAN_VALUE = true; +const float PropertyInputImpl::FLOAT_VALUE = 123.0f; +const int PropertyInputImpl::INTEGER_VALUE = 456; +const Vector2 PropertyInputImpl::VECTOR2_VALUE = Vector2(10.0f, 20.0f); +const Vector3 PropertyInputImpl::VECTOR3_VALUE = Vector3(30.0f, 40.0f, 50.0f); +const Vector4 PropertyInputImpl::VECTOR4_VALUE = Vector4(60.0f, 70.0f, 80.0f, 90.0f); +const Matrix3 PropertyInputImpl::MATRIX3_VALUE(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); +const Matrix PropertyInputImpl::MATRIX_VALUE = Matrix::IDENTITY; +const Quaternion PropertyInputImpl::QUATERNION_VALUE(1.0f, 2.0f, 3.0f, 4.0f); struct Vector3PropertyInput : public PropertyInputImpl { public: - // Construction & Destruction - Vector3PropertyInput( Vector3& value ) - : PropertyInputImpl( Property::VECTOR3 ), - mValue( value ) + Vector3PropertyInput(Vector3& value) + : PropertyInputImpl(Property::VECTOR3), + mValue(value) { } @@ -115,11 +145,10 @@ public: struct QuaternionPropertyInput : public PropertyInputImpl { public: - // Construction & Destruction - QuaternionPropertyInput( Quaternion& value ) - : PropertyInputImpl( Property::ROTATION ), - mValue( value ) + QuaternionPropertyInput(Quaternion& value) + : PropertyInputImpl(Property::ROTATION), + mValue(value) { } @@ -145,16 +174,16 @@ public: int UtcDaliConstraintsEqualToConstraintFloat(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::FLOAT ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::FLOAT); + inputs.PushBack(&input); float value = 0.0f; - DALI_TEST_CHECK( value != PropertyInputImpl::FLOAT_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::FLOAT_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::FLOAT_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::FLOAT_VALUE, TEST_LOCATION); END_TEST; } @@ -162,16 +191,16 @@ int UtcDaliConstraintsEqualToConstraintFloat(void) int UtcDaliConstraintsEqualToConstraintVector2(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR2 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR2); + inputs.PushBack(&input); Vector2 value; - DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR2_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR2_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR2_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR2_VALUE, TEST_LOCATION); END_TEST; } @@ -179,16 +208,16 @@ int UtcDaliConstraintsEqualToConstraintVector2(void) int UtcDaliConstraintsEqualToConstraintVector3(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR3 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR3); + inputs.PushBack(&input); Vector3 value; - DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR3_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR3_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE, TEST_LOCATION); END_TEST; } @@ -196,16 +225,16 @@ int UtcDaliConstraintsEqualToConstraintVector3(void) int UtcDaliConstraintsEqualToConstraintVector4(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR4 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR4); + inputs.PushBack(&input); Vector4 value; - DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR4_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR4_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR4_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR4_VALUE, TEST_LOCATION); END_TEST; } @@ -213,16 +242,16 @@ int UtcDaliConstraintsEqualToConstraintVector4(void) int UtcDaliConstraintsEqualToConstraintQuaternion(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::ROTATION ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::ROTATION); + inputs.PushBack(&input); Quaternion value; - DALI_TEST_CHECK( value != PropertyInputImpl::QUATERNION_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::QUATERNION_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::QUATERNION_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::QUATERNION_VALUE, TEST_LOCATION); END_TEST; } @@ -230,16 +259,16 @@ int UtcDaliConstraintsEqualToConstraintQuaternion(void) int UtcDaliConstraintsEqualToConstraintMatrix3(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::MATRIX3 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::MATRIX3); + inputs.PushBack(&input); Matrix3 value; - DALI_TEST_CHECK( value != PropertyInputImpl::MATRIX3_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::MATRIX3_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::MATRIX3_VALUE, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(value, PropertyInputImpl::MATRIX3_VALUE, 0.1f, TEST_LOCATION); END_TEST; } @@ -247,16 +276,16 @@ int UtcDaliConstraintsEqualToConstraintMatrix3(void) int UtcDaliConstraintsEqualToConstraintMatrix(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::MATRIX ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::MATRIX); + inputs.PushBack(&input); Matrix value; - DALI_TEST_CHECK( value != PropertyInputImpl::MATRIX_VALUE ); + DALI_TEST_CHECK(value != PropertyInputImpl::MATRIX_VALUE); EqualToConstraint constraint; - constraint( value, inputs ); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::MATRIX_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::MATRIX_VALUE, TEST_LOCATION); END_TEST; } @@ -268,17 +297,17 @@ int UtcDaliConstraintsEqualToConstraintMatrix(void) int UtcDaliConstraintsRelativeToConstraintUsingFloat(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR3 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR3); + inputs.PushBack(&input); Vector3 value; - DALI_TEST_EQUALS( value, Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(value, Vector3::ZERO, TEST_LOCATION); - const float scale( 4.0f ); - RelativeToConstraint constraint( scale ); - constraint( value, inputs ); + const float scale(4.0f); + RelativeToConstraint constraint(scale); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION); END_TEST; } @@ -286,17 +315,17 @@ int UtcDaliConstraintsRelativeToConstraintUsingFloat(void) int UtcDaliConstraintsRelativeToConstraintUsingVector3(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR3 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR3); + inputs.PushBack(&input); Vector3 value; - DALI_TEST_EQUALS( value, Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(value, Vector3::ZERO, TEST_LOCATION); - const Vector3 scale( 4.0f, 5.0f, 6.0f ); - RelativeToConstraint constraint( scale ); - constraint( value, inputs ); + const Vector3 scale(4.0f, 5.0f, 6.0f); + RelativeToConstraint constraint(scale); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION); END_TEST; } @@ -308,18 +337,18 @@ int UtcDaliConstraintsRelativeToConstraintUsingVector3(void) int UtcDaliConstraintsRelativeToConstraintFloat(void) { PropertyInputContainer inputs; - PropertyInputImpl input( Property::VECTOR3 ); - inputs.PushBack( &input ); + PropertyInputImpl input(Property::VECTOR3); + inputs.PushBack(&input); - const float scale( 4.0f ); + const float scale(4.0f); float value = 0.0f; - DALI_TEST_CHECK( value != PropertyInputImpl::FLOAT_VALUE * scale ); + DALI_TEST_CHECK(value != PropertyInputImpl::FLOAT_VALUE * scale); - RelativeToConstraintFloat constraint( scale ); - constraint( value, inputs ); + RelativeToConstraintFloat constraint(scale); + constraint(value, inputs); - DALI_TEST_EQUALS( value, PropertyInputImpl::FLOAT_VALUE * scale, TEST_LOCATION ); + DALI_TEST_EQUALS(value, PropertyInputImpl::FLOAT_VALUE * scale, TEST_LOCATION); END_TEST; } @@ -333,62 +362,62 @@ int UtcDaliConstraintsLookAt(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion::IDENTITY, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::WORLD_ORIENTATION), Quaternion::IDENTITY, TEST_LOCATION); - Vector3 targetPosition; - Vector3 cameraPosition; + Vector3 targetPosition; + Vector3 cameraPosition; Quaternion targetOrientation; - Vector3PropertyInput targetPositionProperty( targetPosition ); - Vector3PropertyInput cameraPositionProperty( cameraPosition ); - QuaternionPropertyInput targetOrientationProperty( targetOrientation ); + Vector3PropertyInput targetPositionProperty(targetPosition); + Vector3PropertyInput cameraPositionProperty(cameraPosition); + QuaternionPropertyInput targetOrientationProperty(targetOrientation); PropertyInputContainer inputs; - inputs.PushBack( &targetPositionProperty ); - inputs.PushBack( &cameraPositionProperty ); - inputs.PushBack( &targetOrientationProperty ); + inputs.PushBack(&targetPositionProperty); + inputs.PushBack(&cameraPositionProperty); + inputs.PushBack(&targetOrientationProperty); Quaternion current; // 180 degrees round y - targetPosition = Vector3::ZERO; - cameraPosition = Vector3( 0.0f, 0.0f, 1.0f ); + targetPosition = Vector3::ZERO; + cameraPosition = Vector3(0.0f, 0.0f, 1.0f); targetOrientation = Quaternion::IDENTITY; - Quaternion lookAtOrientation( Quaternion( Radian( Math::PI ), Vector3::YAXIS ) ); - LookAt( current, inputs ); - DALI_TEST_EQUALS( current, lookAtOrientation, TEST_LOCATION ); + Quaternion lookAtOrientation(Quaternion(Radian(Math::PI), Vector3::YAXIS)); + LookAt(current, inputs); + DALI_TEST_EQUALS(current, lookAtOrientation, TEST_LOCATION); // 180 degrees round y * -45 degrees round x - targetPosition = Vector3::ZERO; - cameraPosition = Vector3( 0.0f, -1.0f, 1.0f ); + targetPosition = Vector3::ZERO; + cameraPosition = Vector3(0.0f, -1.0f, 1.0f); targetOrientation = Quaternion::IDENTITY; - lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS ); - LookAt( current, inputs ); - DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS); + LookAt(current, inputs); + DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION); // 180 degrees round y * -45 degrees round x at different points - targetPosition = Vector3( 0.0f, 1.0f, -1.0f ); - cameraPosition = Vector3::ZERO; + targetPosition = Vector3(0.0f, 1.0f, -1.0f); + cameraPosition = Vector3::ZERO; targetOrientation = Quaternion::IDENTITY; - lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS ); - LookAt( current, inputs ); - DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS); + LookAt(current, inputs); + DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION); // 225 degrees round y - targetPosition = Vector3( -1.0f, 0.0f, 0.0f ); - cameraPosition = Vector3( 0.0f, 0.0f, 1.0f ); + targetPosition = Vector3(-1.0f, 0.0f, 0.0f); + cameraPosition = Vector3(0.0f, 0.0f, 1.0f); targetOrientation = Quaternion::IDENTITY; - lookAtOrientation = Quaternion( Radian( Math::PI * 1.25), Vector3::YAXIS ); - LookAt( current, inputs ); - DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + lookAtOrientation = Quaternion(Radian(Math::PI * 1.25), Vector3::YAXIS); + LookAt(current, inputs); + DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION); // 180 degrees round y * -45 degrees round x, Up Vector: 180 degrees - targetPosition = Vector3::ZERO; - cameraPosition = Vector3( 0.0f, -1.0f, 1.0f ); - targetOrientation = Quaternion( Radian( Math::PI ), Vector3::ZAXIS ); - lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS ) * Quaternion( Radian( Math::PI ), -Vector3::ZAXIS ); - LookAt( current, inputs ); - DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + targetPosition = Vector3::ZERO; + cameraPosition = Vector3(0.0f, -1.0f, 1.0f); + targetOrientation = Quaternion(Radian(Math::PI), Vector3::ZAXIS); + lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS) * Quaternion(Radian(Math::PI), -Vector3::ZAXIS); + LookAt(current, inputs); + DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION); END_TEST; } @@ -396,7 +425,7 @@ int UtcDaliConstraintsLookAt(void) int UtcDaliPropertyInputGetExtension(void) { - PropertyInputImpl input( Property::BOOLEAN ); - DALI_TEST_CHECK( input.GetExtension() == NULL ); + PropertyInputImpl input(Property::BOOLEAN); + DALI_TEST_CHECK(input.GetExtension() == NULL); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Context.cpp b/automated-tests/src/dali/utc-Dali-Context.cpp index 711e4cf..3581e59 100644 --- a/automated-tests/src/dali/utc-Dali-Context.cpp +++ b/automated-tests/src/dali/utc-Dali-Context.cpp @@ -15,14 +15,13 @@ * */ -#include - -#include -#include #include +#include +#include -using namespace Dali; +#include +using namespace Dali; namespace { @@ -46,14 +45,13 @@ enum TestAttribType static Actor CreateBitmapActor() { Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::NAME,"Test Image Rendering Actor"); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::NAME, "Test Image Rendering Actor"); return actor; } } // anonymous namespace - // Positive test case for a method int UtcDaliContextVertexAttribStartup(void) { @@ -67,9 +65,9 @@ int UtcDaliContextVertexAttribStartup(void) application.Render(); // check the locations - for (unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++) + for(unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++) { - DALI_TEST_CHECK( application.GetGlAbstraction().GetVertexAttribArrayState(i) == false); + DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayState(i) == false); } tet_result(TET_PASS); @@ -92,12 +90,10 @@ int UtcDaliContextVertexAttribImageRendering(void) // clear the flag to say they've changed application.GetGlAbstraction().ClearVertexAttribArrayChanged(); - // create a test bitmap actor Actor actor(CreateBitmapActor()); application.GetScene().Add(actor); - application.SendNotification(); application.Render(); application.Render(); @@ -116,7 +112,6 @@ int UtcDaliContextVertexAttribImageRendering(void) // if it has changed then the caching has failed DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayChanged() == false); - tet_result(TET_PASS); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Core.cpp b/automated-tests/src/dali/utc-Dali-Core.cpp index 51abda3..67d14a5 100644 --- a/automated-tests/src/dali/utc-Dali-Core.cpp +++ b/automated-tests/src/dali/utc-Dali-Core.cpp @@ -15,13 +15,13 @@ * */ +#include +#include +#include + +#include // isfinite #include #include -#include // isfinite - -#include -#include -#include using namespace Dali; @@ -40,13 +40,13 @@ int UtcDaliCoreGetMaximumUpdateCount(void) TestApplication application; tet_infoline("Testing Dali::GetMaximumUpdateCount"); - DALI_TEST_EQUALS( 2, application.GetCore().GetMaximumUpdateCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(2, application.GetCore().GetMaximumUpdateCount(), TEST_LOCATION); END_TEST; } int UtcDaliCoreGetObjectRegistry(void) { TestApplication application; - DALI_TEST_CHECK( application.GetCore().GetObjectRegistry() ); + DALI_TEST_CHECK(application.GetCore().GetObjectRegistry()); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-CustomActor.cpp b/automated-tests/src/dali/utc-Dali-CustomActor.cpp index 47bacfb..6dd051c 100644 --- a/automated-tests/src/dali/utc-Dali-CustomActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CustomActor.cpp @@ -15,22 +15,22 @@ * */ -#include -#include -#include - #include -#include #include -#include #include +#include +#include +#include #include +#include + +#include + #include "dali-test-suite-utils/dali-test-suite-utils.h" #include "test-custom-actor.h" using namespace Dali; - void custom_actor_test_startup(void) { test_return_value = TET_UNDEF; @@ -41,11 +41,8 @@ void custom_actor_test_cleanup(void) test_return_value = TET_PASS; } - - using namespace Dali; - int UtcDaliCustomActorDestructor(void) { TestApplication application; @@ -53,17 +50,17 @@ int UtcDaliCustomActorDestructor(void) CustomActor* actor = new CustomActor(); delete actor; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } int UtcDaliCustomActorImplDestructor(void) { - TestApplication application; + TestApplication application; CustomActorImpl* actor = new Test::Impl::TestCustomActor(); - CustomActor customActor( *actor ); // Will automatically unref at the end of this function + CustomActor customActor(*actor); // Will automatically unref at the end of this function - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -76,17 +73,17 @@ int UtcDaliCustomActorDownCast(void) Test::TestCustomActor custom = Test::TestCustomActor::New(); Actor anActor = Actor::New(); - anActor.Add( custom ); + anActor.Add(custom); - Actor child = anActor.GetChildAt(0); - CustomActor customActor = CustomActor::DownCast( child ); - DALI_TEST_CHECK( customActor ); + Actor child = anActor.GetChildAt(0); + CustomActor customActor = CustomActor::DownCast(child); + DALI_TEST_CHECK(customActor); customActor = NULL; - DALI_TEST_CHECK( !customActor ); + DALI_TEST_CHECK(!customActor); - customActor = DownCast< CustomActor >( child ); - DALI_TEST_CHECK( customActor ); + customActor = DownCast(child); + DALI_TEST_CHECK(customActor); END_TEST; } @@ -96,20 +93,20 @@ int UtcDaliCustomActorDownCastNegative(void) TestApplication application; tet_infoline("Testing Dali::CustomActor::DownCast()"); - Actor actor1 = Actor::New(); + Actor actor1 = Actor::New(); Actor anActor = Actor::New(); anActor.Add(actor1); - Actor child = anActor.GetChildAt(0); - CustomActor customActor = CustomActor::DownCast( child ); - DALI_TEST_CHECK( !customActor ); + Actor child = anActor.GetChildAt(0); + CustomActor customActor = CustomActor::DownCast(child); + DALI_TEST_CHECK(!customActor); Actor unInitialzedActor; - customActor = CustomActor::DownCast( unInitialzedActor ); - DALI_TEST_CHECK( !customActor ); + customActor = CustomActor::DownCast(unInitialzedActor); + DALI_TEST_CHECK(!customActor); - customActor = DownCast< CustomActor >( unInitialzedActor ); - DALI_TEST_CHECK( !customActor ); + customActor = DownCast(unInitialzedActor); + DALI_TEST_CHECK(!customActor); END_TEST; } @@ -118,16 +115,16 @@ int UtcDaliCustomActorMoveConstructor(void) TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_CHECK( custom ); - DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(custom); + DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION); - int id = custom.GetProperty< int >( Actor::Property::ID ); + int id = custom.GetProperty(Actor::Property::ID); - Test::TestCustomActor moved = std::move( custom ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !custom ); + Test::TestCustomActor moved = std::move(custom); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!custom); END_TEST; } @@ -137,17 +134,17 @@ int UtcDaliCustomActorMoveAssignment(void) TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_CHECK( custom ); - DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(custom); + DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION); - int id = custom.GetProperty< int >( Actor::Property::ID ); + int id = custom.GetProperty(Actor::Property::ID); Test::TestCustomActor moved; - moved = std::move( custom ); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !custom ); + moved = std::move(custom); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(id, moved.GetProperty(Actor::Property::ID), TEST_LOCATION); + DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!custom); END_TEST; } @@ -158,18 +155,18 @@ int UtcDaliCustomActorOnSceneConnectionDisconnection(void) tet_infoline("Testing Dali::CustomActor::OnSceneConnection() & OnSceneDisconnection"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); // add the custom actor to stage - application.GetScene().Add( custom ); + application.GetScene().Add(custom); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", custom.GetMethodsCalled()[0], TEST_LOCATION); - application.GetScene().Remove( custom ); + application.GetScene().Remove(custom); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", custom.GetMethodsCalled()[1], TEST_LOCATION); // Excercise the message passing to Update thread @@ -198,83 +195,83 @@ int UtcDaliCustomActorOnSceneConnectionOrder(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::New(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); Test::TestCustomActor actorC = Test::TestCustomActor::New(); - actorC.SetProperty( Actor::Property::NAME, "ActorC" ); - actorA.Add( actorC ); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); Test::TestCustomActor actorD = Test::TestCustomActor::New(); - actorD.SetProperty( Actor::Property::NAME, "ActorD" ); - actorB.Add( actorD ); + actorD.SetProperty(Actor::Property::NAME, "ActorD"); + actorB.Add(actorD); Test::TestCustomActor actorE = Test::TestCustomActor::New(); - actorE.SetProperty( Actor::Property::NAME, "ActorE" ); - actorB.Add( actorE ); + actorE.SetProperty(Actor::Property::NAME, "ActorE"); + actorB.Add(actorE); Test::TestCustomActor actorF = Test::TestCustomActor::New(); - actorF.SetProperty( Actor::Property::NAME, "ActorF" ); - actorC.Add( actorF ); + actorF.SetProperty(Actor::Property::NAME, "ActorF"); + actorC.Add(actorF); // add the custom actor to stage - application.GetScene().Add( actorA ); + application.GetScene().Add(actorA); - DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorC.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorC.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorC.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorC.GetMethodsCalled()[2], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorD.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorD.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorD.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorE.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorE.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorE.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorF.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorF.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorF.GetMethodsCalled()[1], TEST_LOCATION); // Check sequence is correct in MasterCallStack - DALI_TEST_EQUALS( 4+4+3+2+2+2, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(4 + 4 + 3 + 2 + 2 + 2, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorD: OnPropertySet", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorD: OnPropertySet", MasterCallStack[5], TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 6 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorE: OnPropertySet", MasterCallStack[ 7 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 8 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorF: OnPropertySet", MasterCallStack[ 9 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnChildAdd", MasterCallStack[ 10 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnPropertySet", MasterCallStack[7], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[8], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnPropertySet", MasterCallStack[9], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnChildAdd", MasterCallStack[10], TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 11 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 12 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorD: OnSceneConnection", MasterCallStack[ 13 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorE: OnSceneConnection", MasterCallStack[ 14 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnSceneConnection", MasterCallStack[ 15 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorF: OnSceneConnection", MasterCallStack[ 16 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[11], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[12], TEST_LOCATION); + DALI_TEST_EQUALS("ActorD: OnSceneConnection", MasterCallStack[13], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnSceneConnection", MasterCallStack[14], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnSceneConnection", MasterCallStack[15], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnSceneConnection", MasterCallStack[16], TEST_LOCATION); // Excercise the message passing to Update thread @@ -303,28 +300,28 @@ int UtcDaliCustomActorOnSceneDisconnectionOrder(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::New(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - stage.Add( actorA ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); Test::TestCustomActor actorC = Test::TestCustomActor::New(); - actorC.SetProperty( Actor::Property::NAME, "ActorC" ); - actorA.Add( actorC ); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); Test::TestCustomActor actorD = Test::TestCustomActor::New(); - actorD.SetProperty( Actor::Property::NAME, "ActorD" ); - actorB.Add( actorD ); + actorD.SetProperty(Actor::Property::NAME, "ActorD"); + actorB.Add(actorD); Test::TestCustomActor actorE = Test::TestCustomActor::New(); - actorE.SetProperty( Actor::Property::NAME, "ActorE" ); - actorB.Add( actorE ); + actorE.SetProperty(Actor::Property::NAME, "ActorE"); + actorB.Add(actorE); Test::TestCustomActor actorF = Test::TestCustomActor::New(); - actorF.SetProperty( Actor::Property::NAME, "ActorF" ); - actorC.Add( actorF ); + actorF.SetProperty(Actor::Property::NAME, "ActorF"); + actorC.Add(actorF); // Excercise the message passing to Update thread @@ -341,36 +338,36 @@ int UtcDaliCustomActorOnSceneDisconnectionOrder(void) actorF.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); - DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorC.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorD.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorE.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorF.GetMethodsCalled()[0], TEST_LOCATION); // Check sequence is correct in MasterCallStack - DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorD: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorE: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorF: OnSceneDisconnection", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnSceneDisconnection", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorD: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorE: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorF: OnSceneDisconnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnSceneDisconnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -394,30 +391,30 @@ int UtcDaliCustomActorAddDuringOnSceneConnection(void) */ Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); - Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1( actorB ); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // Called from within OnSceneConnection() + DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); // Called from within OnSceneConnection() - DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(5, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnSceneConnection() - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnSceneConnection() + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); // Occurs during Actor::Add from within from within OnSceneConnection() + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); // Occurs after Actor::Add from within from within OnSceneConnection() // Excercise the message passing to Update thread @@ -427,7 +424,7 @@ int UtcDaliCustomActorAddDuringOnSceneConnection(void) // Check everything is ok after Actors are removed - stage.Remove( actorA ); + stage.Remove(actorA); application.SendNotification(); application.Render(); application.Render(); @@ -448,44 +445,44 @@ int UtcDaliCustomActorRemoveDuringOnSceneConnection(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant2(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); Test::TestCustomActor actorC = Test::TestCustomActor::New(); - actorC.SetProperty( Actor::Property::NAME, "ActorC" ); - actorA.Add( actorC ); + actorC.SetProperty(Actor::Property::NAME, "ActorC"); + actorA.Add(actorC); - stage.Add( actorA ); + stage.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnSceneConnection() - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 5 ], TEST_LOCATION ); // Called from within OnSceneConnection() - - DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION ); - - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorC: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 5 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 6 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 7 ], TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // Called from within OnSceneConnection() + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[5], TEST_LOCATION); // Called from within OnSceneConnection() + + DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION); + + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[5], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION); /* Actors B & C should be removed before the point where they could receive an OnSceneConnection callback * Therefore they shouldn't receive either OnSceneConnection or OnSceneDisconnection */ - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION); // Excercise the message passing to Update thread @@ -495,7 +492,7 @@ int UtcDaliCustomActorRemoveDuringOnSceneConnection(void) // Check everything is ok after last actor is removed - stage.Remove( actorA ); + stage.Remove(actorA); application.SendNotification(); application.Render(); application.Render(); @@ -514,11 +511,11 @@ int UtcDaliCustomActorAddDuringOnSceneDisconnection(void) */ Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); - Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3( actorB ); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); // Excercise the message passing to Update thread @@ -531,21 +528,21 @@ int UtcDaliCustomActorAddDuringOnSceneDisconnection(void) actorB.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); // Child was added after parent disconnection, so should not receive OnSceneConnection() - DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION); // Excercise the message passing to Update thread @@ -567,12 +564,12 @@ int UtcDaliCustomActorRemoveDuringOnSceneDisconnection(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant4(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - stage.Add( actorA ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); // Excercise the message passing to Update thread @@ -585,22 +582,22 @@ int UtcDaliCustomActorRemoveDuringOnSceneDisconnection(void) actorB.ResetCallStack(); MasterCallStack.clear(); - stage.Remove( actorA ); + stage.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[2], TEST_LOCATION); // Excercise the message passing to Update thread @@ -625,34 +622,34 @@ int UtcDaliCustomActorRemoveParentDuringOnSceneConnection(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::New(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant5(scene); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - scene.Add( actorA ); + scene.Add(actorA); // Check callback sequence - DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); - DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -677,36 +674,36 @@ int UtcDaliCustomActorAddParentDuringOnSceneDisconnection(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::New(); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - scene.Add( actorA ); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + scene.Add(actorA); Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant6(scene); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); - scene.Remove( actorA ); + scene.Remove(actorA); // Check callback sequence - DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); - DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION); // Disconnect was interrupted, so we should only get one OnSceneConnection() for actorB - DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION); // Excercise the message passing to Update thread @@ -722,18 +719,18 @@ int UtcDaliCustomActorOnChildAddRemove(void) tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); Actor aChild = Actor::New(); - custom.Add( aChild ); + custom.Add(aChild); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", custom.GetMethodsCalled()[0], TEST_LOCATION); - custom.Remove( aChild ); + custom.Remove(aChild); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", custom.GetMethodsCalled()[1], TEST_LOCATION); END_TEST; } @@ -750,12 +747,12 @@ int UtcDaliCustomActorReparentDuringOnChildAdd(void) * The actorB is the child of actorA */ - Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7( "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7("ActorA"); + stage.Add(actorA); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + actorA.Add(actorB); // Check hierarchy is as follows: // A @@ -764,53 +761,53 @@ int UtcDaliCustomActorReparentDuringOnChildAdd(void) // | // B - DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(actorA.GetChildCount()), TEST_LOCATION); Actor container = actorA.GetChildAt(0); Actor containerChild; - DALI_TEST_CHECK( container ); - if ( container ) + DALI_TEST_CHECK(container); + if(container) { - DALI_TEST_EQUALS( "Container", container.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS("Container", container.GetProperty(Actor::Property::NAME), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(container.GetChildCount()), TEST_LOCATION); containerChild = container.GetChildAt(0); } - DALI_TEST_CHECK( containerChild ); - if ( containerChild ) + DALI_TEST_CHECK(containerChild); + if(containerChild) { - DALI_TEST_EQUALS( "ActorB", containerChild.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB", containerChild.GetProperty(Actor::Property::NAME), TEST_LOCATION); + DALI_TEST_EQUALS(0, (int)(containerChild.GetChildCount()), TEST_LOCATION); } // Check callback sequence - DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); + DALI_TEST_EQUALS(5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // mContainer will then receive OnChildAdd - DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 9, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(9, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 5 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 6 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 7 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 8 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[5], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[8], TEST_LOCATION); // Excercise the message passing to Update thread @@ -839,63 +836,63 @@ int UtcDaliCustomActorRemoveDuringOnChildRemove(void) */ Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorB.SetProperty( Actor::Property::NAME, "ActorB" ); - stage.Add( actorB ); + actorB.SetProperty(Actor::Property::NAME, "ActorB"); + stage.Add(actorB); - Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8( actorB ); - actorA.SetProperty( Actor::Property::NAME, "ActorA" ); - stage.Add( actorA ); + Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8(actorB); + actorA.SetProperty(Actor::Property::NAME, "ActorA"); + stage.Add(actorA); Actor childActor = Actor::New(); - childActor.SetProperty( Actor::Property::NAME, "Child" ); + childActor.SetProperty(Actor::Property::NAME, "Child"); // Reparent from actorA to actorB - actorA.Add( childActor ); - actorB.Add( childActor ); + actorA.Add(childActor); + actorB.Add(childActor); // Check hierarchy is as follows: // A B // | // Child - DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(actorA.GetChildCount()), TEST_LOCATION); + DALI_TEST_EQUALS(1, (int)(actorB.GetChildCount()), TEST_LOCATION); + DALI_TEST_EQUALS(0, (int)(childActor.GetChildCount()), TEST_LOCATION); Actor child = actorB.GetChildAt(0); - DALI_TEST_CHECK( child ); - if ( child ) + DALI_TEST_CHECK(child); + if(child) { - DALI_TEST_EQUALS( "Child", child.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION ); + DALI_TEST_EQUALS("Child", child.GetProperty(Actor::Property::NAME), TEST_LOCATION); } // Check callback sequence - DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA - DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA + DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA + DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA // mContainer will then receive OnChildAdd - DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION); // The derived class are always notified, no matter the child is successfully removed or not - DALI_TEST_EQUALS( "OnChildRemove", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION ); + DALI_TEST_EQUALS("OnChildRemove", actorB.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[3], TEST_LOCATION); - DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION ); + DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION); - DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 5 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[1], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[2], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); + DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[5], TEST_LOCATION); // The derived class are always notified, no matter the child is successfully removed or not - DALI_TEST_EQUALS( "ActorB: OnChildRemove", MasterCallStack[ 6 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 7 ], TEST_LOCATION ); + DALI_TEST_EQUALS("ActorB: OnChildRemove", MasterCallStack[6], TEST_LOCATION); + DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[7], TEST_LOCATION); // Excercise the message passing to Update thread @@ -911,12 +908,12 @@ int UtcDaliCustomActorOnPropertySet(void) tet_infoline("Testing Dali::CustomActor::OnPropertySet()"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); custom.SetDaliProperty("yes"); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[0], TEST_LOCATION); END_TEST; } @@ -926,22 +923,22 @@ int UtcDaliCustomActorOnSizeSet(void) tet_infoline("Testing Dali::CustomActor::OnSizeSet()"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - - custom.SetProperty( Actor::Property::SIZE, Vector2( 9.0f, 10.0f ) ); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION ); - - custom.SetProperty( Actor::Property::SIZE, Vector3( 4.0f, 5.0f, 6.0f ) ); - DALI_TEST_EQUALS( 4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION ); - DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 3 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION ); - DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + + custom.SetProperty(Actor::Property::SIZE, Vector2(9.0f, 10.0f)); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[1], TEST_LOCATION); + DALI_TEST_EQUALS(9.0f, custom.GetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, custom.GetSize().height, TEST_LOCATION); + + custom.SetProperty(Actor::Property::SIZE, Vector3(4.0f, 5.0f, 6.0f)); + DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[2], TEST_LOCATION); + DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[3], TEST_LOCATION); + DALI_TEST_EQUALS(4.0f, custom.GetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(5.0f, custom.GetSize().height, TEST_LOCATION); + DALI_TEST_EQUALS(6.0f, custom.GetSize().depth, TEST_LOCATION); END_TEST; } @@ -951,20 +948,20 @@ int UtcDaliCustomActorOnSizeAnimation(void) tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - Animation anim = Animation::New( 1.0f ); - anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) ); + Animation anim = Animation::New(1.0f); + anim.AnimateTo(Property(custom, Actor::Property::SIZE), Vector3(8.0f, 9.0f, 10.0f)); anim.Play(); application.SendNotification(); - application.Render( static_cast( 1000.0f ) ); + application.Render(static_cast(1000.0f)); - DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION ); - DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION ); + DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[0], TEST_LOCATION); + DALI_TEST_EQUALS(8.0f, custom.GetTargetSize().width, TEST_LOCATION); + DALI_TEST_EQUALS(9.0f, custom.GetTargetSize().height, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, custom.GetTargetSize().depth, TEST_LOCATION); END_TEST; } @@ -974,40 +971,40 @@ int UtcDaliCustomActorSizeComponentAnimation(void) tet_infoline("Testing Size component animation"); Test::TestCustomActor custom = Test::TestCustomActor::New(); - float intialWidth( 10.0f ); + float intialWidth(10.0f); - DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - custom.SetProperty( Actor::Property::SIZE, Vector2( intialWidth, 10.0f) ); // First method + DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); + custom.SetProperty(Actor::Property::SIZE, Vector2(intialWidth, 10.0f)); // First method - Animation anim = Animation::New( 1.0f ); + Animation anim = Animation::New(1.0f); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - anim.AnimateTo( Property( custom, Actor::Property::SIZE_WIDTH ), 20.0f ); + anim.AnimateTo(Property(custom, Actor::Property::SIZE_WIDTH), 20.0f); - DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - anim.Play(); // Triggers second method ( OnSizeAnimation ) + anim.Play(); // Triggers second method ( OnSizeAnimation ) application.SendNotification(); - application.Render( static_cast( 1000.0f ) ); + application.Render(static_cast(1000.0f)); - DALI_TEST_EQUALS( 3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); + DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION); - DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[2], TEST_LOCATION); END_TEST; } int UtcDaliCustomActorImplOnPropertySet(void) { - TestApplication application; + TestApplication application; CustomActorImpl* impl = new Test::Impl::SimpleTestCustomActor(); - CustomActor customActor( *impl ); // Will automatically unref at the end of this function + CustomActor customActor(*impl); // Will automatically unref at the end of this function - impl->OnPropertySet( 0, 0 ); + impl->OnPropertySet(0, 0); - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -1017,14 +1014,14 @@ int UtcDaliCustomActorGetImplementation(void) TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::New(); - CustomActorImpl& impl = custom.GetImplementation(); - impl.GetOwner(); // Test + CustomActorImpl& impl = custom.GetImplementation(); + impl.GetOwner(); // Test const Test::TestCustomActor constCustom = Test::TestCustomActor::New(); - const CustomActorImpl& constImpl = constCustom.GetImplementation(); - constImpl.GetOwner(); // Test + const CustomActorImpl& constImpl = constCustom.GetImplementation(); + constImpl.GetOwner(); // Test - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -1045,8 +1042,8 @@ int UtcDaliCustomActorDoAction(void) DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false); // Check that the custom actor is visible - custom.SetProperty( Actor::Property::VISIBLE,true); - DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + custom.SetProperty(Actor::Property::VISIBLE, true); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == true); // Check the custom actor performed an action to hide itself DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true); @@ -1056,7 +1053,7 @@ int UtcDaliCustomActorDoAction(void) application.Render(); // Check that the custom actor is now invisible - DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == false); // Check the custom actor performed an action to show itself DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true); @@ -1066,16 +1063,16 @@ int UtcDaliCustomActorDoAction(void) application.Render(); // Check that the custom actor is now visible - DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true); + DALI_TEST_CHECK(custom.GetCurrentProperty(Actor::Property::VISIBLE) == true); END_TEST; } int UtcDaliCustomActorCustomActor(void) { Dali::CustomActor customA; - Dali::CustomActor customB( customA ); + Dali::CustomActor customB(customA); - DALI_TEST_CHECK( customA == customB ); + DALI_TEST_CHECK(customA == customB); END_TEST; } @@ -1084,7 +1081,7 @@ int UtcDaliCustomActorImplRelayoutRequest(void) { TestApplication application; - DALI_TEST_CHECK( gOnRelayout == false ); + DALI_TEST_CHECK(gOnRelayout == false); Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); application.GetScene().Add(custom); @@ -1092,21 +1089,21 @@ int UtcDaliCustomActorImplRelayoutRequest(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gOnRelayout == true ); + DALI_TEST_CHECK(gOnRelayout == true); gOnRelayout = false; custom.TestRelayoutRequest(); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gOnRelayout == true ); + DALI_TEST_CHECK(gOnRelayout == true); END_TEST; } int UtcDaliCustomActorImplGetHeightForWidthBase(void) { - TestApplication application; + TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); float width = 300.0f; @@ -1114,16 +1111,16 @@ int UtcDaliCustomActorImplGetHeightForWidthBase(void) application.SendNotification(); application.Render(); - float v = custom.TestGetHeightForWidthBase( width ); + float v = custom.TestGetHeightForWidthBase(width); - DALI_TEST_CHECK( v == width ); + DALI_TEST_CHECK(v == width); END_TEST; } int UtcDaliCustomActorImplGetWidthForHeightBase(void) { - TestApplication application; + TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); float height = 300.0f; @@ -1131,46 +1128,46 @@ int UtcDaliCustomActorImplGetWidthForHeightBase(void) application.SendNotification(); application.Render(); - float v = custom.TestGetWidthForHeightBase( height ); + float v = custom.TestGetWidthForHeightBase(height); - DALI_TEST_CHECK( v == height ); + DALI_TEST_CHECK(v == height); END_TEST; } int UtcDaliCustomActorImplCalculateChildSizeBase(void) { - TestApplication application; + TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); Actor child = Actor::New(); child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS); - child.SetProperty( Actor::Property::SIZE, Vector2( 150, 150 ) ); + child.SetProperty(Actor::Property::SIZE, Vector2(150, 150)); application.SendNotification(); application.Render(); - float v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS ); - DALI_TEST_CHECK( v == 0.0f ); + float v = custom.TestCalculateChildSizeBase(child, Dali::Dimension::ALL_DIMENSIONS); + DALI_TEST_CHECK(v == 0.0f); END_TEST; } int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void) { - TestApplication application; + TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize(); custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS); - bool v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS ); - DALI_TEST_CHECK( v == true ); + bool v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS); + DALI_TEST_CHECK(v == true); application.SendNotification(); application.Render(); custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS); - v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH ); - DALI_TEST_CHECK( v == false ); + v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH); + DALI_TEST_CHECK(v == false); // why is this here? application.SendNotification(); @@ -1185,8 +1182,8 @@ int UtcDaliCustomActorTypeRegistry(void) // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "CustomActor" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("CustomActor"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); std::string name; @@ -1197,23 +1194,22 @@ int UtcDaliCustomActorTypeRegistry(void) name = handle.GetTypeName(); tet_result(TET_FAIL); } - catch( DaliException& e ) + catch(DaliException& e) { exception = e.condition; - DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION ); + DALI_TEST_EQUALS(exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION); } END_TEST; } - int UtcDaliCustomActorGetExtensionP(void) { TestApplication application; Test::TestCustomActor custom = Test::TestCustomActor::NewVariant5(application.GetScene()); - DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() ); + DALI_TEST_CHECK(NULL == custom.GetImplementation().GetExtension()); END_TEST; } @@ -1239,75 +1235,73 @@ int UtcDaliCustomActorOnConnectionDepth(void) */ Test::TestCustomActor actorA = Test::TestCustomActor::New(); - stage.Add( actorA ); + stage.Add(actorA); Test::TestCustomActor actorB = Test::TestCustomActor::New(); - actorA.Add( actorB ); + actorA.Add(actorB); Test::TestCustomActor actorC = Test::TestCustomActor::New(); - actorA.Add( actorC ); + actorA.Add(actorC); Test::TestCustomActor actorD = Test::TestCustomActor::New(); - actorB.Add( actorD ); + actorB.Add(actorD); Test::TestCustomActor actorE = Test::TestCustomActor::New(); - actorB.Add( actorE ); + actorB.Add(actorE); Test::TestCustomActor actorF = Test::TestCustomActor::New(); - actorC.Add( actorF ); + actorC.Add(actorF); // Excercise the message passing to Update thread application.SendNotification(); application.Render(); application.Render(); - DALI_TEST_EQUALS( 1u, actorA.GetDepth(), TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, actorB.GetDepth(), TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, actorC.GetDepth(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, actorD.GetDepth(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, actorE.GetDepth(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, actorF.GetDepth(), TEST_LOCATION ); + DALI_TEST_EQUALS(1u, actorA.GetDepth(), TEST_LOCATION); + DALI_TEST_EQUALS(2u, actorB.GetDepth(), TEST_LOCATION); + DALI_TEST_EQUALS(2u, actorC.GetDepth(), TEST_LOCATION); + DALI_TEST_EQUALS(3u, actorD.GetDepth(), TEST_LOCATION); + DALI_TEST_EQUALS(3u, actorE.GetDepth(), TEST_LOCATION); + DALI_TEST_EQUALS(3u, actorF.GetDepth(), TEST_LOCATION); END_TEST; } - int UtcDaliCustomActorSetGetProperty(void) { TestApplication application; // Need the type registry Test::TestCustomActor actor = Test::TestCustomActor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f ); - actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE ); - actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE ); - actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20 ); - actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f ); + actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f); + actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f); - Property::Value value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1 ); - DALI_TEST_EQUALS( value.Get(), 0.5f, 0.001f, TEST_LOCATION ); + Property::Value value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1); + DALI_TEST_EQUALS(value.Get(), 0.5f, 0.001f, TEST_LOCATION); - value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2 ); - DALI_TEST_EQUALS( value.Get(), Color::WHITE, 0.001f, TEST_LOCATION ); + value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2); + DALI_TEST_EQUALS(value.Get(), Color::WHITE, 0.001f, TEST_LOCATION); + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3); + DALI_TEST_EQUALS(value.Get(), Color::BLUE, 0.001f, TEST_LOCATION); - value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3 ); - DALI_TEST_EQUALS( value.Get(), Color::BLUE, 0.001f, TEST_LOCATION ); + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4); + DALI_TEST_EQUALS(value.Get(), 20, TEST_LOCATION); - value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4 ); - DALI_TEST_EQUALS( value.Get(), 20, TEST_LOCATION ); - - value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5 ); - DALI_TEST_EQUALS( value.Get(), 40.0f, 0.001f, TEST_LOCATION ); + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5); + DALI_TEST_EQUALS(value.Get(), 40.0f, 0.001f, TEST_LOCATION); // Get read-only property - value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6 ); - DALI_TEST_EQUALS( value.Get(), 10.0f, 0.001f, TEST_LOCATION ); + value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6); + DALI_TEST_EQUALS(value.Get(), 10.0f, 0.001f, TEST_LOCATION); // Attempt to set read-only property and then ensure value hasn't changed - actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f ); - DALI_TEST_EQUALS( value.Get(), 10.0f, 0.001f, TEST_LOCATION ); + actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f); + DALI_TEST_EQUALS(value.Get(), 10.0f, 0.001f, TEST_LOCATION); END_TEST; } @@ -1315,13 +1309,13 @@ int UtcDaliCustomActorSetGetProperty(void) int utcDaliActorGetTypeInfo(void) { TestApplication application; - tet_infoline( "Get the type info of a derived actor" ); + tet_infoline("Get the type info of a derived actor"); Test::TestCustomActor customActor = Test::TestCustomActor::New(); - Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo( customActor ); + Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo(customActor); - DALI_TEST_EQUALS( typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION ); + DALI_TEST_EQUALS(typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION); END_TEST; } @@ -1333,79 +1327,111 @@ namespace Impl */ struct UnregisteredCustomActor : public Dali::CustomActorImpl { - UnregisteredCustomActor() : CustomActorImpl( ACTOR_BEHAVIOUR_DEFAULT ) - { } + UnregisteredCustomActor() + : CustomActorImpl(ACTOR_BEHAVIOUR_DEFAULT) + { + } virtual ~UnregisteredCustomActor() - { } - virtual void OnSceneConnection( int32_t depth ) - { } + { + } + virtual void OnSceneConnection(int32_t depth) + { + } virtual void OnSceneDisconnection() - { } + { + } virtual void OnChildAdd(Actor& child) - { } + { + } virtual void OnChildRemove(Actor& child) - { } - virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue ) - { } + { + } + virtual void OnPropertySet(Property::Index index, const Property::Value& propertyValue) + { + } virtual void OnSizeSet(const Vector3& targetSize) - { } + { + } virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) - { } + { + } virtual bool OnHoverEvent(const HoverEvent& event) - { return false; } + { + return false; + } virtual bool OnWheelEvent(const WheelEvent& event) - { return false; } - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) - { } - virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) - { } + { + return false; + } + virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) + { + } + virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) + { + } virtual Vector3 GetNaturalSize() - { return Vector3(); } - virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) - { return 0.f; } - virtual float GetHeightForWidth( float width ) - { return 0.f; } - virtual float GetWidthForHeight( float height ) - { return 0.f; } - virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) - { return false; } - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) - { } - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) - { } + { + return Vector3(); + } + virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) + { + return 0.f; + } + virtual float GetHeightForWidth(float width) + { + return 0.f; + } + virtual float GetWidthForHeight(float height) + { + return 0.f; + } + virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) + { + return false; + } + virtual void OnCalculateRelayoutSize(Dimension::Type dimension) + { + } + virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) + { + } }; -} +} // namespace Impl struct UnregisteredCustomActor : public Dali::CustomActor { static UnregisteredCustomActor New() { Impl::UnregisteredCustomActor* impl = new Impl::UnregisteredCustomActor; - UnregisteredCustomActor custom( *impl ); // takes ownership + UnregisteredCustomActor custom(*impl); // takes ownership return custom; } UnregisteredCustomActor() - { } + { + } ~UnregisteredCustomActor() - { } - UnregisteredCustomActor( Internal::CustomActor* impl ) - : CustomActor( impl ) - { } - UnregisteredCustomActor( Impl::UnregisteredCustomActor& impl ) - : CustomActor( impl ) - { } - static UnregisteredCustomActor DownCast( BaseHandle handle ) + { + } + UnregisteredCustomActor(Internal::CustomActor* impl) + : CustomActor(impl) + { + } + UnregisteredCustomActor(Impl::UnregisteredCustomActor& impl) + : CustomActor(impl) + { + } + static UnregisteredCustomActor DownCast(BaseHandle handle) { UnregisteredCustomActor hndl; - CustomActor custom = Dali::CustomActor::DownCast( handle ); - if( custom ) + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); - Impl::UnregisteredCustomActor* impl = dynamic_cast( &customImpl ); + Impl::UnregisteredCustomActor* impl = dynamic_cast(&customImpl); - if( impl ) + if(impl) { - hndl = UnregisteredCustomActor( customImpl.GetOwner() ); + hndl = UnregisteredCustomActor(customImpl.GetOwner()); } } return hndl; @@ -1417,47 +1443,45 @@ int UtcDaliCustomActorSetGetActorPropertyActionSignal(void) TestApplication application; // Need the type registry auto custom = UnregisteredCustomActor::New(); - application.GetScene().Add( custom ); + application.GetScene().Add(custom); // should have all actor properties - DALI_TEST_EQUALS( custom.GetPropertyType( Actor::Property::COLOR ), Property::VECTOR4, TEST_LOCATION ); + DALI_TEST_EQUALS(custom.GetPropertyType(Actor::Property::COLOR), Property::VECTOR4, TEST_LOCATION); auto actorHandle = Actor::New(); - DALI_TEST_EQUALS( custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION); - DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); - custom.SetProperty( Actor::Property::VISIBLE, false ); + DALI_TEST_EQUALS(custom.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); + custom.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); // IsVisible returns scene value - DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(custom.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); // should have custom actor typename (as it has not registered itself) - DALI_TEST_EQUALS( "CustomActor", custom.GetTypeName(), TEST_LOCATION ); + DALI_TEST_EQUALS("CustomActor", custom.GetTypeName(), TEST_LOCATION); // should have actor actions - custom.DoAction( "show", Property::Map() ); - DALI_TEST_EQUALS( custom.GetProperty( Actor::Property::VISIBLE ).Get(), true, TEST_LOCATION ); + custom.DoAction("show", Property::Map()); + DALI_TEST_EQUALS(custom.GetProperty(Actor::Property::VISIBLE).Get(), true, TEST_LOCATION); Animation animation = Animation::New(0.01f); // very short animation // should be able to animate actor property - animation.AnimateTo( Property( custom, Actor::Property::POSITION ), Vector3( 100.0f, 150.0f, 200.0f ) ); + animation.AnimateTo(Property(custom, Actor::Property::POSITION), Vector3(100.0f, 150.0f, 200.0f)); animation.Play(); application.SendNotification(); application.Render(1000.f); - DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetProperty( Actor::Property::POSITION ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetProperty(Actor::Property::POSITION).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetCurrentProperty(Actor::Property::POSITION), TEST_LOCATION); - Dali::WeakHandle weakRef( custom ); + Dali::WeakHandle weakRef(custom); // should have actor signals - custom.ConnectSignal( &application, "offScene", - [weakRef]() - { - DALI_TEST_EQUALS( weakRef.GetHandle().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ), false, TEST_LOCATION ); - } ); + custom.ConnectSignal(&application, "offScene", [weakRef]() { + DALI_TEST_EQUALS(weakRef.GetHandle().GetProperty(Actor::Property::CONNECTED_TO_SCENE), false, TEST_LOCATION); + }); - application.GetScene().Remove( custom ); - application.GetScene().Add( custom ); + application.GetScene().Remove(custom); + application.GetScene().Add(custom); END_TEST; } @@ -1465,31 +1489,36 @@ int UtcDaliCustomActorSetGetActorPropertyActionSignal(void) namespace Impl { struct DerivedCustomActor : public UnregisteredCustomActor -{ }; -} +{ +}; +} // namespace Impl struct DerivedCustomActor : public UnregisteredCustomActor { static DerivedCustomActor New() { Impl::DerivedCustomActor* impl = new Impl::DerivedCustomActor; - DerivedCustomActor custom( *impl ); // takes ownership + DerivedCustomActor custom(*impl); // takes ownership return custom; } DerivedCustomActor() - { } + { + } ~DerivedCustomActor() - { } - DerivedCustomActor( Internal::CustomActor* impl ) - : UnregisteredCustomActor( impl ) - { } - DerivedCustomActor( Impl::UnregisteredCustomActor& impl ) - : UnregisteredCustomActor( impl ) - { } + { + } + DerivedCustomActor(Internal::CustomActor* impl) + : UnregisteredCustomActor(impl) + { + } + DerivedCustomActor(Impl::UnregisteredCustomActor& impl) + : UnregisteredCustomActor(impl) + { + } }; // register custom -DALI_TYPE_REGISTRATION_BEGIN( DerivedCustomActor, UnregisteredCustomActor, nullptr ); +DALI_TYPE_REGISTRATION_BEGIN(DerivedCustomActor, UnregisteredCustomActor, nullptr); DALI_TYPE_REGISTRATION_END() int UtcDaliCustomActorPropertyRegistrationDefaultValue(void) @@ -1497,25 +1526,25 @@ int UtcDaliCustomActorPropertyRegistrationDefaultValue(void) TestApplication application; // Need the type registry // register our base and add a property with default value for it - Dali::TypeRegistration typeRegistration( typeid( UnregisteredCustomActor ), typeid( Dali::CustomActor ), nullptr ); + Dali::TypeRegistration typeRegistration(typeid(UnregisteredCustomActor), typeid(Dali::CustomActor), nullptr); auto derived = DerivedCustomActor::New(); - application.GetScene().Add( derived ); + application.GetScene().Add(derived); // should have all actor properties - DALI_TEST_EQUALS( derived.GetPropertyType( Actor::Property::WORLD_MATRIX ), Property::MATRIX, TEST_LOCATION ); + DALI_TEST_EQUALS(derived.GetPropertyType(Actor::Property::WORLD_MATRIX), Property::MATRIX, TEST_LOCATION); auto actorHandle = Actor::New(); - DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION); // add a property in base class - AnimatablePropertyRegistration( typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f ); + AnimatablePropertyRegistration(typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f); // should be one more property now - DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION ); + DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION); // check that the default value is set for base class - DALI_TEST_EQUALS( UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION); // check that the default value is set for the derived instance as well - DALI_TEST_EQUALS( derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS(derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get(), 10.f, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Degree.cpp b/automated-tests/src/dali/utc-Dali-Degree.cpp index eb64d9c..b5905ab 100644 --- a/automated-tests/src/dali/utc-Dali-Degree.cpp +++ b/automated-tests/src/dali/utc-Dali-Degree.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -33,64 +33,63 @@ void utc_dali_degree_cleanup(void) test_return_value = TET_PASS; } - // Positive test case for constructors int UtcDaliDegreeConstructors01(void) { TestApplication application; // Default constructor, does not initialise the value - Degree degree0( 0.0f ); + Degree degree0(0.0f); // Test assignment operator degree0 = Degree(180.0f); - DALI_TEST_EQUALS( degree0.degree, 180.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(degree0.degree, 180.0f, 0.001f, TEST_LOCATION); // Constructor from float value - Degree degree1( 180.0f ); - DALI_TEST_EQUALS( degree1.degree, 180.0f, 0.001f, TEST_LOCATION ); + Degree degree1(180.0f); + DALI_TEST_EQUALS(degree1.degree, 180.0f, 0.001f, TEST_LOCATION); // Constructor from a Radian - Degree degree2( Radian( Math::PI ) ); - DALI_TEST_EQUALS( degree2.degree, 180.0f, 0.001f, TEST_LOCATION ); + Degree degree2(Radian(Math::PI)); + DALI_TEST_EQUALS(degree2.degree, 180.0f, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliDegreeCopyConstructor(void) { - Degree degree0( 90.0f ); - Degree degree1( degree0 ); - DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION ); + Degree degree0(90.0f); + Degree degree1(degree0); + DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliDegreeMoveConstructor(void) { - Degree degree0( 90.0f ); - Degree degree1 = std::move( degree0 ); - DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION ); + Degree degree0(90.0f); + Degree degree1 = std::move(degree0); + DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliDegreeCopyAssignment(void) { - Degree degree0( 90.0f ); + Degree degree0(90.0f); Degree degree1; degree1 = degree0; - DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliDegreeMoveAssignment(void) { - Degree degree0( 90.0f ); + Degree degree0(90.0f); Degree degree1; - degree1 = std::move( degree0 ); - DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION ); + degree1 = std::move(degree0); + DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION); END_TEST; } @@ -101,26 +100,26 @@ int UtcDaliDegreeComparison01(void) TestApplication application; // Comparison between degrees - Degree degree0( 90.0f ); - Degree degree1( 90.0f ); - Degree degree2( 180.0f ); + Degree degree0(90.0f); + Degree degree1(90.0f); + Degree degree2(180.0f); - DALI_TEST_CHECK( degree0 == degree1 ); - DALI_TEST_CHECK( degree0 != degree2 ); + DALI_TEST_CHECK(degree0 == degree1); + DALI_TEST_CHECK(degree0 != degree2); // Comparison between radian to degree - Degree degree3( 180.0f ); - Degree degree4( 90.0f ); - Radian radian0( Math::PI ); + Degree degree3(180.0f); + Degree degree4(90.0f); + Radian radian0(Math::PI); - DALI_TEST_CHECK( degree3 == Degree(radian0) ); - DALI_TEST_CHECK( degree4 != Degree(radian0) ); + DALI_TEST_CHECK(degree3 == Degree(radian0)); + DALI_TEST_CHECK(degree4 != Degree(radian0)); // Comparison with float - Degree degree5( 90.0f ); + Degree degree5(90.0f); - DALI_TEST_CHECK( degree5.degree == 90.0f ); - DALI_TEST_CHECK( degree5.degree != 180.0f ); + DALI_TEST_CHECK(degree5.degree == 90.0f); + DALI_TEST_CHECK(degree5.degree != 180.0f); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-DistanceField.cpp b/automated-tests/src/dali/utc-Dali-DistanceField.cpp index b9ab2da..c709985 100644 --- a/automated-tests/src/dali/utc-Dali-DistanceField.cpp +++ b/automated-tests/src/dali/utc-Dali-DistanceField.cpp @@ -15,47 +15,35 @@ * */ -#include -#include - +#include +#include +#include #include -#include -#include -#include +#include +#include using std::max; using namespace Dali; namespace { - static const float ROTATION_EPSILON = 0.0001f; static unsigned char sourceImage[] = -{ - 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, - 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, - 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, - 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF -}; + { + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; } // anonymous namespace - - int UtcDaliGenerateDistanceField(void) { - unsigned char distanceField[4*4]; + unsigned char distanceField[4 * 4]; GenerateDistanceFieldMap(sourceImage, Size(8.0f, 8.0f), distanceField, Size(4.0f, 4.0f), 0, Size(4.0f, 4.0f)); - if(distanceField[0] <= distanceField[5] && - distanceField[5] <= distanceField[10] && + if(distanceField[0] <= distanceField[5] && + distanceField[5] <= distanceField[10] && distanceField[10] <= distanceField[15]) { tet_result(TET_PASS); diff --git a/automated-tests/src/dali/utc-Dali-Extents.cpp b/automated-tests/src/dali/utc-Dali-Extents.cpp index d2c2280..435dfd5 100644 --- a/automated-tests/src/dali/utc-Dali-Extents.cpp +++ b/automated-tests/src/dali/utc-Dali-Extents.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,20 +15,20 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; namespace { /// Compare a uint16_t value with an unsigned int -void DALI_TEST_EQUALS( uint16_t value1, unsigned int value2, const char* location ) +void DALI_TEST_EQUALS(uint16_t value1, unsigned int value2, const char* location) { - ::DALI_TEST_EQUALS< uint16_t >( value1, static_cast< uint16_t >( value2 ), location ); + ::DALI_TEST_EQUALS(value1, static_cast(value2), location); } } // unnamed namespace @@ -47,10 +47,10 @@ int UtcDaliExtentsConstructor01(void) TestApplication application; Extents extent; - DALI_TEST_EQUALS( extent.start, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.end, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.top, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.bottom, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(extent.start, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.end, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.top, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.bottom, 0u, TEST_LOCATION); END_TEST; } @@ -58,11 +58,11 @@ int UtcDaliExtentsConstructor02(void) { TestApplication application; - Extents extent( 10u, 20u, 400u, 200u ); - DALI_TEST_EQUALS( extent.start, 10u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.end, 20u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.top, 400u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.bottom, 200u, TEST_LOCATION ); + Extents extent(10u, 20u, 400u, 200u); + DALI_TEST_EQUALS(extent.start, 10u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.end, 20u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.top, 400u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.bottom, 200u, TEST_LOCATION); END_TEST; } @@ -70,14 +70,14 @@ int UtcDaliExtentsConstructor03(void) { TestApplication application; - Extents extent( 10u, 20u, 400u, 200u ); + Extents extent(10u, 20u, 400u, 200u); Extents e2 = extent; - DALI_TEST_EQUALS( e2.start, 10u, TEST_LOCATION ); - DALI_TEST_EQUALS( e2.end, 20u, TEST_LOCATION ); - DALI_TEST_EQUALS( e2.top, 400u, TEST_LOCATION ); - DALI_TEST_EQUALS( e2.bottom, 200u, TEST_LOCATION ); + DALI_TEST_EQUALS(e2.start, 10u, TEST_LOCATION); + DALI_TEST_EQUALS(e2.end, 20u, TEST_LOCATION); + DALI_TEST_EQUALS(e2.top, 400u, TEST_LOCATION); + DALI_TEST_EQUALS(e2.bottom, 200u, TEST_LOCATION); END_TEST; } @@ -85,14 +85,14 @@ int UtcDaliExtentsCopyConstructor(void) { TestApplication application; - Extents extent( 10u, 20u, 400u, 200u ); + Extents extent(10u, 20u, 400u, 200u); - Extents extent2( extent ); + Extents extent2(extent); - DALI_TEST_EQUALS( extent2.start, 10u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent2.end, 20u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent2.top, 400u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent2.bottom, 200u, TEST_LOCATION ); + DALI_TEST_EQUALS(extent2.start, 10u, TEST_LOCATION); + DALI_TEST_EQUALS(extent2.end, 20u, TEST_LOCATION); + DALI_TEST_EQUALS(extent2.top, 400u, TEST_LOCATION); + DALI_TEST_EQUALS(extent2.bottom, 200u, TEST_LOCATION); END_TEST; } @@ -102,26 +102,26 @@ int UtcDaliExtentsCopyAssignment(void) Extents extent; - Extents extent2( 10u, 20u, 400u, 200u ); + Extents extent2(10u, 20u, 400u, 200u); extent = extent2; - DALI_TEST_EQUALS( extent.start, 10u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.end, 20u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.top, 400u, TEST_LOCATION ); - DALI_TEST_EQUALS( extent.bottom, 200u, TEST_LOCATION ); + DALI_TEST_EQUALS(extent.start, 10u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.end, 20u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.top, 400u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.bottom, 200u, TEST_LOCATION); END_TEST; } int UtcDaliExtentsAssignP(void) { - Extents extent; - const uint16_t array[] = { 1u, 2u, 3u, 4u }; - extent = (const uint16_t*)array; - - DALI_TEST_EQUALS( extent.start, 1u, TEST_LOCATION); - DALI_TEST_EQUALS( extent.end, 2u, TEST_LOCATION); - DALI_TEST_EQUALS( extent.top, 3u, TEST_LOCATION); - DALI_TEST_EQUALS( extent.bottom, 4u, TEST_LOCATION); + Extents extent; + const uint16_t array[] = {1u, 2u, 3u, 4u}; + extent = (const uint16_t*)array; + + DALI_TEST_EQUALS(extent.start, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.end, 2u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.top, 3u, TEST_LOCATION); + DALI_TEST_EQUALS(extent.bottom, 4u, TEST_LOCATION); END_TEST; } @@ -129,12 +129,12 @@ int UtcDaliExtentsOperatorNotEquals(void) { TestApplication application; - Extents extent1( 10u, 20u, 200u, 200u ); - Extents extent2( 10u, 120u, 200u, 200u ); - Extents extent3( 10u, 80u, 200u, 200u ); + Extents extent1(10u, 20u, 200u, 200u); + Extents extent2(10u, 120u, 200u, 200u); + Extents extent3(10u, 80u, 200u, 200u); - DALI_TEST_CHECK( extent1 != extent2 ); - DALI_TEST_CHECK( extent1 != extent3 ); + DALI_TEST_CHECK(extent1 != extent2); + DALI_TEST_CHECK(extent1 != extent3); END_TEST; } @@ -142,31 +142,31 @@ int UtcDaliExtentsOperatorEquals(void) { TestApplication application; - Extents extent1( 10u, 20u, 200u, 200u ); - Extents extent1p( 10u, 20u, 200u, 200u ); + Extents extent1(10u, 20u, 200u, 200u); + Extents extent1p(10u, 20u, 200u, 200u); - Extents extent2( 10u, 120u, 200u, 200u ); - Extents extent3( 10u, 80u, 200u, 200u ); + Extents extent2(10u, 120u, 200u, 200u); + Extents extent3(10u, 80u, 200u, 200u); - DALI_TEST_CHECK( extent1 == extent1p ); - DALI_TEST_CHECK( extent1 == extent1 ); - DALI_TEST_CHECK( !( extent1 == extent2 ) ); - DALI_TEST_CHECK( !( extent1 == extent3 ) ); + DALI_TEST_CHECK(extent1 == extent1p); + DALI_TEST_CHECK(extent1 == extent1); + DALI_TEST_CHECK(!(extent1 == extent2)); + DALI_TEST_CHECK(!(extent1 == extent3)); END_TEST; } int UtcDaliExtentsOStreamOperatorP(void) { - TestApplication application; + TestApplication application; std::ostringstream oss; - Extents extent( 1u, 2u, 10u, 10u ); + Extents extent(1u, 2u, 10u, 10u); oss << extent; std::string expectedOutput = "[1, 2, 10, 10]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-FrameBuffer.cpp b/automated-tests/src/dali/utc-Dali-FrameBuffer.cpp index 8b06a36..1a16484 100644 --- a/automated-tests/src/dali/utc-Dali-FrameBuffer.cpp +++ b/automated-tests/src/dali/utc-Dali-FrameBuffer.cpp @@ -15,9 +15,9 @@ * */ -#include #include #include +#include using namespace Dali; @@ -39,9 +39,9 @@ int UtcDaliFrameBufferNew01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); application.SendNotification(); application.Render(); @@ -59,9 +59,9 @@ int UtcDaliFrameBufferNew02(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); application.SendNotification(); application.Render(); @@ -79,9 +79,9 @@ int UtcDaliFrameBufferNew03(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::STENCIL ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::STENCIL); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); application.SendNotification(); application.Render(); @@ -99,9 +99,9 @@ int UtcDaliFrameBufferNew04(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); application.SendNotification(); application.Render(); @@ -116,8 +116,8 @@ int UtcDaliFrameBufferNew04(void) int UtcDaliFrameBufferNew05(void) { TestApplication application; - FrameBuffer frameBuffer; - DALI_TEST_CHECK( !frameBuffer ); + FrameBuffer frameBuffer; + DALI_TEST_CHECK(!frameBuffer); END_TEST; } @@ -127,9 +127,9 @@ int UtcDaliFrameBufferNew06(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, static_cast( FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL ) ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, static_cast(FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL)); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); application.SendNotification(); application.Render(); @@ -144,80 +144,80 @@ int UtcDaliFrameBufferNew06(void) int UtcDaliFrameBufferNewWithColor01(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height); application.SendNotification(); application.Render(); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); // check that texture is not empty handle - DALI_TEST_CHECK( frameBuffer.GetColorTexture() ); + DALI_TEST_CHECK(frameBuffer.GetColorTexture()); END_TEST; } int UtcDaliFrameBufferNewWithColor02(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR); application.SendNotification(); application.Render(); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); // check that texture is not empty handle - DALI_TEST_CHECK( frameBuffer.GetColorTexture() ); + DALI_TEST_CHECK(frameBuffer.GetColorTexture()); END_TEST; } int UtcDaliFrameBufferNewWithColor03(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_DEPTH); application.SendNotification(); application.Render(); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); // check that texture is not empty handle - DALI_TEST_CHECK( frameBuffer.GetColorTexture() ); + DALI_TEST_CHECK(frameBuffer.GetColorTexture()); END_TEST; } int UtcDaliFrameBufferNewWithColor04(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_STENCIL ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_STENCIL); application.SendNotification(); application.Render(); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION); // check that texture is not empty handle - DALI_TEST_CHECK( frameBuffer.GetColorTexture() ); + DALI_TEST_CHECK(frameBuffer.GetColorTexture()); END_TEST; } int UtcDaliFrameBufferNewWithColor05(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL); application.SendNotification(); application.Render(); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION); DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION); // check that texture is not empty handle - DALI_TEST_CHECK( frameBuffer.GetColorTexture() ); + DALI_TEST_CHECK(frameBuffer.GetColorTexture()); END_TEST; } @@ -227,11 +227,11 @@ int UtcDaliFrameBufferCopyConstructor(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); - FrameBuffer frameBufferCopy( frameBuffer ); + FrameBuffer frameBufferCopy(frameBuffer); - DALI_TEST_CHECK( frameBufferCopy ); + DALI_TEST_CHECK(frameBufferCopy); END_TEST; } @@ -242,13 +242,13 @@ int UtcDaliFrameBufferAssignmentOperator(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); FrameBuffer frameBuffer2; - DALI_TEST_CHECK( !frameBuffer2 ); + DALI_TEST_CHECK(!frameBuffer2); frameBuffer2 = frameBuffer; - DALI_TEST_CHECK( frameBuffer2 ); + DALI_TEST_CHECK(frameBuffer2); END_TEST; } @@ -257,21 +257,21 @@ int UtcDaliFrameBufferMoveConstructor(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); - DALI_TEST_CHECK( frameBuffer ); - DALI_TEST_EQUALS( 1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); + DALI_TEST_CHECK(frameBuffer); + DALI_TEST_EQUALS(1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); - DALI_TEST_EQUALS( frameBuffer.GetColorTexture(), texture, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); + DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION); - FrameBuffer move = std::move( frameBuffer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetColorTexture(), texture, TEST_LOCATION ); - DALI_TEST_CHECK( !frameBuffer ); + FrameBuffer move = std::move(frameBuffer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetColorTexture(), texture, TEST_LOCATION); + DALI_TEST_CHECK(!frameBuffer); END_TEST; } @@ -280,22 +280,22 @@ int UtcDaliFrameBufferMoveAssignment(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); - DALI_TEST_CHECK( frameBuffer ); - DALI_TEST_EQUALS( 1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + uint32_t width = 64; + uint32_t height = 64; + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); + DALI_TEST_CHECK(frameBuffer); + DALI_TEST_EQUALS(1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); - DALI_TEST_EQUALS( frameBuffer.GetColorTexture(), texture, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); + DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION); FrameBuffer move; - move = std::move( frameBuffer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetColorTexture(), texture, TEST_LOCATION ); - DALI_TEST_CHECK( !frameBuffer ); + move = std::move(frameBuffer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetColorTexture(), texture, TEST_LOCATION); + DALI_TEST_CHECK(!frameBuffer); END_TEST; } @@ -303,13 +303,13 @@ int UtcDaliFrameBufferMoveAssignment(void) int UtcDaliFrameBufferDownCast01(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); + unsigned int width(64); + unsigned int height(64); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); - BaseHandle handle(frameBuffer); + BaseHandle handle(frameBuffer); FrameBuffer frameBuffer2 = FrameBuffer::DownCast(handle); - DALI_TEST_CHECK( frameBuffer2 ); + DALI_TEST_CHECK(frameBuffer2); END_TEST; } @@ -318,9 +318,9 @@ int UtcDaliFrameBufferDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object FrameBuffer frameBuffer = FrameBuffer::DownCast(handle); - DALI_TEST_CHECK( !frameBuffer ); + DALI_TEST_CHECK(!frameBuffer); END_TEST; } @@ -330,9 +330,9 @@ int UtcDaliFrameBufferAttachColorTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); application.SendNotification(); application.Render(); @@ -350,12 +350,12 @@ int UtcDaliFrameBufferAttachColorTexture02(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); texture.GenerateMipmaps(); //Attach mipmap 1 - frameBuffer.AttachColorTexture( texture, 0u, 1u ); + frameBuffer.AttachColorTexture(texture, 0u, 1u); application.SendNotification(); application.Render(); @@ -373,12 +373,12 @@ int UtcDaliFrameBufferAttachColorTexture03(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height); texture.GenerateMipmaps(); //Attach NEGATIVE_Y face of the cubemap - frameBuffer.AttachColorTexture( texture, 0u, CubeMapLayer::NEGATIVE_Y ); + frameBuffer.AttachColorTexture(texture, 0u, CubeMapLayer::NEGATIVE_Y); application.SendNotification(); application.Render(); @@ -396,9 +396,9 @@ int UtcDaliFrameBufferAttachColorTexture04(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, static_cast( FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL ) ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, static_cast(FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL)); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); application.SendNotification(); application.Render(); @@ -416,13 +416,13 @@ int UtcDaliFrameBufferAttachColorTexture05(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); // N.B. it doesn't make sense per se, however the OGL standard doesn't seem to forbid attaching the same texture to different slots. - for (int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i) + for(int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i) { - frameBuffer.AttachColorTexture( texture ); + frameBuffer.AttachColorTexture(texture); } application.SendNotification(); @@ -441,12 +441,12 @@ int UtcDaliFrameBufferAttachDepthTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); - Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_UNSIGNED_INT, width, height ); - DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth ); + Texture textureDepth = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_UNSIGNED_INT, width, height); + DevelFrameBuffer::AttachDepthTexture(frameBuffer, textureDepth); application.SendNotification(); application.Render(); @@ -464,12 +464,12 @@ int UtcDaliFrameBufferAttachDepthStencilTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); - Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height ); - DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil ); + Texture textureStencil = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height); + DevelFrameBuffer::AttachDepthStencilTexture(frameBuffer, textureStencil); application.SendNotification(); application.Render(); @@ -487,9 +487,9 @@ int UtcDaliFrameBufferGetColorTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION); @@ -502,9 +502,9 @@ int UtcDaliFrameBufferGetColorTexture02(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture, 0u, 1u ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture, 0u, 1u); DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION); @@ -517,9 +517,9 @@ int UtcDaliFrameBufferGetColorTexture03(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture, 0u, 1u ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture, 0u, 1u); DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION); DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, 0), texture, TEST_LOCATION); @@ -533,24 +533,24 @@ int UtcDaliFrameBufferGetColorTexture04(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture textures[] = { - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), - Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ), + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture textures[] = { + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), + Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height), }; - for (auto& t: textures) + for(auto& t : textures) { - frameBuffer.AttachColorTexture( t, 0u, 1u ); + frameBuffer.AttachColorTexture(t, 0u, 1u); } - for (unsigned int i = 0; i < std::extent::value; ++i) + for(unsigned int i = 0; i < std::extent::value; ++i) { DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, i), textures[i], TEST_LOCATION); } @@ -564,14 +564,14 @@ int UtcDaliFrameBufferGetDepthTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); - Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_FLOAT, width, height ); - DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth ); + Texture textureDepth = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_FLOAT, width, height); + DevelFrameBuffer::AttachDepthTexture(frameBuffer, textureDepth); - DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthTexture( frameBuffer ), textureDepth, TEST_LOCATION); + DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthTexture(frameBuffer), textureDepth, TEST_LOCATION); END_TEST; } @@ -582,14 +582,14 @@ int UtcDaliFrameBufferGetDepthStencilTexture01(void) unsigned int width(64); unsigned int height(64); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - frameBuffer.AttachColorTexture( texture ); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + frameBuffer.AttachColorTexture(texture); - Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height ); - DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil ); + Texture textureStencil = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height); + DevelFrameBuffer::AttachDepthStencilTexture(frameBuffer, textureStencil); - DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthStencilTexture( frameBuffer ), textureStencil, TEST_LOCATION); + DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthStencilTexture(frameBuffer), textureStencil, TEST_LOCATION); END_TEST; } @@ -602,14 +602,14 @@ int UtcDaliFramebufferContextLoss(void) //Create the texture unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_CHECK( texture ); - FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE ); - DALI_TEST_CHECK( frameBuffer ); - frameBuffer.AttachColorTexture( texture, 0u, 1u ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_CHECK(texture); + FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE); + DALI_TEST_CHECK(frameBuffer); + frameBuffer.AttachColorTexture(texture, 0u, 1u); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); application.SendNotification(); @@ -617,14 +617,14 @@ int UtcDaliFramebufferContextLoss(void) // Lose & regain context (in render 'thread') application.ResetContext(); - DALI_TEST_CHECK( frameBuffer ); + DALI_TEST_CHECK(frameBuffer); END_TEST; } int UtcDaliFrameBufferGetColorTextureNegative(void) { - TestApplication application; + TestApplication application; Dali::FrameBuffer instance; try { @@ -640,7 +640,7 @@ int UtcDaliFrameBufferGetColorTextureNegative(void) int UtcDaliFrameBufferAttachColorTextureNegative01(void) { - TestApplication application; + TestApplication application; Dali::FrameBuffer instance; try { @@ -657,14 +657,14 @@ int UtcDaliFrameBufferAttachColorTextureNegative01(void) int UtcDaliFrameBufferAttachColorTextureNegative02(void) { - TestApplication application; + TestApplication application; Dali::FrameBuffer instance; try { Dali::Texture arg1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 400u, 400u); - unsigned int arg2(0u); - unsigned int arg3(0u); - instance.AttachColorTexture(arg1,arg2,arg3); + unsigned int arg2(0u); + unsigned int arg3(0u); + instance.AttachColorTexture(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) diff --git a/automated-tests/src/dali/utc-Dali-FrameCallbackInterface.cpp b/automated-tests/src/dali/utc-Dali-FrameCallbackInterface.cpp index 11a8c08..f2917ac 100644 --- a/automated-tests/src/dali/utc-Dali-FrameCallbackInterface.cpp +++ b/automated-tests/src/dali/utc-Dali-FrameCallbackInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,15 +15,15 @@ * */ -#include - -#include -#include +#include #include #include #include #include -#include +#include +#include + +#include using namespace Dali; @@ -40,14 +40,12 @@ void utc_dali_frame_callback_interface_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - class FrameCallbackBasic : public FrameCallbackInterface { public: - FrameCallbackBasic() = default; - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) { mCalled = true; } @@ -57,26 +55,25 @@ public: mCalled = false; } - bool mCalled{ false }; + bool mCalled{false}; }; class FrameCallbackOneActor : public FrameCallbackBasic { public: - - FrameCallbackOneActor( unsigned int actorId ) - : mActorId( actorId ) + FrameCallbackOneActor(unsigned int actorId) + : mActorId(actorId) { } - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override { - FrameCallbackBasic::Update( updateProxy, elapsedSeconds ); - updateProxy.GetSize( mActorId, mSizeGetSizeCall ); - updateProxy.GetPosition( mActorId, mPositionGetPositionCall ); - updateProxy.GetPositionAndSize( mActorId, mPositionGetPositionAndSizeCall, mSizeGetPositionAndSizeCall ); - updateProxy.GetColor( mActorId, mColor ); - updateProxy.GetScale( mActorId, mScale ); + FrameCallbackBasic::Update(updateProxy, elapsedSeconds); + updateProxy.GetSize(mActorId, mSizeGetSizeCall); + updateProxy.GetPosition(mActorId, mPositionGetPositionCall); + updateProxy.GetPositionAndSize(mActorId, mPositionGetPositionAndSizeCall, mSizeGetPositionAndSizeCall); + updateProxy.GetColor(mActorId, mColor); + updateProxy.GetScale(mActorId, mScale); } const unsigned int mActorId; @@ -92,39 +89,38 @@ public: class FrameCallbackSetter : public FrameCallbackBasic { public: - FrameCallbackSetter( - unsigned int actorId, - const Vector3& sizeToSet, - const Vector3& positionToSet, - const Vector4& colorToSet, - const Vector3& scaleToSet ) - : mActorId( actorId ), - mSizeToSet( sizeToSet ), - mPositionToSet( positionToSet ), - mColorToSet( colorToSet ), - mScaleToSet( scaleToSet ) + unsigned int actorId, + const Vector3& sizeToSet, + const Vector3& positionToSet, + const Vector4& colorToSet, + const Vector3& scaleToSet) + : mActorId(actorId), + mSizeToSet(sizeToSet), + mPositionToSet(positionToSet), + mColorToSet(colorToSet), + mScaleToSet(scaleToSet) { } - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override { - FrameCallbackBasic::Update( updateProxy, elapsedSeconds ); - updateProxy.SetSize( mActorId, mSizeToSet ); - updateProxy.SetPosition( mActorId, mPositionToSet ); - updateProxy.SetColor( mActorId, mColorToSet ); - updateProxy.SetScale( mActorId, mScaleToSet ); - updateProxy.GetSize( mActorId, mSizeAfterSetting ); - updateProxy.GetPosition( mActorId, mPositionAfterSetting ); - updateProxy.GetColor( mActorId, mColorAfterSetting ); - updateProxy.GetScale( mActorId, mScaleAfterSetting ); + FrameCallbackBasic::Update(updateProxy, elapsedSeconds); + updateProxy.SetSize(mActorId, mSizeToSet); + updateProxy.SetPosition(mActorId, mPositionToSet); + updateProxy.SetColor(mActorId, mColorToSet); + updateProxy.SetScale(mActorId, mScaleToSet); + updateProxy.GetSize(mActorId, mSizeAfterSetting); + updateProxy.GetPosition(mActorId, mPositionAfterSetting); + updateProxy.GetColor(mActorId, mColorAfterSetting); + updateProxy.GetScale(mActorId, mScaleAfterSetting); } const unsigned int mActorId; - const Vector3& mSizeToSet; - const Vector3& mPositionToSet; - const Vector4& mColorToSet; - const Vector3& mScaleToSet; + const Vector3& mSizeToSet; + const Vector3& mPositionToSet; + const Vector4& mColorToSet; + const Vector3& mScaleToSet; Vector3 mSizeAfterSetting; Vector3 mPositionAfterSetting; @@ -135,39 +131,38 @@ public: class FrameCallbackBaker : public FrameCallbackBasic { public: - FrameCallbackBaker( - unsigned int actorId, - const Vector3& sizeToSet, - const Vector3& positionToSet, - const Vector4& colorToSet, - const Vector3& scaleToSet ) - : mActorId( actorId ), - mSizeToSet( sizeToSet ), - mPositionToSet( positionToSet ), - mColorToSet( colorToSet ), - mScaleToSet( scaleToSet ) + unsigned int actorId, + const Vector3& sizeToSet, + const Vector3& positionToSet, + const Vector4& colorToSet, + const Vector3& scaleToSet) + : mActorId(actorId), + mSizeToSet(sizeToSet), + mPositionToSet(positionToSet), + mColorToSet(colorToSet), + mScaleToSet(scaleToSet) { } - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override { - FrameCallbackBasic::Update( updateProxy, elapsedSeconds ); - updateProxy.BakeSize( mActorId, mSizeToSet ); - updateProxy.BakePosition( mActorId, mPositionToSet ); - updateProxy.BakeColor( mActorId, mColorToSet ); - updateProxy.BakeScale( mActorId, mScaleToSet ); - updateProxy.GetSize( mActorId, mSizeAfterSetting ); - updateProxy.GetPosition( mActorId, mPositionAfterSetting ); - updateProxy.GetColor( mActorId, mColorAfterSetting ); - updateProxy.GetScale( mActorId, mScaleAfterSetting ); + FrameCallbackBasic::Update(updateProxy, elapsedSeconds); + updateProxy.BakeSize(mActorId, mSizeToSet); + updateProxy.BakePosition(mActorId, mPositionToSet); + updateProxy.BakeColor(mActorId, mColorToSet); + updateProxy.BakeScale(mActorId, mScaleToSet); + updateProxy.GetSize(mActorId, mSizeAfterSetting); + updateProxy.GetPosition(mActorId, mPositionAfterSetting); + updateProxy.GetColor(mActorId, mColorAfterSetting); + updateProxy.GetScale(mActorId, mScaleAfterSetting); } const unsigned int mActorId; - const Vector3& mSizeToSet; - const Vector3& mPositionToSet; - const Vector4& mColorToSet; - const Vector3& mScaleToSet; + const Vector3& mSizeToSet; + const Vector3& mPositionToSet; + const Vector4& mColorToSet; + const Vector3& mScaleToSet; Vector3 mSizeAfterSetting; Vector3 mPositionAfterSetting; @@ -178,58 +173,56 @@ public: class FrameCallbackMultipleActors : public FrameCallbackBasic { public: - FrameCallbackMultipleActors() { } - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override { - FrameCallbackBasic::Update( updateProxy, elapsedSeconds ); - for( auto&& i : mActorIds ) + FrameCallbackBasic::Update(updateProxy, elapsedSeconds); + for(auto&& i : mActorIds) { Vector3 position; Vector3 size; - updateProxy.GetPositionAndSize( i, position, size ); - mPositions[ i ] = position; - mSizes[ i ] = size; + updateProxy.GetPositionAndSize(i, position, size); + mPositions[i] = position; + mSizes[i] = size; } } - Vector< unsigned int > mActorIds; + Vector mActorIds; - std::map< unsigned int, Vector3 > mPositions; - std::map< unsigned int, Vector3 > mSizes; + std::map mPositions; + std::map mSizes; }; class FrameCallbackActorIdCheck : public FrameCallbackBasic { public: - - FrameCallbackActorIdCheck( unsigned int actorId ) - : mActorId( actorId ) + FrameCallbackActorIdCheck(unsigned int actorId) + : mActorId(actorId) { } - virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override + virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override { - FrameCallbackBasic::Update( updateProxy, elapsedSeconds ); + FrameCallbackBasic::Update(updateProxy, elapsedSeconds); Vector3 vec3; Vector4 vec4; - mGetSizeCallSuccess = updateProxy.GetSize( mActorId, vec3 ); - mGetPositionCallSuccess = updateProxy.GetPosition( mActorId, vec3 ); - mGetColorCallSuccess = updateProxy.GetColor( mActorId, vec4 ); - mGetScaleCallSuccess = updateProxy.GetScale( mActorId, vec3 ); - mGetPositionAndSizeCallSuccess = updateProxy.GetPositionAndSize( mActorId, vec3, vec3 ); - mSetSizeCallSuccess = updateProxy.SetSize( mActorId, vec3 ); - mSetPositionCallSuccess = updateProxy.SetPosition( mActorId, vec3 ); - mSetColorCallSuccess = updateProxy.SetColor( mActorId, vec4 ); - mSetScaleCallSuccess = updateProxy.SetScale( mActorId, vec3 ); - mBakeSizeCallSuccess = updateProxy.BakeSize( mActorId, vec3 ); - mBakePositionCallSuccess = updateProxy.BakePosition( mActorId, vec3 ); - mBakeColorCallSuccess = updateProxy.BakeColor( mActorId, vec4 ); - mBakeScaleCallSuccess = updateProxy.BakeScale( mActorId, vec3 ); + mGetSizeCallSuccess = updateProxy.GetSize(mActorId, vec3); + mGetPositionCallSuccess = updateProxy.GetPosition(mActorId, vec3); + mGetColorCallSuccess = updateProxy.GetColor(mActorId, vec4); + mGetScaleCallSuccess = updateProxy.GetScale(mActorId, vec3); + mGetPositionAndSizeCallSuccess = updateProxy.GetPositionAndSize(mActorId, vec3, vec3); + mSetSizeCallSuccess = updateProxy.SetSize(mActorId, vec3); + mSetPositionCallSuccess = updateProxy.SetPosition(mActorId, vec3); + mSetColorCallSuccess = updateProxy.SetColor(mActorId, vec4); + mSetScaleCallSuccess = updateProxy.SetScale(mActorId, vec3); + mBakeSizeCallSuccess = updateProxy.BakeSize(mActorId, vec3); + mBakePositionCallSuccess = updateProxy.BakePosition(mActorId, vec3); + mBakeColorCallSuccess = updateProxy.BakeColor(mActorId, vec4); + mBakeScaleCallSuccess = updateProxy.BakeScale(mActorId, vec3); } virtual void Reset() override @@ -237,38 +230,38 @@ public: // Up-call FrameCallbackBasic::Reset(); - mGetSizeCallSuccess = false; - mGetPositionCallSuccess = false; - mGetColorCallSuccess = false; - mGetScaleCallSuccess = false; + mGetSizeCallSuccess = false; + mGetPositionCallSuccess = false; + mGetColorCallSuccess = false; + mGetScaleCallSuccess = false; mGetPositionAndSizeCallSuccess = false; - mSetSizeCallSuccess = false; - mSetPositionCallSuccess = false; - mSetColorCallSuccess = false; - mSetScaleCallSuccess = false; - mBakeSizeCallSuccess = false; - mBakePositionCallSuccess = false; - mBakeColorCallSuccess = false; - mBakeScaleCallSuccess = false; + mSetSizeCallSuccess = false; + mSetPositionCallSuccess = false; + mSetColorCallSuccess = false; + mSetScaleCallSuccess = false; + mBakeSizeCallSuccess = false; + mBakePositionCallSuccess = false; + mBakeColorCallSuccess = false; + mBakeScaleCallSuccess = false; } const uint32_t mActorId; - bool mGetSizeCallSuccess{ false }; - bool mGetPositionCallSuccess{ false }; - bool mGetColorCallSuccess{ false }; - bool mGetScaleCallSuccess{ false }; - bool mGetPositionAndSizeCallSuccess{ false }; - bool mSetSizeCallSuccess{ false }; - bool mSetPositionCallSuccess{ false }; - bool mSetColorCallSuccess{ false }; - bool mSetScaleCallSuccess{ false }; - bool mBakeSizeCallSuccess{ false }; - bool mBakePositionCallSuccess{ false }; - bool mBakeColorCallSuccess{ false }; - bool mBakeScaleCallSuccess{ false }; + bool mGetSizeCallSuccess{false}; + bool mGetPositionCallSuccess{false}; + bool mGetColorCallSuccess{false}; + bool mGetScaleCallSuccess{false}; + bool mGetPositionAndSizeCallSuccess{false}; + bool mSetSizeCallSuccess{false}; + bool mSetPositionCallSuccess{false}; + bool mSetColorCallSuccess{false}; + bool mSetScaleCallSuccess{false}; + bool mBakeSizeCallSuccess{false}; + bool mBakePositionCallSuccess{false}; + bool mBakeColorCallSuccess{false}; + bool mBakeScaleCallSuccess{false}; }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -281,21 +274,21 @@ int UtcDaliFrameCallbackCheckInstallationAndRemoval(void) FrameCallbackBasic frameCallback; Stage stage = Stage::GetCurrent(); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); frameCallback.mCalled = false; - DevelStage::RemoveFrameCallback( stage, frameCallback ); + DevelStage::RemoveFrameCallback(stage, frameCallback); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, false, TEST_LOCATION); END_TEST; } @@ -305,35 +298,35 @@ int UtcDaliFrameCallbackGetters(void) // Test to see that the Getters all return the expected values TestApplication application; - Vector2 actorSize( 200, 300 ); - Vector4 color( 0.5f, 0.6f, 0.7f, 0.8f ); - Vector3 position( 10.0f, 20.0f, 30.0f ); - Vector3 scale( 2.0f, 4.0f, 6.0f ); + Vector2 actorSize(200, 300); + Vector4 color(0.5f, 0.6f, 0.7f, 0.8f); + Vector3 position(10.0f, 20.0f, 30.0f); + Vector3 scale(2.0f, 4.0f, 6.0f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::SIZE, actorSize ); - actor.SetProperty( Actor::Property::COLOR, color ); - actor.SetProperty( Actor::Property::POSITION, position ); - actor.SetProperty( Actor::Property::SCALE, scale ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, actorSize); + actor.SetProperty(Actor::Property::COLOR, color); + actor.SetProperty(Actor::Property::POSITION, position); + actor.SetProperty(Actor::Property::SCALE, scale); Stage stage = Stage::GetCurrent(); - stage.Add( actor ); + stage.Add(actor); - FrameCallbackOneActor frameCallback( actor.GetProperty< int >( Actor::Property::ID ) ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + FrameCallbackOneActor frameCallback(actor.GetProperty(Actor::Property::ID)); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, position, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mPositionGetPositionAndSizeCall, position, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizeGetPositionAndSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mColor, color, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mScale, scale, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizeGetSizeCall, Vector3(actorSize.width, actorSize.height, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mPositionGetPositionCall, position, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mPositionGetPositionAndSizeCall, position, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizeGetPositionAndSizeCall, Vector3(actorSize.width, actorSize.height, 0.0f), TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mColor, color, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mScale, scale, TEST_LOCATION); END_TEST; } @@ -343,61 +336,61 @@ int UtcDaliFrameCallbackSetters(void) // Test to see that the setters set the values appropriately TestApplication application; - Vector2 actorSize( 200, 300 ); + Vector2 actorSize(200, 300); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::SIZE, actorSize ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, actorSize); Stage stage = Stage::GetCurrent(); - stage.Add( actor ); + stage.Add(actor); - Vector3 sizeToSet( 1.0f, 2.0f, 3.0f ); - Vector3 positionToSet( 10.0f, 20.0f, 30.0f ); - Vector4 colorToSet( Color::MAGENTA ); - Vector3 scaleToSet( 1.0f, 3.0f, 5.0f ); + Vector3 sizeToSet(1.0f, 2.0f, 3.0f); + Vector3 positionToSet(10.0f, 20.0f, 30.0f); + Vector4 colorToSet(Color::MAGENTA); + Vector3 scaleToSet(1.0f, 3.0f, 5.0f); - FrameCallbackSetter frameCallback( actor.GetProperty< int >( Actor::Property::ID ), sizeToSet, positionToSet, colorToSet, scaleToSet ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + FrameCallbackSetter frameCallback(actor.GetProperty(Actor::Property::ID), sizeToSet, positionToSet, colorToSet, scaleToSet); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION); // Ensure the actual actor values haven't changed as we didn't bake the values after removing the callback - DevelStage::RemoveFrameCallback( stage, frameCallback ); + DevelStage::RemoveFrameCallback(stage, frameCallback); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get(), Vector3(actorSize), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get(), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get(), Vector3::ONE, TEST_LOCATION); // Render for a couple more frames to ensure the values are reset properly (some values are double-buffered) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get(), Vector3(actorSize), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get(), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get(), Vector3::ONE, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get(), Vector3(actorSize), TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get(), Color::WHITE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get(), Vector3::ONE, TEST_LOCATION); END_TEST; } @@ -407,48 +400,47 @@ int UtcDaliFrameCallbackBake(void) // Test to see that the bake methods bake the values TestApplication application; - Vector2 actorSize( 200, 300 ); + Vector2 actorSize(200, 300); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::SIZE, actorSize ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, actorSize); Stage stage = Stage::GetCurrent(); - stage.Add( actor ); + stage.Add(actor); - Vector3 sizeToSet( 1.0f, 2.0f, 3.0f ); - Vector3 positionToSet( 10.0f, 20.0f, 30.0f ); - Vector4 colorToSet( Color::MAGENTA ); - Vector3 scaleToSet( 1.0f, 3.0f, 5.0f ); + Vector3 sizeToSet(1.0f, 2.0f, 3.0f); + Vector3 positionToSet(10.0f, 20.0f, 30.0f); + Vector4 colorToSet(Color::MAGENTA); + Vector3 scaleToSet(1.0f, 3.0f, 5.0f); - FrameCallbackBaker frameCallback( actor.GetProperty< int >( Actor::Property::ID ), sizeToSet, positionToSet, colorToSet, scaleToSet ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + FrameCallbackBaker frameCallback(actor.GetProperty(Actor::Property::ID), sizeToSet, positionToSet, colorToSet, scaleToSet); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION); // Ensure the new values are saved after removing the callback - DevelStage::RemoveFrameCallback( stage, frameCallback ); + DevelStage::RemoveFrameCallback(stage, frameCallback); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), positionToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), sizeToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), colorToSet, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), scaleToSet, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get(), positionToSet, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get(), sizeToSet, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get(), colorToSet, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get(), scaleToSet, TEST_LOCATION); END_TEST; } - int UtcDaliFrameCallbackMultipleActors(void) { /** @@ -483,111 +475,111 @@ int UtcDaliFrameCallbackMultipleActors(void) */ TestApplication application; - Stage stage = Stage::GetCurrent(); - - std::map< char, Vector3 > sizes; - sizes['A'] = Vector3( 50.0f, 50.0f, 0.0f ); - sizes['B'] = Vector3( 100.0f, 100.0f, 0.0f ); - sizes['C'] = Vector3( 150.0f, 150.0f, 0.0f ); - sizes['D'] = Vector3( 200.0f, 200.0f, 0.0f ); - sizes['E'] = Vector3( 250.0f, 250.0f, 0.0f ); - sizes['F'] = Vector3( 300.0f, 300.0f, 0.0f ); - sizes['G'] = Vector3( 350.0f, 350.0f, 0.0f ); - sizes['H'] = Vector3( 400.0f, 350.0f, 0.0f ); - - std::map< char, Vector3 > positions; - positions['A'] = Vector3( 0.0f, 1.0f, 2.0f ); - positions['B'] = Vector3( 2.0f, 3.0f, 4.0f ); - positions['C'] = Vector3( 5.0f, 6.0f, 7.0f ); - positions['D'] = Vector3( 8.0f, 9.0f, 10.0f ); - positions['E'] = Vector3( 11.0f, 12.0f, 13.0f ); - positions['F'] = Vector3( 14.0f, 15.0f, 16.0f ); - positions['G'] = Vector3( 17.0f, 18.0f, 19.0f ); - positions['H'] = Vector3( 20.0f, 21.0f, 22.0f ); + Stage stage = Stage::GetCurrent(); + + std::map sizes; + sizes['A'] = Vector3(50.0f, 50.0f, 0.0f); + sizes['B'] = Vector3(100.0f, 100.0f, 0.0f); + sizes['C'] = Vector3(150.0f, 150.0f, 0.0f); + sizes['D'] = Vector3(200.0f, 200.0f, 0.0f); + sizes['E'] = Vector3(250.0f, 250.0f, 0.0f); + sizes['F'] = Vector3(300.0f, 300.0f, 0.0f); + sizes['G'] = Vector3(350.0f, 350.0f, 0.0f); + sizes['H'] = Vector3(400.0f, 350.0f, 0.0f); + + std::map positions; + positions['A'] = Vector3(0.0f, 1.0f, 2.0f); + positions['B'] = Vector3(2.0f, 3.0f, 4.0f); + positions['C'] = Vector3(5.0f, 6.0f, 7.0f); + positions['D'] = Vector3(8.0f, 9.0f, 10.0f); + positions['E'] = Vector3(11.0f, 12.0f, 13.0f); + positions['F'] = Vector3(14.0f, 15.0f, 16.0f); + positions['G'] = Vector3(17.0f, 18.0f, 19.0f); + positions['H'] = Vector3(20.0f, 21.0f, 22.0f); Actor actorA = Actor::New(); - actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorA.SetProperty( Actor::Property::SIZE, sizes['A'] ); - actorA.SetProperty( Actor::Property::POSITION, positions['A'] ); - stage.Add( actorA ); + actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorA.SetProperty(Actor::Property::SIZE, sizes['A']); + actorA.SetProperty(Actor::Property::POSITION, positions['A']); + stage.Add(actorA); Actor actorB = Actor::New(); - actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT ); - actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actorB.SetProperty( Actor::Property::SIZE, sizes['B'] ); - actorB.SetProperty( Actor::Property::POSITION, positions['B'] ); - actorA.Add( actorB ); + actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT); + actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actorB.SetProperty(Actor::Property::SIZE, sizes['B']); + actorB.SetProperty(Actor::Property::POSITION, positions['B']); + actorA.Add(actorB); Actor actorC = Actor::New(); - actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER ); - actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); - actorC.SetProperty( Actor::Property::SIZE, sizes['C'] ); - actorC.SetProperty( Actor::Property::POSITION, positions['C'] ); - actorB.Add( actorC ); + actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER); + actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER); + actorC.SetProperty(Actor::Property::SIZE, sizes['C']); + actorC.SetProperty(Actor::Property::POSITION, positions['C']); + actorB.Add(actorC); Actor actorD = Actor::New(); - actorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT ); - actorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - actorD.SetProperty( Actor::Property::SIZE, sizes['D'] ); - actorD.SetProperty( Actor::Property::POSITION, positions['D'] ); - actorA.Add( actorD ); + actorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT); + actorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + actorD.SetProperty(Actor::Property::SIZE, sizes['D']); + actorD.SetProperty(Actor::Property::POSITION, positions['D']); + actorA.Add(actorD); Actor actorE = Actor::New(); - actorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); - actorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); - actorE.SetProperty( Actor::Property::SIZE, sizes['E'] ); - actorE.SetProperty( Actor::Property::POSITION, positions['E'] ); - stage.Add( actorE ); + actorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT); + actorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT); + actorE.SetProperty(Actor::Property::SIZE, sizes['E']); + actorE.SetProperty(Actor::Property::POSITION, positions['E']); + stage.Add(actorE); Actor actorF = Actor::New(); - actorF.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER ); - actorF.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER ); - actorF.SetProperty( Actor::Property::SIZE, sizes['F'] ); - actorF.SetProperty( Actor::Property::POSITION, positions['F'] ); - actorE.Add( actorF ); + actorF.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER); + actorF.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER); + actorF.SetProperty(Actor::Property::SIZE, sizes['F']); + actorF.SetProperty(Actor::Property::POSITION, positions['F']); + actorE.Add(actorF); Actor actorG = Actor::New(); - actorG.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT ); - actorG.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - actorG.SetProperty( Actor::Property::SIZE, sizes['G'] ); - actorG.SetProperty( Actor::Property::POSITION, positions['G'] ); - actorE.Add( actorG ); + actorG.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT); + actorG.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + actorG.SetProperty(Actor::Property::SIZE, sizes['G']); + actorG.SetProperty(Actor::Property::POSITION, positions['G']); + actorE.Add(actorG); Actor actorH = Actor::New(); - actorH.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT ); - actorH.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); - actorH.SetProperty( Actor::Property::SIZE, sizes['H'] ); - actorH.SetProperty( Actor::Property::POSITION, positions['H'] ); - actorG.Add( actorH ); - - std::map< char, unsigned int > actorIds; - actorIds['A'] = actorA.GetProperty< int >( Actor::Property::ID ); - actorIds['B'] = actorB.GetProperty< int >( Actor::Property::ID ); - actorIds['C'] = actorC.GetProperty< int >( Actor::Property::ID ); - actorIds['D'] = actorD.GetProperty< int >( Actor::Property::ID ); - actorIds['E'] = actorE.GetProperty< int >( Actor::Property::ID ); - actorIds['F'] = actorF.GetProperty< int >( Actor::Property::ID ); - actorIds['G'] = actorG.GetProperty< int >( Actor::Property::ID ); - actorIds['H'] = actorH.GetProperty< int >( Actor::Property::ID ); + actorH.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT); + actorH.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT); + actorH.SetProperty(Actor::Property::SIZE, sizes['H']); + actorH.SetProperty(Actor::Property::POSITION, positions['H']); + actorG.Add(actorH); + + std::map actorIds; + actorIds['A'] = actorA.GetProperty(Actor::Property::ID); + actorIds['B'] = actorB.GetProperty(Actor::Property::ID); + actorIds['C'] = actorC.GetProperty(Actor::Property::ID); + actorIds['D'] = actorD.GetProperty(Actor::Property::ID); + actorIds['E'] = actorE.GetProperty(Actor::Property::ID); + actorIds['F'] = actorF.GetProperty(Actor::Property::ID); + actorIds['G'] = actorG.GetProperty(Actor::Property::ID); + actorIds['H'] = actorH.GetProperty(Actor::Property::ID); FrameCallbackMultipleActors frameCallback; - for( auto&& i : actorIds ) + for(auto&& i : actorIds) { - frameCallback.mActorIds.PushBack( i.second ); + frameCallback.mActorIds.PushBack(i.second); } - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); - for( char i = 'A'; i <= 'H'; ++i ) + for(char i = 'A'; i <= 'H'; ++i) { - DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mPositions[actorIds[i]], positions[i], TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizes[actorIds[i]], sizes[i], TEST_LOCATION); } // Render again to make sure it still gets called and gives the correct values (in case any optimisations break this) @@ -596,12 +588,12 @@ int UtcDaliFrameCallbackMultipleActors(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); - for( char i = 'A'; i <= 'H'; ++i ) + for(char i = 'A'; i <= 'H'; ++i) { - DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mPositions[actorIds[i]], positions[i], TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizes[actorIds[i]], sizes[i], TEST_LOCATION); } END_TEST; @@ -612,23 +604,23 @@ int UtcDaliFrameCallbackCheckActorNotAdded(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 200, 300 ) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(200, 300)); - Stage stage = Stage::GetCurrent(); - FrameCallbackOneActor frameCallback( actor.GetProperty< int >( Actor::Property::ID ) ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + Stage stage = Stage::GetCurrent(); + FrameCallbackOneActor frameCallback(actor.GetProperty(Actor::Property::ID)); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); // All should be default constructed objects - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mColor, Vector4::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mScale, Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mPositionGetPositionCall, Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSizeGetSizeCall, Vector3::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mColor, Vector4::ZERO, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mScale, Vector3::ZERO, TEST_LOCATION); END_TEST; } @@ -638,30 +630,30 @@ int UtcDaliFrameCallbackInvalidActorId(void) // Test to ensure that there are no issues when trying to use the update-proxy methods with an invalid actor ID. TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - FrameCallbackActorIdCheck frameCallback( 10000 ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + FrameCallbackActorIdCheck frameCallback(10000); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); // Invalid Actor ID so all the methods should not return successfully. - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION); END_TEST; } @@ -672,79 +664,79 @@ int UtcDaliFrameCallbackActorRemovedAndAdded(void) // and then re-start calling the required methods if that actor is re-added back to the stage TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); - FrameCallbackActorIdCheck frameCallback( actor.GetProperty< int >( Actor::Property::ID ) ); - DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() ); + FrameCallbackActorIdCheck frameCallback(actor.GetProperty(Actor::Property::ID)); + DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer()); application.SendNotification(); application.Render(); // All methods should return successfully. - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION); frameCallback.Reset(); // Remove the actor from stage, the methods should not return successfully. - stage.Remove( actor ); + stage.Remove(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION); frameCallback.Reset(); // Re-add the actor back to the stage, all the methods should once again, return successfully. - stage.Add( actor ); + stage.Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION); END_TEST; } @@ -754,68 +746,68 @@ int UtcDaliFrameCallbackMultipleCallbacks(void) // Test to ensure multiple frame-callbacks work as expected TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); FrameCallbackBasic frameCallback1; FrameCallbackBasic frameCallback2; - DevelStage::AddFrameCallback( stage, frameCallback1, stage.GetRootLayer() ); - DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() ); + DevelStage::AddFrameCallback(stage, frameCallback1, stage.GetRootLayer()); + DevelStage::AddFrameCallback(stage, frameCallback2, stage.GetRootLayer()); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Remove the second frame-callback, only the first should be called - DevelStage::RemoveFrameCallback( stage, frameCallback2 ); + DevelStage::RemoveFrameCallback(stage, frameCallback2); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Re-add the second frame-callback and remove the first, only the second should be called - DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() ); - DevelStage::RemoveFrameCallback( stage, frameCallback1 ); + DevelStage::AddFrameCallback(stage, frameCallback2, stage.GetRootLayer()); + DevelStage::RemoveFrameCallback(stage, frameCallback1); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Attempt removal of the first frame-callback again, should be a no-op and yield the exact same results as the last run - DevelStage::RemoveFrameCallback( stage, frameCallback1 ); + DevelStage::RemoveFrameCallback(stage, frameCallback1); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Remove the second frame-callback as well, neither should be called - DevelStage::RemoveFrameCallback( stage, frameCallback2 ); + DevelStage::RemoveFrameCallback(stage, frameCallback2); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION); END_TEST; } @@ -825,45 +817,45 @@ int UtcDaliFrameCallbackActorDestroyed(void) // Test to ensure that the frame-callback behaves gracefully if the connected root-actor is destroyed TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); FrameCallbackBasic frameCallback1; FrameCallbackBasic frameCallback2; - DevelStage::AddFrameCallback( stage, frameCallback1, actor ); - DevelStage::AddFrameCallback( stage, frameCallback2, actor ); + DevelStage::AddFrameCallback(stage, frameCallback1, actor); + DevelStage::AddFrameCallback(stage, frameCallback2, actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Remove the second frame-callback, only the first should be called - DevelStage::RemoveFrameCallback( stage, frameCallback2 ); + DevelStage::RemoveFrameCallback(stage, frameCallback2); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION); frameCallback1.Reset(); frameCallback2.Reset(); // Remove and destroy the actor, the first one should not be called either - stage.Remove( actor ); + stage.Remove(actor); actor.Reset(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION); END_TEST; } @@ -873,19 +865,19 @@ int UtcDaliFrameCallbackDestroyedBeforeRemoving(void) // Ensure there's no segmentation fault if the callback is deleted without being removed TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); { FrameCallbackBasic frameCallback; - DevelStage::AddFrameCallback( stage, frameCallback, actor ); + DevelStage::AddFrameCallback(stage, frameCallback, actor); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION); frameCallback.Reset(); } @@ -893,7 +885,7 @@ int UtcDaliFrameCallbackDestroyedBeforeRemoving(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( true ); // If it runs to here then there's no segmentation fault + DALI_TEST_CHECK(true); // If it runs to here then there's no segmentation fault END_TEST; } @@ -903,19 +895,19 @@ int UtcDaliFrameCallbackDoubleAddition(void) // Ensure we don't connect the same frame-callback twice TestApplication application; - Stage stage = Stage::GetCurrent(); - Actor rootActor = stage.GetRootLayer(); + Stage stage = Stage::GetCurrent(); + Actor rootActor = stage.GetRootLayer(); FrameCallbackBasic frameCallback; - DevelStage::AddFrameCallback( stage, frameCallback, rootActor ); + DevelStage::AddFrameCallback(stage, frameCallback, rootActor); try { - DevelStage::AddFrameCallback( stage, frameCallback, rootActor ); + DevelStage::AddFrameCallback(stage, frameCallback, rootActor); } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-Geometry.cpp b/automated-tests/src/dali/utc-Dali-Geometry.cpp index dbbb0f8..f43288b 100644 --- a/automated-tests/src/dali/utc-Dali-Geometry.cpp +++ b/automated-tests/src/dali/utc-Dali-Geometry.cpp @@ -15,8 +15,8 @@ * */ -#include #include +#include using namespace Dali; @@ -34,31 +34,32 @@ void geometry_test_cleanup(void) namespace { +struct TexturedQuadVertex +{ + Vector2 position; + Vector2 textureCoordinates; +}; -struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; - -VertexBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord ) +VertexBuffer CreateVertexBuffer(const std::string& aPosition, const std::string& aTexCoord) { - const float halfQuadSize = .5f; + const float halfQuadSize = .5f; TexturedQuadVertex texturedQuadVertexData[4] = { - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) }, - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) }, - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; + {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)}, + {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)}, + {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)}, + {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}}; Property::Map vertexFormat; vertexFormat[aPosition] = Property::VECTOR2; vertexFormat[aTexCoord] = Property::VECTOR2; - VertexBuffer vertexData = VertexBuffer::New( vertexFormat ); - vertexData.SetData( texturedQuadVertexData, 4 ); + VertexBuffer vertexData = VertexBuffer::New(vertexFormat); + vertexData.SetData(texturedQuadVertexData, 4); return vertexData; } - -} - +} // namespace int UtcDaliGeometryNew01(void) { @@ -66,15 +67,15 @@ int UtcDaliGeometryNew01(void) Geometry geometry = Geometry::New(); - DALI_TEST_EQUALS( (bool)geometry, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)geometry, true, TEST_LOCATION); END_TEST; } int UtcDaliGeometryNew02(void) { TestApplication application; - Geometry geometry; - DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION ); + Geometry geometry; + DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION); END_TEST; } @@ -86,7 +87,7 @@ int UtcDaliGeometryCopyConstructor(void) Geometry geometryCopy(geometry); - DALI_TEST_EQUALS( (bool)geometryCopy, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)geometryCopy, true, TEST_LOCATION); END_TEST; } @@ -97,10 +98,10 @@ int UtcDaliGeometryAssignmentOperator(void) Geometry geometry = Geometry::New(); Geometry geometry2; - DALI_TEST_EQUALS( (bool)geometry2, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)geometry2, false, TEST_LOCATION); geometry2 = geometry; - DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION); END_TEST; } @@ -110,19 +111,19 @@ int UtcDaliGeometryMoveConstructor(void) TestApplication application; Geometry geometry = Geometry::New(); - DALI_TEST_CHECK( geometry ); - DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); + DALI_TEST_CHECK(geometry); + DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); - geometry.AddVertexBuffer( vertexBuffer ); - DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); + VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord"); + geometry.AddVertexBuffer(vertexBuffer); + DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION); - Geometry move = std::move( geometry ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION ); - DALI_TEST_CHECK( !geometry ); + Geometry move = std::move(geometry); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION); + DALI_TEST_CHECK(!geometry); END_TEST; } @@ -132,20 +133,20 @@ int UtcDaliGeometryMoveAssignment(void) TestApplication application; Geometry geometry = Geometry::New(); - DALI_TEST_CHECK( geometry ); - DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); + DALI_TEST_CHECK(geometry); + DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); - geometry.AddVertexBuffer( vertexBuffer ); - DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); + VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord"); + geometry.AddVertexBuffer(vertexBuffer); + DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION); Geometry move; - move = std::move( geometry ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION ); - DALI_TEST_CHECK( !geometry ); + move = std::move(geometry); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION); + DALI_TEST_CHECK(!geometry); END_TEST; } @@ -157,8 +158,8 @@ int UtcDaliGeometryDownCast01(void) Geometry geometry = Geometry::New(); BaseHandle handle(geometry); - Geometry geometry2 = Geometry::DownCast(handle); - DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION ); + Geometry geometry2 = Geometry::DownCast(handle); + DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION); END_TEST; } @@ -166,9 +167,9 @@ int UtcDaliGeometryDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object Geometry geometry = Geometry::DownCast(handle); - DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION); END_TEST; } @@ -178,14 +179,14 @@ int UtcDaliGeometryAddVertexBuffer(void) tet_infoline("Test AddVertexBuffer"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); - Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer1 ); + VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1"); + Geometry geometry = Geometry::New(); + geometry.AddVertexBuffer(vertexBuffer1); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); @@ -196,18 +197,18 @@ int UtcDaliGeometryAddVertexBuffer(void) { const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); + application.GetGlAbstraction().GetBufferDataCalls(); - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION); } // add the second vertex buffer application.GetGlAbstraction().ResetBufferDataCalls(); - VertexBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" ); - geometry.AddVertexBuffer( vertexBuffer2 ); + VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2"); + geometry.AddVertexBuffer(vertexBuffer2); application.SendNotification(); application.Render(0); application.Render(); @@ -215,11 +216,11 @@ int UtcDaliGeometryAddVertexBuffer(void) { const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); + application.GetGlAbstraction().GetBufferDataCalls(); //Check that only the new buffer gets uploaded - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION); } END_TEST; @@ -230,20 +231,20 @@ int UtcDaliGeometryGetNumberOfVertexBuffers(void) TestApplication application; tet_infoline("Test GetNumberOfVertexBuffers"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); - VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); - VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" ); + VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1"); + VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2"); + VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3"); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer1 ); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION ); + geometry.AddVertexBuffer(vertexBuffer1); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION); - geometry.AddVertexBuffer( vertexBuffer2 ); - geometry.AddVertexBuffer( vertexBuffer3 ); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION ); + geometry.AddVertexBuffer(vertexBuffer2); + geometry.AddVertexBuffer(vertexBuffer3); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION); - geometry.RemoveVertexBuffer( 2u ); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION ); + geometry.RemoveVertexBuffer(2u); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION); END_TEST; } @@ -254,32 +255,32 @@ int UtcDaliGeometryRemoveVertexBuffer(void) tet_infoline("Test RemoveVertexBuffer"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); - VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); + VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1"); + VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2"); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer1 ); + geometry.AddVertexBuffer(vertexBuffer1); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION); - geometry.RemoveVertexBuffer( 0 ); - geometry.AddVertexBuffer( vertexBuffer2 ); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION ); + geometry.RemoveVertexBuffer(0); + geometry.AddVertexBuffer(vertexBuffer2); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION); - geometry.RemoveVertexBuffer( 0 ); - DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION ); + geometry.RemoveVertexBuffer(0); + DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION); //Todo: test by checking the BufferDataCalls // make sure the vertex buffer in actually removed from gl - END_TEST; + END_TEST; } int UtcDaliGeometrySetIndexBuffer(void) @@ -288,15 +289,15 @@ int UtcDaliGeometrySetIndexBuffer(void) tet_infoline("Test SetIndexBuffer"); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord"); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer(vertexBuffer); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); @@ -307,18 +308,18 @@ int UtcDaliGeometrySetIndexBuffer(void) { const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); + application.GetGlAbstraction().GetBufferDataCalls(); - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION); } // Set index buffer application.GetGlAbstraction().ResetBufferDataCalls(); - const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 }; - geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) ); + const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3}; + geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0])); application.SendNotification(); application.Render(0); application.Render(); @@ -326,16 +327,15 @@ int UtcDaliGeometrySetIndexBuffer(void) { const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); + application.GetGlAbstraction().GetBufferDataCalls(); //Only the index buffer should be uploaded - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); // should be unsigned short instead of unsigned int - DALI_TEST_EQUALS( bufferDataCalls[0], 6*sizeof( unsigned short ), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(unsigned short), TEST_LOCATION); } - END_TEST; } @@ -345,21 +345,21 @@ int UtcDaliGeometrySetGetGeometryType01(void) tet_infoline("Test SetType and GetType: without index buffer"); - unsigned int numVertex = 4u; - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + unsigned int numVertex = 4u; + VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord"); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer(vertexBuffer); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); /****************************************************/ // Default (TRIANGLES), no index buffer @@ -369,20 +369,20 @@ int UtcDaliGeometrySetGetGeometryType01(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // Test the default geometry type is GL_TRIANGLE // no index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); std::stringstream out; out << GL_TRIANGLES << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION); /*********************************************************/ // LINES, no index buffer - geometry.SetType( Geometry::LINES ); + geometry.SetType(Geometry::LINES); drawTrace.Reset(); drawTrace.Enable(true); @@ -390,20 +390,20 @@ int UtcDaliGeometrySetGetGeometryType01(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_LINES // no index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); out.str(""); out << GL_LINES << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION); /*****************************************************/ //POINTS - geometry.SetType( Geometry::POINTS ); + geometry.SetType(Geometry::POINTS); drawTrace.Reset(); drawTrace.Enable(true); @@ -411,20 +411,20 @@ int UtcDaliGeometrySetGetGeometryType01(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_POINTS // no index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); out.str(""); out << GL_POINTS << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION); /*****************************************************/ //TRIANGLE_STRIP, no index buffer - geometry.SetType( Geometry::TRIANGLE_STRIP ); + geometry.SetType(Geometry::TRIANGLE_STRIP); drawTrace.Reset(); drawTrace.Enable(true); @@ -432,20 +432,20 @@ int UtcDaliGeometrySetGetGeometryType01(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_TRIANGLE_STRIP // no index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); out.str(""); out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION); /*****************************************************/ //TRIANGLE_FAN, no index buffer - geometry.SetType( Geometry::TRIANGLE_FAN ); + geometry.SetType(Geometry::TRIANGLE_FAN); drawTrace.Reset(); drawTrace.Enable(true); @@ -453,16 +453,16 @@ int UtcDaliGeometrySetGetGeometryType01(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_TRIANGLE_FAN // no index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); out.str(""); out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION); END_TEST; } @@ -473,25 +473,24 @@ int UtcDaliGeometrySetGetGeometryType02(void) tet_infoline("Test SetType and GetType: with index buffer"); - unsigned int numVertex = 4u; - unsigned int numIndex = 6u; // 6 unsigned short - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); - + unsigned int numVertex = 4u; + unsigned int numIndex = 6u; // 6 unsigned short + VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord"); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); - const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 }; - geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) ); + geometry.AddVertexBuffer(vertexBuffer); + const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3}; + geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0])); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); + TraceCallStack& drawTrace = glAbstraction.GetDrawTrace(); /****************************************************/ // Default (TRIANGLES), with index buffer @@ -501,19 +500,20 @@ int UtcDaliGeometrySetGetGeometryType02(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // Test the default geometry type is GL_TRIANGLE - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION); std::stringstream out; - out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices"; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); + out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", " + << "indices"; + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION); /*********************************************************/ // LINES, with index buffer - geometry.SetType( Geometry::LINES ); + geometry.SetType(Geometry::LINES); drawTrace.Reset(); drawTrace.Enable(true); @@ -521,19 +521,20 @@ int UtcDaliGeometrySetGetGeometryType02(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_LINES - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION); out.str(""); - out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices"; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); + out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", " + << "indices"; + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION); /*****************************************************/ //POINTS - geometry.SetType( Geometry::POINTS ); + geometry.SetType(Geometry::POINTS); drawTrace.Reset(); drawTrace.Enable(true); @@ -541,20 +542,20 @@ int UtcDaliGeometrySetGetGeometryType02(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_POINTS // As Points does not use the index buffer, call glDrawArrays, - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION); out.str(""); out << GL_POINTS << ", " << 0 << ", " << numVertex; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION); /*****************************************************/ //TRIANGLE_STRIP - geometry.SetType( Geometry::TRIANGLE_STRIP ); + geometry.SetType(Geometry::TRIANGLE_STRIP); drawTrace.Reset(); drawTrace.Enable(true); @@ -562,19 +563,20 @@ int UtcDaliGeometrySetGetGeometryType02(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_TRIANGLE_STRIP - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION); out.str(""); - out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices"; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); + out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", " + << "indices"; + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION); /*****************************************************/ //TRIANGLE_FAN - geometry.SetType( Geometry::TRIANGLE_FAN ); + geometry.SetType(Geometry::TRIANGLE_FAN); drawTrace.Reset(); drawTrace.Enable(true); @@ -582,15 +584,16 @@ int UtcDaliGeometrySetGetGeometryType02(void) application.Render(0); application.Render(); application.SendNotification(); - drawTrace.Enable( false ); + drawTrace.Enable(false); // geometry type is set as GL_TRIANGLE_FAN - DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION); out.str(""); - out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices"; - DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); + out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", " + << "indices"; + DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION); - DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION); + DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION); END_TEST; } @@ -598,12 +601,12 @@ int UtcDaliGeometrySetGetGeometryType02(void) int UtcDaliGeometrySetIndexBufferNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { unsigned short* arg1(nullptr); - unsigned long arg2(0u); - instance.SetIndexBuffer(arg1,arg2); + unsigned long arg2(0u); + instance.SetIndexBuffer(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -616,7 +619,7 @@ int UtcDaliGeometrySetIndexBufferNegative(void) int UtcDaliGeometryAddVertexBufferNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { Dali::VertexBuffer arg1; @@ -633,7 +636,7 @@ int UtcDaliGeometryAddVertexBufferNegative(void) int UtcDaliGeometryRemoveVertexBufferNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { unsigned long arg1(0u); @@ -650,7 +653,7 @@ int UtcDaliGeometryRemoveVertexBufferNegative(void) int UtcDaliGeometrySetTypeNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { Dali::Geometry::Type arg1(Geometry::POINTS); @@ -667,7 +670,7 @@ int UtcDaliGeometrySetTypeNegative(void) int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { instance.GetNumberOfVertexBuffers(); @@ -683,7 +686,7 @@ int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void) int UtcDaliGeometryGetTypeNegative(void) { TestApplication application; - Dali::Geometry instance; + Dali::Geometry instance; try { instance.GetType(); diff --git a/automated-tests/src/dali/utc-Dali-GestureDetector.cpp b/automated-tests/src/dali/utc-Dali-GestureDetector.cpp index 4ae9175..f53121b 100644 --- a/automated-tests/src/dali/utc-Dali-GestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-GestureDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,12 @@ * */ -#include - +#include +#include #include + #include -#include -#include +#include using namespace Dali; @@ -34,7 +34,6 @@ void utc_dali_gesture_detector_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliGestureDetectorConstructorN(void) { TestApplication application; @@ -48,9 +47,9 @@ int UtcDaliGestureDetectorConstructorN(void) detector.Attach(actor); tet_result(TET_FAIL); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "detector", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "detector", TEST_LOCATION); } END_TEST; } @@ -69,9 +68,9 @@ int UtcDaliGestureDetectorConstructorP(void) detector.Attach(actor); tet_result(TET_PASS); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_FAIL); } END_TEST; @@ -94,9 +93,9 @@ int UtcDaliGestureDetectorAssignP(void) detector2.Attach(actor); tet_result(TET_PASS); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_FAIL); } END_TEST; @@ -114,14 +113,14 @@ int UtcDaliGestureDetectorDownCastP(void) GestureDetector detector2 = GestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - GestureDetector detector3 = DownCast< GestureDetector >(object); + GestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; GestureDetector detector4 = GestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - GestureDetector detector5 = DownCast< GestureDetector >(unInitializedObject); + GestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); END_TEST; } @@ -140,7 +139,7 @@ int UtcDaliGestureDetectorAttachP(void) bool found = false; for(size_t i = 0; i < detector.GetAttachedActorCount(); i++) { - if( detector.GetAttachedActor(i) == actor ) + if(detector.GetAttachedActor(i) == actor) { tet_result(TET_PASS); found = true; @@ -178,9 +177,9 @@ int UtcDaliGestureDetectorAttachN(void) detector.Attach(actor); tet_result(TET_FAIL); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "actor", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "actor", TEST_LOCATION); } END_TEST; } @@ -198,7 +197,7 @@ int UtcDaliGestureDetectorDetachP(void) bool found = false; for(size_t i = 0; i < detector.GetAttachedActorCount(); i++) { - if( detector.GetAttachedActor(i) == actor ) + if(detector.GetAttachedActor(i) == actor) { tet_result(TET_PASS); found = true; @@ -216,7 +215,7 @@ int UtcDaliGestureDetectorDetachP(void) found = false; for(size_t i = 0; i < detector.GetAttachedActorCount(); i++) { - if( detector.GetAttachedActor(i) == actor ) + if(detector.GetAttachedActor(i) == actor) { found = true; } @@ -249,9 +248,9 @@ int UtcDaliGestureDetectorDetachN01(void) detector.Detach(actor); tet_result(TET_FAIL); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "actor", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "actor", TEST_LOCATION); } END_TEST; } @@ -273,9 +272,9 @@ int UtcDaliGestureDetectorDetachN02(void) detector.Detach(actor2); tet_result(TET_PASS); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_FAIL); } END_TEST; @@ -299,9 +298,9 @@ int UtcDaliGestureDetectorDetachN03(void) detector.Detach(actor); detector.Detach(actor); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_FAIL); } @@ -320,7 +319,7 @@ int UtcDaliGestureDetectorDetachAllP(void) const unsigned int actorsToAdd = 5; std::vector myActors; - for (unsigned int i = 0; i < actorsToAdd; ++i) + for(unsigned int i = 0; i < actorsToAdd; ++i) { Actor actor = Actor::New(); myActors.push_back(actor); @@ -346,7 +345,7 @@ int UtcDaliGestureDetectorDetachAllN(void) const unsigned int actorsToAdd = 5; std::vector myActors; - for (unsigned int i = 0; i < actorsToAdd; ++i) + for(unsigned int i = 0; i < actorsToAdd; ++i) { Actor actor = Actor::New(); myActors.push_back(actor); @@ -365,9 +364,9 @@ int UtcDaliGestureDetectorDetachAllN(void) { detector.DetachAll(); } - catch (DaliException& e) + catch(DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_FAIL); } END_TEST; @@ -395,7 +394,7 @@ int UtcDaliGestureDetectorGetAttachedActors(void) // Attach another five actors std::vector myActors; - for (unsigned int i = 0; i < 5; ++i) + for(unsigned int i = 0; i < 5; ++i) { Actor actor = Actor::New(); myActors.push_back(actor); @@ -441,25 +440,25 @@ int UtcDaliGestureDetectorProperties(void) // Use pinch gesture as that doen't currently have any properties. Will need to change it if default properties are added. GestureDetector detector = PinchGestureDetector::New(); - DALI_TEST_EQUALS( detector.GetPropertyCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetPropertyCount(), 0u, TEST_LOCATION); Property::IndexContainer indices; - detector.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), 0u, TEST_LOCATION ); + detector.GetPropertyIndices(indices); + DALI_TEST_EQUALS(indices.Size(), 0u, TEST_LOCATION); - DALI_TEST_EQUALS( detector.IsPropertyWritable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.IsPropertyAnimatable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetPropertyType( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), Property::NONE, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetPropertyIndex( "InvalidIndex" ), Property::INVALID_INDEX, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.IsPropertyWritable(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION); + DALI_TEST_EQUALS(detector.IsPropertyAnimatable(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION); + DALI_TEST_EQUALS(detector.IsPropertyAConstraintInput(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetPropertyType(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), Property::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetPropertyIndex("InvalidIndex"), Property::INVALID_INDEX, TEST_LOCATION); - Property::Value propValue = detector.GetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ); - DALI_TEST_EQUALS( propValue.GetType(), Property::NONE, TEST_LOCATION ); + Property::Value propValue = detector.GetProperty(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX); + DALI_TEST_EQUALS(propValue.GetType(), Property::NONE, TEST_LOCATION); - DALI_TEST_CHECK( detector.GetPropertyName( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ).empty() ); + DALI_TEST_CHECK(detector.GetPropertyName(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX).empty()); // For coverage only, not testable - detector.SetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX, true ); + detector.SetProperty(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX, true); END_TEST; } @@ -470,24 +469,24 @@ int UtcDaliGestureDetectorRegisterProperty(void) GestureDetector detector = PinchGestureDetector::New(); - Property::Index index = detector.RegisterProperty( "sceneProperty", 0 ); - DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION ); + Property::Index index = detector.RegisterProperty("sceneProperty", 0); + DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetProperty(index), 0, TEST_LOCATION); - detector.SetProperty( index, -123 ); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION ); + detector.SetProperty(index, -123); + DALI_TEST_EQUALS(detector.GetProperty(index), -123, TEST_LOCATION); using Dali::Animation; - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( detector, index ), 99 ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(detector, index), 99); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetProperty(index), -123, TEST_LOCATION); // Start the animation animation.Play(); application.SendNotification(); - application.Render( 1000 /* 100% progress */); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION ); + application.Render(1000 /* 100% progress */); + DALI_TEST_EQUALS(detector.GetProperty(index), 99, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Handle.cpp b/automated-tests/src/dali/utc-Dali-Handle.cpp index 24a4000..a950104 100644 --- a/automated-tests/src/dali/utc-Dali-Handle.cpp +++ b/automated-tests/src/dali/utc-Dali-Handle.cpp @@ -15,17 +15,18 @@ * */ -#include -#include -#include -#include #include #include +#include +#include +#include + +#include +#include + #include "dali-test-suite-utils/dali-test-suite-utils.h" #include "dali-test-suite-utils/test-custom-actor.h" -#include - using namespace Dali; void handle_test_startup(void) @@ -40,7 +41,6 @@ void handle_test_cleanup(void) namespace { - /// Allows the creation of a BaseObject class BaseObjectType : public BaseObject { @@ -54,7 +54,7 @@ Handle ImplicitCopyConstructor(Handle passedByValue) { // object + copy + passedByValue, ref count == 3 DALI_TEST_CHECK(passedByValue); - if (passedByValue) + if(passedByValue) { DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -62,8 +62,7 @@ Handle ImplicitCopyConstructor(Handle passedByValue) return passedByValue; } -} // anon namespace - +} // namespace int UtcDaliHandleConstructorVoid(void) { @@ -90,7 +89,7 @@ int UtcDaliHandleCopyConstructor(void) // Copy the object, ref count == 2 Handle copy(object); DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -100,7 +99,7 @@ int UtcDaliHandleCopyConstructor(void) Handle anotherCopy = ImplicitCopyConstructor(copy); DALI_TEST_CHECK(anotherCopy); - if (anotherCopy) + if(anotherCopy) { DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -108,7 +107,7 @@ int UtcDaliHandleCopyConstructor(void) // anotherCopy out of scope, ref count == 2 DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -142,20 +141,20 @@ int UtcDaliHandleMoveConstructor(void) // Initialize a handle, ref count == 1 Handle handle = Actor::New(); - DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION); - int value( 20 ); - Property::Index index = handle.RegisterProperty( "customProperty", value ); - DALI_TEST_CHECK( handle.GetProperty( index ) == value ); + int value(20); + Property::Index index = handle.RegisterProperty("customProperty", value); + DALI_TEST_CHECK(handle.GetProperty(index) == value); // Move the object, ref count == 1 - Handle move = std::move( handle ); - DALI_TEST_CHECK( move ); + Handle move = std::move(handle); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( move.GetProperty( index ) == value ); - DALI_TEST_CHECK( !handle ); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(move.GetProperty(index) == value); + DALI_TEST_CHECK(!handle); END_TEST; } @@ -167,21 +166,21 @@ int UtcDaliHandleMoveAssignment(void) // Initialize a handle, ref count == 1 Handle handle = Actor::New(); - DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION); - int value( 20 ); - Property::Index index = handle.RegisterProperty( "customProperty", value ); - DALI_TEST_CHECK( handle.GetProperty( index ) == value ); + int value(20); + Property::Index index = handle.RegisterProperty("customProperty", value); + DALI_TEST_CHECK(handle.GetProperty(index) == value); // Move the object, ref count == 1 Handle move; - move = std::move( handle ); - DALI_TEST_CHECK( move ); + move = std::move(handle); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( move.GetProperty( index ) == value ); - DALI_TEST_CHECK( !handle ); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(move.GetProperty(index) == value); + DALI_TEST_CHECK(!handle); END_TEST; } @@ -192,7 +191,7 @@ int UtcDaliHandleSupports(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) ); + DALI_TEST_CHECK(true == actor.Supports(Handle::DYNAMIC_PROPERTIES)); END_TEST; } @@ -202,11 +201,11 @@ int UtcDaliHandleGetPropertyCount(void) TestApplication application; Actor actor = Actor::New(); - int defaultPropertyCount( actor.GetPropertyCount() ); + int defaultPropertyCount(actor.GetPropertyCount()); // Register a dynamic property - actor.RegisterProperty( "testProperty", float(123.0f) ); - DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() ); + actor.RegisterProperty("testProperty", float(123.0f)); + DALI_TEST_CHECK((defaultPropertyCount + 1u) == actor.GetPropertyCount()); END_TEST; } @@ -216,12 +215,12 @@ int UtcDaliHandleGetPropertyName(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( "parentOrigin" == actor.GetPropertyName( Actor::Property::PARENT_ORIGIN ) ); + DALI_TEST_CHECK("parentOrigin" == actor.GetPropertyName(Actor::Property::PARENT_ORIGIN)); // Register a dynamic property - std::string name("thisNameShouldMatch"); - Property::Index index = actor.RegisterProperty( name, float(123.0f) ); - DALI_TEST_CHECK( name == actor.GetPropertyName( index ) ); + std::string name("thisNameShouldMatch"); + Property::Index index = actor.RegisterProperty(name, float(123.0f)); + DALI_TEST_CHECK(name == actor.GetPropertyName(index)); END_TEST; } @@ -232,12 +231,12 @@ int UtcDaliHandleGetPropertyIndex01(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin") ); + DALI_TEST_CHECK(Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin")); // Register a dynamic property - std::string name("thisNameShouldMatch"); - Property::Index index = actor.RegisterProperty( name, float(123.0f) ); - DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) ); + std::string name("thisNameShouldMatch"); + Property::Index index = actor.RegisterProperty(name, float(123.0f)); + DALI_TEST_CHECK(index == actor.GetPropertyIndex(name)); END_TEST; } @@ -249,34 +248,34 @@ int UtcDaliHandleGetPropertyIndex02(void) Integration::Scene stage = application.GetScene(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); const unsigned int defaultPropertyCount = actor.GetPropertyCount(); application.SendNotification(); application.Render(); - Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1; - Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2; + Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1; + Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2; const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f); - const float withFlake(99.f); + const float withFlake(99.f); - Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE ); - Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor); - Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE ); - Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake ); - Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE ); + Property::Index index1 = actor.RegisterProperty("MyPropertyOne", Vector3::ONE); + Property::Index index2 = actor.RegisterProperty(key1, "sideColor", testColor); + Property::Index index3 = actor.RegisterProperty("MyPropertyTwo", Vector3::ONE); + Property::Index index4 = actor.RegisterProperty(key2, "iceCream", withFlake); + Property::Index index5 = actor.RegisterProperty("MyPropertyThree", Vector3::ONE); application.SendNotification(); application.Render(); // Test that we can get the property index from the integer key - Property::Index testIndex1 = actor.GetPropertyIndex( key1 ); - Property::Index testIndex2 = actor.GetPropertyIndex( key2 ); + Property::Index testIndex1 = actor.GetPropertyIndex(key1); + Property::Index testIndex2 = actor.GetPropertyIndex(key2); - DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); - DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION ); + DALI_TEST_EQUALS(index2, testIndex1, TEST_LOCATION); + DALI_TEST_EQUALS(index4, testIndex2, TEST_LOCATION); // Test that we keep the same indices on the named properties Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne"); @@ -290,7 +289,7 @@ int UtcDaliHandleGetPropertyIndex02(void) testIndex = actor.GetPropertyIndex("iceCream"); DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION); - DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION); + DALI_TEST_EQUALS(defaultPropertyCount + 5, actor.GetPropertyCount(), TEST_LOCATION); END_TEST; } @@ -300,22 +299,21 @@ int UtcDaliHandleGetPropertyIndex03(void) Actor actor = Actor::New(); - std::string myName("croydon"); - Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1; - Property::Value value( Color::GREEN ); - Property::Index myIndex = actor.RegisterProperty( intKey, myName, value ); + std::string myName("croydon"); + Property::Index intKey = CORE_PROPERTY_MAX_INDEX + 1; + Property::Value value(Color::GREEN); + Property::Index myIndex = actor.RegisterProperty(intKey, myName, value); - DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( intKey ), TEST_LOCATION ); + DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(intKey), TEST_LOCATION); Property::Key key1(myName); Property::Key key2(intKey); - DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key2 ), TEST_LOCATION ); + DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(key1), TEST_LOCATION); + DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(key2), TEST_LOCATION); END_TEST; } - int UtcDaliHandleIsPropertyWritable(void) { tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()"); @@ -324,43 +322,43 @@ int UtcDaliHandleIsPropertyWritable(void) Actor actor = Actor::New(); // Actor properties which are writable: - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_WIDTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_HEIGHT ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_DEPTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ORIENTATION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::VISIBLE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_RED ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_GREEN ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_BLUE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_ALPHA ) ); - DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::OPACITY ) ); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_X)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_X)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_WIDTH)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_HEIGHT)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_DEPTH)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_X)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ORIENTATION)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_X)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::VISIBLE)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_RED)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_GREEN)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_BLUE)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_ALPHA)); + DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::OPACITY)); // World-properties are not writable: - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_ORIENTATION ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_SCALE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_COLOR ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_X ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Y ) ); - DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Z ) ); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_ORIENTATION)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_SCALE)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_COLOR)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_X)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_Y)); + DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_Z)); END_TEST; } @@ -373,43 +371,43 @@ int UtcDaliHandleIsPropertyAnimatable(void) Actor actor = Actor::New(); // Actor properties which are animatable: - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_X ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Y ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Z ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_X ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Y ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_WIDTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_HEIGHT ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_DEPTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::ORIENTATION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::VISIBLE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_RED ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_GREEN ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_BLUE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_ALPHA ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::OPACITY ) ); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_X)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_Y)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_Z)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_X)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_Y)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_WIDTH)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_HEIGHT)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_DEPTH)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::ORIENTATION)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::VISIBLE)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_RED)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_GREEN)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_BLUE)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_ALPHA)); + DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::OPACITY)); // World-properties can not be animated - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_ORIENTATION ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_SCALE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_COLOR ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_X ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Y ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Z ) ); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_ORIENTATION)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_SCALE)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_COLOR)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_X)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_Y)); + DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_Z)); END_TEST; } @@ -421,128 +419,127 @@ int UtcDaliHandleIsPropertyAConstraintInput(void) Actor actor = Actor::New(); // Actor properties which can be used as a constraint input: - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_WIDTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_HEIGHT ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_DEPTH ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ORIENTATION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Z ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::VISIBLE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_RED ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_GREEN ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_BLUE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_ALPHA ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::OPACITY ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_ORIENTATION ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_SCALE ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_COLOR ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_X ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Y ) ); - DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Z ) ); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_WIDTH)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_HEIGHT)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_DEPTH)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ORIENTATION)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_Z)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::VISIBLE)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_RED)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_GREEN)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_BLUE)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_ALPHA)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::OPACITY)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_ORIENTATION)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_SCALE)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_COLOR)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_X)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_Y)); + DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_Z)); // Actor properties that cannot be used as a constraint input - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::NAME ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SENSITIVE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::LEAVE_REQUIRED ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) ); - DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) ); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::NAME)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::SENSITIVE)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::LEAVE_REQUIRED)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::INHERIT_ORIENTATION)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::INHERIT_SCALE)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_MODE)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::DRAW_MODE)); + DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_MODE_FACTOR)); END_TEST; } - int UtcDaliHandleGetPropertyType(void) { tet_infoline("Positive Test Dali::Handle::GetPropertyType()"); TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::PARENT_ORIGIN ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::ANCHOR_POINT ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SIZE ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::POSITION ) ); - DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::Property::ORIENTATION ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SCALE ) ); - DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( Actor::Property::VISIBLE ) ); - DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( Actor::Property::COLOR ) ); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::PARENT_ORIGIN)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::ANCHOR_POINT)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::SIZE)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::POSITION)); + DALI_TEST_CHECK(Property::ROTATION == actor.GetPropertyType(Actor::Property::ORIENTATION)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::SCALE)); + DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(Actor::Property::VISIBLE)); + DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(Actor::Property::COLOR)); // Register some dynamic properties - Property::Index boolIndex = actor.RegisterProperty( "boolProperty", bool(true) ); - Property::Index floatIndex = actor.RegisterProperty( "floatProperty", float(123.0f) ); - Property::Index intIndex = actor.RegisterProperty( "intProperty", 123 ); - Property::Index vector2Index = actor.RegisterProperty( "vector2Property", Vector2(1.0f, 2.0f) ); - Property::Index vector3Index = actor.RegisterProperty( "vector3Property", Vector3(1.0f, 2.0f, 3.0f) ); - Property::Index vector4Index = actor.RegisterProperty( "vector4Property", Vector4(1.0f, 2.0f, 3.0f, 4.0f) ); - Property::Index rotationIndex = actor.RegisterProperty( "rotationProperty", AngleAxis(Degree(180.0f), Vector3::YAXIS) ); - - DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( boolIndex ) ); - DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( floatIndex ) ); - DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( intIndex ) ); - DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( vector2Index ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( vector3Index ) ); - DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( vector4Index ) ); - DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) ); + Property::Index boolIndex = actor.RegisterProperty("boolProperty", bool(true)); + Property::Index floatIndex = actor.RegisterProperty("floatProperty", float(123.0f)); + Property::Index intIndex = actor.RegisterProperty("intProperty", 123); + Property::Index vector2Index = actor.RegisterProperty("vector2Property", Vector2(1.0f, 2.0f)); + Property::Index vector3Index = actor.RegisterProperty("vector3Property", Vector3(1.0f, 2.0f, 3.0f)); + Property::Index vector4Index = actor.RegisterProperty("vector4Property", Vector4(1.0f, 2.0f, 3.0f, 4.0f)); + Property::Index rotationIndex = actor.RegisterProperty("rotationProperty", AngleAxis(Degree(180.0f), Vector3::YAXIS)); + + DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(boolIndex)); + DALI_TEST_CHECK(Property::FLOAT == actor.GetPropertyType(floatIndex)); + DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(intIndex)); + DALI_TEST_CHECK(Property::VECTOR2 == actor.GetPropertyType(vector2Index)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(vector3Index)); + DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(vector4Index)); + DALI_TEST_CHECK(Property::ROTATION == actor.GetPropertyType(rotationIndex)); // Non animatable properties - Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("yes"), Property::READ_WRITE); - Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE); - Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE); - Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE); - Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE); - Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE); - Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE); - - DALI_TEST_CHECK( nonAnimStringIndex != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimV2Index != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimV3Index != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimV4Index != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimFloatIndex != Property::INVALID_INDEX ); - DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX ); - - DALI_TEST_CHECK( Property::STRING == actor.GetPropertyType( nonAnimStringIndex ) ); - DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( nonAnimV2Index ) ); - DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( nonAnimV3Index ) ); - DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( nonAnimV4Index ) ); - DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( nonAnimBooleanIndex ) ); - DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( nonAnimFloatIndex ) ); - DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( nonAnimIntegerIndex ) ); - - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) ); - - DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get(), TEST_LOCATION ); + Property::Index nonAnimStringIndex = actor.RegisterProperty("manFromDelmonte", std::string("yes"), Property::READ_WRITE); + Property::Index nonAnimV2Index = actor.RegisterProperty("v2", Vector2(1.f, 2.f), Property::READ_WRITE); + Property::Index nonAnimV3Index = actor.RegisterProperty("v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE); + Property::Index nonAnimV4Index = actor.RegisterProperty("v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE); + Property::Index nonAnimBooleanIndex = actor.RegisterProperty("bool", true, Property::READ_WRITE); + Property::Index nonAnimFloatIndex = actor.RegisterProperty("float", 0.f, Property::READ_WRITE); + Property::Index nonAnimIntegerIndex = actor.RegisterProperty("int", 0, Property::READ_WRITE); + + DALI_TEST_CHECK(nonAnimStringIndex != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimV2Index != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimV3Index != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimV4Index != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimBooleanIndex != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimFloatIndex != Property::INVALID_INDEX); + DALI_TEST_CHECK(nonAnimIntegerIndex != Property::INVALID_INDEX); + + DALI_TEST_CHECK(Property::STRING == actor.GetPropertyType(nonAnimStringIndex)); + DALI_TEST_CHECK(Property::VECTOR2 == actor.GetPropertyType(nonAnimV2Index)); + DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(nonAnimV3Index)); + DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(nonAnimV4Index)); + DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(nonAnimBooleanIndex)); + DALI_TEST_CHECK(Property::FLOAT == actor.GetPropertyType(nonAnimFloatIndex)); + DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(nonAnimIntegerIndex)); + + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimStringIndex)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV2Index)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV3Index)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV4Index)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimBooleanIndex)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimFloatIndex)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimIntegerIndex)); + + DALI_TEST_EQUALS("yes", actor.GetProperty(nonAnimStringIndex).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(1.f, 2.f), actor.GetProperty(nonAnimV2Index).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(1.f, 2.f, 3.f), actor.GetProperty(nonAnimV3Index).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(1.f, 2.f, 3.f, 4.f), actor.GetProperty(nonAnimV4Index).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, actor.GetProperty(nonAnimBooleanIndex).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(0.f, actor.GetProperty(nonAnimFloatIndex).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(0, actor.GetProperty(nonAnimIntegerIndex).Get(), TEST_LOCATION); END_TEST; } @@ -554,46 +551,46 @@ int UtcDaliHandleNonAnimatableProperties(void) Actor actor = Actor::New(); - Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE); + Property::Index nonAnimStringIndex = actor.RegisterProperty("manFromDelmonte", std::string("no"), Property::READ_WRITE); //// modify writable? - actor.SetProperty( nonAnimStringIndex, Property::Value("yes") ); + actor.SetProperty(nonAnimStringIndex, Property::Value("yes")); - DALI_TEST_CHECK( "yes" == actor.GetProperty( nonAnimStringIndex ).Get() ); + DALI_TEST_CHECK("yes" == actor.GetProperty(nonAnimStringIndex).Get()); //// cannot modify read only? - Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY); + Property::Index readonly = actor.RegisterProperty("float", 0.f, Property::READ_ONLY); DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly)); DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly)); - actor.SetProperty( readonly, Property::Value(1.f) ); + actor.SetProperty(readonly, Property::Value(1.f)); // trying to set a read-only property is a no-op - DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get(), TEST_LOCATION ); + DALI_TEST_EQUALS(0.f, actor.GetProperty(readonly).Get(), TEST_LOCATION); /// animatable can be set - Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE); + Property::Index write_anim = actor.RegisterProperty("write_float", 0.f, Property::ANIMATABLE); DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim)); DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim)); - actor.SetProperty( write_anim, Property::Value(1.f) ); + actor.SetProperty(write_anim, Property::Value(1.f)); //// animate a non animatable property throws - float durationSeconds(2.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - bool relativeValue(true); + bool relativeValue(true); try { animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_ASSERT( e, "Property type is not animatable", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property type is not animatable", TEST_LOCATION); } - DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get(), TEST_LOCATION ); + DALI_TEST_EQUALS("yes", actor.GetProperty(nonAnimStringIndex).Get(), TEST_LOCATION); END_TEST; } @@ -605,58 +602,58 @@ int UtcDaliHandleNonAnimtableCompositeProperties(void) Actor actor = Actor::New(); - Property::Value value(Property::ARRAY); + Property::Value value(Property::ARRAY); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); - array->PushBack( Property::Value( 0.1f ) ); - array->PushBack( "a string" ); - array->PushBack( Property::Value( Vector3(1,2,3) ) ); + array->PushBack(Property::Value(0.1f)); + array->PushBack("a string"); + array->PushBack(Property::Value(Vector3(1, 2, 3))); - DALI_TEST_EQUALS( 3u, array->Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(3u, array->Count(), TEST_LOCATION); - Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE ); + Property::Index propertyIndex = actor.RegisterProperty("composite", value, Property::READ_WRITE); - Property::Value out = actor.GetProperty( propertyIndex ); + Property::Value out = actor.GetProperty(propertyIndex); Property::Array* outArray = out.GetArray(); - DALI_TEST_CHECK( outArray != NULL ); + DALI_TEST_CHECK(outArray != NULL); - DALI_TEST_CHECK( Property::FLOAT == outArray->GetElementAt(0).GetType()); - DALI_TEST_CHECK( Property::STRING == outArray->GetElementAt(1).GetType()); - DALI_TEST_CHECK( Property::VECTOR3 == outArray->GetElementAt(2).GetType()); + DALI_TEST_CHECK(Property::FLOAT == outArray->GetElementAt(0).GetType()); + DALI_TEST_CHECK(Property::STRING == outArray->GetElementAt(1).GetType()); + DALI_TEST_CHECK(Property::VECTOR3 == outArray->GetElementAt(2).GetType()); - DALI_TEST_EQUALS( 0.1f, outArray->GetElementAt(0).Get(), TEST_LOCATION); - DALI_TEST_EQUALS( "a string", outArray->GetElementAt(1).Get(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector3(1,2,3), outArray->GetElementAt(2).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(0.1f, outArray->GetElementAt(0).Get(), TEST_LOCATION); + DALI_TEST_EQUALS("a string", outArray->GetElementAt(1).Get(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(1, 2, 3), outArray->GetElementAt(2).Get(), TEST_LOCATION); // composite types not animatable bool exception = false; try { - actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE); + actor.RegisterProperty("compositemap", value, Property::ANIMATABLE); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { exception = true; - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); } DALI_TEST_EQUALS(exception, true, TEST_LOCATION); // Map of maps Property::Value mapOfMaps(Property::MAP); - Property::Map* map = mapOfMaps.GetMap(); + Property::Map* map = mapOfMaps.GetMap(); - map->Insert( "key", Property::Value(Property::MAP) ); - map->Insert( "2key", "a string" ); + map->Insert("key", Property::Value(Property::MAP)); + map->Insert("2key", "a string"); - DALI_TEST_EQUALS( "a string", (*map)["2key"].Get(), TEST_LOCATION); + DALI_TEST_EQUALS("a string", (*map)["2key"].Get(), TEST_LOCATION); Property::Map* innerMap = map->Find("key")->GetMap(); - innerMap->Insert( "subkey", 5.f ); + innerMap->Insert("subkey", 5.f); - DALI_TEST_CHECK( NULL != map->Find("key")->GetMap()->Find("subkey") ); - DALI_TEST_EQUALS( 5.f, map->Find("key")->GetMap()->Find("subkey")->Get(), TEST_LOCATION); + DALI_TEST_CHECK(NULL != map->Find("key")->GetMap()->Find("subkey")); + DALI_TEST_EQUALS(5.f, map->Find("key")->GetMap()->Find("subkey")->Get(), TEST_LOCATION); END_TEST; } @@ -666,13 +663,13 @@ int UtcDaliHandleSetProperty01(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get() ); + DALI_TEST_CHECK(ParentOrigin::TOP_LEFT == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get()); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get() ); + DALI_TEST_CHECK(ParentOrigin::CENTER == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get()); END_TEST; } @@ -683,10 +680,10 @@ int UtcDaliHandleSetProperty02(void) Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) ); + DALI_TEST_CHECK(!actor.IsPropertyWritable(Actor::Property::WORLD_POSITION)); // World position is not writable so this is a no-op and should not crash - actor.SetProperty( Actor::Property::WORLD_POSITION, Vector3(1,2,3) ); + actor.SetProperty(Actor::Property::WORLD_POSITION, Vector3(1, 2, 3)); END_TEST; } @@ -699,31 +696,30 @@ int UtcDaliHandleRegisterProperty01(void) Integration::Scene stage = application.GetScene(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); const unsigned int defaultPropertyCount = actor.GetPropertyCount(); application.SendNotification(); application.Render(); - Property::Index index1 = actor.RegisterProperty( "MyProperty", Vector3::ONE ); + Property::Index index1 = actor.RegisterProperty("MyProperty", Vector3::ONE); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index1), Vector3::ONE, TEST_LOCATION); // No new property should be registered when we call the below function - Property::Index index2 = actor.RegisterProperty( "MyProperty", Vector3::ZAXIS ); + Property::Index index2 = actor.RegisterProperty("MyProperty", Vector3::ZAXIS); application.SendNotification(); application.Render(); - - DALI_TEST_EQUALS( index1, index2, TEST_LOCATION ); // We should have the same index as per the first registration - DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); // Property count should be the same - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index2 ), Vector3::ZAXIS, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call + DALI_TEST_EQUALS(index1, index2, TEST_LOCATION); // We should have the same index as per the first registration + DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION); // Property count should be the same + DALI_TEST_EQUALS(actor.GetProperty(index2), Vector3::ZAXIS, TEST_LOCATION); // Value should be what we sent on second RegisterProperty call END_TEST; } @@ -736,48 +732,46 @@ int UtcDaliHandleRegisterProperty02(void) Integration::Scene stage = application.GetScene(); Actor actor = Actor::New(); - stage.Add( actor ); + stage.Add(actor); const unsigned int defaultPropertyCount = actor.GetPropertyCount(); application.SendNotification(); application.Render(); - Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1; - Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2; + Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1; + Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2; const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f); - const float withFlake(99.f); + const float withFlake(99.f); - Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE ); - Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor); - Property::Index index3 = actor.RegisterProperty( key2, "iceCream", withFlake ); + Property::Index index1 = actor.RegisterProperty("MyPropertyOne", Vector3::ONE); + Property::Index index2 = actor.RegisterProperty(key1, "sideColor", testColor); + Property::Index index3 = actor.RegisterProperty(key2, "iceCream", withFlake); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), testColor, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), withFlake, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index1), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index2), testColor, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(index3), withFlake, TEST_LOCATION); // No new property should be registered when we call the below functions - Property::Index testIndex2 = actor.RegisterProperty( "iceCream", 2200.f ); - Property::Index testIndex1 = actor.RegisterProperty( "sideColor", Color::BLACK ); + Property::Index testIndex2 = actor.RegisterProperty("iceCream", 2200.f); + Property::Index testIndex1 = actor.RegisterProperty("sideColor", Color::BLACK); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); // We should have the same index as per the first registration - DALI_TEST_EQUALS( index3, testIndex2, TEST_LOCATION ); // We should have the same index as per the first registration - DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); // Property count should be the same - DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), Color::BLACK, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call - DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), 2200.f, TEST_LOCATION ); + DALI_TEST_EQUALS(index2, testIndex1, TEST_LOCATION); // We should have the same index as per the first registration + DALI_TEST_EQUALS(index3, testIndex2, TEST_LOCATION); // We should have the same index as per the first registration + DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION); // Property count should be the same + DALI_TEST_EQUALS(actor.GetProperty(index2), Color::BLACK, TEST_LOCATION); // Value should be what we sent on second RegisterProperty call + DALI_TEST_EQUALS(actor.GetProperty(index3), 2200.f, TEST_LOCATION); END_TEST; } - - int UtcDaliHandleGetProperty(void) { tet_infoline("Positive Test Dali::Handle::GetProperty()"); @@ -785,13 +779,13 @@ int UtcDaliHandleGetProperty(void) Actor actor = Actor::New(); - DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get() ); - DALI_TEST_CHECK( AnchorPoint::CENTER == actor.GetProperty( Actor::Property::ANCHOR_POINT ).Get() ); - DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::SIZE ).Get() ); - DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::POSITION ).Get() ); - DALI_TEST_CHECK( Vector3::ONE == actor.GetProperty( Actor::Property::SCALE ).Get() ); - DALI_TEST_CHECK( true == actor.GetProperty( Actor::Property::VISIBLE ).Get() ); - DALI_TEST_CHECK( Color::WHITE == actor.GetProperty( Actor::Property::COLOR ).Get() ); + DALI_TEST_CHECK(ParentOrigin::TOP_LEFT == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get()); + DALI_TEST_CHECK(AnchorPoint::CENTER == actor.GetProperty(Actor::Property::ANCHOR_POINT).Get()); + DALI_TEST_CHECK(Vector3::ZERO == actor.GetProperty(Actor::Property::SIZE).Get()); + DALI_TEST_CHECK(Vector3::ZERO == actor.GetProperty(Actor::Property::POSITION).Get()); + DALI_TEST_CHECK(Vector3::ONE == actor.GetProperty(Actor::Property::SCALE).Get()); + DALI_TEST_CHECK(true == actor.GetProperty(Actor::Property::VISIBLE).Get()); + DALI_TEST_CHECK(Color::WHITE == actor.GetProperty(Actor::Property::COLOR).Get()); END_TEST; } @@ -806,13 +800,13 @@ int UtcDaliHandleDownCast(void) Handle handle = Handle::DownCast(baseHandle); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); baseHandle = BaseHandle(); handle = Handle::DownCast(baseHandle); - DALI_TEST_CHECK( !handle ); + DALI_TEST_CHECK(!handle); END_TEST; } @@ -822,45 +816,45 @@ int UtcDaliHandleDownCastNegative(void) TestApplication application; // BaseObject is NOT an Object, so this DownCast should fail - BaseHandle handle( new BaseObjectType ); - Handle customHandle1 = Handle::DownCast( handle ); - DALI_TEST_CHECK( ! customHandle1 ); + BaseHandle handle(new BaseObjectType); + Handle customHandle1 = Handle::DownCast(handle); + DALI_TEST_CHECK(!customHandle1); // A DownCast on an empty handle will also fail Handle empty; - Handle customHandle2 = Handle::DownCast( empty ); - DALI_TEST_CHECK( ! customHandle2 ); + Handle customHandle2 = Handle::DownCast(empty); + DALI_TEST_CHECK(!customHandle2); END_TEST; } int UtcDaliHandleGetPropertyIndices(void) { - TestApplication application; + TestApplication application; Property::IndexContainer indices; // Actor Actor actor = Actor::New(); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); int numDefaultProperties = indices.Size(); - DALI_TEST_CHECK( numDefaultProperties > 0 ); - DALI_TEST_EQUALS( numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_CHECK(numDefaultProperties > 0); + DALI_TEST_EQUALS(numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION); const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f); - const float withFlake(99.f); + const float withFlake(99.f); - Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1; - Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2; + Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1; + Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2; - actor.RegisterProperty( "MyPropertyOne", Vector3::ONE ); - actor.RegisterProperty( key1, "sideColor", testColor); - actor.RegisterProperty( "MyPropertyTwo", 1234 ); - Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake ); - actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) ); + actor.RegisterProperty("MyPropertyOne", Vector3::ONE); + actor.RegisterProperty(key1, "sideColor", testColor); + actor.RegisterProperty("MyPropertyTwo", 1234); + Property::Index index4 = actor.RegisterProperty(key2, "iceCream", withFlake); + actor.RegisterProperty("MyPropertyThree", Vector2(.2f, .7f)); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); - DALI_TEST_EQUALS( indices.Size(), numDefaultProperties + 5, TEST_LOCATION ); - DALI_TEST_EQUALS( indices[indices.Size()-2], index4, TEST_LOCATION ); + DALI_TEST_EQUALS(indices.Size(), numDefaultProperties + 5, TEST_LOCATION); + DALI_TEST_EQUALS(indices[indices.Size() - 2], index4, TEST_LOCATION); END_TEST; } @@ -871,49 +865,49 @@ int UtcDaliHandleRegisterPropertyTypes(void) struct PropertyTypeAnimatable { - const char * name; + const char* name; Property::Value value; - bool animatable; + bool animatable; }; Property::Array array; - Property::Map map; + Property::Map map; PropertyTypeAnimatable properties[] = + { + {"Property::BOOLEAN", true, true}, + {"Property::FLOAT", 1.0f, true}, + {"Property::INTEGER", 1, true}, + {"Property::VECTOR2", Vector2::ONE, true}, + {"Property::VECTOR3", Vector3::ONE, true}, + {"Property::VECTOR4", Vector4::ONE, true}, + {"Property::MATRIX3", Matrix3::IDENTITY, true}, + {"Property::MATRIX", Matrix::IDENTITY, true}, + {"Property::RECTANGLE", Rect(), false}, + {"Property::ROTATION", AngleAxis(), true}, + {"Property::STRING", std::string("Me"), false}, + {"Property::ARRAY", array, false}, + {"Property::MAP", map, false}, + }; + + unsigned int numOfProperties(sizeof(properties) / sizeof(properties[0])); + + for(unsigned int i = 0; i < numOfProperties; ++i) { - { "Property::BOOLEAN", true, true }, - { "Property::FLOAT", 1.0f, true }, - { "Property::INTEGER", 1, true }, - { "Property::VECTOR2", Vector2::ONE, true }, - { "Property::VECTOR3", Vector3::ONE, true }, - { "Property::VECTOR4", Vector4::ONE, true }, - { "Property::MATRIX3", Matrix3::IDENTITY, true }, - { "Property::MATRIX", Matrix::IDENTITY, true }, - { "Property::RECTANGLE", Rect(), false }, - { "Property::ROTATION", AngleAxis(), true }, - { "Property::STRING", std::string("Me"), false }, - { "Property::ARRAY", array, false }, - { "Property::MAP", map, false }, - }; - - unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) ); - - for ( unsigned int i = 0; i < numOfProperties; ++i ) - { - tet_printf( "Testing: %s\n", properties[i].name ); + tet_printf("Testing: %s\n", properties[i].name); bool exception = false; try { Actor actor = Actor::New(); - actor.RegisterProperty( "manFromDelmonte", properties[i].value ); + actor.RegisterProperty("manFromDelmonte", properties[i].value); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { exception = true; } - DALI_TEST_CHECK( properties[i].animatable != exception ); + DALI_TEST_CHECK(properties[i].animatable != exception); } END_TEST; } @@ -924,23 +918,23 @@ int UtcDaliHandleCustomProperty(void) Handle handle = Handle::New(); - float startValue(1.0f); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + float startValue(1.0f); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); - handle.SetProperty( index, 5.0f ); + handle.SetProperty(index, 5.0f); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == 5.0f ); + DALI_TEST_CHECK(handle.GetProperty(index) == 5.0f); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == 5.0f ); + DALI_TEST_CHECK(handle.GetProperty(index) == 5.0f); END_TEST; } @@ -950,13 +944,13 @@ int UtcDaliHandleCustomPropertyNone(void) Handle handle = Handle::New(); - Property::Value value( Property::NONE ); - Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE); + Property::Value value(Property::NONE); + Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE); // Negative test i.e. setting a property of type NONE is meaningless - handle.SetProperty( index, 5.0f ); + handle.SetProperty(index, 5.0f); - DALI_TEST_CHECK( true ); // got here without crashing + DALI_TEST_CHECK(true); // got here without crashing END_TEST; } @@ -967,19 +961,19 @@ int UtcDaliHandleCustomPropertyIntToFloat(void) Handle handle = Handle::New(); - float startValue(5.0f); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + float startValue(5.0f); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); - handle.SetProperty( index, int(1) ); + handle.SetProperty(index, int(1)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == 1.0f ); + DALI_TEST_CHECK(handle.GetProperty(index) == 1.0f); END_TEST; } @@ -989,19 +983,19 @@ int UtcDaliHandleCustomPropertyFloatToInt(void) Handle handle = Handle::New(); - int startValue(5); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + int startValue(5); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); - handle.SetProperty( index, float(1.5) ); + handle.SetProperty(index, float(1.5)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == 1 ); + DALI_TEST_CHECK(handle.GetProperty(index) == 1); END_TEST; } @@ -1011,29 +1005,29 @@ int UtcDaliHandleCustomPropertyInvalidToRect(void) Handle handle = Handle::New(); - Rect startValue(1,2,3,4); - Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE); - DALI_TEST_EQUALS( handle.GetProperty< Rect >( index ), startValue, TEST_LOCATION ); + Rect startValue(1, 2, 3, 4); + Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE); + DALI_TEST_EQUALS(handle.GetProperty >(index), startValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Rect >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty >(index), startValue, TEST_LOCATION); // Negative test i.e. there is no conversion from float to Rect - handle.SetProperty( index, float(1.5) ); + handle.SetProperty(index, float(1.5)); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Rect >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty >(index), startValue, TEST_LOCATION); // Positive test (sanity check) - Rect endValue(5,6,7,8); - handle.SetProperty( index, endValue ); - DALI_TEST_EQUALS( handle.GetProperty< Rect >( index ), endValue, TEST_LOCATION ); + Rect endValue(5, 6, 7, 8); + handle.SetProperty(index, endValue); + DALI_TEST_EQUALS(handle.GetProperty >(index), endValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Rect >( index ), endValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty >(index), endValue, TEST_LOCATION); END_TEST; } @@ -1044,29 +1038,29 @@ int UtcDaliHandleCustomPropertyInvalidToString(void) Handle handle = Handle::New(); - std::string startValue( "Libraries gave us power" ); - Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION ); + std::string startValue("Libraries gave us power"); + Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // No conversion from Vector3 to std::string, therefore this should be a NOOP - handle.SetProperty( index, Vector3(1,2,3) ); + handle.SetProperty(index, Vector3(1, 2, 3)); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // Positive test (sanity check) - std::string endValue( "Then work came and made us free" ); - handle.SetProperty( index, endValue ); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION ); + std::string endValue("Then work came and made us free"); + handle.SetProperty(index, endValue); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); END_TEST; } @@ -1077,40 +1071,40 @@ int UtcDaliHandleCustomPropertyInvalidToArray(void) Handle handle = Handle::New(); - Property::Value value( Property::ARRAY ); - std::string startValue( "The future teaches you to be alone" ); - value.GetArray()->PushBack( startValue ); + Property::Value value(Property::ARRAY); + std::string startValue("The future teaches you to be alone"); + value.GetArray()->PushBack(startValue); - Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE); - Property::Array check1 = handle.GetProperty< Property::Array >( index ); - DALI_TEST_EQUALS( check1.GetElementAt(0).Get(), startValue, TEST_LOCATION ); + Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE); + Property::Array check1 = handle.GetProperty(index); + DALI_TEST_EQUALS(check1.GetElementAt(0).Get(), startValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - Property::Array check2 = handle.GetProperty< Property::Array >( index ); - DALI_TEST_EQUALS( check2.GetElementAt(0).Get(), startValue, TEST_LOCATION ); + Property::Array check2 = handle.GetProperty(index); + DALI_TEST_EQUALS(check2.GetElementAt(0).Get(), startValue, TEST_LOCATION); // No conversion from int to ARRAY, therefore this should be a NOOP - handle.SetProperty( index, int(2) ); + handle.SetProperty(index, int(2)); application.SendNotification(); application.Render(0); - Property::Array check3 = handle.GetProperty< Property::Array >( index ); - DALI_TEST_EQUALS( check3.GetElementAt(0).Get(), startValue, TEST_LOCATION ); + Property::Array check3 = handle.GetProperty(index); + DALI_TEST_EQUALS(check3.GetElementAt(0).Get(), startValue, TEST_LOCATION); // Positive test (sanity check) Property::Value value2(Property::ARRAY); - std::string endValue( "The present to be afraid and cold" ); - value2.GetArray()->PushBack( endValue ); - handle.SetProperty( index, value2 ); + std::string endValue("The present to be afraid and cold"); + value2.GetArray()->PushBack(endValue); + handle.SetProperty(index, value2); - Property::Array check4 = handle.GetProperty< Property::Array >( index ); - DALI_TEST_EQUALS( check4.GetElementAt(0).Get(), endValue, TEST_LOCATION ); + Property::Array check4 = handle.GetProperty(index); + DALI_TEST_EQUALS(check4.GetElementAt(0).Get(), endValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - Property::Array check5 = handle.GetProperty< Property::Array >( index ); - DALI_TEST_EQUALS( check5.GetElementAt(0).Get(), endValue, TEST_LOCATION ); + Property::Array check5 = handle.GetProperty(index); + DALI_TEST_EQUALS(check5.GetElementAt(0).Get(), endValue, TEST_LOCATION); END_TEST; } @@ -1121,22 +1115,22 @@ int UtcDaliHandleCustomPropertyInvalidToMap(void) Handle handle = Handle::New(); - Property::Value value( Property::MAP ); - std::string startValue( "Culture sucks down words" ); - value.GetMap()->Insert( "1", startValue ); + Property::Value value(Property::MAP); + std::string startValue("Culture sucks down words"); + value.GetMap()->Insert("1", startValue); - Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE ); - Property::Value* check1 = handle.GetProperty< Property::Map >( index ).Find("1"); - DALI_TEST_CHECK( NULL != check1 ); + Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE); + Property::Value* check1 = handle.GetProperty(index).Find("1"); + DALI_TEST_CHECK(NULL != check1); // No conversion from float to MAP, therefore this should be a NOOP - handle.SetProperty( index, float(3.0) ); + handle.SetProperty(index, float(3.0)); // Positive test (sanity check) - Property::Value value2( Property::MAP ); - std::string endValue( "Itemise loathing and feed yourself smiles" ); - value.GetMap()->Insert( "1", endValue ); - handle.SetProperty( index, value2 ); + Property::Value value2(Property::MAP); + std::string endValue("Itemise loathing and feed yourself smiles"); + value.GetMap()->Insert("1", endValue); + handle.SetProperty(index, value2); END_TEST; } @@ -1147,29 +1141,29 @@ int UtcDaliHandleCustomPropertyInvalidToExtents(void) Handle handle = Handle::New(); - Extents startValue(1,2,3,4); - Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE); - DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION ); + Extents startValue(1, 2, 3, 4); + Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // Negative test i.e. there is no conversion from float to Extents - handle.SetProperty( index, float(1.5) ); + handle.SetProperty(index, float(1.5)); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // Positive test (sanity check) - Extents endValue(5,6,7,8); - handle.SetProperty( index, endValue ); - DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION ); + Extents endValue(5, 6, 7, 8); + handle.SetProperty(index, endValue); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); END_TEST; } @@ -1180,29 +1174,29 @@ int UtcDaliHandleCustomPropertyInvalidToBool(void) Handle handle = Handle::New(); - bool startValue(true); - Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE); - DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION ); + bool startValue(true); + Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // Negative test i.e. there is no conversion from float to bool - handle.SetProperty( index, float(0.0) ); + handle.SetProperty(index, float(0.0)); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), startValue, TEST_LOCATION); // Positive test (sanity check) bool endValue(false); - handle.SetProperty( index, endValue ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION ); + handle.SetProperty(index, endValue); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(index), endValue, TEST_LOCATION); END_TEST; } @@ -1213,20 +1207,20 @@ int UtcDaliHandleCustomPropertyInvalidToInt(void) Handle handle = Handle::New(); - int startValue(5); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + int startValue(5); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Negative test i.e. there is no conversion from Vector3 to int - handle.SetProperty( index, Vector3(1,2,3) ); + handle.SetProperty(index, Vector3(1, 2, 3)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); END_TEST; } @@ -1236,20 +1230,20 @@ int UtcDaliHandleCustomPropertyInvalidToFloat(void) Handle handle = Handle::New(); - float startValue(5.0); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + float startValue(5.0); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Negative test i.e. there is no conversion from Vector3 to float - handle.SetProperty( index, Vector3(1,2,3) ); + handle.SetProperty(index, Vector3(1, 2, 3)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); END_TEST; } @@ -1259,25 +1253,25 @@ int UtcDaliHandleCustomPropertyInvalidToRotation(void) Handle handle = Handle::New(); - Quaternion startValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + Quaternion startValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Negative test i.e. there is no conversion from float to Quaternion - handle.SetProperty( index, float(7.0) ); + handle.SetProperty(index, float(7.0)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Positive test (sanity check) - Quaternion endValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - handle.SetProperty( index, endValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == endValue ); + Quaternion endValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + handle.SetProperty(index, endValue); + DALI_TEST_CHECK(handle.GetProperty(index) == endValue); END_TEST; } @@ -1288,27 +1282,27 @@ int UtcDaliHandleCustomPropertyInvalidToMatrix(void) Handle handle = Handle::New(); - Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - Matrix startValue(rotation); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + Matrix startValue(rotation); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Negative test i.e. there is no conversion from float to Matrix - handle.SetProperty( index, float(7.0) ); + handle.SetProperty(index, float(7.0)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Positive test (sanity check) - Quaternion endRotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); - Matrix endValue(endRotation); - handle.SetProperty( index, endValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == endValue ); + Quaternion endRotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f)); + Matrix endValue(endRotation); + handle.SetProperty(index, endValue); + DALI_TEST_CHECK(handle.GetProperty(index) == endValue); END_TEST; } @@ -1319,30 +1313,26 @@ int UtcDaliHandleCustomPropertyInvalidToMatrix3(void) Handle handle = Handle::New(); - Matrix3 startValue(11,12,13, - 21,22,23, - 31,32,33); + Matrix3 startValue(11, 12, 13, 21, 22, 23, 31, 32, 33); - Property::Index index = handle.RegisterProperty( "testProperty", startValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + Property::Index index = handle.RegisterProperty("testProperty", startValue); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Negative test i.e. there is no conversion from float to Matrix3 - handle.SetProperty( index, float(7.0) ); + handle.SetProperty(index, float(7.0)); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( handle.GetProperty(index) == startValue ); + DALI_TEST_CHECK(handle.GetProperty(index) == startValue); // Positive test (sanity check) - Matrix3 endValue(31,32,33, - 21,22,23, - 11,12,13); - handle.SetProperty( index, endValue ); - DALI_TEST_CHECK( handle.GetProperty(index) == endValue ); + Matrix3 endValue(31, 32, 33, 21, 22, 23, 11, 12, 13); + handle.SetProperty(index, endValue); + DALI_TEST_CHECK(handle.GetProperty(index) == endValue); END_TEST; } @@ -1352,7 +1342,7 @@ int UtcDaliHandleWeightNew(void) TestApplication application; Handle handle = WeightObject::New(); - DALI_TEST_CHECK( handle.GetProperty(WeightObject::WEIGHT) == 0.0f ); + DALI_TEST_CHECK(handle.GetProperty(WeightObject::WEIGHT) == 0.0f); // process the message so scene object is added to update manager application.SendNotification(); @@ -1370,7 +1360,7 @@ int UtcDaliHandleWeightNew2(void) // scope for the weight object { Handle handle = WeightObject::New(); - DALI_TEST_CHECK( handle.GetProperty(WeightObject::WEIGHT) == 0.0f ); + DALI_TEST_CHECK(handle.GetProperty(WeightObject::WEIGHT) == 0.0f); // process the message so scene object is added to update manager application.SendNotification(); @@ -1387,19 +1377,19 @@ int UtcDaliHandleWeightNew2(void) int UtcDaliHandleSetTypeInfo(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); Actor actor = Actor::DownCast(typeInfo.CreateInstance()); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); DevelHandle::SetTypeInfo(actor, typeInfo); TypeInfo newTypeInfo; - bool success = actor.GetTypeInfo( newTypeInfo ); - DALI_TEST_CHECK( success ); + bool success = actor.GetTypeInfo(newTypeInfo); + DALI_TEST_CHECK(success); DALI_TEST_CHECK(typeInfo.GetName() == newTypeInfo.GetName()); DALI_TEST_CHECK(typeInfo.GetBaseName() == newTypeInfo.GetBaseName()); @@ -1411,27 +1401,27 @@ int UtcDaliHandleCustomPropertySynchronousGetSet(void) { TestApplication application; - tet_infoline( "Create a custom property and set the value ensuring it can be retrieved synchronously" ); + tet_infoline("Create a custom property and set the value ensuring it can be retrieved synchronously"); Actor actor = Actor::New(); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); - tet_infoline( "Create the custom property with an initial value" ); - float startValue(1.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), startValue, TEST_LOCATION ); + tet_infoline("Create the custom property with an initial value"); + float startValue(1.0f); + Property::Index index = actor.RegisterProperty("testProperty", startValue); + DALI_TEST_EQUALS(actor.GetProperty(index), startValue, TEST_LOCATION); - tet_infoline( "Set the value, retrieve it and ensure both the synchronous and the async version work" ); - actor.SetProperty( index, 5.0f ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION ); + tet_infoline("Set the value, retrieve it and ensure both the synchronous and the async version work"); + actor.SetProperty(index, 5.0f); + DALI_TEST_EQUALS(actor.GetProperty(index), 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), startValue, TEST_LOCATION); - tet_infoline( "Render and retrieve values again" ); + tet_infoline("Render and retrieve values again"); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(index), 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 5.0f, TEST_LOCATION); END_TEST; } @@ -1440,11 +1430,11 @@ int UtcDaliHandleCustomPropertyGetType(void) { TestApplication application; - tet_infoline( "Create a custom property and retrieve its type" ); + tet_infoline("Create a custom property and retrieve its type"); - Handle handle = Handle::New(); - Property::Index index = handle.RegisterProperty( "testProperty", 1.0f ); - DALI_TEST_EQUALS( handle.GetPropertyType( index ), Property::FLOAT, TEST_LOCATION ); + Handle handle = Handle::New(); + Property::Index index = handle.RegisterProperty("testProperty", 1.0f); + DALI_TEST_EQUALS(handle.GetPropertyType(index), Property::FLOAT, TEST_LOCATION); END_TEST; } @@ -1453,20 +1443,20 @@ int UtcDaliHandleCustomPropertyAccessMode(void) { TestApplication application; - tet_infoline( "Create a custom property and retrieve whether it's animatable etc." ); + tet_infoline("Create a custom property and retrieve whether it's animatable etc."); - Handle handle = Handle::New(); - Property::Index index = handle.RegisterProperty( "testProperty", 1.0f ); - DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION ); + Handle handle = Handle::New(); + Property::Index index = handle.RegisterProperty("testProperty", 1.0f); + DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), true, TEST_LOCATION); + DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION); - index = handle.RegisterProperty( "testProperty2", 1.0f, Property::READ_ONLY ); - DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), false, TEST_LOCATION ); + index = handle.RegisterProperty("testProperty2", 1.0f, Property::READ_ONLY); + DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.IsPropertyWritable(index), false, TEST_LOCATION); - index = handle.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE ); - DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION ); + index = handle.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE); + DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION); END_TEST; } @@ -1475,19 +1465,19 @@ int UtcDaliHandleGetCurrentProperty(void) { TestApplication application; - tet_infoline( "Get a default and non-animatable custom property using the GetCurrentProperty API" ); + tet_infoline("Get a default and non-animatable custom property using the GetCurrentProperty API"); Actor actor = Actor::New(); - application.GetScene().Add( actor ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + application.GetScene().Add(actor); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::VISIBLE), true, TEST_LOCATION); - Property::Index index = actor.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 1.0f, TEST_LOCATION ); + Property::Index index = actor.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE); + DALI_TEST_EQUALS(actor.GetProperty(index), 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 1.0f, TEST_LOCATION); - actor.SetProperty( index, 2.0f ); - DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 2.0f, TEST_LOCATION ); + actor.SetProperty(index, 2.0f); + DALI_TEST_EQUALS(actor.GetProperty(index), 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(index), 2.0f, TEST_LOCATION); END_TEST; } @@ -1496,12 +1486,12 @@ int UtcDaliHandleDoesCustomPropertyExistP1(void) { TestApplication application; // Needs type registry - tet_infoline( "Test if a registered custom property exists on object" ); + tet_infoline("Test if a registered custom property exists on object"); - Actor actor = Actor::New(); - auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); + Actor actor = Actor::New(); + auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); - DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( propertyIndex ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION); END_TEST; } @@ -1509,12 +1499,12 @@ int UtcDaliHandleDoesCustomPropertyExistN1(void) { TestApplication application; // Needs type registry - tet_infoline( "Test if a registered custom property does not exist on object" ); + tet_infoline("Test if a registered custom property does not exist on object"); - Actor actor = Actor::New(); - auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); + Actor actor = Actor::New(); + auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); - DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( propertyIndex+1 ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex + 1), false, TEST_LOCATION); END_TEST; } @@ -1522,10 +1512,10 @@ int UtcDaliHandleDoesCustomPropertyExistN2(void) { TestApplication application; // Needs type registry - tet_infoline( "Test that a default property does not show as a custom property on object" ); + tet_infoline("Test that a default property does not show as a custom property on object"); Actor actor = Actor::New(); - DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( Actor::Property::POSITION ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(Actor::Property::POSITION), false, TEST_LOCATION); END_TEST; } @@ -1533,22 +1523,22 @@ int UtcDaliHandleDoesCustomPropertyExistN3(void) { TestApplication application; // Needs type registry - tet_infoline( "Test that a child property does not exist on actor after parenting to container" ); + tet_infoline("Test that a child property does not exist on actor after parenting to container"); TypeRegistry typeRegistry = TypeRegistry::Get(); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor)); - const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const char* CHILD_PROPERTY_NAME( "childProperty" ); + const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const char* CHILD_PROPERTY_NAME("childProperty"); - ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER); auto container = Test::TestCustomActor::New(); - application.GetScene().Add( container ); + application.GetScene().Add(container); auto child = Actor::New(); - container.Add( child ); // Resolve child properties (if any) + container.Add(child); // Resolve child properties (if any) - DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), false, TEST_LOCATION); END_TEST; } @@ -1556,24 +1546,24 @@ int UtcDaliHandleDoesCustomPropertyExistP2(void) { TestApplication application; // Needs type registry - tet_infoline( "Test that a child property exists after being set" ); + tet_infoline("Test that a child property exists after being set"); TypeRegistry typeRegistry = TypeRegistry::Get(); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor)); - const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const char* CHILD_PROPERTY_NAME( "childProperty" ); + const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const char* CHILD_PROPERTY_NAME("childProperty"); - ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER); auto container = Test::TestCustomActor::New(); - application.GetScene().Add( container ); + application.GetScene().Add(container); auto child = Actor::New(); - container.Add( child ); // Resolve child properties (if any) - child.SetProperty( CHILD_PROPERTY, 2 ); + container.Add(child); // Resolve child properties (if any) + child.SetProperty(CHILD_PROPERTY, 2); - DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(CHILD_PROPERTY), 2, TEST_LOCATION); END_TEST; } @@ -1581,30 +1571,29 @@ int UtcDaliHandleDoesCustomPropertyExistP3(void) { TestApplication application; // Needs type registry - tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" ); + tet_infoline("Test that a child property is re-indexed after registration, and that it exists"); TypeRegistry typeRegistry = TypeRegistry::Get(); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor)); - const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const char* CHILD_PROPERTY_NAME( "childProperty" ); + const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const char* CHILD_PROPERTY_NAME("childProperty"); - ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER); auto container = Test::TestCustomActor::New(); - application.GetScene().Add( container ); + application.GetScene().Add(container); auto child = Actor::New(); - child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) ); - container.Add( child ); // Resolve child properties (if any) + child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3)); + container.Add(child); // Resolve child properties (if any) - DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(CHILD_PROPERTY), 3, TEST_LOCATION); END_TEST; } namespace { - struct PropertySetSignalCheck { PropertySetSignalCheck(bool& signalReceived, Property::Value& value) @@ -1616,7 +1605,7 @@ struct PropertySetSignalCheck void operator()(Handle& handle, Property::Index index, Property::Value value) { mSignalReceived = true; - mValue = value; + mValue = value; } void Reset() @@ -1626,7 +1615,7 @@ struct PropertySetSignalCheck void CheckSignalReceived() { - if (!mSignalReceived) + if(!mSignalReceived) { tet_printf("Expected Property Set signal was not received\n"); tet_result(TET_FAIL); @@ -1637,49 +1626,48 @@ struct PropertySetSignalCheck } } - bool& mSignalReceived; // owned by individual tests + bool& mSignalReceived; // owned by individual tests Property::Value& mValue; }; -} // anon namespace +} // namespace int UtcDaliHandlePropertySetSignal01(void) { TestApplication application; - bool signalReceived(false); - Property::Value value; + bool signalReceived(false); + Property::Value value; PropertySetSignalCheck propertySetCheck(signalReceived, value); - tet_infoline( "Test that setting a default property triggers a signal" ); + tet_infoline("Test that setting a default property triggers a signal"); auto actor = Actor::New(); actor.PropertySetSignal().Connect(&application, propertySetCheck); - actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS ); + actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS); propertySetCheck.CheckSignalReceived(); END_TEST; } - int UtcDaliHandlePropertySetSignal02(void) { TestApplication application; - bool signalReceived(false); - Property::Value value; + bool signalReceived(false); + Property::Value value; PropertySetSignalCheck propertySetCheck(signalReceived, value); - tet_infoline( "Test that setting a custom property triggers a signal" ); + tet_infoline("Test that setting a custom property triggers a signal"); auto actor = Actor::New(); actor.PropertySetSignal().Connect(&application, propertySetCheck); auto propertyIndex = actor.RegisterProperty("propName", 3.0f); - actor.SetProperty( propertyIndex, 5.0f ); + actor.SetProperty(propertyIndex, 5.0f); propertySetCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(5.0f), 0.001f, TEST_LOCATION); END_TEST; } @@ -1687,94 +1675,89 @@ int UtcDaliHandlePropertySetSignal02(void) int UtcDaliHandlePropertySetSignal03(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - bool signalReceived(false); - Property::Value value; + bool signalReceived(false); + Property::Value value; PropertySetSignalCheck propertySetCheck(signalReceived, value); - tet_infoline( "Test that setting a child property triggers a signal" ); + tet_infoline("Test that setting a child property triggers a signal"); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor)); - const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const char* CHILD_PROPERTY_NAME( "childProperty" ); + const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const char* CHILD_PROPERTY_NAME("childProperty"); - ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER); auto container = Test::TestCustomActor::New(); - application.GetScene().Add( container ); + application.GetScene().Add(container); auto child = Actor::New(); - child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) ); + child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3)); child.PropertySetSignal().Connect(&application, propertySetCheck); - container.Add( child ); // Resolve child properties (if any) + container.Add(child); // Resolve child properties (if any) - DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION); + DALI_TEST_EQUALS(child.GetProperty(CHILD_PROPERTY), 3, TEST_LOCATION); - child.SetProperty( CHILD_PROPERTY, 29 ); + child.SetProperty(CHILD_PROPERTY, 29); propertySetCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION ); + DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(29), TEST_LOCATION); END_TEST; } - - int UtcDaliHandlePropertySetSignal04(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - bool signalReceived(false); - Property::Value value; + bool signalReceived(false); + Property::Value value; PropertySetSignalCheck propertySetCheck(signalReceived, value); - tet_infoline( "Test that setting a property on a vanilla Object triggers a signal" ); + tet_infoline("Test that setting a property on a vanilla Object triggers a signal"); constexpr Property::Index TEST_PROPERTY_KEY_INDEX = 1; - const std::string TEST_PROPERTY_KEY_NAME = "testProperty"; + const std::string TEST_PROPERTY_KEY_NAME = "testProperty"; Handle vanillaObject = Handle::New(); - auto propertyIndex = vanillaObject.RegisterProperty( + auto propertyIndex = vanillaObject.RegisterProperty( TEST_PROPERTY_KEY_INDEX, TEST_PROPERTY_KEY_NAME, - Color::WHITE ); + Color::WHITE); vanillaObject.PropertySetSignal().Connect(&application, propertySetCheck); - DALI_TEST_EQUALS( vanillaObject.DoesCustomPropertyExist( propertyIndex ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( vanillaObject.GetProperty( propertyIndex ), Color::WHITE, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(vanillaObject.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION); + DALI_TEST_EQUALS(vanillaObject.GetProperty(propertyIndex), Color::WHITE, 0.001f, TEST_LOCATION); vanillaObject[TEST_PROPERTY_KEY_NAME] = Color::RED; propertySetCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( Color::RED ), 0.001f, TEST_LOCATION ); - DALI_TEST_VALUE_EQUALS( vanillaObject[propertyIndex], Property::Value( Color::RED), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(Color::RED), 0.001f, TEST_LOCATION); + DALI_TEST_VALUE_EQUALS(vanillaObject[propertyIndex], Property::Value(Color::RED), 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliHandlePropertySetProperties(void) { TestApplication application; - const Vector3 actorSize( 10.0f, 20.0f, 30.0f ); - const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f ); - const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f ); + const Vector3 actorSize(10.0f, 20.0f, 30.0f); + const Vector3 anchorPoint(1.0f, 0.5f, 0.0f); + const Vector4 color(0.1f, 0.2, 0.3f, 0.4f); Handle handle = Actor::New(); handle.SetProperties( - Property::Map - { - { Actor::Property::SIZE, actorSize }, - { Actor::Property::ANCHOR_POINT, anchorPoint }, - { "color", color }, - { "invalid", Vector2::ZERO } // It should quietly ignore invalid data - } - ); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION ); + Property::Map{ + {Actor::Property::SIZE, actorSize}, + {Actor::Property::ANCHOR_POINT, anchorPoint}, + {"color", color}, + {"invalid", Vector2::ZERO} // It should quietly ignore invalid data + }); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SIZE).Get(), actorSize, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::ANCHOR_POINT).Get(), anchorPoint, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR).Get(), color, TEST_LOCATION); END_TEST; } @@ -1782,23 +1765,21 @@ int UtcDaliHandlePropertySetProperties(void) int UtcDaliHandleTemplateNew01(void) { TestApplication application; - const Vector3 actorSize( 10.0f, 20.0f, 30.0f ); - const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f ); - const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f ); + const Vector3 actorSize(10.0f, 20.0f, 30.0f); + const Vector3 anchorPoint(1.0f, 0.5f, 0.0f); + const Vector4 color(0.1f, 0.2, 0.3f, 0.4f); - Handle handle = Handle::New< Actor >( - Property::Map - { - { Actor::Property::SIZE, actorSize }, - { Actor::Property::ANCHOR_POINT, anchorPoint }, - { "color", color }, - { "invalid", Vector2::ZERO } // It should quietly ignore invalid data - } - ); + Handle handle = Handle::New( + Property::Map{ + {Actor::Property::SIZE, actorSize}, + {Actor::Property::ANCHOR_POINT, anchorPoint}, + {"color", color}, + {"invalid", Vector2::ZERO} // It should quietly ignore invalid data + }); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SIZE).Get(), actorSize, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::ANCHOR_POINT).Get(), anchorPoint, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR).Get(), color, TEST_LOCATION); END_TEST; } @@ -1809,70 +1790,96 @@ int UtcDaliHandleGetProperties(void) Handle handle = Actor::New(); handle.SetProperties( - Property::Map - { - { Actor::Property::SIZE, Vector3( 400.0f, 200.0f, 100.0f ) }, - { Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER }, - { Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER }, - { Actor::Property::NAME, "Actor" }, - { Actor::Property::LEAVE_REQUIRED, true }, - { "color", Color::RED }, - } - ); + Property::Map{ + {Actor::Property::SIZE, Vector3(400.0f, 200.0f, 100.0f)}, + {Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER}, + {Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER}, + {Actor::Property::NAME, "Actor"}, + {Actor::Property::LEAVE_REQUIRED, true}, + {"color", Color::RED}, + }); Property::Map map; - handle.GetProperties( map ); + handle.GetProperties(map); // Get all the properties and ensure they match - DALI_TEST_EQUALS( handle.GetPropertyCount(), map.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetPropertyCount(), map.Count(), TEST_LOCATION); - for( auto position = 0u; position < map.Count(); ++position ) + for(auto position = 0u; position < map.Count(); ++position) { - auto keyValuePair = map.GetKeyValue( position ); - const auto& index = keyValuePair.first.indexKey; - const auto& value = keyValuePair.second; - auto handleValue = handle.GetProperty( index ); + auto keyValuePair = map.GetKeyValue(position); + const auto& index = keyValuePair.first.indexKey; + const auto& value = keyValuePair.second; + auto handleValue = handle.GetProperty(index); - switch( value.GetType() ) + switch(value.GetType()) { - case Property::NONE: break; - case Property::BOOLEAN: DALI_TEST_EQUALS( value.Get< bool >(), handleValue.Get< bool >(), TEST_LOCATION ); break; - case Property::FLOAT: DALI_TEST_EQUALS( value.Get< float >(), handleValue.Get< float >(), TEST_LOCATION ); break; - case Property::INTEGER: DALI_TEST_EQUALS( value.Get< int >(), handleValue.Get< int >(), TEST_LOCATION ); break; - case Property::VECTOR2: DALI_TEST_EQUALS( value.Get< Vector2 >(), handleValue.Get< Vector2 >(), TEST_LOCATION ); break; - case Property::VECTOR3: DALI_TEST_EQUALS( value.Get< Vector3 >(), handleValue.Get< Vector3 >(), TEST_LOCATION ); break; - case Property::VECTOR4: DALI_TEST_EQUALS( value.Get< Vector4 >(), handleValue.Get< Vector4 >(), TEST_LOCATION ); break; - case Property::MATRIX3: DALI_TEST_EQUALS( value.Get< Matrix3 >(), handleValue.Get< Matrix3 >(), TEST_LOCATION ); break; - case Property::MATRIX: DALI_TEST_EQUALS( value.Get< Matrix >(), handleValue.Get< Matrix >(), TEST_LOCATION ); break; - case Property::RECTANGLE: DALI_TEST_EQUALS( value.Get< Rect< int > >(), handleValue.Get< Rect< int > >(), TEST_LOCATION ); break; - case Property::ROTATION: DALI_TEST_EQUALS( value.Get< Quaternion >(), handleValue.Get< Quaternion >(), TEST_LOCATION ); break; - case Property::STRING: DALI_TEST_EQUALS( value.Get< std::string >(), handleValue.Get< std::string >(), TEST_LOCATION ); break; - case Property::ARRAY: DALI_TEST_EQUALS( value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION ); break; - case Property::MAP: DALI_TEST_EQUALS( value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION ); break; - case Property::EXTENTS: DALI_TEST_EQUALS( value.Get< Extents >(), handleValue.Get< Extents >(), TEST_LOCATION ); break; + case Property::NONE: + break; + case Property::BOOLEAN: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::FLOAT: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::INTEGER: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::VECTOR2: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::VECTOR3: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::VECTOR4: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::MATRIX3: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::MATRIX: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::RECTANGLE: + DALI_TEST_EQUALS(value.Get >(), handleValue.Get >(), TEST_LOCATION); + break; + case Property::ROTATION: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::STRING: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; + case Property::ARRAY: + DALI_TEST_EQUALS(value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION); + break; + case Property::MAP: + DALI_TEST_EQUALS(value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION); + break; + case Property::EXTENTS: + DALI_TEST_EQUALS(value.Get(), handleValue.Get(), TEST_LOCATION); + break; } } // Add a custom property and ensure the count goes up by one. const auto countBefore = map.Count(); - handle.RegisterProperty( "tempProperty", Color::GREEN ); - handle.GetProperties( map ); - DALI_TEST_EQUALS( countBefore + 1, map.Count(), TEST_LOCATION ); + handle.RegisterProperty("tempProperty", Color::GREEN); + handle.GetProperties(map); + DALI_TEST_EQUALS(countBefore + 1, map.Count(), TEST_LOCATION); END_TEST; } - int UtcDaliHandleSetPropertyNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { - int arg1(0); + int arg1(0); Dali::Property::Value arg2; - instance.SetProperty(arg1,arg2); + instance.SetProperty(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -1885,12 +1892,12 @@ int UtcDaliHandleSetPropertyNegative(void) int UtcDaliHandleRegisterPropertyNegative01(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { - std::string arg1; + std::string arg1; Dali::Property::Value arg2; - instance.RegisterProperty(arg1,arg2); + instance.RegisterProperty(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -1903,13 +1910,13 @@ int UtcDaliHandleRegisterPropertyNegative01(void) int UtcDaliHandleRegisterPropertyNegative02(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { - std::string arg1; - Dali::Property::Value arg2; + std::string arg1; + Dali::Property::Value arg2; Dali::Property::AccessMode arg3(Property::READ_ONLY); - instance.RegisterProperty(arg1,arg2,arg3); + instance.RegisterProperty(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -1922,7 +1929,7 @@ int UtcDaliHandleRegisterPropertyNegative02(void) int UtcDaliHandleRemoveConstraintsNegative01(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { unsigned int arg1(0u); @@ -1939,7 +1946,7 @@ int UtcDaliHandleRemoveConstraintsNegative01(void) int UtcDaliHandleRemoveConstraintsNegative02(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { instance.RemoveConstraints(); @@ -1955,13 +1962,13 @@ int UtcDaliHandleRemoveConstraintsNegative02(void) int UtcDaliHandleAddPropertyNotificationNegative01(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { - int arg1(0); - int arg2(0); + int arg1(0); + int arg2(0); Dali::PropertyCondition arg3; - instance.AddPropertyNotification(arg1,arg2,arg3); + instance.AddPropertyNotification(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -1974,12 +1981,12 @@ int UtcDaliHandleAddPropertyNotificationNegative01(void) int UtcDaliHandleAddPropertyNotificationNegative02(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { - int arg1(0); + int arg1(0); Dali::PropertyCondition arg2; - instance.AddPropertyNotification(arg1,arg2); + instance.AddPropertyNotification(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -1992,7 +1999,7 @@ int UtcDaliHandleAddPropertyNotificationNegative02(void) int UtcDaliHandleRemovePropertyNotificationNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { Dali::PropertyNotification arg1; @@ -2009,7 +2016,7 @@ int UtcDaliHandleRemovePropertyNotificationNegative(void) int UtcDaliHandleRemovePropertyNotificationsNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { instance.RemovePropertyNotifications(); @@ -2025,7 +2032,7 @@ int UtcDaliHandleRemovePropertyNotificationsNegative(void) int UtcDaliHandleGetPropertyNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2042,7 +2049,7 @@ int UtcDaliHandleGetPropertyNegative(void) int UtcDaliHandleGetPropertyNameNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2059,7 +2066,7 @@ int UtcDaliHandleGetPropertyNameNegative(void) int UtcDaliHandleGetPropertyTypeNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2076,7 +2083,7 @@ int UtcDaliHandleGetPropertyTypeNegative(void) int UtcDaliHandleGetPropertyCountNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { instance.GetPropertyCount(); @@ -2092,7 +2099,7 @@ int UtcDaliHandleGetPropertyCountNegative(void) int UtcDaliHandleGetPropertyIndexNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { std::string arg1; @@ -2109,7 +2116,7 @@ int UtcDaliHandleGetPropertyIndexNegative(void) int UtcDaliHandleGetCurrentPropertyNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2126,7 +2133,7 @@ int UtcDaliHandleGetCurrentPropertyNegative(void) int UtcDaliHandleGetPropertyIndicesNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { Dali::Vector arg1; @@ -2143,7 +2150,7 @@ int UtcDaliHandleGetPropertyIndicesNegative(void) int UtcDaliHandleIsPropertyWritableNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2160,7 +2167,7 @@ int UtcDaliHandleIsPropertyWritableNegative(void) int UtcDaliHandleIsPropertyAnimatableNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2177,7 +2184,7 @@ int UtcDaliHandleIsPropertyAnimatableNegative(void) int UtcDaliHandleIsPropertyAConstraintInputNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { int arg1(0); @@ -2194,7 +2201,7 @@ int UtcDaliHandleIsPropertyAConstraintInputNegative(void) int UtcDaliHandleSupportsNegative(void) { TestApplication application; - Dali::Handle instance; + Dali::Handle instance; try { Dali::Handle::Capability arg1(Handle::DYNAMIC_PROPERTIES); @@ -2208,21 +2215,19 @@ int UtcDaliHandleSupportsNegative(void) END_TEST; } - int UtcDaliHandleIndexOperatorByIndexP01(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); - actor[Actor::Property::SIZE] = Vector3( 100.0f, 200.0f, 1.0f ); + actor[Actor::Property::SIZE] = Vector3(100.0f, 200.0f, 1.0f); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE), Vector3( 100.0f, 200.0f, 1.0f ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION); + actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f)); - actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) ); - - Vector3 position = actor[ Actor::Property::POSITION ]; - DALI_TEST_EQUALS( position, Vector3( 10.0f, 20.0f, 0.0f ), TEST_LOCATION ); + Vector3 position = actor[Actor::Property::POSITION]; + DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -2230,18 +2235,18 @@ int UtcDaliHandleIndexOperatorByIndexP01(void) int UtcDaliHandleIndexOperatorByIndexP02(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f); actor.SetProperty(Actor::Property::COLOR, defaultActorColor); actor[Actor::Property::COLOR_RED] = 0.5f; - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f)); - DALI_TEST_EQUALS( (float)actor[ Actor::Property::POSITION_Z ], 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION); END_TEST; } @@ -2249,17 +2254,17 @@ int UtcDaliHandleIndexOperatorByIndexP02(void) int UtcDaliHandleIndexOperatorByIndexP03(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f); actor.SetProperty(Actor::Property::COLOR, defaultActorColor); // Value under test is second to allow compiler to deduce type - DALI_TEST_VALUE_EQUALS( actor[Actor::Property::COLOR_RED], 1.0f, 0.001f, TEST_LOCATION); + DALI_TEST_VALUE_EQUALS(actor[Actor::Property::COLOR_RED], 1.0f, 0.001f, TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f)); - DALI_TEST_EQUALS( (float)actor[ Actor::Property::POSITION_Z ], 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION); END_TEST; } @@ -2267,45 +2272,43 @@ int UtcDaliHandleIndexOperatorByIndexP03(void) int UtcDaliHandleIndexOperatorByNameP01(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); - actor["size"] = Vector3( 100.0f, 200.0f, 1.0f ); + actor["size"] = Vector3(100.0f, 200.0f, 1.0f); - DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::SIZE), Vector3( 100.0f, 200.0f, 1.0f ), 0.001f, TEST_LOCATION ); + DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) ); - Vector3 position = actor[ "position" ]; + actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f)); + Vector3 position = actor["position"]; - DALI_TEST_EQUALS( position, Vector3( 10.0f, 20.0f, 0.0f ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliHandleIndexOperatorByNameP02(void) { TestApplication application; - Actor actor = Actor::New(); + Actor actor = Actor::New(); const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f); actor.SetProperty(Actor::Property::COLOR, defaultActorColor); actor["colorRed"] = 0.5f; - DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION); - DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION); + DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION); + DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION); - actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f)); - float positionY = actor[ "positionY" ]; - DALI_TEST_EQUALS( positionY, 20.0f, 0.001f, TEST_LOCATION ); + float positionY = actor["positionY"]; + DALI_TEST_EQUALS(positionY, 20.0f, 0.001f, TEST_LOCATION); // Should automatically promote IndirectValue to Property::Value rvalue. - DALI_TEST_VALUE_EQUALS( actor["positionZ"], 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_VALUE_EQUALS(actor["positionZ"], 0.0f, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliHandleIndexOperatorNegative02(void) { TestApplication application; @@ -2314,7 +2317,7 @@ int UtcDaliHandleIndexOperatorNegative02(void) try { Vector3 position = actor[Actor::Property::POSITION]; - if( position == position ) + if(position == position) { DALI_TEST_CHECK(false); // Should throw before reaching here. } diff --git a/automated-tests/src/dali/utc-Dali-Hash.cpp b/automated-tests/src/dali/utc-Dali-Hash.cpp index 79c3881..5343f33 100644 --- a/automated-tests/src/dali/utc-Dali-Hash.cpp +++ b/automated-tests/src/dali/utc-Dali-Hash.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,11 @@ * */ -#include -#include -#include #include +#include +#include + +#include void utc_dali_hash_startup(void) { @@ -30,7 +31,6 @@ void utc_dali_hash_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliHash(void) { // To fully test the Hash distribution we need to use a tool like http://code.google.com/p/smhasher/ @@ -40,11 +40,11 @@ int UtcDaliHash(void) tet_infoline("UtcDaliHash"); - const std::string testString1( "highp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );"); - const std::string testString2( "lowp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );"); + const std::string testString1("highp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );"); + const std::string testString2("lowp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );"); - DALI_TEST_CHECK( Dali::CalculateHash( testString1 ) != Dali::CalculateHash( testString2 ) ); - DALI_TEST_CHECK( Dali::CalculateHash( testString1, testString2 ) != Dali::CalculateHash( testString2, testString1 ) ); + DALI_TEST_CHECK(Dali::CalculateHash(testString1) != Dali::CalculateHash(testString2)); + DALI_TEST_CHECK(Dali::CalculateHash(testString1, testString2) != Dali::CalculateHash(testString2, testString1)); END_TEST; } @@ -54,8 +54,8 @@ int UtcDaliHashNegative(void) // negative test, check hash value == initial value const std::string emptyString; - DALI_TEST_CHECK( Dali::CalculateHash( emptyString ) != 0 ); - DALI_TEST_CHECK( Dali::CalculateHash( emptyString, emptyString ) != 0 ); + DALI_TEST_CHECK(Dali::CalculateHash(emptyString) != 0); + DALI_TEST_CHECK(Dali::CalculateHash(emptyString, emptyString) != 0); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp index c178d40..2abc74e 100644 --- a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp +++ b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp @@ -15,19 +15,18 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include + +#include using namespace Dali; namespace { - /** * The functor to be used in the hit-test algorithm to check whether the actor is hittable. */ @@ -35,16 +34,15 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t { bool hittable = false; - switch (type) + switch(type) { case Dali::HitTestAlgorithm::CHECK_ACTOR: { // Check whether the actor is visible and not fully transparent. - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) - && actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) // not FULLY_TRANSPARENT + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && actor.GetCurrentProperty(Actor::Property::WORLD_COLOR).a > 0.01f) // not FULLY_TRANSPARENT { // Check whether the actor has the specific name "HittableActor" - if(actor.GetProperty< std::string >( Actor::Property::NAME ) == "HittableActor") + if(actor.GetProperty(Actor::Property::NAME) == "HittableActor") { hittable = true; } @@ -53,7 +51,7 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible. + if(actor.GetCurrentProperty(Actor::Property::VISIBLE)) // Actor is visible, if not visible then none of its children are visible. { hittable = true; } @@ -68,18 +66,17 @@ bool IsActorHittableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType t return hittable; }; - bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::TraverseType type) { bool hittable = false; - switch (type) + switch(type) { case Dali::HitTestAlgorithm::CHECK_ACTOR: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) && - actor.GetProperty< bool >( Actor::Property::SENSITIVE ) && - actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && + actor.GetProperty(Actor::Property::SENSITIVE) && + actor.GetCurrentProperty(Actor::Property::WORLD_COLOR).a > 0.01f) { hittable = true; } @@ -87,8 +84,8 @@ bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm:: } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) && // Actor is visible, if not visible then none of its children are visible. - actor.GetProperty< bool >( Actor::Property::SENSITIVE )) // Actor is sensitive, if insensitive none of its children should be hittable either. + if(actor.GetCurrentProperty(Actor::Property::VISIBLE) && // Actor is visible, if not visible then none of its children are visible. + actor.GetProperty(Actor::Property::SENSITIVE)) // Actor is sensitive, if insensitive none of its children should be hittable either. { hittable = true; } @@ -105,7 +102,6 @@ bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm:: } // anonymous namespace - // Positive test case for a method int UtcDaliHitTestAlgorithmWithFunctor(void) { @@ -115,33 +111,33 @@ int UtcDaliHitTestAlgorithmWithFunctor(void) Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor.SetProperty( Actor::Property::NAME,"NonHittableActor"); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::NAME, "NonHittableActor"); stage.Add(actor); // Render and notify application.SendNotification(); application.Render(); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Perform a hit-test at the given screen coordinates Dali::HitTestAlgorithm::Results results; - Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction ); - DALI_TEST_CHECK( results.actor != actor ); + Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction); + DALI_TEST_CHECK(results.actor != actor); - actor.SetProperty( Actor::Property::NAME,"HittableActor"); + actor.SetProperty(Actor::Property::NAME, "HittableActor"); - results.actor = Actor(); + results.actor = Actor(); results.actorCoordinates = Vector2::ZERO; // Perform a hit-test at the given screen coordinates - Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction ); - DALI_TEST_CHECK( results.actor == actor ); - DALI_TEST_EQUALS( localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION ); + Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction); + DALI_TEST_CHECK(results.actor == actor); + DALI_TEST_EQUALS(localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION); END_TEST; } @@ -150,33 +146,33 @@ int UtcDaliHitTestAlgorithmOrtho01(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with parallel Ortho camera()"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection( stageSize ); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(stageSize); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -185,54 +181,51 @@ int UtcDaliHitTestAlgorithmOrtho01(void) HitTestAlgorithm::Results results; HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 1.0f/6.0f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 1.0f / 6.0f, TEST_LOCATION); HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); END_TEST; } - int UtcDaliHitTestAlgorithmOrtho02(void) { TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, - stageSize.y * 0.3f, -stageSize.y * 0.7f, - 800.0f, 4895.0f); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, stageSize.y * 0.3f, -stageSize.y * 0.7f, 800.0f, 4895.0f); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -241,31 +234,31 @@ int UtcDaliHitTestAlgorithmOrtho02(void) { HitTestAlgorithm::Results results; - HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION ); + HitTest(stage, Vector2(240.0f, 400.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION); } { HitTestAlgorithm::Results results; - HitTest(stage, Vector2( 0.001f, 0.001f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, Vector2( 0.001f, 0.001f ), 0.001f, TEST_LOCATION ); + HitTest(stage, Vector2(0.001f, 0.001f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, Vector2(0.001f, 0.001f), 0.001f, TEST_LOCATION); } { HitTestAlgorithm::Results results; HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( ! results.actor ); - DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION ); + DALI_TEST_CHECK(!results.actor); + DALI_TEST_EQUALS(results.actorCoordinates, Vector2::ZERO, TEST_LOCATION); } // Just inside green { HitTestAlgorithm::Results results; - HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION ); + HitTest(stage, stageSize * 0.69f, results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION); } END_TEST; @@ -276,33 +269,33 @@ int UtcDaliHitTestAlgorithmClippingActor(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with a stencil"); - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); Actor rootLayer = stage.GetRootLayer(); - rootLayer.SetProperty( Actor::Property::NAME, "RootLayer" ); + rootLayer.SetProperty(Actor::Property::NAME, "RootLayer"); // Create a layer Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - layer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - layer.SetProperty( Actor::Property::NAME, "layer" ); - stage.Add( layer ); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + layer.SetProperty(Actor::Property::NAME, "layer"); + stage.Add(layer); // Create a clipping actor and add it to the layer. Actor clippingActor = CreateRenderableActor(); - clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - clippingActor.SetProperty( Actor::Property::NAME, "clippingActor" ); - layer.Add( clippingActor ); + clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + clippingActor.SetProperty(Actor::Property::NAME, "clippingActor"); + layer.Add(clippingActor); // Create a renderable actor and add it to the clipping actor. Actor childActor = CreateRenderableActor(); - childActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - childActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - childActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - childActor.SetProperty( Actor::Property::NAME, "childActor" ); - clippingActor.Add( childActor ); + childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + childActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + childActor.SetProperty(Actor::Property::NAME, "childActor"); + clippingActor.Add(childActor); // Render and notify application.SendNotification(); @@ -310,14 +303,14 @@ int UtcDaliHitTestAlgorithmClippingActor(void) // Hit within clippingActor and childActor. HitTestAlgorithm::Results results; - HitTest( stage, Vector2( 10.0f, 10.0f ), results, &DefaultIsActorTouchableFunction ); - DALI_TEST_CHECK( results.actor == childActor ); - tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) ); + HitTest(stage, Vector2(10.0f, 10.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == childActor); + tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty(Actor::Property::NAME).c_str() : "NULL")); // Hit within childActor but outside of clippingActor, should hit the root-layer instead. - HitTest( stage, Vector2( 60.0f, 60.0f ), results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == rootLayer ); - tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) ); + HitTest(stage, Vector2(60.0f, 60.0f), results, &DefaultIsActorTouchableFunction); + DALI_TEST_CHECK(results.actor == rootLayer); + tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty(Actor::Property::NAME).c_str() : "NULL")); END_TEST; } @@ -327,34 +320,34 @@ int UtcDaliHitTestAlgorithmOverlay(void) TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with overlay actors"); - Stage stage = Stage::GetCurrent(); - RenderTaskList renderTaskList = stage.GetRenderTaskList(); - RenderTask defaultRenderTask = renderTaskList.GetTask(0u); - Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); + Stage stage = Stage::GetCurrent(); + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + RenderTask defaultRenderTask = renderTaskList.GetTask(0u); + Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); - Vector2 stageSize ( stage.GetSize() ); - cameraActor.SetOrthographicProjection( stageSize ); - cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); + Vector2 stageSize(stage.GetSize()); + cameraActor.SetOrthographicProjection(stageSize); + cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f)); - Vector2 actorSize( stageSize * 0.5f ); + Vector2 actorSize(stageSize * 0.5f); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); - blue.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); - blue.SetProperty( Actor::Property::NAME, "Blue" ); - blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) ); - blue.SetProperty( Actor::Property::SIZE, actorSize ); - blue.SetProperty( Actor::Property::POSITION_Z, 30.0f); - - Actor green = Actor::New( ); - green.SetProperty( Actor::Property::NAME, "Green" ); - green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) ); - green.SetProperty( Actor::Property::SIZE, actorSize ); + blue.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D); + blue.SetProperty(Actor::Property::NAME, "Blue"); + blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f)); + blue.SetProperty(Actor::Property::SIZE, actorSize); + blue.SetProperty(Actor::Property::POSITION_Z, 30.0f); + + Actor green = Actor::New(); + green.SetProperty(Actor::Property::NAME, "Green"); + green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f)); + green.SetProperty(Actor::Property::SIZE, actorSize); // Add the actors to the view - stage.Add( blue ); - stage.Add( green ); + stage.Add(blue); + stage.Add(green); // Render and notify application.SendNotification(); @@ -365,17 +358,17 @@ int UtcDaliHitTestAlgorithmOverlay(void) //Hit in the intersection. Should pick the blue actor since it is an overlay. HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 5.0f/6.0f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 5.0f / 6.0f, TEST_LOCATION); //Hit in the blue actor HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == blue ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == blue); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); //Hit in the green actor HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction); - DALI_TEST_CHECK( results.actor == green ); - DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(results.actor == green); + DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp index 861ade2..7f1784d 100644 --- a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp @@ -15,14 +15,14 @@ * */ -#include - -#include -#include +#include +#include #include #include -#include -#include +#include +#include + +#include using namespace Dali; @@ -40,12 +40,11 @@ void utc_dali_hover_processing_cleanup(void) namespace { - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() - : functorCalled( false ), + : functorCalled(false), hoverEvent(), hoveredActor() { @@ -58,9 +57,9 @@ struct SignalData hoveredActor.Reset(); } - bool functorCalled; + bool functorCalled; HoverEvent hoverEvent; - Actor hoveredActor; + Actor hoveredActor; }; // Functor that sets the data when called @@ -71,23 +70,23 @@ struct HoverEventFunctor * @param[in] data Reference to the data to store callback information. * @param[in] returnValue What the functor should return. */ - HoverEventFunctor( SignalData& data, bool returnValue = true ) - : signalData( data ), - returnValue( returnValue ) + HoverEventFunctor(SignalData& data, bool returnValue = true) + : signalData(data), + returnValue(returnValue) { } - bool operator()( Actor actor, const HoverEvent& hoverEvent ) + bool operator()(Actor actor, const HoverEvent& hoverEvent) { signalData.functorCalled = true; - signalData.hoveredActor = actor; - signalData.hoverEvent = hoverEvent; + signalData.hoveredActor = actor; + signalData.hoverEvent = hoverEvent; return returnValue; } SignalData& signalData; - bool returnValue; + bool returnValue; }; // Functor that removes the actor when called. @@ -98,34 +97,34 @@ struct RemoveActorFunctor : public HoverEventFunctor * @param[in] data Reference to the data to store callback information. * @param[in] returnValue What the functor should return. */ - RemoveActorFunctor( SignalData& data, bool returnValue = true ) - : HoverEventFunctor( data, returnValue ) + RemoveActorFunctor(SignalData& data, bool returnValue = true) + : HoverEventFunctor(data, returnValue) { } - bool operator()( Actor actor, const HoverEvent& hoverEvent ) + bool operator()(Actor actor, const HoverEvent& hoverEvent) { - Actor parent( actor.GetParent() ); - if ( parent ) + Actor parent(actor.GetParent()); + if(parent) { - parent.Remove( actor ); + parent.Remove(actor); } - return HoverEventFunctor::operator()( actor, hoverEvent ); + return HoverEventFunctor::operator()(actor, hoverEvent); } }; -Integration::HoverEvent GenerateSingleHover( PointState::Type state, const Vector2& screenPosition ) +Integration::HoverEvent GenerateSingleHover(PointState::Type state, const Vector2& screenPosition) { Integration::HoverEvent hoverEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - hoverEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + hoverEvent.points.push_back(point); return hoverEvent; } -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -134,8 +133,8 @@ int UtcDaliHoverNormalProcessing(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -143,74 +142,74 @@ int UtcDaliHoverNormalProcessing(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION); + DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION); + DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION); + DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION); data.Reset(); // Emit a motion signal screenCoordinates.x = screenCoordinates.y = 11.0f; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION); + DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION); + DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION); + DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION); data.Reset(); // Emit a finished signal screenCoordinates.x = screenCoordinates.y = 12.0f; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION ); - DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleHover(PointState::FINISHED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION); + DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION); + DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION); + DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION); data.Reset(); // Emit a started signal where the actor is not present screenCoordinates.x = screenCoordinates.y = 200.0f; - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( !data.hoverEvent ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(!data.hoverEvent); END_TEST; } @@ -219,13 +218,13 @@ int UtcDaliHoverOutsideCameraNearFarPlanes(void) { TestApplication application; - Integration::Scene stage = application.GetScene(); - Vector2 stageSize = stage.GetSize(); + Integration::Scene stage = application.GetScene(); + Vector2 stageSize = stage.GetSize(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); stage.Add(actor); // Render and notify @@ -233,70 +232,70 @@ int UtcDaliHoverOutsideCameraNearFarPlanes(void) application.Render(); // Get the camera's near and far planes - RenderTaskList taskList = stage.GetRenderTaskList(); - Dali::RenderTask task = taskList.GetTask(0); - CameraActor camera = task.GetCameraActor(); - float nearPlane = camera.GetNearClippingPlane(); - float farPlane = camera.GetFarClippingPlane(); + RenderTaskList taskList = stage.GetRenderTaskList(); + Dali::RenderTask task = taskList.GetTask(0); + CameraActor camera = task.GetCameraActor(); + float nearPlane = camera.GetNearClippingPlane(); + float farPlane = camera.GetFarClippingPlane(); // Calculate the current distance of the actor from the camera float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f); - float distance = (stageSize.y * 0.5f) / tanHalfFov; + float distance = (stageSize.y * 0.5f) / tanHalfFov; // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); - Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f ); + Vector2 screenCoordinates(stageSize.x * 0.5f, stageSize.y * 0.5f); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a started signal where actor is just at the camera's near plane - actor.SetProperty( Actor::Property::POSITION_Z, distance - nearPlane); + actor.SetProperty(Actor::Property::POSITION_Z, distance - nearPlane); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a started signal where actor is closer than the camera's near plane - actor.SetProperty( Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f); + actor.SetProperty(Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a started signal where actor is just at the camera's far plane - actor.SetProperty( Actor::Property::POSITION_Z, distance - farPlane); + actor.SetProperty(Actor::Property::POSITION_Z, distance - farPlane); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a started signal where actor is further than the camera's far plane - actor.SetProperty( Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f); + actor.SetProperty(Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@ -309,12 +308,12 @@ int UtcDaliHoverEmitEmpty(void) { // Emit an empty HoverEvent Integration::HoverEvent event; - application.ProcessEvent( event ); - tet_result( TET_FAIL ); + application.ProcessEvent(event); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_ASSERT( e, "!event.points.empty()", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "!event.points.empty()", TEST_LOCATION); } END_TEST; } @@ -324,8 +323,8 @@ int UtcDaliHoverInterrupted(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -333,36 +332,36 @@ int UtcDaliHoverInterrupted(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not. - application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // Emit another interrupted signal, our signal handler should not be called. - application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } int UtcDaliHoverParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -370,99 +369,99 @@ int UtcDaliHoverParentConsumer(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data, false ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data, false); + actor.HoveredSignal().Connect(&application, functor); // Connect to root actor's hovered signal - SignalData rootData; - HoverEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.HoveredSignal().Connect( &application, rootFunctor ); + SignalData rootData; + HoverEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.HoveredSignal().Connect(&application, rootFunctor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 actorCoordinates, rootCoordinates; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit a motion signal screenCoordinates.x = screenCoordinates.y = 11.0f; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit a finished signal screenCoordinates.x = screenCoordinates.y = 12.0f; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleHover(PointState::FINISHED, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit a started signal where the actor is not present, will hit the root actor though screenCoordinates.x = screenCoordinates.y = 200.0f; - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) ); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0)); END_TEST; } int UtcDaliHoverInterruptedParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -470,66 +469,66 @@ int UtcDaliHoverInterruptedParentConsumer(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data, false ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data, false); + actor.HoveredSignal().Connect(&application, functor); // Connect to root actor's hovered signal - SignalData rootData; - HoverEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.HoveredSignal().Connect( &application, rootFunctor ); + SignalData rootData; + HoverEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.HoveredSignal().Connect(&application, rootFunctor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit an interrupted signal - application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit another started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); rootData.Reset(); // Remove actor from Stage - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); // Render and notify application.SendNotification(); application.Render(); // Emit an interrupted signal, only root actor's signal should be called. - application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit another interrupted state, none of the signal's should be called. - application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); END_TEST; } @@ -538,8 +537,8 @@ int UtcDaliHoverLeave(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -547,42 +546,42 @@ int UtcDaliHoverLeave(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Set actor to require leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // Emit a motion signal outside of actor, should be signalled with a Leave - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // Another motion outside of actor, no signalling - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(201.0f, 201.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Another motion event inside actor, signalled with motion - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // We do not want to listen to leave events anymore - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false); // Another motion event outside of actor, no signalling - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@ -590,11 +589,11 @@ int UtcDaliHoverLeave(void) int UtcDaliHoverLeaveParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -602,70 +601,70 @@ int UtcDaliHoverLeaveParentConsumer(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data, false ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data, false); + actor.HoveredSignal().Connect(&application, functor); // Connect to root actor's hovered signal - SignalData rootData; - HoverEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.HoveredSignal().Connect( &application, rootFunctor ); + SignalData rootData; + HoverEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.HoveredSignal().Connect(&application, rootFunctor); // Set actor to require leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); - rootActor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + rootActor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Emit a motion signal outside of actor, should be signalled with a Leave - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Another motion outside of actor, only rootActor signalled - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(201.0f, 201.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Another motion event inside actor, signalled with motion - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // We do not want to listen to leave events of actor anymore - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false); // Another motion event outside of root actor, only root signalled - Vector2 stageSize( application.GetScene().GetSize() ); - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); + Vector2 stageSize(application.GetScene().GetSize()); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(stageSize.width + 10.0f, stageSize.height + 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, rootData.hoverEvent.GetState(0), TEST_LOCATION); END_TEST; } @@ -674,8 +673,8 @@ int UtcDaliHoverActorBecomesInsensitive(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -683,23 +682,23 @@ int UtcDaliHoverActorBecomesInsensitive(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); // Change actor to insensitive - actor.SetProperty( Actor::Property::SENSITIVE, false ); + actor.SetProperty(Actor::Property::SENSITIVE, false); // Emit a motion signal, signalled with an interrupted - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); END_TEST; } @@ -707,11 +706,11 @@ int UtcDaliHoverActorBecomesInsensitive(void) int UtcDaliHoverActorBecomesInsensitiveParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -719,322 +718,322 @@ int UtcDaliHoverActorBecomesInsensitiveParentConsumer(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data, false ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data, false); + actor.HoveredSignal().Connect(&application, functor); // Connect to root actor's hovered signal - SignalData rootData; - HoverEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.HoveredSignal().Connect( &application, rootFunctor ); + SignalData rootData; + HoverEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.HoveredSignal().Connect(&application, rootFunctor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) ); - DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0)); + DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0)); data.Reset(); rootData.Reset(); // Remove actor from Stage - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); // Render and notify application.SendNotification(); application.Render(); // Make root actor insensitive - rootActor.SetProperty( Actor::Property::SENSITIVE, false ); + rootActor.SetProperty(Actor::Property::SENSITIVE, false); // Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor) - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION); END_TEST; } int UtcDaliHoverMultipleLayers(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); + SignalData data; + HoverEventFunctor functor(data); - Layer layer1 ( Layer::New() ); - layer1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer1 ); + Layer layer1(Layer::New()); + layer1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer1); - Actor actor1 ( Actor::New() ); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor1.SetProperty( Actor::Property::POSITION_Z, 1.0f ); // Should hit actor1 in this layer - layer1.Add( actor1 ); + Actor actor1(Actor::New()); + actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor1.SetProperty(Actor::Property::POSITION_Z, 1.0f); // Should hit actor1 in this layer + layer1.Add(actor1); // Render and notify application.SendNotification(); application.Render(); // Connect to layer1 and actor1 - layer1.HoveredSignal().Connect( &application, functor ); - actor1.HoveredSignal().Connect( &application, functor ); + layer1.HoveredSignal().Connect(&application, functor); + actor1.HoveredSignal().Connect(&application, functor); // Hit in hittable area, actor1 should be hit - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.hoveredActor == actor1 ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.hoveredActor == actor1); data.Reset(); // Make layer1 insensitive, nothing should be hit - layer1.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + layer1.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Make layer1 sensitive again, again actor1 will be hit - layer1.SetProperty( Actor::Property::SENSITIVE, true ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.hoveredActor == actor1 ); + layer1.SetProperty(Actor::Property::SENSITIVE, true); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.hoveredActor == actor1); data.Reset(); // Make rootActor insensitive, nothing should be hit - rootActor.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + rootActor.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Make rootActor sensitive - rootActor.SetProperty( Actor::Property::SENSITIVE, true ); + rootActor.SetProperty(Actor::Property::SENSITIVE, true); // Add another layer - Layer layer2 ( Layer::New() ); - layer2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - layer2.SetProperty( Actor::Property::POSITION_Z, 10.0f ); // Should hit layer2 in this layer rather than actor2 - application.GetScene().Add( layer2 ); + Layer layer2(Layer::New()); + layer2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer2.SetProperty(Actor::Property::POSITION_Z, 10.0f); // Should hit layer2 in this layer rather than actor2 + application.GetScene().Add(layer2); - Actor actor2 ( Actor::New() ); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - layer2.Add( actor2 ); + Actor actor2(Actor::New()); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer2.Add(actor2); // Render and notify application.SendNotification(); application.Render(); // Connect to layer2 and actor2 - layer2.HoveredSignal().Connect( &application, functor ); - actor2.HoveredSignal().Connect( &application, functor ); + layer2.HoveredSignal().Connect(&application, functor); + actor2.HoveredSignal().Connect(&application, functor); // Emit an event, should hit layer2 - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); //DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack! data.Reset(); // Make layer2 insensitive, should hit actor1 - layer2.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.hoveredActor == actor1 ); + layer2.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.hoveredActor == actor1); data.Reset(); // Make layer2 sensitive again, should hit layer2 - layer2.SetProperty( Actor::Property::SENSITIVE, true ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + layer2.SetProperty(Actor::Property::SENSITIVE, true); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); //DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack! data.Reset(); // Make layer2 invisible, render and notify - layer2.SetProperty( Actor::Property::VISIBLE, false ); + layer2.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); // Should hit actor1 - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.hoveredActor == actor1 ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.hoveredActor == actor1); data.Reset(); // Make rootActor invisible, render and notify - rootActor.SetProperty( Actor::Property::VISIBLE, false ); + rootActor.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); // Should not hit anything - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliHoverMultipleRenderTasks(void) { - TestApplication application; - Integration::Scene stage ( application.GetScene() ); - Vector2 stageSize ( stage.GetSize() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); + Vector2 stageSize(stage.GetSize()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); stage.Add(actor); // Create render task - Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f ); - RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() ); - renderTask.SetViewport( viewport ); - renderTask.SetInputEnabled( true ); + Viewport viewport(stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f); + RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask()); + renderTask.SetViewport(viewport); + renderTask.SetInputEnabled(true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Ensure renderTask actor can be hit too. - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Disable input on renderTask, should not be hittable - renderTask.SetInputEnabled( false ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + renderTask.SetInputEnabled(false); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliHoverMultipleRenderTasksWithChildLayer(void) { - TestApplication application; - Integration::Scene stage ( application.GetScene() ); - Vector2 stageSize ( stage.GetSize() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); + Vector2 stageSize(stage.GetSize()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); stage.Add(actor); Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); actor.Add(layer); // Create render task - Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f ); - RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() ); - renderTask.SetViewport( viewport ); - renderTask.SetInputEnabled( true ); - renderTask.SetSourceActor( actor ); + Viewport viewport(stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f); + RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask()); + renderTask.SetViewport(viewport); + renderTask.SetInputEnabled(true); + renderTask.SetSourceActor(actor); // Render and notify application.SendNotification(); application.Render(); // Connect to layer's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); - layer.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); + layer.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Ensure renderTask actor can be hit too. - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Disable input on renderTask, should not be hittable - renderTask.SetInputEnabled( false ); - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + renderTask.SetInputEnabled(false); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliHoverOffscreenRenderTasks(void) { - TestApplication application; - Integration::Scene stage ( application.GetScene() ); - Vector2 stageSize ( stage.GetSize() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); + Vector2 stageSize(stage.GetSize()); // FrameBufferImage for offscreen RenderTask - FrameBuffer frameBuffer = FrameBuffer::New( stageSize.width, stageSize.height ); + FrameBuffer frameBuffer = FrameBuffer::New(stageSize.width, stageSize.height); // Create a renderable actor to display the FrameBufferImage Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture()); - renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - renderableActor.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) ); - renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME - stage.Add( renderableActor ); + renderableActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + renderableActor.SetProperty(Actor::Property::SIZE, Vector2(stageSize.x, stageSize.y)); + renderableActor.ScaleBy(Vector3(1.0f, -1.0f, 1.0f)); // FIXME + stage.Add(renderableActor); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - stage.Add( actor ); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + stage.Add(actor); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); // Ensure framebuffer connects - stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION ); + stage.GetRenderTaskList().GetTask(0u).SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION); // Create a RenderTask RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); - renderTask.SetSourceActor( actor ); + renderTask.SetSourceActor(actor); renderTask.SetFrameBuffer(frameBuffer); - renderTask.SetInputEnabled( true ); + renderTask.SetInputEnabled(true); // Create another RenderTask - RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() ); - renderTask2.SetInputEnabled( true ); + RenderTask renderTask2(stage.GetRenderTaskList().CreateTask()); + renderTask2.SetInputEnabled(true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliHoverMultipleRenderableActors(void) { - TestApplication application; - Integration::Scene stage ( application.GetScene() ); - Vector2 stageSize ( stage.GetSize() ); + TestApplication application; + Integration::Scene stage(application.GetScene()); + Vector2 stageSize(stage.GetSize()); Actor parent = CreateRenderableActor(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); stage.Add(parent); Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify @@ -1042,15 +1041,15 @@ int UtcDaliHoverMultipleRenderableActors(void) application.Render(); // Connect to layer's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - parent.HoveredSignal().Connect( &application, functor ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + parent.HoveredSignal().Connect(&application, functor); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.hoveredActor ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.hoveredActor); END_TEST; } @@ -1059,8 +1058,8 @@ int UtcDaliHoverActorRemovedInSignal(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1068,16 +1067,16 @@ int UtcDaliHoverActorRemovedInSignal(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - RemoveActorFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + RemoveActorFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Register for leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Re-add, render and notify @@ -1086,13 +1085,13 @@ int UtcDaliHoverActorRemovedInSignal(void) application.Render(); // Emit another signal outside of actor's area, should not get anything as the scene has changed. - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Render and notify @@ -1100,8 +1099,8 @@ int UtcDaliHoverActorRemovedInSignal(void) application.Render(); // Emit another signal outside of actor's area, should not get anything as the scene has changed. - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Re-add actor back to stage, render and notify @@ -1110,16 +1109,16 @@ int UtcDaliHoverActorRemovedInSignal(void) application.Render(); // Emit another started event - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Completely delete the actor actor.Reset(); // Emit event, should not crash and should not receive an event. - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1128,8 +1127,8 @@ int UtcDaliHoverActorSignalNotConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1137,13 +1136,13 @@ int UtcDaliHoverActorSignalNotConsumed(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data, false ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data, false); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1152,8 +1151,8 @@ int UtcDaliHoverActorUnStaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1161,70 +1160,70 @@ int UtcDaliHoverActorUnStaged(void) application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started signal - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Remove actor from stage - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); // Render and notify application.SendNotification(); application.Render(); // Emit a move at the same point, we should not be signalled. - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliHoverLeaveActorReadded(void) { - TestApplication application; + TestApplication application; Integration::Scene stage = application.GetScene(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); stage.Add(actor); // Set actor to receive hover-events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's hovered signal - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit a started and motion - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 11.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(11.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Remove actor from stage and add again - stage.Remove( actor ); - stage.Add( actor ); + stage.Remove(actor); + stage.Add(actor); // Emit a motion within the actor's bounds - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 12.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(12.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a motion outside the actor's bounds - application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION); data.Reset(); END_TEST; @@ -1232,51 +1231,51 @@ int UtcDaliHoverLeaveActorReadded(void) int UtcDaliHoverClippingActor(void) { - TestApplication application; + TestApplication application; Integration::Scene stage = application.GetScene(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - stage.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + stage.Add(actor); Actor clippingActor = Actor::New(); - clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - stage.Add( clippingActor ); + clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + stage.Add(clippingActor); // Add a child to the clipped region. Actor clippingChild = Actor::New(); - clippingChild.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingChild.SetProperty( Actor::Property::POSITION, Vector2( 25.0f, 25.0f )); - clippingChild.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.Add( clippingChild ); + clippingChild.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingChild.SetProperty(Actor::Property::POSITION, Vector2(25.0f, 25.0f)); + clippingChild.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.Add(clippingChild); // Render and notify. application.SendNotification(); application.Render(); // Connect to actor's hovered signal. - SignalData data; - HoverEventFunctor functor( data ); - actor.HoveredSignal().Connect( &application, functor ); + SignalData data; + HoverEventFunctor functor(data); + actor.HoveredSignal().Connect(&application, functor); // Emit an event within clipped area - no hit. - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit an event outside the clipped area but within the actor area, we should have a hit. - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 60.0f, 60.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(60.0f, 60.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - clippingChild.HoveredSignal().Connect( &application, functor ); + clippingChild.HoveredSignal().Connect(&application, functor); // Emit an event inside part of the child which is within the clipped area, we should have a hit. - application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 30.0f, 30.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(30.0f, 30.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; @@ -1286,13 +1285,12 @@ int UtcDaliHoverEventCreate(void) { TestApplication application; - Dali::HoverEvent hoverEvent = DevelHoverEvent::New( 100 ); - DALI_TEST_CHECK( hoverEvent ); + Dali::HoverEvent hoverEvent = DevelHoverEvent::New(100); + DALI_TEST_CHECK(hoverEvent); // Emit a started signal - DALI_TEST_EQUALS( 100, hoverEvent.GetTime(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, hoverEvent.GetPointCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(100, hoverEvent.GetTime(), TEST_LOCATION); + DALI_TEST_EQUALS(0, hoverEvent.GetPointCount(), TEST_LOCATION); END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp b/automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp index 8f057fe..238b200 100644 --- a/automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp +++ b/automated-tests/src/dali/utc-Dali-IntrusivePtr.cpp @@ -15,24 +15,23 @@ * */ +#include +#include +#include #include -#include -#include -#include using namespace Dali; namespace { - const int REPEAT = 1000; -size_t g_creationCount = 0; -size_t g_destructionCount = 0; -size_t g_creationCountSubclass = 0; -size_t g_destructionCountSubclass = 0; -size_t g_creationCountUnrelated = 0; +size_t g_creationCount = 0; +size_t g_destructionCount = 0; +size_t g_creationCountSubclass = 0; +size_t g_destructionCountSubclass = 0; +size_t g_creationCountUnrelated = 0; size_t g_destructionCountUnrelated = 0; class Counted : public RefObject @@ -91,14 +90,13 @@ public: TestObject& Assign(const TestObject& testObject) { RefObject::operator=(testObject); - data = testObject.data; + data = testObject.data; return *this; } int data; }; - } // Anonymous namespace /** @@ -106,36 +104,36 @@ public: */ int UtcDaliIntrusivePtrIntrusivePtr(void) { - tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr()" ); + tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr()"); g_creationCount = g_destructionCount = 0; IntrusivePtr counted; - DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); // Test the pointer is null - DALI_TEST_EQUALS( counted.Get(), (Counted*) 0, TEST_LOCATION ); - DALI_TEST_EQUALS( &(*counted), (Counted*) 0, TEST_LOCATION ); + DALI_TEST_EQUALS(counted.Get(), (Counted*)0, TEST_LOCATION); + DALI_TEST_EQUALS(&(*counted), (Counted*)0, TEST_LOCATION); // Check destruction of the null smart pointer does nothing: counted = IntrusivePtr(); - DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrIntrusivePtrTP(void) { - tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(T*)" ); + tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(T*)"); g_creationCount = g_destructionCount = 0; - IntrusivePtr counted( new Counted ); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + IntrusivePtr counted(new Counted); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); counted = 0; - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION); END_TEST; } @@ -144,30 +142,30 @@ int UtcDaliIntrusivePtrIntrusivePtrTP(void) int UtcDaliIntrusivePtrIntrusivePtrIntrusivePtrUP(void) { - tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)" ); + tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)"); g_creationCount = g_destructionCount = g_creationCountSubclass = g_destructionCountSubclass = 0; - IntrusivePtr countedSubclass( new CountedSubclass ); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_creationCountSubclass, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCountSubclass, 0u, TEST_LOCATION ); + IntrusivePtr countedSubclass(new CountedSubclass); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_creationCountSubclass, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCountSubclass, 0u, TEST_LOCATION); - IntrusivePtr counted( countedSubclass ); - DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION ); + IntrusivePtr counted(countedSubclass); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION); // Make loads more references: - std::vector< IntrusivePtr > intrusivePtrs; - for( int i = 0; i < REPEAT; ++i ) + std::vector > intrusivePtrs; + for(int i = 0; i < REPEAT; ++i) { - intrusivePtrs.push_back( IntrusivePtr( countedSubclass ) ); + intrusivePtrs.push_back(IntrusivePtr(countedSubclass)); } - DALI_TEST_EQUALS( counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION ); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_creationCountSubclass, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_creationCountSubclass, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); END_TEST; } @@ -177,312 +175,309 @@ int UtcDaliIntrusivePtrIntrusivePtrIntrusivePtrUP(void) int UtcDaliIntrusivePtrIntrusivePtrIntrusivePtrP(void) { - tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)" ); + tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)"); // Pass a pointer to a constructed second object: // Pass a pointer to null: g_creationCount = g_destructionCount = 0; - IntrusivePtr counted( new Counted ); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr counted(new Counted); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION); - IntrusivePtr counted2( counted ); - DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( counted.Get(), counted2.Get(), TEST_LOCATION ); + IntrusivePtr counted2(counted); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(counted.Get(), counted2.Get(), TEST_LOCATION); // Make loads more references: - std::vector< IntrusivePtr > intrusivePtrs; - for( int i = 0; i < REPEAT; ++i ) + std::vector > intrusivePtrs; + for(int i = 0; i < REPEAT; ++i) { - intrusivePtrs.push_back( IntrusivePtr( counted ) ); + intrusivePtrs.push_back(IntrusivePtr(counted)); } - DALI_TEST_EQUALS( counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION ); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); intrusivePtrs.clear(); - DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); counted.Reset(); - DALI_TEST_EQUALS( counted2->ReferenceCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(counted2->ReferenceCount(), 1, TEST_LOCATION); counted2.Reset(); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrGetP(void) { - tet_infoline( "Testing Dali::IntrusivePtr::Get()" ); + tet_infoline("Testing Dali::IntrusivePtr::Get()"); - IntrusivePtr counted( new Counted ); - DALI_TEST_CHECK( counted.Get() != 0 ); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr counted(new Counted); + DALI_TEST_CHECK(counted.Get() != 0); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrGetN(void) { - tet_infoline( "Testing Dali::IntrusivePtr::Get()" ); + tet_infoline("Testing Dali::IntrusivePtr::Get()"); g_creationCount = 0; - IntrusivePtr counted( 0 ); - DALI_TEST_CHECK( counted.Get() == 0 ); - DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION ); + IntrusivePtr counted(0); + DALI_TEST_CHECK(counted.Get() == 0); + DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrArrowOperatorP(void) { - tet_infoline( "Positive Test for Dali::IntrusivePtr::operator->()" ); + tet_infoline("Positive Test for Dali::IntrusivePtr::operator->()"); - IntrusivePtr counted( new Counted ); - DALI_TEST_CHECK( (counted.operator->()) != 0 ); - DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr counted(new Counted); + DALI_TEST_CHECK((counted.operator->()) != 0); + DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrArrowOperatorN(void) { - tet_infoline( "Negative Test for Dali::IntrusivePtr::operator->()" ); + tet_infoline("Negative Test for Dali::IntrusivePtr::operator->()"); IntrusivePtr counted; - DALI_TEST_CHECK( (counted.operator->()) == 0 ); + DALI_TEST_CHECK((counted.operator->()) == 0); END_TEST; } int UtcDaliIntrusivePtrIndirectionOperatorP(void) { - tet_infoline( "Positive Test for Dali::IntrusivePtr::operator*()" ); + tet_infoline("Positive Test for Dali::IntrusivePtr::operator*()"); - IntrusivePtr counted( new Counted ); - DALI_TEST_CHECK( &(counted.operator*()) != 0 ); - DALI_TEST_EQUALS( (*counted).ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr counted(new Counted); + DALI_TEST_CHECK(&(counted.operator*()) != 0); + DALI_TEST_EQUALS((*counted).ReferenceCount(), 1, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrIndirectionOperatorN(void) { - tet_infoline( "Negative Test for Dali::IntrusivePtr::operator*()" ); + tet_infoline("Negative Test for Dali::IntrusivePtr::operator*()"); IntrusivePtr counted; - DALI_TEST_CHECK( &(counted.operator*()) == 0 ); + DALI_TEST_CHECK(&(counted.operator*()) == 0); END_TEST; } int UtcDaliIntrusivePtrResetP(void) { - tet_infoline( "Positive Test for Dali::IntrusivePtr::Reset()" ); + tet_infoline("Positive Test for Dali::IntrusivePtr::Reset()"); - IntrusivePtr counted( new Counted ); - DALI_TEST_CHECK( counted.Get() != 0 ); + IntrusivePtr counted(new Counted); + DALI_TEST_CHECK(counted.Get() != 0); counted.Reset(); - DALI_TEST_CHECK( counted.Get() == 0 ); + DALI_TEST_CHECK(counted.Get() == 0); END_TEST; } int UtcDaliIntrusivePtrResetN(void) { - tet_infoline( "Negative Test for Dali::IntrusivePtr::Reset()" ); + tet_infoline("Negative Test for Dali::IntrusivePtr::Reset()"); IntrusivePtr counted; - Counted* firstGet = counted.Get(); + Counted* firstGet = counted.Get(); counted.Reset(); - DALI_TEST_EQUALS( counted.Get(), firstGet, TEST_LOCATION ); + DALI_TEST_EQUALS(counted.Get(), firstGet, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrResetTP(void) { - tet_infoline( "Positive Test for Dali::IntrusivePtr::Reset(T*)" ); + tet_infoline("Positive Test for Dali::IntrusivePtr::Reset(T*)"); g_creationCount = g_destructionCount = 0; - IntrusivePtr counted( new Counted ); + IntrusivePtr counted(new Counted); - IntrusivePtr counted2( new Counted ); + IntrusivePtr counted2(new Counted); - DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( counted2->ReferenceCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(counted2->ReferenceCount(), 1, TEST_LOCATION); - counted.Reset( counted2.Get() ); + counted.Reset(counted2.Get()); - DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( counted2->ReferenceCount(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(counted2->ReferenceCount(), 2, TEST_LOCATION); - DALI_TEST_EQUALS( counted.Get(), counted2.Get(), TEST_LOCATION ); + DALI_TEST_EQUALS(counted.Get(), counted2.Get(), TEST_LOCATION); - DALI_TEST_EQUALS( g_creationCount, 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_creationCount, 2u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION); - counted2.Reset( (Counted*) 0 ); - counted.Reset( counted2.Get() ); - DALI_TEST_EQUALS( g_destructionCount, 2u, TEST_LOCATION ); + counted2.Reset((Counted*)0); + counted.Reset(counted2.Get()); + DALI_TEST_EQUALS(g_destructionCount, 2u, TEST_LOCATION); // Check that reseting nulls is harmless: - counted2.Reset( counted.Get() ); - counted.Reset( counted2.Get() ); + counted2.Reset(counted.Get()); + counted.Reset(counted2.Get()); - DALI_TEST_EQUALS( g_destructionCount, 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(g_destructionCount, 2u, TEST_LOCATION); END_TEST; } - int UtcDaliIntrusivePtrResetTN(void) { - tet_infoline( "Negative Test for Dali::IntrusivePtr::Reset(T*)" ); + tet_infoline("Negative Test for Dali::IntrusivePtr::Reset(T*)"); g_creationCount = g_destructionCount = 0; - IntrusivePtr counted( new Counted ); + IntrusivePtr counted(new Counted); - counted.Reset( (Counted*) 0 ); + counted.Reset((Counted*)0); - DALI_TEST_EQUALS( counted.Get(), (Counted*) 0, TEST_LOCATION ); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(counted.Get(), (Counted*)0, TEST_LOCATION); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION); END_TEST; } - - int UtcDaliIntrusivePtrOperatorBooleanTypeP(void) { - tet_infoline( "Positive Test for Dali::IntrusivePtr::operator Booleantype()" ); + tet_infoline("Positive Test for Dali::IntrusivePtr::operator Booleantype()"); - IntrusivePtr counted( new Counted ); - DALI_TEST_CHECK( counted.operator BooleanType() != 0 ); - DALI_TEST_CHECK( counted ); + IntrusivePtr counted(new Counted); + DALI_TEST_CHECK(counted.operator BooleanType() != 0); + DALI_TEST_CHECK(counted); typedef void (IntrusivePtr::*BoolIdiomFunc)() const; - BoolIdiomFunc func = static_cast( counted.operator BooleanType() ); + BoolIdiomFunc func = static_cast(counted.operator BooleanType()); ((counted).*func)(); // purely for test coverage counted.Reset(); - DALI_TEST_CHECK( counted.operator BooleanType() == 0 ); + DALI_TEST_CHECK(counted.operator BooleanType() == 0); END_TEST; } int UtcDaliIntrusivePtrOperatorBooleanTypeN(void) { - tet_infoline( "Negative Test for Dali::IntrusivePtr::operator Booleantype()" ); + tet_infoline("Negative Test for Dali::IntrusivePtr::operator Booleantype()"); IntrusivePtr counted; - DALI_TEST_CHECK( counted.operator BooleanType() == 0 ); - DALI_TEST_CHECK( !counted ); + DALI_TEST_CHECK(counted.operator BooleanType() == 0); + DALI_TEST_CHECK(!counted); END_TEST; } /** Equality of two different types*/ int UtcDaliIntrusivePtrOperatorEqualTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T, U)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator ==(T, U)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator==( counted1, countedSubclass1 ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( operator==( counted2, countedSubclass2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(operator==(counted1, countedSubclass1), false, TEST_LOCATION); + DALI_TEST_EQUALS(operator==(counted2, countedSubclass2), true, TEST_LOCATION); END_TEST; } /** Inequality of two different types*/ int UtcDaliIntrusivePtrOperatorNotEqualTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T, U)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator !=(T, U)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator!=( counted1, countedSubclass1 ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( operator!=( counted2, countedSubclass2 ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(operator!=(counted1, countedSubclass1), true, TEST_LOCATION); + DALI_TEST_EQUALS(operator!=(counted2, countedSubclass2), false, TEST_LOCATION); END_TEST; } /** Equality of two different types where right hand side is a raw pointer */ int UtcDaliIntrusivePtrOperatorEqualRightPointerTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T, U*)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator ==(T, U*)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator==( counted1, countedSubclass1.Get() ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( operator==( counted2, countedSubclass2.Get() ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(operator==(counted1, countedSubclass1.Get()), false, TEST_LOCATION); + DALI_TEST_EQUALS(operator==(counted2, countedSubclass2.Get()), true, TEST_LOCATION); END_TEST; } /** Inequality of two different types where the right hand side is a raw pointer */ int UtcDaliIntrusivePtrOperatorNotEqualRightPointerTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T, U*)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator !=(T, U*)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator!=( counted1, countedSubclass1.Get() ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( operator!=( counted2, countedSubclass2.Get() ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(operator!=(counted1, countedSubclass1.Get()), true, TEST_LOCATION); + DALI_TEST_EQUALS(operator!=(counted2, countedSubclass2.Get()), false, TEST_LOCATION); END_TEST; } /** Equality of two different types where left hand side is a raw pointer */ int UtcDaliIntrusivePtrOperatorEqualLeftPointerTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T*, U)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator ==(T*, U)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator==( counted1.Get(), countedSubclass1 ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( operator==( counted2.Get(), countedSubclass2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(operator==(counted1.Get(), countedSubclass1), false, TEST_LOCATION); + DALI_TEST_EQUALS(operator==(counted2.Get(), countedSubclass2), true, TEST_LOCATION); END_TEST; } /** Inequality of two different types where the left hand side is a raw pointer */ int UtcDaliIntrusivePtrOperatorNotEqualLeftPointerTU(void) { - tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T*, U)" ); + tet_infoline("Test for Dali::IntrusivePtr::operator !=(T*, U)"); - IntrusivePtr counted1( new Counted ); - IntrusivePtr countedSubclass1( new CountedSubclass ); - IntrusivePtr countedSubclass2( new CountedSubclass ); - IntrusivePtr counted2( countedSubclass2 ); + IntrusivePtr counted1(new Counted); + IntrusivePtr countedSubclass1(new CountedSubclass); + IntrusivePtr countedSubclass2(new CountedSubclass); + IntrusivePtr counted2(countedSubclass2); - DALI_TEST_EQUALS( operator!=( counted1.Get(), countedSubclass1 ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( operator!=( counted2.Get(), countedSubclass2 ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(operator!=(counted1.Get(), countedSubclass1), true, TEST_LOCATION); + DALI_TEST_EQUALS(operator!=(counted2.Get(), countedSubclass2), false, TEST_LOCATION); END_TEST; } @@ -491,131 +486,129 @@ int UtcDaliRefObjectCopyConstructor(void) tet_infoline("Test for Dali::RefObject(const RefObject&)"); { - IntrusivePtr testPtr( new TestObject ); - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr testPtr(new TestObject); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); - const TestObject& testObject=*testPtr.Get(); + const TestObject& testObject = *testPtr.Get(); { - IntrusivePtr testPtr2( new TestObject(testObject) ); - DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr testPtr2(new TestObject(testObject)); + DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 1, TEST_LOCATION); } - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); } END_TEST; } - int UtcDaliRefObjectAssignmentOperator(void) { tet_infoline("Test for Dali::RefObject::operator=(const RefObject&)"); { - IntrusivePtr testPtr( new TestObject ); - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr testPtr(new TestObject); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); - const TestObject& testObject=*testPtr.Get(); + const TestObject& testObject = *testPtr.Get(); { - IntrusivePtr testPtr2( new TestObject() ); - testPtr->data = 33; + IntrusivePtr testPtr2(new TestObject()); + testPtr->data = 33; IntrusivePtr testPtr3 = testPtr2; - DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( testPtr2->data, 201, TEST_LOCATION ); + DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(testPtr2->data, 201, TEST_LOCATION); TestObject& testObject2 = *testPtr2.Get(); - testObject2 = testObject; + testObject2 = testObject; - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 2, TEST_LOCATION); } - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); } END_TEST; } - int UtcDaliRefObjectAssignmentOperatorToNull(void) { tet_infoline("Testing Dali::IntrusivePtr = nullptr"); g_creationCount = g_destructionCount = 0; - IntrusivePtr counted( new Counted ); + IntrusivePtr counted(new Counted); - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); IntrusivePtr counted2 = counted; - DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION); - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); - DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION); counted2 = nullptr; - DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION); - DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION); + DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION); counted = nullptr; - DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION); + DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION); END_TEST; } int UtcDaliIntrusivePtrMoveConstructor(void) { - IntrusivePtr testPtr( new TestObject ); - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( testPtr->data, 201, TEST_LOCATION ); + IntrusivePtr testPtr(new TestObject); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(testPtr->data, 201, TEST_LOCATION); - IntrusivePtr movePtr = std::move( testPtr ); - DALI_TEST_EQUALS( movePtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( movePtr->data, 201, TEST_LOCATION ); - DALI_TEST_CHECK( !testPtr ); + IntrusivePtr movePtr = std::move(testPtr); + DALI_TEST_EQUALS(movePtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(movePtr->data, 201, TEST_LOCATION); + DALI_TEST_CHECK(!testPtr); - IntrusivePtr anotherTestPtr( new TestObject ); - DALI_TEST_EQUALS( anotherTestPtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( anotherTestPtr->data, 201, TEST_LOCATION ); - IntrusivePtr anotherMovePtr = std::move( anotherTestPtr ); - DALI_TEST_EQUALS( anotherMovePtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( anotherMovePtr->data, 201, TEST_LOCATION ); - DALI_TEST_CHECK( !anotherTestPtr.Get() ); + IntrusivePtr anotherTestPtr(new TestObject); + DALI_TEST_EQUALS(anotherTestPtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(anotherTestPtr->data, 201, TEST_LOCATION); + IntrusivePtr anotherMovePtr = std::move(anotherTestPtr); + DALI_TEST_EQUALS(anotherMovePtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(anotherMovePtr->data, 201, TEST_LOCATION); + DALI_TEST_CHECK(!anotherTestPtr.Get()); - IntrusivePtr countedSubclass( new CountedSubclass ); - DALI_TEST_EQUALS( countedSubclass->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr countedSubclass(new CountedSubclass); + DALI_TEST_EQUALS(countedSubclass->ReferenceCount(), 1, TEST_LOCATION); - IntrusivePtr countedMovePtr = std::move( countedSubclass ); - DALI_TEST_EQUALS( countedMovePtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_CHECK( !countedSubclass ); + IntrusivePtr countedMovePtr = std::move(countedSubclass); + DALI_TEST_EQUALS(countedMovePtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_CHECK(!countedSubclass); END_TEST; } int UtcDaliIntrusivePtrMoveAssignment(void) { - IntrusivePtr testPtr( new TestObject ); - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( testPtr->data, 201, TEST_LOCATION ); + IntrusivePtr testPtr(new TestObject); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(testPtr->data, 201, TEST_LOCATION); - IntrusivePtr secondPtr( testPtr ); - DALI_TEST_EQUALS( testPtr->ReferenceCount(), 2, TEST_LOCATION ); + IntrusivePtr secondPtr(testPtr); + DALI_TEST_EQUALS(testPtr->ReferenceCount(), 2, TEST_LOCATION); IntrusivePtr thirdPtr; - testPtr = std::move( thirdPtr ); - DALI_TEST_EQUALS( secondPtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( secondPtr->data, 201, TEST_LOCATION ); - DALI_TEST_CHECK( !testPtr.Get() ); + testPtr = std::move(thirdPtr); + DALI_TEST_EQUALS(secondPtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(secondPtr->data, 201, TEST_LOCATION); + DALI_TEST_CHECK(!testPtr.Get()); - IntrusivePtr fourthPtr( new TestObject ); - testPtr = std::move( fourthPtr ); - DALI_TEST_CHECK( !fourthPtr.Get() ); + IntrusivePtr fourthPtr(new TestObject); + testPtr = std::move(fourthPtr); + DALI_TEST_CHECK(!fourthPtr.Get()); - IntrusivePtr countedSubclassPtr( new CountedSubclass ); - DALI_TEST_EQUALS( countedSubclassPtr->ReferenceCount(), 1, TEST_LOCATION ); + IntrusivePtr countedSubclassPtr(new CountedSubclass); + DALI_TEST_EQUALS(countedSubclassPtr->ReferenceCount(), 1, TEST_LOCATION); IntrusivePtr countedMovePtr; - countedMovePtr = std::move( countedSubclassPtr ); - DALI_TEST_EQUALS( countedMovePtr->ReferenceCount(), 1, TEST_LOCATION ); - DALI_TEST_CHECK( !countedSubclassPtr ); + countedMovePtr = std::move(countedSubclassPtr); + DALI_TEST_EQUALS(countedMovePtr->ReferenceCount(), 1, TEST_LOCATION); + DALI_TEST_CHECK(!countedSubclassPtr); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-KeyEvent.cpp b/automated-tests/src/dali/utc-Dali-KeyEvent.cpp index db51c33..32fb3d8 100644 --- a/automated-tests/src/dali/utc-Dali-KeyEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-KeyEvent.cpp @@ -15,14 +15,13 @@ * */ -#include - -#include -#include -#include +#include #include +#include +#include +#include -#include +#include using namespace Dali; @@ -38,24 +37,23 @@ void utc_dali_key_event_cleanup(void) namespace { - // Key Event Test references -const static int SHIFT_MODIFIER = 0x1; -const static int CTRL_MODIFIER = 0x2; -const static int ALT_MODIFIER = 0x4; -const static int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER; +const static int SHIFT_MODIFIER = 0x1; +const static int CTRL_MODIFIER = 0x2; +const static int ALT_MODIFIER = 0x4; +const static int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER; const static int SHIFT_AND_ALT_MODIFIER = SHIFT_MODIFIER | ALT_MODIFIER; -const static int CTRL_AND_ALT_MODIFIER = CTRL_MODIFIER | ALT_MODIFIER; +const static int CTRL_AND_ALT_MODIFIER = CTRL_MODIFIER | ALT_MODIFIER; const static char* TEST_STRING_1 = "alpha"; - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -66,21 +64,24 @@ struct SignalData keyedActor.Reset(); } - bool functorCalled; + bool functorCalled; KeyEvent receivedKeyEvent; - Actor keyedActor; + Actor keyedActor; }; // Functor that sets the data when called struct KeyEventReceivedFunctor { - KeyEventReceivedFunctor( SignalData& data ) : signalData( data ) { } + KeyEventReceivedFunctor(SignalData& data) + : signalData(data) + { + } - bool operator()( Actor actor, const KeyEvent& keyEvent ) + bool operator()(Actor actor, const KeyEvent& keyEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedKeyEvent = keyEvent; - signalData.keyedActor = actor; + signalData.keyedActor = actor; return true; } @@ -88,25 +89,25 @@ struct KeyEventReceivedFunctor SignalData& signalData; }; -} // anon namespace +} // namespace int UtcDaliKeyEventConstructor(void) { TestApplication application; // Reset all test adapter return codes - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass END_TEST; @@ -115,49 +116,49 @@ int UtcDaliKeyEventConstructor(void) int UtcDaliKeyEventCopyAssignment(void) { // Test Assignment operator - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass - Dali::KeyEvent event2 = DevelKeyEvent::New(TEST_STRING_1, "J", "j", 88, CTRL_MODIFIER, 0lu, KeyEvent::UP, "", "", Device::Class::USER, Device::Subclass::FINGER); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event2 ); - - DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("J", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("j", event2.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(88, event2.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(CTRL_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::UP, event2.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::USER, event2.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event2 = DevelKeyEvent::New(TEST_STRING_1, "J", "j", 88, CTRL_MODIFIER, 0lu, KeyEvent::UP, "", "", Device::Class::USER, Device::Subclass::FINGER); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event2); + + DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("J", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("j", event2.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(88, event2.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(CTRL_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::UP, event2.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::USER, event2.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::FINGER, event2.GetDeviceSubclass(), TEST_LOCATION); // check device subclass event = event2; - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("J", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("j", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::USER, event.GetDeviceClass(), TEST_LOCATION); // check device class + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("J", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("j", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::USER, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::FINGER, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass END_TEST; @@ -166,34 +167,34 @@ int UtcDaliKeyEventCopyAssignment(void) int UtcDaliKeyEventCopyConstructor(void) { // Test Assignment operator - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass - KeyEvent event2( event ); - DALI_TEST_CHECK( event2 ); - - DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event2.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event2.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event2.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event2.GetDeviceClass(), TEST_LOCATION); // check device class + KeyEvent event2(event); + DALI_TEST_CHECK(event2); + + DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event2.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event2.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event2.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event2.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event2.GetDeviceSubclass(), TEST_LOCATION); // check device subclass END_TEST; @@ -202,38 +203,38 @@ int UtcDaliKeyEventCopyConstructor(void) int UtcDaliKeyEventMoveAssignment(void) { // Test Assignment operator - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass KeyEvent move; - move = std::move( event ); - DALI_TEST_CHECK( move ); - - DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class + move = std::move(event); + DALI_TEST_CHECK(move); + + DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, move.GetDeviceSubclass(), TEST_LOCATION); // check device subclass - DALI_TEST_CHECK( !event ); + DALI_TEST_CHECK(!event); END_TEST; } @@ -241,37 +242,37 @@ int UtcDaliKeyEventMoveAssignment(void) int UtcDaliKeyEventMoveConstructor(void) { // Test Assignment operator - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); - - DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); + + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass - KeyEvent move = std::move( event ); - DALI_TEST_CHECK( move ); - - DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name - DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string - DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string - DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode - DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time - DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state - DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose - DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name - DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class + KeyEvent move = std::move(event); + DALI_TEST_CHECK(move); + + DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name + DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string + DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string + DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode + DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time + DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state + DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose + DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name + DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class DALI_TEST_EQUALS(Device::Subclass::NONE, move.GetDeviceSubclass(), TEST_LOCATION); // check device subclass - DALI_TEST_CHECK( !event ); + DALI_TEST_CHECK(!event); END_TEST; } @@ -281,13 +282,13 @@ int UtcDaliKeyEventIsShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION); // check IsShiftModifier - DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier + DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set @@ -301,13 +302,13 @@ int UtcDaliKeyEventIsCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION); // check IsCtrlModifier - DevelKeyEvent::SetKeyModifier( event, CTRL_MODIFIER ); // Set to Ctrl Modifier + DevelKeyEvent::SetKeyModifier(event, CTRL_MODIFIER); // Set to Ctrl Modifier DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set @@ -320,17 +321,17 @@ int UtcDaliKeyEventIsAltModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift - DALI_TEST_CHECK( event ); + Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION); // check IsAltModifier - DevelKeyEvent::SetKeyModifier( event, ALT_MODIFIER ); // Set to Alt Modifier + DevelKeyEvent::SetKeyModifier(event, ALT_MODIFIER); // Set to Alt Modifier DALI_TEST_EQUALS(ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set - DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier + DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier END_TEST; } @@ -381,7 +382,7 @@ int UtcDaliKeyEventANDModifer(void) Dali::KeyEvent event = DevelKeyEvent::New("i", "I", "i", 0, SHIFT_AND_CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); DALI_TEST_EQUALS(true, (bool)(event.IsCtrlModifier() & event.IsShiftModifier()), TEST_LOCATION); - DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier + DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier DALI_TEST_EQUALS(false, (bool)(event.IsCtrlModifier() & event.IsShiftModifier()), TEST_LOCATION); END_TEST; @@ -395,7 +396,7 @@ int UtcDaliKeyEventORModifer(void) Dali::KeyEvent event = DevelKeyEvent::New("i", "I", "i", 0, SHIFT_AND_CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); DALI_TEST_EQUALS(true, (bool)(event.IsCtrlModifier() | event.IsAltModifier()), TEST_LOCATION); - DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier + DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier DALI_TEST_EQUALS(false, (bool)(event.IsCtrlModifier() & event.IsAltModifier()), TEST_LOCATION); END_TEST; @@ -407,46 +408,46 @@ int UtcDaliIntegrationKeyEvent(void) { Integration::KeyEvent keyEvent; - DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION ); - DALI_TEST_CHECK( keyEvent.keyName == std::string() ); - DALI_TEST_CHECK( keyEvent.logicalKey == std::string() ); - DALI_TEST_CHECK( keyEvent.keyString == std::string() ); - DALI_TEST_EQUALS( keyEvent.keyCode, -1, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.keyModifier, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.time, 0lu, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.state, Integration::KeyEvent::DOWN, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.compose, std::string(), TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceName, std::string(), TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceClass, Device::Class::NONE, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceSubclass, Device::Subclass::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.type, Integration::Event::Key, TEST_LOCATION); + DALI_TEST_CHECK(keyEvent.keyName == std::string()); + DALI_TEST_CHECK(keyEvent.logicalKey == std::string()); + DALI_TEST_CHECK(keyEvent.keyString == std::string()); + DALI_TEST_EQUALS(keyEvent.keyCode, -1, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.keyModifier, 0, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.time, 0lu, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.state, Integration::KeyEvent::DOWN, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.compose, std::string(), TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceName, std::string(), TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceClass, Device::Class::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceSubclass, Device::Subclass::NONE, TEST_LOCATION); } { - const std::string keyName("keyName"); - const std::string logicalKey("logicalKey"); - const std::string keyString("keyString"); - const int keyCode(333); - const int keyModifier(312); - const unsigned long timeStamp(132); + const std::string keyName("keyName"); + const std::string logicalKey("logicalKey"); + const std::string keyString("keyString"); + const int keyCode(333); + const int keyModifier(312); + const unsigned long timeStamp(132); const Integration::KeyEvent::State keyState(Integration::KeyEvent::UP); - const std::string compose("compose"); - const std::string deviceName("hwKeyboard"); - const Device::Class::Type deviceClass = Device::Class::KEYBOARD; - const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE; - - Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass ); - DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION ); - DALI_TEST_CHECK( keyEvent.keyName == keyName ); - DALI_TEST_CHECK( keyEvent.logicalKey == logicalKey ); - DALI_TEST_CHECK( keyEvent.keyString == keyString ); - DALI_TEST_EQUALS( keyEvent.keyCode, keyCode, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.keyModifier, keyModifier, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.time, timeStamp, TEST_LOCATION ); - DALI_TEST_EQUALS( keyEvent.state, keyState, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.compose, compose, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceName, deviceName, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceClass, deviceClass, TEST_LOCATION); - DALI_TEST_EQUALS( keyEvent.deviceSubclass, deviceSubclass, TEST_LOCATION); + const std::string compose("compose"); + const std::string deviceName("hwKeyboard"); + const Device::Class::Type deviceClass = Device::Class::KEYBOARD; + const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE; + + Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass); + DALI_TEST_EQUALS(keyEvent.type, Integration::Event::Key, TEST_LOCATION); + DALI_TEST_CHECK(keyEvent.keyName == keyName); + DALI_TEST_CHECK(keyEvent.logicalKey == logicalKey); + DALI_TEST_CHECK(keyEvent.keyString == keyString); + DALI_TEST_EQUALS(keyEvent.keyCode, keyCode, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.keyModifier, keyModifier, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.time, timeStamp, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.state, keyState, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.compose, compose, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceName, deviceName, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceClass, deviceClass, TEST_LOCATION); + DALI_TEST_EQUALS(keyEvent.deviceSubclass, deviceSubclass, TEST_LOCATION); } END_TEST; } @@ -457,10 +458,10 @@ int UtcDaliKeyEventSetKeyName(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( TEST_STRING_1, event.GetKeyName(), TEST_LOCATION ); + DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); - DevelKeyEvent::SetKeyName( event, "keyName" ); - DALI_TEST_EQUALS( "keyName", event.GetKeyName(), TEST_LOCATION ); + DevelKeyEvent::SetKeyName(event, "keyName"); + DALI_TEST_EQUALS("keyName", event.GetKeyName(), TEST_LOCATION); END_TEST; } @@ -471,10 +472,10 @@ int UtcDaliKeyEventSetKeyString(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( "i", event.GetKeyString(), TEST_LOCATION ); + DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); - DevelKeyEvent::SetKeyString( event, "keyString" ); - DALI_TEST_EQUALS( "keyString", event.GetKeyString(), TEST_LOCATION ); + DevelKeyEvent::SetKeyString(event, "keyString"); + DALI_TEST_EQUALS("keyString", event.GetKeyString(), TEST_LOCATION); END_TEST; } @@ -485,10 +486,10 @@ int UtcDaliKeyEventSetKeyCode(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( 99, event.GetKeyCode(), TEST_LOCATION ); + DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); - DevelKeyEvent::SetKeyCode( event, 88 ); - DALI_TEST_EQUALS( 88, event.GetKeyCode(), TEST_LOCATION ); + DevelKeyEvent::SetKeyCode(event, 88); + DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION); END_TEST; } @@ -499,10 +500,10 @@ int UtcDaliKeyEventSetKeyModifier(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION ); + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); - DevelKeyEvent::SetKeyModifier( event, ALT_MODIFIER ); - DALI_TEST_EQUALS( ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION ); + DevelKeyEvent::SetKeyModifier(event, ALT_MODIFIER); + DALI_TEST_EQUALS(ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); END_TEST; } @@ -513,10 +514,10 @@ int UtcDaliKeyEventSetTime(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( 0lu, event.GetTime(), TEST_LOCATION ); + DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); - DevelKeyEvent::SetTime( event, 100lu ); - DALI_TEST_EQUALS( 100lu, event.GetTime(), TEST_LOCATION ); + DevelKeyEvent::SetTime(event, 100lu); + DALI_TEST_EQUALS(100lu, event.GetTime(), TEST_LOCATION); END_TEST; } @@ -527,10 +528,10 @@ int UtcDaliKeyEventSetState(void) Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); - DALI_TEST_EQUALS( KeyEvent::DOWN, event.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); - DevelKeyEvent::SetState( event, KeyEvent::UP ); - DALI_TEST_EQUALS( KeyEvent::UP, event.GetState(), TEST_LOCATION ); + DevelKeyEvent::SetState(event, KeyEvent::UP); + DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Layer.cpp b/automated-tests/src/dali/utc-Dali-Layer.cpp index eba0f09..c3b5410 100644 --- a/automated-tests/src/dali/utc-Dali-Layer.cpp +++ b/automated-tests/src/dali/utc-Dali-Layer.cpp @@ -15,13 +15,11 @@ * */ -#include - -#include - +#include #include +#include -#include +#include using namespace Dali; @@ -35,11 +33,10 @@ void layer_test_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliLayerNew(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); DALI_TEST_CHECK(layer); END_TEST; @@ -50,12 +47,12 @@ int UtcDaliLayerDownCast(void) TestApplication application; tet_infoline("Testing Dali::Layer::DownCast()"); - Layer actor1 = Layer::New(); + Layer actor1 = Layer::New(); Actor anActor = Actor::New(); anActor.Add(actor1); Actor child = anActor.GetChildAt(0); - Layer layer = DownCast< Layer >(child); + Layer layer = DownCast(child); DALI_TEST_CHECK(layer); END_TEST; @@ -66,16 +63,16 @@ int UtcDaliLayerDownCast2(void) TestApplication application; tet_infoline("Testing Dali::Layer::DownCast()"); - Actor actor1 = Actor::New(); + Actor actor1 = Actor::New(); Actor anActor = Actor::New(); anActor.Add(actor1); Actor child = anActor.GetChildAt(0); - Layer layer = DownCast< Layer >(child); + Layer layer = DownCast(child); DALI_TEST_CHECK(!layer); Actor unInitialzedActor; - layer = Layer::DownCast( unInitialzedActor ); + layer = Layer::DownCast(unInitialzedActor); DALI_TEST_CHECK(!layer); END_TEST; } @@ -83,20 +80,20 @@ int UtcDaliLayerDownCast2(void) int UtcDaliLayerMoveConstructor(void) { TestApplication application; - Layer layer = Layer::New(); - DALI_TEST_CHECK( layer ); - DALI_TEST_EQUALS( 1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + Layer layer = Layer::New(); + DALI_TEST_CHECK(layer); + DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); - application.GetScene().Add( layer ); - DALI_TEST_EQUALS( 2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + application.GetScene().Add(layer); + DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); - Layer move = std::move( layer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, move.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - DALI_TEST_CHECK( !layer ); + Layer move = std::move(layer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, move.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + DALI_TEST_CHECK(!layer); END_TEST; } @@ -104,21 +101,21 @@ int UtcDaliLayerMoveConstructor(void) int UtcDaliLayerMoveAssignment(void) { TestApplication application; - Layer layer = Layer::New(); - DALI_TEST_CHECK( layer ); - DALI_TEST_EQUALS( 1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + Layer layer = Layer::New(); + DALI_TEST_CHECK(layer); + DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); - application.GetScene().Add( layer ); - DALI_TEST_EQUALS( 2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + application.GetScene().Add(layer); + DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); Layer move; - move = std::move( layer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, move.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - DALI_TEST_CHECK( !layer ); + move = std::move(layer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, move.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + DALI_TEST_CHECK(!layer); END_TEST; } @@ -127,23 +124,23 @@ int UtcDaliLayerGetDepth(void) { tet_infoline("Testing Dali::Layer::GetDepth()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); // layers are not on scene - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // root depth is 0 - Layer root = application.GetScene().GetLayer( 0 ); - DALI_TEST_EQUALS(root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + Layer root = application.GetScene().GetLayer(0); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); application.GetScene().Add(layer1); application.GetScene().Add(layer2); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); END_TEST; } @@ -151,23 +148,23 @@ int UtcDaliLayerRaise(void) { tet_infoline("Testing Dali::Layer::Raise()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); application.GetScene().Add(layer1); application.GetScene().Add(layer2); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); layer1.Raise(); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); // get root - Layer root = application.GetScene().GetLayer( 0 ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + Layer root = application.GetScene().GetLayer(0); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); root.Raise(); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } @@ -175,23 +172,23 @@ int UtcDaliLayerLower(void) { tet_infoline("Testing Dali::Layer::Lower()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); application.GetScene().Add(layer1); application.GetScene().Add(layer2); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); layer2.Lower(); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); // get root - Layer root = application.GetScene().GetLayer( 0 ); + Layer root = application.GetScene().GetLayer(0); root.Lower(); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); layer2.Lower(); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } @@ -199,25 +196,25 @@ int UtcDaliLayerRaiseToTop(void) { tet_infoline("Testing Dali::Layer::RaiseToTop()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); - Layer layer3 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); application.GetScene().Add(layer1); application.GetScene().Add(layer2); application.GetScene().Add(layer3); - Layer root = application.GetScene().GetLayer( 0 ); + Layer root = application.GetScene().GetLayer(0); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); layer1.RaiseToTop(); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); root.RaiseToTop(); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); END_TEST; } @@ -225,20 +222,20 @@ int UtcDaliLayerLowerToBottom(void) { tet_infoline("Testing Dali::Layer::LowerToBottom()"); TestApplication application; - Layer layer1 = Layer::New(); - Layer layer2 = Layer::New(); - Layer layer3 = Layer::New(); + Layer layer1 = Layer::New(); + Layer layer2 = Layer::New(); + Layer layer3 = Layer::New(); application.GetScene().Add(layer1); application.GetScene().Add(layer2); application.GetScene().Add(layer3); - DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION); - DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer1.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); layer3.LowerToBottom(); - DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); END_TEST; } @@ -248,10 +245,10 @@ int UtcDaliLayerSetClipping(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK( !layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) ); + DALI_TEST_CHECK(!layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); - layer.SetProperty( Layer::Property::CLIPPING_ENABLE, true ); - DALI_TEST_CHECK( layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) ); + layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true); + DALI_TEST_CHECK(layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); END_TEST; } @@ -261,7 +258,7 @@ int UtcDaliLayerIsClipping(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK( !layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) ); + DALI_TEST_CHECK(!layer.GetProperty(Layer::Property::CLIPPING_ENABLE)); END_TEST; } @@ -270,12 +267,12 @@ int UtcDaliLayerSetClippingBox(void) tet_infoline("Testing Dali::Layer::SetClippingBox()"); TestApplication application; - ClippingBox testBox(5,6, 77,83); + ClippingBox testBox(5, 6, 77, 83); Layer layer = Layer::New(); - DALI_TEST_CHECK(layer.GetProperty< Rect >( Layer::Property::CLIPPING_BOX ) != testBox); - layer.SetProperty( Layer::Property::CLIPPING_BOX, testBox ); - DALI_TEST_CHECK(layer.GetProperty< Rect >( Layer::Property::CLIPPING_BOX ) == testBox); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) != testBox); + layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) == testBox); END_TEST; } @@ -285,7 +282,7 @@ int UtcDaliLayerGetClippingBox(void) TestApplication application; Layer layer = Layer::New(); - DALI_TEST_CHECK( layer.GetProperty< Rect >( Layer::Property::CLIPPING_BOX ) == ClippingBox(0,0,0,0) ); + DALI_TEST_CHECK(layer.GetProperty >(Layer::Property::CLIPPING_BOX) == ClippingBox(0, 0, 0, 0)); END_TEST; } @@ -303,18 +300,18 @@ int UtcDaliLayerSetSortFunction(void) TestApplication application; // create two transparent actors so there is something to sort - Actor actor = CreateRenderableActor(); + Actor actor = CreateRenderableActor(); Actor actor2 = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f ) ); // 50% transparent - actor2.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) ); - actor2.SetProperty( Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f ) ); // 50% transparent + actor.SetProperty(Actor::Property::SIZE, Vector2(1, 1)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent + actor2.SetProperty(Actor::Property::SIZE, Vector2(1, 1)); + actor2.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent // add to scene - application.GetScene().Add( actor ); - application.GetScene().Add( actor2 ); + application.GetScene().Add(actor); + application.GetScene().Add(actor2); - Layer root = application.GetScene().GetLayer( 0 ); + Layer root = application.GetScene().GetLayer(0); gTestSortFunctionCalled = 0; root.SetSortFunction(TestSortFunction); @@ -322,39 +319,38 @@ int UtcDaliLayerSetSortFunction(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gTestSortFunctionCalled > 0 ); + DALI_TEST_CHECK(gTestSortFunctionCalled > 0); END_TEST; } - int UtcDaliLayerRaiseAbove(void) { tet_infoline("Testing Dali::Layer::RaiseAbove()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = application.GetScene().GetLayer( 0 ); - layer.RaiseAbove( root ); + Layer root = application.GetScene().GetLayer(0); + layer.RaiseAbove(root); // layer depth is zero as its not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // add to scene - application.GetScene().Add( layer ); - layer.RaiseAbove( root ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - root.RaiseAbove( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - layer.RaiseAbove( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + application.GetScene().Add(layer); + layer.RaiseAbove(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + root.RaiseAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + layer.RaiseAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // make another layer on the scene Layer layer2 = Layer::New(); - application.GetScene().Add( layer2 ); - layer.RaiseAbove( layer2 ); - DALI_TEST_GREATER( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - layer2.RaiseAbove( layer ); - DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - root.RaiseAbove( layer2 ); - DALI_TEST_GREATER( root.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.RaiseAbove(layer2); + DALI_TEST_GREATER(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + layer2.RaiseAbove(layer); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + root.RaiseAbove(layer2); + DALI_TEST_GREATER(root.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); END_TEST; } @@ -362,31 +358,31 @@ int UtcDaliLayerRaiseBelow(void) { tet_infoline("Testing Dali::Layer::RaiseBelow()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to lower below root layer - Layer root = application.GetScene().GetLayer( 0 ); - layer.LowerBelow( root ); + Layer root = application.GetScene().GetLayer(0); + layer.LowerBelow(root); // layer depth is zero as its not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // add to scene - application.GetScene().Add( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - layer.LowerBelow( root ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - root.LowerBelow( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - layer.LowerBelow( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); + application.GetScene().Add(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + layer.LowerBelow(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.LowerBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + layer.LowerBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); // make another layer on the scene Layer layer2 = Layer::New(); - application.GetScene().Add( layer2 ); - layer.LowerBelow( layer2 ); - DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - layer2.LowerBelow( layer ); - DALI_TEST_GREATER( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); - root.LowerBelow( layer2 ); - DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.LowerBelow(layer2); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + layer2.LowerBelow(layer); + DALI_TEST_GREATER(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); + root.LowerBelow(layer2); + DALI_TEST_GREATER(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH), TEST_LOCATION); END_TEST; } @@ -394,43 +390,43 @@ int UtcDaliLayerMoveAbove(void) { tet_infoline("Testing Dali::Layer::MoveAbove()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = application.GetScene().GetLayer( 0 ); - layer.MoveAbove( root ); + Layer root = application.GetScene().GetLayer(0); + layer.MoveAbove(root); // layer depth is zero as its not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - root.MoveAbove( layer ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveAbove(layer); // root depth is zero as layer is not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // add to scene - application.GetScene().Add( layer ); - layer.MoveAbove( root ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - root.MoveAbove( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); + application.GetScene().Add(layer); + layer.MoveAbove(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveAbove(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); // make another layer on the scene Layer layer2 = Layer::New(); - application.GetScene().Add( layer2 ); - layer.MoveAbove( layer2 ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION ); - layer2.MoveAbove( root ); - DALI_TEST_EQUALS( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION ); - root.MoveAbove( layer ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.MoveAbove(layer2); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); + layer2.MoveAbove(root); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); + root.MoveAbove(layer); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH) + 1u, TEST_LOCATION); Layer layer3 = Layer::New(); - application.GetScene().Add( layer3 ); - DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION ); - root.MoveAbove( layer3 ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION ); - DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetScene().GetLayer( 0 ).GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - layer3.MoveAbove( application.GetScene().GetLayer( 0 ) ); - DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); + application.GetScene().Add(layer3); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + root.MoveAbove(layer3); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(application.GetScene().GetLayer(0).GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + layer3.MoveAbove(application.GetScene().GetLayer(0)); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); END_TEST; } @@ -438,40 +434,40 @@ int UtcDaliLayerMoveBelow(void) { tet_infoline("Testing Dali::Layer::MoveBelow()"); TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); // try to raise above root layer - Layer root = application.GetScene().GetLayer( 0 ); - layer.MoveBelow( root ); + Layer root = application.GetScene().GetLayer(0); + layer.MoveBelow(root); // layer depth is zero as its not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - root.MoveBelow( layer ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + root.MoveBelow(layer); // root depth is zero as layer is not on scene - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // add to scene - application.GetScene().Add( layer ); - layer.MoveBelow( root ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - root.MoveBelow( layer ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION ); + application.GetScene().Add(layer); + layer.MoveBelow(root); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + root.MoveBelow(layer); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 0u, TEST_LOCATION); // make another layer on the scene Layer layer2 = Layer::New(); - application.GetScene().Add( layer2 ); - layer.MoveBelow( layer2 ); - DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION ); - layer2.MoveBelow( root ); - DALI_TEST_EQUALS( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION ); - root.MoveBelow( layer ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION ); + application.GetScene().Add(layer2); + layer.MoveBelow(layer2); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::DEPTH), layer2.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); + layer2.MoveBelow(root); + DALI_TEST_EQUALS(layer2.GetProperty(Layer::Property::DEPTH), root.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); + root.MoveBelow(layer); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), layer.GetProperty(Layer::Property::DEPTH) - 1u, TEST_LOCATION); Layer layer3 = Layer::New(); - application.GetScene().Add( layer3 ); - DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION ); - root.MoveBelow( layer3 ); - DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION ); + application.GetScene().Add(layer3); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); + root.MoveBelow(layer3); + DALI_TEST_EQUALS(root.GetProperty(Layer::Property::DEPTH), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(layer3.GetProperty(Layer::Property::DEPTH), 3u, TEST_LOCATION); END_TEST; } @@ -491,21 +487,21 @@ int UtcDaliLayerDefaultProperties(void) indices.push_back(Layer::Property::CONSUMES_TOUCH); indices.push_back(Layer::Property::CONSUMES_HOVER); - DALI_TEST_CHECK(actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) ); + DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size())); for(std::vector::iterator iter = indices.begin(); iter != indices.end(); ++iter) { - DALI_TEST_CHECK( *iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)) ); - DALI_TEST_CHECK( *iter == Layer::Property::DEPTH ? !actor.IsPropertyWritable(*iter) : actor.IsPropertyWritable(*iter) ); - DALI_TEST_CHECK( !actor.IsPropertyAnimatable(*iter) ); - DALI_TEST_CHECK( actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter) ); // just checking call succeeds + DALI_TEST_CHECK(*iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter))); + DALI_TEST_CHECK(*iter == Layer::Property::DEPTH ? !actor.IsPropertyWritable(*iter) : actor.IsPropertyWritable(*iter)); + DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter)); + DALI_TEST_CHECK(actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter)); // just checking call succeeds } // set/get one of them - actor.SetProperty( Layer::Property::CLIPPING_BOX, ClippingBox( 0, 0, 0, 0 ) ); + actor.SetProperty(Layer::Property::CLIPPING_BOX, ClippingBox(0, 0, 0, 0)); - ClippingBox testBox(10,20,30,40); - DALI_TEST_CHECK(actor.GetProperty< Rect >( Layer::Property::CLIPPING_BOX ) != testBox); + ClippingBox testBox(10, 20, 30, 40); + DALI_TEST_CHECK(actor.GetProperty >(Layer::Property::CLIPPING_BOX) != testBox); actor.SetProperty(Layer::Property::CLIPPING_BOX, Property::Value(Rect(testBox))); @@ -514,21 +510,21 @@ int UtcDaliLayerDefaultProperties(void) Property::Value v = actor.GetProperty(Layer::Property::CLIPPING_BOX); DALI_TEST_CHECK(v.Get >() == testBox); - v = actor.GetCurrentProperty( Layer::Property::CLIPPING_BOX ); + v = actor.GetCurrentProperty(Layer::Property::CLIPPING_BOX); DALI_TEST_CHECK(v.Get >() == testBox); // set the same boundaries, but through a clipping box object - actor.SetProperty( Layer::Property::CLIPPING_BOX, testBox ); - DALI_TEST_CHECK( actor.GetProperty< Rect >( Layer::Property::CLIPPING_BOX ) == testBox ); + actor.SetProperty(Layer::Property::CLIPPING_BOX, testBox); + DALI_TEST_CHECK(actor.GetProperty >(Layer::Property::CLIPPING_BOX) == testBox); actor.SetProperty(Layer::Property::BEHAVIOR, Property::Value(Layer::LAYER_UI)); DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(Layer::Property::BEHAVIOR)); Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR); - DALI_TEST_EQUALS( behavior.Get(), Layer::LAYER_UI, TEST_LOCATION ); + DALI_TEST_EQUALS(behavior.Get(), Layer::LAYER_UI, TEST_LOCATION); - behavior = actor.GetCurrentProperty( Layer::Property::BEHAVIOR ); - DALI_TEST_EQUALS( behavior.Get(), Layer::LAYER_UI, TEST_LOCATION ); + behavior = actor.GetCurrentProperty(Layer::Property::BEHAVIOR); + DALI_TEST_EQUALS(behavior.Get(), Layer::LAYER_UI, TEST_LOCATION); END_TEST; } @@ -542,13 +538,13 @@ int UtcDaliLayerSetDepthTestDisabled(void) // Note that Layer::Property::DEPTH_TEST does not depend on layer behavior, // as 2D layers can still have depth tests performed on a per-renderer basis. // Check default. - DALI_TEST_CHECK( !actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) ); + DALI_TEST_CHECK(!actor.GetProperty(Layer::Property::DEPTH_TEST)); // Check Set / Unset. - actor.SetProperty(Layer::Property::DEPTH_TEST, true ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) ); - actor.SetProperty(Layer::Property::DEPTH_TEST, false ); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) ); + actor.SetProperty(Layer::Property::DEPTH_TEST, true); + DALI_TEST_CHECK(actor.GetProperty(Layer::Property::DEPTH_TEST)); + actor.SetProperty(Layer::Property::DEPTH_TEST, false); + DALI_TEST_CHECK(!actor.GetProperty(Layer::Property::DEPTH_TEST)); END_TEST; } @@ -557,7 +553,7 @@ int UtcDaliLayerCreateDestroy(void) { tet_infoline("Testing Dali::Layer::CreateDestroy() "); Layer* layer = new Layer; - DALI_TEST_CHECK( layer ); + DALI_TEST_CHECK(layer); delete layer; END_TEST; } @@ -565,113 +561,113 @@ int UtcDaliLayerCreateDestroy(void) int UtcDaliLayerPropertyIndices(void) { TestApplication application; - Actor basicActor = Actor::New(); - Layer layer = Layer::New(); + Actor basicActor = Actor::New(); + Layer layer = Layer::New(); Property::IndexContainer indices; - layer.GetPropertyIndices( indices ); - DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() ); - DALI_TEST_EQUALS( indices.Size(), layer.GetPropertyCount(), TEST_LOCATION ); + layer.GetPropertyIndices(indices); + DALI_TEST_CHECK(indices.Size() > basicActor.GetPropertyCount()); + DALI_TEST_EQUALS(indices.Size(), layer.GetPropertyCount(), TEST_LOCATION); END_TEST; } int UtcDaliLayerTouchConsumed(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); - DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_TOUCH ), false, TEST_LOCATION ); - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); - DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_TOUCH ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_TOUCH), false, TEST_LOCATION); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_TOUCH), true, TEST_LOCATION); END_TEST; } int UtcDaliLayerHoverConsumed(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); - DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_HOVER ), false, TEST_LOCATION ); - layer.SetProperty( Layer::Property::CONSUMES_HOVER, true ); - DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_HOVER ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_HOVER), false, TEST_LOCATION); + layer.SetProperty(Layer::Property::CONSUMES_HOVER, true); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::CONSUMES_HOVER), true, TEST_LOCATION); END_TEST; } int UtcDaliLayerClippingGLCalls(void) { - TestApplication application; - const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() ); - Integration::Scene scene( application.GetScene() ); + TestApplication application; + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); + Integration::Scene scene(application.GetScene()); - ClippingBox testBox( 5, 6, 77, 83 ); - Layer layer = application.GetScene().GetRootLayer(); - layer.SetProperty( Layer::Property::CLIPPING_ENABLE, true ); - layer.SetProperty( Layer::Property::CLIPPING_BOX, testBox ); + ClippingBox testBox(5, 6, 77, 83); + Layer layer = application.GetScene().GetRootLayer(); + layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true); + layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox); // Add at least one renderable actor so the GL calls are actually made - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor actor = CreateRenderableActor( img ); - scene.Add( actor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor actor = CreateRenderableActor(img); + scene.Add(actor); // flush the queue and render once application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( testBox.x, glScissorParams.x, TEST_LOCATION ); - DALI_TEST_EQUALS( testBox.y, (int)(scene.GetSize().height - glScissorParams.y - testBox.height), TEST_LOCATION ); // GL Coordinates are from bottom left - DALI_TEST_EQUALS( testBox.width, glScissorParams.width, TEST_LOCATION ); - DALI_TEST_EQUALS( testBox.height, glScissorParams.height, TEST_LOCATION ); + DALI_TEST_EQUALS(testBox.x, glScissorParams.x, TEST_LOCATION); + DALI_TEST_EQUALS(testBox.y, (int)(scene.GetSize().height - glScissorParams.y - testBox.height), TEST_LOCATION); // GL Coordinates are from bottom left + DALI_TEST_EQUALS(testBox.width, glScissorParams.width, TEST_LOCATION); + DALI_TEST_EQUALS(testBox.height, glScissorParams.height, TEST_LOCATION); END_TEST; } int UtcDaliLayerBehaviour(void) { TestApplication application; - Layer layer = Layer::New(); + Layer layer = Layer::New(); - DALI_TEST_EQUALS( layer.GetProperty( Layer::Property::BEHAVIOR ), Dali::Layer::LAYER_UI, TEST_LOCATION ); - layer.SetProperty( Layer::Property::BEHAVIOR, Dali::Layer::LAYER_3D ); - DALI_TEST_EQUALS( layer.GetProperty( Layer::Property::BEHAVIOR ), Dali::Layer::LAYER_3D, TEST_LOCATION ); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_UI, TEST_LOCATION); + layer.SetProperty(Layer::Property::BEHAVIOR, Dali::Layer::LAYER_3D); + DALI_TEST_EQUALS(layer.GetProperty(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_3D, TEST_LOCATION); END_TEST; } -Actor CreateActor( bool withAlpha ) +Actor CreateActor(bool withAlpha) { - Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u); - Actor actor = CreateRenderableActor( texture ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + Actor actor = CreateRenderableActor(texture); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); return actor; } int UtcDaliLayer3DSort(void) { - tet_infoline( "Testing LAYER_3D sort coverage test" ); - TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); + tet_infoline("Testing LAYER_3D sort coverage test"); + TestApplication application; + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); + application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D); // Create an actor. - Actor actor = CreateActor( false ); - application.GetScene().Add( actor ); + Actor actor = CreateActor(false); + application.GetScene().Add(actor); // Create child actors. - Actor child1 = CreateActor( true ); - actor.Add( child1 ); - Actor child2 = CreateActor( false ); - child1.Add( child2 ); + Actor child1 = CreateActor(true); + actor.Add(child1); + Actor child2 = CreateActor(false); + child1.Add(child2); enabledDisableTrace.Reset(); - enabledDisableTrace.Enable( true ); + enabledDisableTrace.Enable(true); application.SendNotification(); application.Render(); - enabledDisableTrace.Enable( false ); + enabledDisableTrace.Enable(false); - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2929" ) ); // 2929 is GL_DEPTH_TEST + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2929")); // 2929 is GL_DEPTH_TEST END_TEST; } @@ -679,7 +675,7 @@ int UtcDaliLayer3DSort(void) int UtcDaliLayerLowerBelowNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { Dali::Layer arg1; @@ -696,7 +692,7 @@ int UtcDaliLayerLowerBelowNegative(void) int UtcDaliLayerRaiseAboveNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { Dali::Layer arg1; @@ -713,7 +709,7 @@ int UtcDaliLayerRaiseAboveNegative(void) int UtcDaliLayerRaiseToTopNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { instance.RaiseToTop(); @@ -729,7 +725,7 @@ int UtcDaliLayerRaiseToTopNegative(void) int UtcDaliLayerLowerToBottomNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { instance.LowerToBottom(); @@ -745,7 +741,7 @@ int UtcDaliLayerLowerToBottomNegative(void) int UtcDaliLayerSetSortFunctionNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { Layer::SortFunctionType function = nullptr; @@ -762,7 +758,7 @@ int UtcDaliLayerSetSortFunctionNegative(void) int UtcDaliLayerLowerNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { instance.Lower(); @@ -778,7 +774,7 @@ int UtcDaliLayerLowerNegative(void) int UtcDaliLayerRaiseNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { instance.Raise(); @@ -794,7 +790,7 @@ int UtcDaliLayerRaiseNegative(void) int UtcDaliLayerMoveAboveNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { Dali::Layer arg1; @@ -811,7 +807,7 @@ int UtcDaliLayerMoveAboveNegative(void) int UtcDaliLayerMoveBelowNegative(void) { TestApplication application; - Dali::Layer instance; + Dali::Layer instance; try { Dali::Layer arg1; diff --git a/automated-tests/src/dali/utc-Dali-LocklessBuffer.cpp b/automated-tests/src/dali/utc-Dali-LocklessBuffer.cpp index 46f1dc2..e649a4e 100644 --- a/automated-tests/src/dali/utc-Dali-LocklessBuffer.cpp +++ b/automated-tests/src/dali/utc-Dali-LocklessBuffer.cpp @@ -15,22 +15,21 @@ * */ -#include - -#include -#include -#include #include +#include +#include +#include + +#include using namespace Dali; namespace { - static bool ReadTest(Integration::LocklessBuffer& buf, const unsigned char exp[], size_t size) { - const unsigned char *res = buf.Read(); - for (size_t i=0; i - -#include -#include +#include +#include #include #include #include -#include -#include +#include +#include #include +#include + using namespace Dali; void utc_dali_long_press_gesture_detector_startup(void) @@ -41,20 +41,20 @@ void utc_dali_long_press_gesture_detector_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() - : functorCalled( false ), - voidFunctorCalled( false ), + : functorCalled(false), + voidFunctorCalled(false), receivedGesture(), pressedActor() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -62,22 +62,25 @@ struct SignalData pressedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; LongPressGesture receivedGesture; - Actor pressedActor; + Actor pressedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const LongPressGesture& longPress) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = longPress; - signalData.pressedActor = actor; + signalData.pressedActor = actor; } void operator()() @@ -91,24 +94,24 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) - : GestureReceivedFunctor( data ), - stateToUnstage( stateToUnstage ), - scene( scene ) + UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene) + : GestureReceivedFunctor(data), + stateToUnstage(stateToUnstage), + scene(scene) { } - void operator()( Actor actor, const LongPressGesture& longPress ) + void operator()(Actor actor, const LongPressGesture& longPress) { - GestureReceivedFunctor::operator()( actor, longPress ); + GestureReceivedFunctor::operator()(actor, longPress); - if ( longPress.GetState() == stateToUnstage ) + if(longPress.GetState() == stateToUnstage) { - scene.Remove( actor ); + scene.Remove(actor); } } - GestureState& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -119,7 +122,7 @@ struct TouchEventFunctor { //For line coverage unsigned int points = touch.GetPointCount(); - if( points > 0) + if(points > 0) { tet_printf("Touch Point state = %d\n", touch.GetState(0)); } @@ -127,11 +130,10 @@ struct TouchEventFunctor } }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - // Positive test case for a method int UtcDaliLongPressGestureDetectorConstructorP(void) { @@ -146,10 +148,11 @@ int UtcDaliLongPressGestureDetectorCopyConstructorP(void) { TestApplication application; - LongPressGestureDetector detector = LongPressGestureDetector::New();; + LongPressGestureDetector detector = LongPressGestureDetector::New(); + ; - LongPressGestureDetector copy( detector ); - DALI_TEST_CHECK( detector ); + LongPressGestureDetector copy(detector); + DALI_TEST_CHECK(detector); END_TEST; } @@ -158,13 +161,14 @@ int UtcDaliLongPressGestureDetectorAssignmentOperatorP(void) TestApplication application; LongPressGestureDetector detector; - detector = LongPressGestureDetector::New();; + detector = LongPressGestureDetector::New(); + ; LongPressGestureDetector copy; copy = detector; - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(detector); - DALI_TEST_CHECK( detector == copy ); + DALI_TEST_CHECK(detector == copy); END_TEST; } @@ -195,8 +199,8 @@ int UtcDaliLongPressGestureDetectorNew(void) // Attach an actor and emit a touch event on the actor to ensure complete line coverage Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -209,10 +213,10 @@ int UtcDaliLongPressGestureDetectorNew(void) actor.TouchedSignal().Connect(&application, touchFunctor); Integration::TouchEvent touchEvent(1); - Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + Integration::Point point; + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); @@ -235,17 +239,17 @@ int UtcDaliLongPressGestureDetectorDownCast(void) LongPressGestureDetector detector2 = LongPressGestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - LongPressGestureDetector detector3 = DownCast< LongPressGestureDetector >(object); + LongPressGestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; LongPressGestureDetector detector4 = LongPressGestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - LongPressGestureDetector detector5 = DownCast< LongPressGestureDetector >(unInitializedObject); + LongPressGestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); - GestureDetector detector6 = LongPressGestureDetector::New(); + GestureDetector detector6 = LongPressGestureDetector::New(); LongPressGestureDetector detector7 = LongPressGestureDetector::DownCast(detector6); DALI_TEST_CHECK(detector7); END_TEST; @@ -274,15 +278,15 @@ int UtcDaliLongPressGestureSignalReceptionNegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -290,8 +294,8 @@ int UtcDaliLongPressGestureSignalReceptionNegative(void) detector.DetectedSignal().Connect(&application, functor); // Do a long press outside actor's area - TestGenerateLongPress( application, 112.0f, 112.0f ); - TestEndLongPress( application, 112.0f, 112.0f); + TestGenerateLongPress(application, 112.0f, 112.0f); + TestEndLongPress(application, 112.0f, 112.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -302,15 +306,15 @@ int UtcDaliLongPressGestureSignalReceptionPositive(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -318,11 +322,11 @@ int UtcDaliLongPressGestureSignalReceptionPositive(void) detector.DetectedSignal().Connect(&application, functor); // Do a long press inside actor's area - TestGenerateLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); - TestEndLongPress( application, 50.0f, 50.0f); + DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + TestEndLongPress(application, 50.0f, 50.0f); END_TEST; } @@ -331,15 +335,15 @@ int UtcDaliLongPressGestureSignalReceptionDetach(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -347,28 +351,28 @@ int UtcDaliLongPressGestureSignalReceptionDetach(void) detector.DetectedSignal().Connect(&application, functor); // Start long press within the actor's area - TestGenerateLongPress( application, 20.0f, 20.0f ); + TestGenerateLongPress(application, 20.0f, 20.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); - TestEndLongPress( application, 20.0f, 20.0f); + DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + TestEndLongPress(application, 20.0f, 20.0f); // repeat the long press within the actor's area - we should still receive the signal data.Reset(); - TestGenerateLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); - TestEndLongPress( application, 50.0f, 50.0f); + DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + TestEndLongPress(application, 50.0f, 50.0f); // Detach actor detector.DetachAll(); // Ensure we are no longer signalled data.Reset(); - TestGenerateLongPress( application, 20.0f, 20.0f ); + TestGenerateLongPress(application, 20.0f, 20.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - TestEndLongPress( application, 50.0f, 50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -377,7 +381,7 @@ int UtcDaliLongPressGestureSignalReceptionActorDestroyedDuringLongPress(void) { TestApplication application; - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -386,8 +390,8 @@ int UtcDaliLongPressGestureSignalReceptionActorDestroyedDuringLongPress(void) // Actor lifetime is scoped { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -397,7 +401,7 @@ int UtcDaliLongPressGestureSignalReceptionActorDestroyedDuringLongPress(void) detector.Attach(actor); // Start long press within the actor's area - TestGenerateLongPress( application, 20.0f, 20.0f ); + TestGenerateLongPress(application, 20.0f, 20.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Remove the actor from stage and reset the data @@ -411,7 +415,7 @@ int UtcDaliLongPressGestureSignalReceptionActorDestroyedDuringLongPress(void) // Actor should now have been destroyed data.Reset(); - TestEndLongPress( application, 20.0f, 20.0f); + TestEndLongPress(application, 20.0f, 20.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -421,15 +425,15 @@ int UtcDaliLongPressGestureSignalReceptionRotatedActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::Degree(90.0f), Vector3::ZAXIS ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -437,34 +441,34 @@ int UtcDaliLongPressGestureSignalReceptionRotatedActor(void) detector.DetectedSignal().Connect(&application, functor); // Do a long press - TestGenerateLongPress( application, 5.0f, 5.0f ); - TestEndLongPress( application, 5.0f, 5.0f); + TestGenerateLongPress(application, 5.0f, 5.0f); + TestEndLongPress(application, 5.0f, 5.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); // Rotate actor again and render - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do another long press, should still receive event data.Reset(); - TestGenerateLongPress( application, 5.0f, 5.0f ); - TestEndLongPress( application, 5.0f, 5.0f); + TestGenerateLongPress(application, 5.0f, 5.0f); + TestEndLongPress(application, 5.0f, 5.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); // Rotate actor again and render - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS)); application.SendNotification(); application.Render(); // Do a long press, inside where the actor used to be, Should not receive the event data.Reset(); - TestGenerateLongPress( application, 70.0f, 70.0f ); - TestEndLongPress( application, 70.0f, 70.0f); + TestGenerateLongPress(application, 70.0f, 70.0f); + TestEndLongPress(application, 70.0f, 70.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -474,25 +478,25 @@ int UtcDaliLongPressGestureSignalReceptionChildHit(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); // Set child to completely cover parent. // Change rotation of child to be different from parent so that we can check if our local coordinate // conversion of the parent actor is correct. Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); parent.Add(child); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -500,8 +504,8 @@ int UtcDaliLongPressGestureSignalReceptionChildHit(void) detector.DetectedSignal().Connect(&application, functor); // Do long press - hits child area but parent should still receive it - TestGenerateLongPress( application, 50.0f, 50.0f ); - TestEndLongPress( application, 50.0f, 50.0f); + TestGenerateLongPress(application, 50.0f, 50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, parent == data.pressedActor, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION); @@ -513,8 +517,8 @@ int UtcDaliLongPressGestureSignalReceptionChildHit(void) // Do an entire long press, only check finished value data.Reset(); - TestGenerateLongPress( application, 51.0f, 51.0f ); - TestEndLongPress( application, 51.0f, 51.0f); + TestGenerateLongPress(application, 51.0f, 51.0f); + TestEndLongPress(application, 51.0f, 51.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, child == data.pressedActor, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION); @@ -526,21 +530,21 @@ int UtcDaliLongPressGestureSignalReceptionAttachDetachMany(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -549,15 +553,15 @@ int UtcDaliLongPressGestureSignalReceptionAttachDetachMany(void) detector.DetectedSignal().Connect(&application, functor); // LongPress within second actor's area - TestGenerateLongPress( application, 120.0f, 10.0f ); - TestEndLongPress( application, 120.0f, 10.0f); + TestGenerateLongPress(application, 120.0f, 10.0f); + TestEndLongPress(application, 120.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.pressedActor, TEST_LOCATION); // LongPress within first actor's area data.Reset(); - TestGenerateLongPress( application, 20.0f, 10.0f ); - TestEndLongPress( application, 20.0f, 10.0f); + TestGenerateLongPress(application, 20.0f, 10.0f); + TestEndLongPress(application, 20.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, first == data.pressedActor, TEST_LOCATION); @@ -566,14 +570,14 @@ int UtcDaliLongPressGestureSignalReceptionAttachDetachMany(void) // second actor shouldn't receive event data.Reset(); - TestGenerateLongPress( application, 120.0f, 10.0f ); - TestEndLongPress( application, 120.0f, 10.0f); + TestGenerateLongPress(application, 120.0f, 10.0f); + TestEndLongPress(application, 120.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // first actor should continue receiving event data.Reset(); - TestGenerateLongPress( application, 20.0f, 10.0f ); - TestEndLongPress( application, 20.0f, 10.0f); + TestGenerateLongPress(application, 20.0f, 10.0f); + TestEndLongPress(application, 20.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -583,15 +587,15 @@ int UtcDaliLongPressGestureSignalReceptionActorBecomesUntouchable(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -599,12 +603,12 @@ int UtcDaliLongPressGestureSignalReceptionActorBecomesUntouchable(void) detector.DetectedSignal().Connect(&application, functor); // LongPress in actor's area - TestGenerateLongPress( application, 50.0f, 10.0f ); - TestEndLongPress( application, 50.0f, 10.0f); + TestGenerateLongPress(application, 50.0f, 10.0f); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Actor becomes invisible - actor should not receive the next long press - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // Render and notify application.SendNotification(); @@ -612,8 +616,8 @@ int UtcDaliLongPressGestureSignalReceptionActorBecomesUntouchable(void) // LongPress in the same area, shouldn't receive event data.Reset(); - TestGenerateLongPress( application, 50.0f, 10.0f ); - TestEndLongPress( application, 50.0f, 10.0f); + TestGenerateLongPress(application, 50.0f, 10.0f); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -623,8 +627,8 @@ int UtcDaliLongPressGestureSignalReceptionMultipleDetectorsOnActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -632,21 +636,21 @@ int UtcDaliLongPressGestureSignalReceptionMultipleDetectorsOnActor(void) application.Render(); // Attach actor to one detector - SignalData firstData; - GestureReceivedFunctor firstFunctor(firstData); + SignalData firstData; + GestureReceivedFunctor firstFunctor(firstData); LongPressGestureDetector firstDetector = LongPressGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector - SignalData secondData; - GestureReceivedFunctor secondFunctor(secondData); + SignalData secondData; + GestureReceivedFunctor secondFunctor(secondData); LongPressGestureDetector secondDetector = LongPressGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); // LongPress in actor's area - both detector's functors should be called - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); END_TEST; @@ -657,8 +661,8 @@ int UtcDaliLongPressGestureSignalReceptionDifferentPossible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -666,47 +670,47 @@ int UtcDaliLongPressGestureSignalReceptionDifferentPossible(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // LongPress possible in actor's area. - TestStartLongPress( application, 50.0f, 10.0f ); + TestStartLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor somewhere else - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit Started event, we should not receive the long press. - TestTriggerLongPress( application ); - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestTriggerLongPress(application); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // LongPress possible in empty area. - TestStartLongPress( application, 50.0f, 10.0f ); + TestStartLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor in to the long press position. - actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit STARTED event, we should not receive the long press. - TestTriggerLongPress( application ); - TestEndLongPress( application, 50.0f, 10.0f ); + TestTriggerLongPress(application); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Normal long press in actor's area for completeness. - TestGenerateLongPress( application, 50.0f, 10.0f ); - TestEndLongPress( application, 50.0f, 10.0f); + TestGenerateLongPress(application, 50.0f, 10.0f); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -716,8 +720,8 @@ int UtcDaliLongPressGesturePossibleCancelled(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -725,16 +729,16 @@ int UtcDaliLongPressGesturePossibleCancelled(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Send a possible followed by a cancel, we should not be signalled - TestStartLongPress( application, 50.0f, 10.0f ); + TestStartLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - TestMovePan( application, Vector2( 50.0f, 10.0f ) ); + TestMovePan(application, Vector2(50.0f, 10.0f)); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -744,8 +748,8 @@ int UtcDaliLongPressGestureDetachAfterStarted(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -753,14 +757,14 @@ int UtcDaliLongPressGestureDetachAfterStarted(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit initial signal - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -768,7 +772,7 @@ int UtcDaliLongPressGestureDetachAfterStarted(void) detector.Detach(actor); // Emit FINISHED, no signal - TestEndLongPress( application, 50.0f, 10.0f ); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -778,8 +782,8 @@ int UtcDaliLongPressGestureActorUnstaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -787,20 +791,20 @@ int UtcDaliLongPressGestureActorUnstaged(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit signals - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndLongPress( application, 50.0f, 10.0f ); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Render and notify @@ -818,12 +822,12 @@ int UtcDaliLongPressGestureActorUnstaged(void) stateToUnstage = GestureState::FINISHED; // Emit signals - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndLongPress( application, 50.0f, 10.0f ); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully. + tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully. END_TEST; } @@ -832,15 +836,15 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Create and add a second actor so that GestureDetector destruction does not come into play. - Actor dummyActor( Actor::New() ); - dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + Actor dummyActor(Actor::New()); + dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(dummyActor); // Render and notify @@ -848,22 +852,22 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); detector.Attach(dummyActor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back // before we get a finished state. As we were removed from the stage, even if we're at the same // position, we should still not be signalled. // Emit signals - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -879,14 +883,14 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestEndLongPress( application, 50.0f, 10.0f ); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Here we delete an actor in started, we should not receive any subsequent signalling. // Emit signals - TestGenerateLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -902,7 +906,7 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestEndLongPress( application, 50.0f, 10.0f ); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -912,22 +916,22 @@ int UtcDaliLongPressGestureLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - SignalData data; - GestureReceivedFunctor functor(data); + SignalData data; + GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -935,21 +939,21 @@ int UtcDaliLongPressGestureLayerConsumesTouch(void) application.Render(); // Emit signals, should receive - TestGenerateLongPress( application, 50.0f, 50.0f ); - TestEndLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - TestGenerateLongPress( application, 50.0f, 50.0f ); - TestEndLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -963,28 +967,28 @@ int UtcDaliLongPressGestureSetMinimumHoldingTime(void) const uint32_t kMinumumHolding1 = 5000; const uint32_t kMinumumHolding2 = 3000; - Integration::SetLongPressMinimumHoldingTime( kMinumumHolding1 ); + Integration::SetLongPressMinimumHoldingTime(kMinumumHolding1); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); detector.Attach(actor); detector.DetectedSignal().Connect(&application, functor); - DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding1, TEST_LOCATION ); + DALI_TEST_EQUALS(DevelLongPressGestureDetector::GetMinimumHoldingTime(detector), kMinumumHolding1, TEST_LOCATION); - Integration::SetLongPressMinimumHoldingTime( kMinumumHolding2 ); - DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding2, TEST_LOCATION ); + Integration::SetLongPressMinimumHoldingTime(kMinumumHolding2); + DALI_TEST_EQUALS(DevelLongPressGestureDetector::GetMinimumHoldingTime(detector), kMinumumHolding2, TEST_LOCATION); END_TEST; } @@ -994,19 +998,19 @@ int UtcDaliLongPressGestureInterruptedWhenTouchConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); - bool consume = false; + bool consume = false; TouchEventFunctorConsumeSetter touchFunctor(consume); - actor.TouchedSignal().Connect(&application,touchFunctor); + actor.TouchedSignal().Connect(&application, touchFunctor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); LongPressGestureDetector detector = LongPressGestureDetector::New(); @@ -1014,19 +1018,19 @@ int UtcDaliLongPressGestureInterruptedWhenTouchConsumed(void) detector.DetectedSignal().Connect(&application, functor); // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed - TestGenerateLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndLongPress(application, 50.0f,50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Another gesture in the same location, this time we will not receive it as touch is being consumed consume = true; - TestGenerateLongPress( application, 50.0f, 50.0f ); + TestGenerateLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndLongPress(application, 50.0f,50.0f); + TestEndLongPress(application, 50.0f, 50.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -1039,24 +1043,23 @@ int UtcDaliLongPressGestureDisableDetectionDuringLongPressN(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - LongPressGestureDetector detector = LongPressGestureDetector::New(); - bool functorCalled = false; - detector.Attach( actor ); + LongPressGestureDetector detector = LongPressGestureDetector::New(); + bool functorCalled = false; + detector.Attach(actor); detector.DetectedSignal().Connect( - &application, - [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture) + &application, + [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture) { + if(gesture.GetState() == GestureState::FINISHED) { - if( gesture.GetState() == GestureState::FINISHED ) - { - detector.Detach(actor); - functorCalled = true; - } - }); + detector.Detach(actor); + functorCalled = true; + } + }); // Render and notify application.SendNotification(); @@ -1065,18 +1068,16 @@ int UtcDaliLongPressGestureDisableDetectionDuringLongPressN(void) // Try the gesture, should not crash try { - TestGenerateLongPress( application, 50.0f, 10.0f ); - TestEndLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); + TestEndLongPress(application, 50.0f, 10.0f); - DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_CHECK(true); // No crash, test has passed DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } catch(...) { - DALI_TEST_CHECK( false ); // If we crash, the test has failed + DALI_TEST_CHECK(false); // If we crash, the test has failed } END_TEST; } - - diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp index 27b4494..83c25db 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp @@ -15,33 +15,33 @@ * */ -#include -#include -#include - -#include -#include +#include #include #include -#include +#include +#include + +#include +#include +#include using namespace Dali; /////////////////////////////////////////////////////////////////////////////// namespace { - struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -49,22 +49,25 @@ struct SignalData pressedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; LongPressGesture receivedGesture; - Actor pressedActor; + Actor pressedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const LongPressGesture& pan) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = pan; - signalData.pressedActor = actor; + signalData.pressedActor = actor; } void operator()() @@ -75,45 +78,42 @@ struct GestureReceivedFunctor SignalData& signalData; }; - -Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); + Integration::Point point; + point.SetState(state); point.SetDeviceId(4); - point.SetScreenPosition( screenPosition ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); + point.SetScreenPosition(screenPosition); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } -Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time ) +Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( stateA ); + Integration::Point point; + point.SetState(stateA); point.SetDeviceId(4); - point.SetScreenPosition( screenPositionA ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); - point.SetScreenPosition( screenPositionB ); - point.SetState( stateB); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + point.SetState(stateB); point.SetDeviceId(7); - touchEvent.points.push_back( point ); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } - -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - int UtcDaliLongPressGestureRecognizerBasicNoAction(void) { TestApplication application; @@ -121,8 +121,8 @@ int UtcDaliLongPressGestureRecognizerBasicNoAction(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -131,13 +131,13 @@ int UtcDaliLongPressGestureRecognizerBasicNoAction(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -153,8 +153,8 @@ int UtcDaliLongPressGestureRecognizerBasic(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -163,11 +163,11 @@ int UtcDaliLongPressGestureRecognizerBasic(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); application.GetPlatform().TriggerTimer(); @@ -185,8 +185,8 @@ int UtcDaliLongPressGestureRecognizerTooShortWait(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -195,11 +195,11 @@ int UtcDaliLongPressGestureRecognizerTooShortWait(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); application.SendNotification(); @@ -214,11 +214,11 @@ int UtcDaliLongPressGestureRecognizerTooFewPoints(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); - detector.SetTouchesRequired(2,2); + detector.SetTouchesRequired(2, 2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -227,11 +227,11 @@ int UtcDaliLongPressGestureRecognizerTooFewPoints(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); // There should be no function to call application.GetPlatform().TriggerTimer(); @@ -250,8 +250,8 @@ int UtcDaliLongPressGestureRecognizerTooManyPoints(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -260,12 +260,12 @@ int UtcDaliLongPressGestureRecognizerTooManyPoints(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 151 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 151)); // There should be no function to call as the double touch should have cancelled it application.GetPlatform().TriggerTimer(); @@ -283,11 +283,11 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsMoving(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); - detector.SetTouchesRequired(2,2); + detector.SetTouchesRequired(2, 2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -296,17 +296,17 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsMoving(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 0.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 10.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 153 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 155 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 157 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 50.0f ), 159 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 20.0f, 40.0f ), PointState::UP, Vector2( 20.0f, 50.0f ), 160 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 161 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 0.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 10.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 153)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 155)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 157)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 50.0f), 159)); + application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(20.0f, 40.0f), PointState::UP, Vector2(20.0f, 50.0f), 160)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 161)); application.GetPlatform().TriggerTimer(); @@ -324,8 +324,8 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsLongPress(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -333,19 +333,19 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsLongPress(void) application.Render(); detector.Attach(actor); - detector.SetTouchesRequired(2,2); // Set after we've attached forcing us to change things internally + detector.SetTouchesRequired(2, 2); // Set after we've attached forcing us to change things internally - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 40.0f ), 140 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 40.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 40.0f), 140)); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 40.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); application.GetPlatform().TriggerTimer(); - application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 20.0f, 20.0f ), PointState::UP, Vector2( 20.0f, 90.0f ), 760 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 761 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(20.0f, 20.0f), PointState::UP, Vector2(20.0f, 90.0f), 760)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 761)); application.SendNotification(); @@ -358,57 +358,57 @@ int UtcDaliLongPressGestureRecognizerMultipleDetectors(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add(actor); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); - Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor2.SetProperty( Actor::Property::POSITION_X, 100.0f); - application.GetScene().Add(actor2); + Actor actor2 = Actor::New(); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor2.SetProperty(Actor::Property::POSITION_X, 100.0f); + application.GetScene().Add(actor2); - // Render and notify - application.SendNotification(); - application.Render(); + // Render and notify + application.SendNotification(); + application.Render(); - LongPressGestureDetector detector = LongPressGestureDetector::New(); - detector.Attach(actor); + LongPressGestureDetector detector = LongPressGestureDetector::New(); + detector.Attach(actor); - LongPressGestureDetector detector2 = LongPressGestureDetector::New(2); - detector2.Attach(actor2); + LongPressGestureDetector detector2 = LongPressGestureDetector::New(2); + detector2.Attach(actor2); - SignalData data; - GestureReceivedFunctor functor(data); - detector.DetectedSignal().Connect(&application, functor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - SignalData data2; - GestureReceivedFunctor functor2(data2); - detector2.DetectedSignal().Connect(&application, functor2); + SignalData data2; + GestureReceivedFunctor functor2(data2); + detector2.DetectedSignal().Connect(&application, functor2); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.GetPlatform().TriggerTimer(); + application.GetPlatform().TriggerTimer(); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 700 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 700)); - application.SendNotification(); + application.SendNotification(); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(true, actor == data.pressedActor, TEST_LOCATION); - data.Reset(); - DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, actor == data.pressedActor, TEST_LOCATION); + data.Reset(); + DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 40.0f ), 800 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 120.0f, 40.0f ), PointState::DOWN, Vector2( 120.0f, 90.0f ), 805 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 40.0f), 800)); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(120.0f, 40.0f), PointState::DOWN, Vector2(120.0f, 90.0f), 805)); - application.GetPlatform().TriggerTimer(); + application.GetPlatform().TriggerTimer(); - application.SendNotification(); + application.SendNotification(); - DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION); - END_TEST; + END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-MathUtils.cpp b/automated-tests/src/dali/utc-Dali-MathUtils.cpp index d8a5b4e..6d791fd 100644 --- a/automated-tests/src/dali/utc-Dali-MathUtils.cpp +++ b/automated-tests/src/dali/utc-Dali-MathUtils.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -92,17 +92,17 @@ int UtcDaliMathUtilsNextPowerOfTwoN(void) try { - NextPowerOfTwo( (1u << (sizeof(unsigned) * 8 - 1)) + 1); + NextPowerOfTwo((1u << (sizeof(unsigned) * 8 - 1)) + 1); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "Return type cannot represent the next power of two greater than the argument.", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "Return type cannot represent the next power of two greater than the argument.", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -124,7 +124,7 @@ int UtcDaliMathUtilsClampP(void) DALI_TEST_EQUALS(Clamp(0, -10, 10), 0, TEST_LOCATION); DALI_TEST_EQUALS(Clamp(20, 0, 10), 10, TEST_LOCATION); - float value=-10.0f, min=-2.0f, max=4.0f; + float value = -10.0f, min = -2.0f, max = 4.0f; ClampInPlace(value, min, max); DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION); @@ -142,7 +142,7 @@ int UtcDaliMathUtilsClampInPlaceP(void) { Dali::TestApplication testApp; - float value=-10.0f, min=-2.0f, max=4.0f; + float value = -10.0f, min = -2.0f, max = 4.0f; ClampInPlace(value, min, max); DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION); @@ -160,7 +160,7 @@ int UtcDaliMathUtilsLerpP(void) { Dali::TestApplication testApp; - float offset=0.0f, low=-2.0f, high=4.0f; + float offset = 0.0f, low = -2.0f, high = 4.0f; DALI_TEST_EQUALS(Lerp(offset, low, high), low, 0.001, TEST_LOCATION); offset = 1.0f; DALI_TEST_EQUALS(Lerp(offset, low, high), high, 0.001, TEST_LOCATION); @@ -176,17 +176,17 @@ int UtcDaliMathUtilsGetRangedEpsilonP(void) DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(0.099f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(0.099f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.98f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(1.05f, 0.99f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(1.99f, 1.05f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(2.0f, 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(1.0f, 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(2.0f, 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(1.0f, 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 0.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 1.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 9.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); @@ -207,20 +207,19 @@ int UtcDaliMathUtilsGetRangedEpsilonP(void) DALI_TEST_EQUALS(GetRangedEpsilon(1e07f, 0.99e09f), Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.099f, - 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-0.099f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.98f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-1.05f, -0.99f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-1.99f, -1.05f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-2.0f, - 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); - DALI_TEST_EQUALS(GetRangedEpsilon(-1.0f, - 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-2.0f, -1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(GetRangedEpsilon(-1.0f, -3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -0.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -1.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -9.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION); @@ -241,7 +240,6 @@ int UtcDaliMathUtilsGetRangedEpsilonP(void) DALI_TEST_EQUALS(GetRangedEpsilon(-1e07f, -0.99e09f), Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION); - END_TEST; } @@ -280,11 +278,11 @@ int UtcDaliMathUtilsShortestDistanceInDomainP(void) int UtcDaliMathUtilsEqualsZeroP(void) { - float v=0.0f; + float v = 0.0f; DALI_TEST_CHECK(EqualsZero(v)); - v = Math::PI; + v = Math::PI; v -= (Math::PI_2 * 2.0f); DALI_TEST_CHECK(EqualsZero(v)); @@ -293,17 +291,17 @@ int UtcDaliMathUtilsEqualsZeroP(void) int UtcDaliMathUtilsEquals01P(void) { - float w=100.0f; - float x=w+1e-8f; - DALI_TEST_CHECK( Equals(w, x, GetRangedEpsilon( w, x )) ); + float w = 100.0f; + float x = w + 1e-8f; + DALI_TEST_CHECK(Equals(w, x, GetRangedEpsilon(w, x))); END_TEST; } int UtcDaliMathUtilsEquals02P(void) { - float w=100.0f; - float x=w+1e-8f; - DALI_TEST_CHECK( Equals(w, x) ); + float w = 100.0f; + float x = w + 1e-8f; + DALI_TEST_CHECK(Equals(w, x)); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Matrix.cpp b/automated-tests/src/dali/utc-Dali-Matrix.cpp index e6cd7da..d40d9b3 100644 --- a/automated-tests/src/dali/utc-Dali-Matrix.cpp +++ b/automated-tests/src/dali/utc-Dali-Matrix.cpp @@ -15,16 +15,15 @@ * */ +#include +#include +#include + #include #include -#include -#include -#include - using namespace Dali; - void utc_dali_matrix_startup(void) { test_return_value = TET_UNDEF; @@ -35,7 +34,6 @@ void utc_dali_matrix_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliMatrixConstructor01P(void) { // State of memory cannot be guaranteed, so use @@ -44,11 +42,11 @@ int UtcDaliMatrixConstructor01P(void) memset(buffer, 1, sizeof(Matrix)); - Matrix* m2 = new(&buffer) Matrix(false); - bool initialisation_occured = false; + Matrix* m2 = new(&buffer) Matrix(false); + bool initialisation_occured = false; { float* els = m2->AsFloat(); - for(size_t idx=0; idx<16; ++idx, ++els) + for(size_t idx = 0; idx < 16; ++idx, ++els) { if(*els == 0.0f) initialisation_occured = true; @@ -62,13 +60,13 @@ int UtcDaliMatrixConstructor01P(void) int UtcDaliMatrixConstructor02P(void) { - float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; + float r[] = {1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; Matrix m(r); - float* els = m.AsFloat(); - float* init = r; - bool initialised = true; - for(size_t idx=0; idx<16; ++idx, ++els, ++init) + float* els = m.AsFloat(); + float* init = r; + bool initialised = true; + for(size_t idx = 0; idx < 16; ++idx, ++els, ++init) { if(*els != *init) initialised = false; @@ -80,15 +78,15 @@ int UtcDaliMatrixConstructor02P(void) int UtcDaliMatrixConstructor03P(void) { - float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; + float r[] = {1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; Matrix ma(r); Matrix mb(ma); - float* els = ma.AsFloat(); - float* init = mb.AsFloat(); - bool initialised = true; - for(size_t idx=0; idx<16; ++idx, ++els, ++init) + float* els = ma.AsFloat(); + float* init = mb.AsFloat(); + bool initialised = true; + for(size_t idx = 0; idx < 16; ++idx, ++els, ++init) { if(*els != *init) initialised = false; @@ -101,15 +99,15 @@ int UtcDaliMatrixConstructor03P(void) int UtcDaliMatrixConstructor04P(void) { Quaternion q(Quaternion::IDENTITY); - Matrix m(q); + Matrix m(q); DALI_TEST_EQUALS(Matrix(Matrix::IDENTITY), m, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliMatrixCopyConstructor(void) { - Matrix m0( Matrix::IDENTITY ); - Matrix m1( m0 ); + Matrix m0(Matrix::IDENTITY); + Matrix m1(m0); DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -117,8 +115,8 @@ int UtcDaliMatrixCopyConstructor(void) int UtcDaliMatrixMoveConstructor(void) { - Matrix m0( Matrix::IDENTITY ); - Matrix m1 = std::move( m0 ); + Matrix m0(Matrix::IDENTITY); + Matrix m1 = std::move(m0); DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -126,7 +124,7 @@ int UtcDaliMatrixMoveConstructor(void) int UtcDaliMatrixCopyAssignment(void) { - Matrix m0( Matrix::IDENTITY ); + Matrix m0(Matrix::IDENTITY); Matrix m1; m1 = m0; DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION); @@ -136,9 +134,9 @@ int UtcDaliMatrixCopyAssignment(void) int UtcDaliMatrixMoveAssignment(void) { - Matrix m0( Matrix::IDENTITY ); + Matrix m0(Matrix::IDENTITY); Matrix m1; - m1 = std::move( m0 ); + m1 = std::move(m0); DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -162,10 +160,7 @@ int UtcDaliMatrixAssign02P(void) int UtcDaliMatrixSetIdentityP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); m.SetIdentity(); @@ -175,17 +170,11 @@ int UtcDaliMatrixSetIdentityP(void) int UtcDaliMatrixSetIdentityAndScaleP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); m.SetIdentityAndScale(Vector3(4.0f, 4.0f, 4.0f)); - float els2[] = { 4.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 4.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 4.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; + float els2[] = {4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix r(els2); DALI_TEST_EQUALS(m, r, 0.001f, TEST_LOCATION); @@ -194,22 +183,22 @@ int UtcDaliMatrixSetIdentityAndScaleP(void) int UtcDaliMatrixInvertTransformP(void) { - for (int i=0;i<1000;++i) + for(int i = 0; i < 1000; ++i) { - float f = i; - Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f)); + float f = i; + Vector3 axis(cosf(f * 0.001f), cosf(f * 0.02f), cosf(f * 0.03f)); axis.Normalize(); - Vector3 center(f, cosf(f) * 100.0f, cosf(f*0.5f) * 50.0f); + Vector3 center(f, cosf(f) * 100.0f, cosf(f * 0.5f) * 50.0f); Matrix m0; m0.SetIdentity(); - m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center ); + m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center); Matrix m1; m0.InvertTransform(m1); - Matrix m2( false ); - Matrix::Multiply( m2, m0, m1 ); + Matrix m2(false); + Matrix::Multiply(m2, m0, m1); DALI_TEST_EQUALS(m2, Matrix::IDENTITY, 0.001f, TEST_LOCATION); } @@ -218,77 +207,65 @@ int UtcDaliMatrixInvertTransformP(void) int UtcDaliMatrixInvertTransformN(void) { - std::string exceptionString( "EqualsZero( mMatrix[3] ) && EqualsZero( mMatrix[7] ) && EqualsZero( mMatrix[11] ) && Equals( mMatrix[15], 1.0f" ); + std::string exceptionString("EqualsZero(mMatrix[3]) && EqualsZero(mMatrix[7]) && EqualsZero(mMatrix[11]) && Equals(mMatrix[15], 1.0f"); try { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); Matrix it; m.InvertTransform(it); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION); } try { - float els[] = { 0.0f, 1.0f, 2.0f, 0.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 0.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); Matrix it; m.InvertTransform(it); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION); } try { - float els[] = { 0.0f, 1.0f, 2.0f, 0.0f, - 4.0f, 5.0f, 6.0f, 0.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 0.0f, 4.0f, 5.0f, 6.0f, 0.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); Matrix it; m.InvertTransform(it); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION); } try { - float els[] = { 0.0f, 1.0f, 2.0f, 0.0f, - 4.0f, 5.0f, 6.0f, 0.0f, - 8.0f, 9.0f, 10.0f, 0.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 0.0f, 4.0f, 5.0f, 6.0f, 0.0f, 8.0f, 9.0f, 10.0f, 0.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); Matrix it; m.InvertTransform(it); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION); } END_TEST; } @@ -297,26 +274,26 @@ int UtcDaliMatrixInvert01P(void) { // We're going to invert a whole load of different matrices to make sure we don't // fail on particular orientations. - for (int i=0;i<1000;++i) + for(int i = 0; i < 1000; ++i) { - float f = i; - Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f)); + float f = i; + Vector3 axis(cosf(f * 0.001f), cosf(f * 0.02f), cosf(f * 0.03f)); axis.Normalize(); - Vector3 center(f, cosf(f) * 100.0f, cosf(f*0.5f) * 50.0f); + Vector3 center(f, cosf(f) * 100.0f, cosf(f * 0.5f) * 50.0f); Matrix m0; m0.SetIdentity(); - m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center ); + m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center); Matrix m1(m0); m1.Invert(); - Matrix m2( false ); - Matrix::Multiply( m2, m0, m1 ); + Matrix m2(false); + Matrix::Multiply(m2, m0, m1); DALI_TEST_EQUALS(m2, Matrix::IDENTITY, 0.001f, TEST_LOCATION); - m1.Invert(); // doube invert - should be back to m0 + m1.Invert(); // doube invert - should be back to m0 DALI_TEST_EQUALS(m0, m1, 0.001f, TEST_LOCATION); } @@ -334,22 +311,18 @@ int UtcDaliMatrixInvert02P(void) int UtcDaliMatrixTransposeP(void) { float floats[] = - { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f - }; + {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(floats); m.Transpose(); bool success = true; - for (int x=0;x<4;++x) + for(int x = 0; x < 4; ++x) { - for (int y=0;y<4;++y) + for(int y = 0; y < 4; ++y) { - success &= (m.AsFloat()[x+y*4] == floats[x*4+y]); + success &= (m.AsFloat()[x + y * 4] == floats[x * 4 + y]); } } @@ -359,43 +332,34 @@ int UtcDaliMatrixTransposeP(void) int UtcDaliMatrixGetXAxisP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); - DALI_TEST_CHECK(m.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f)); + DALI_TEST_CHECK(m.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f)); END_TEST; } int UtcDaliMatrixGetYAxisP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); - DALI_TEST_CHECK(m.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f)); + DALI_TEST_CHECK(m.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f)); END_TEST; } int UtcDaliMatrixGetZAxisP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); - DALI_TEST_CHECK(m.GetZAxis() == Vector3(8.0f, 9.0f, 10.0f)); + DALI_TEST_CHECK(m.GetZAxis() == Vector3(8.0f, 9.0f, 10.0f)); END_TEST; } int UtcDaliMatrixSetXAxisP(void) { - Matrix m; + Matrix m; Vector3 v(2.0f, 3.0f, 4.0f); m.SetXAxis(v); @@ -405,7 +369,7 @@ int UtcDaliMatrixSetXAxisP(void) int UtcDaliMatrixSetYAxisP(void) { - Matrix m; + Matrix m; Vector3 v(2.0f, 3.0f, 4.0f); m.SetYAxis(v); @@ -415,7 +379,7 @@ int UtcDaliMatrixSetYAxisP(void) int UtcDaliMatrixSetZAxisP(void) { - Matrix m; + Matrix m; Vector3 v(2.0f, 3.0f, 4.0f); m.SetZAxis(v); @@ -425,10 +389,7 @@ int UtcDaliMatrixSetZAxisP(void) int UtcDaliMatrixGetTranslationP(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); DALI_TEST_EQUALS(m.GetTranslation(), Vector4(12.0f, 13.0f, 14.0f, 15.0f), TEST_LOCATION); @@ -437,10 +398,7 @@ int UtcDaliMatrixGetTranslationP(void) int UtcDaliMatrixGetTranslation3P(void) { - float els[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f }; + float els[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m(els); DALI_TEST_EQUALS(m.GetTranslation3(), Vector3(12.0f, 13.0f, 14.0f), TEST_LOCATION); @@ -449,7 +407,7 @@ int UtcDaliMatrixGetTranslation3P(void) int UtcDaliMatrixSetTranslationP(void) { - Matrix m; + Matrix m; Vector4 v(2.0f, 3.0f, 4.0f, 5.0f); m.SetTranslation(v); @@ -459,7 +417,7 @@ int UtcDaliMatrixSetTranslationP(void) int UtcDaliMatrixSetTranslation3P(void) { - Matrix m; + Matrix m; Vector3 v(2.0f, 3.0f, 4.0f); m.SetTranslation(v); @@ -473,13 +431,13 @@ int UtcDaliMatrixOrthoNormalize0P(void) Matrix m; m.SetIdentity(); - for (int i=0;i<1000;++i) + for(int i = 0; i < 1000; ++i) { - float f = i; - Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f)); + float f = i; + Vector3 axis(cosf(f * 0.001f), cosf(f * 0.02f), cosf(f * 0.03f)); axis.Normalize(); - m.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), Vector3::ZERO ); + m.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), Vector3::ZERO); m.OrthoNormalize(); } @@ -499,16 +457,16 @@ int UtcDaliMatrixOrthoNormalize0P(void) int UtcDaliMatrixOrthoNormalize1P(void) { // OrthoNormalize is not flipping the axes and is maintaining the translation - for (int i=0;i<1000;++i) + for(int i = 0; i < 1000; ++i) { - float f = i; - Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f)); + float f = i; + Vector3 axis(cosf(f * 0.001f), cosf(f * 0.02f), cosf(f * 0.03f)); axis.Normalize(); Vector3 center(10.0f, 15.0f, 5.0f); Matrix m0; m0.SetIdentity(); - m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center ); + m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center); Matrix m1(m0); m1.OrthoNormalize(); @@ -523,39 +481,37 @@ int UtcDaliMatrixOrthoNormalize1P(void) int UtcDaliMatrixConstAsFloatP(void) { - float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; + float r[] = {1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; const Matrix m(r); - const float* els = m.AsFloat(); - const float* init = r; - bool initialised = true; - for(size_t idx=0; idx<16; ++idx, ++els, ++init) + const float* els = m.AsFloat(); + const float* init = r; + bool initialised = true; + for(size_t idx = 0; idx < 16; ++idx, ++els, ++init) { if(*els != *init) initialised = false; } DALI_TEST_EQUALS(initialised, true, TEST_LOCATION); - END_TEST; } int UtcDaliMatrixAsFloatP(void) { - float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; + float r[] = {1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f}; Matrix m(r); - float* els = m.AsFloat(); - float* init = r; - bool initialised = true; - for(size_t idx=0; idx<16; ++idx, ++els, ++init) + float* els = m.AsFloat(); + float* init = r; + bool initialised = true; + for(size_t idx = 0; idx < 16; ++idx, ++els, ++init) { if(*els != *init) initialised = false; } DALI_TEST_EQUALS(initialised, true, TEST_LOCATION); - END_TEST; } @@ -563,14 +519,11 @@ int UtcDaliMatrixMultiplyP(void) { Matrix m1 = Matrix::IDENTITY; - float els[] = { 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.707f, 0.707f, 0.0f, - 0.0f, -0.707f, 0.707f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; + float els[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.707f, 0.707f, 0.0f, 0.0f, -0.707f, 0.707f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix result(els); Quaternion q(Radian(Degree(45.0f)), Vector3::XAXIS); - Matrix m2(false); + Matrix m2(false); Matrix::Multiply(m2, m1, q); DALI_TEST_EQUALS(m2, result, 0.01f, TEST_LOCATION); @@ -581,10 +534,7 @@ int UtcDaliMatrixOperatorMultiply01P(void) { Vector4 v1(2.0f, 5.0f, 4.0f, 0.0f); - float els[] = {2.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 3.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 4.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; + float els[] = {2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix m1(els); Vector4 v2 = m1 * v1; @@ -597,14 +547,14 @@ int UtcDaliMatrixOperatorMultiply02P(void) { TestApplication application; - Vector3 position ( 30.f, 40.f, 50.f); + Vector3 position(30.f, 40.f, 50.f); Matrix m1(false); m1.SetIdentity(); m1.SetTranslation(-position); Vector4 positionV4(position); - positionV4.w=1.0f; + positionV4.w = 1.0f; Vector4 output = m1 * positionV4; output.w = 0.0f; @@ -616,14 +566,14 @@ int UtcDaliMatrixOperatorEqualsP(void) { Matrix m1 = Matrix::IDENTITY; - float els[] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + float els[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix r2(els); DALI_TEST_EQUALS(m1 == r2, true, TEST_LOCATION); - float *f = m1.AsFloat(); - for(size_t i=0; i<16; i++) + float* f = m1.AsFloat(); + for(size_t i = 0; i < 16; i++) { - f[15-i] = 1.2f; + f[15 - i] = 1.2f; DALI_TEST_EQUALS(m1 == r2, false, TEST_LOCATION); } END_TEST; @@ -631,11 +581,8 @@ int UtcDaliMatrixOperatorEqualsP(void) int UtcDaliMatrixOperatorNotEqualsP(void) { - Matrix m1 = Matrix::IDENTITY; - float els[] = {2.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 3.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 4.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; + Matrix m1 = Matrix::IDENTITY; + float els[] = {2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix r1(els); DALI_TEST_CHECK(m1 != r1); @@ -646,23 +593,23 @@ int UtcDaliMatrixOperatorNotEqualsP(void) int UtcDaliMatrixSetTransformComponents01P(void) { // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { Vector3 vForward(x, y, z); vForward.Normalize(); - for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f) + for(float angle = 5.0f; angle <= 360.0f; angle += 15.0f) { Quaternion rotation1(Radian(Degree(angle)), vForward); - Matrix m1(rotation1); - Matrix result1(false); + Matrix m1(rotation1); + Matrix result1(false); Vector3 vForward3(vForward.x, vForward.y, vForward.z); - result1.SetTransformComponents( Vector3::ONE, Quaternion(Radian(Degree(angle)), vForward3), Vector3::ZERO ); + result1.SetTransformComponents(Vector3::ONE, Quaternion(Radian(Degree(angle)), vForward3), Vector3::ZERO); DALI_TEST_EQUALS(m1, result1, 0.001, TEST_LOCATION); @@ -696,19 +643,19 @@ int UtcDaliMatrixSetTransformComponents01P(void) int UtcDaliMatrixSetInverseTransformComponent01P(void) { // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { Vector3 vForward(x, y, z); vForward.Normalize(); { Quaternion rotation1(Quaternion::IDENTITY); // test no rotation branch - Vector3 scale1(2.0f, 3.0f, 4.0f); - Vector3 position1(1.0f, 2.0f, 3.0f); + Vector3 scale1(2.0f, 3.0f, 4.0f); + Vector3 position1(1.0f, 2.0f, 3.0f); Matrix m1(false); m1.SetTransformComponents(scale1, rotation1, position1); @@ -730,30 +677,30 @@ int UtcDaliMatrixSetInverseTransformComponent01P(void) int UtcDaliMatrixSetInverseTransformComponent02P(void) { // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { Vector3 vForward(x, y, z); vForward.Normalize(); - for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f) + for(float angle = 5.0f; angle <= 360.0f; angle += 15.0f) { Quaternion rotation1(Radian(Degree(angle)), vForward); - Matrix rotationMatrix(rotation1); // TEST RELIES ON THIS METHOD WORKING!!! + Matrix rotationMatrix(rotation1); // TEST RELIES ON THIS METHOD WORKING!!! Vector3 position1(5.0f, -6.0f, 7.0f); Matrix m1(false); - m1.SetTransformComponents( Vector3::ONE, rotation1, position1 ); + m1.SetTransformComponents(Vector3::ONE, rotation1, position1); Matrix m2(false); - m2.SetInverseTransformComponents( rotationMatrix.GetXAxis(), - rotationMatrix.GetYAxis(), - rotationMatrix.GetZAxis(), - position1 ); + m2.SetInverseTransformComponents(rotationMatrix.GetXAxis(), + rotationMatrix.GetYAxis(), + rotationMatrix.GetZAxis(), + position1); Matrix result; Matrix::Multiply(result, m1, m2); @@ -768,9 +715,9 @@ int UtcDaliMatrixSetInverseTransformComponent02P(void) int UtcDaliMatrixGetTransformComponents01P(void) { - Matrix m2(Matrix::IDENTITY.AsFloat()); - Vector3 pos2; - Vector3 scale2; + Matrix m2(Matrix::IDENTITY.AsFloat()); + Vector3 pos2; + Vector3 scale2; Quaternion q2; m2.GetTransformComponents(pos2, q2, scale2); DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), pos2, 0.001, TEST_LOCATION); @@ -779,31 +726,30 @@ int UtcDaliMatrixGetTransformComponents01P(void) END_TEST; } - int UtcDaliMatrixGetTransformComponents02P(void) { // Create an arbitrary vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { Vector3 vForward(x, y, z); vForward.Normalize(); - for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f) + for(float angle = 5.0f; angle <= 360.0f; angle += 15.0f) { Quaternion rotation1(Radian(Degree(angle)), vForward); - Vector3 scale1(2.0f, 3.0f, 4.0f); - Vector3 position1(1.0f, 2.0f, 3.0f); + Vector3 scale1(2.0f, 3.0f, 4.0f); + Vector3 position1(1.0f, 2.0f, 3.0f); Matrix m1(false); m1.SetTransformComponents(scale1, rotation1, position1); - Vector3 position2; + Vector3 position2; Quaternion rotation2; - Vector3 scale2; + Vector3 scale2; m1.GetTransformComponents(position2, rotation2, scale2); DALI_TEST_EQUALS(position1, position2, 0.001, TEST_LOCATION); @@ -818,9 +764,9 @@ int UtcDaliMatrixGetTransformComponents02P(void) int UtcDaliMatrixGetTransformComponents03P(void) { - Matrix m2; // zero branch - Vector3 pos2; - Vector3 scale2; + Matrix m2; // zero branch + Vector3 pos2; + Vector3 scale2; Quaternion q2; m2.GetTransformComponents(pos2, q2, scale2); DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), pos2, 0.001, TEST_LOCATION); @@ -840,6 +786,6 @@ int UtcDaliMatrixOStreamOperator(void) std::string expectedOutput = "[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Matrix3.cpp b/automated-tests/src/dali/utc-Dali-Matrix3.cpp index f9803cd..fe2ee41 100644 --- a/automated-tests/src/dali/utc-Dali-Matrix3.cpp +++ b/automated-tests/src/dali/utc-Dali-Matrix3.cpp @@ -15,12 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include +#include using namespace Dali; @@ -36,108 +35,65 @@ void utc_dali_matrix3_cleanup(void) namespace { - Matrix3 m1( - -18.6f, 1.88e-09f, -6.85e-09f, - 0.0f,13.2f, 13.2f, - -1.36e-08f,13.2f, -13.2f); + -18.6f, 1.88e-09f, -6.85e-09f, 0.0f, 13.2f, 13.2f, -1.36e-08f, 13.2f, -13.2f); Matrix3 m2( - -18.6f,6.91e-06f, 6.76e-06f, - 8.04e-09f,13.2f, 13.2f, - 3.01e-06f,13.2f, -13.2f); + -18.6f, 6.91e-06f, 6.76e-06f, 8.04e-09f, 13.2f, 13.2f, 3.01e-06f, 13.2f, -13.2f); Matrix3 m3( - 6.24f,-12.4f, -12.4f, - -17.6f,-4.46f, -4.37f, - -0.0641f,13.2f, -13.2f); + 6.24f, -12.4f, -12.4f, -17.6f, -4.46f, -4.37f, -0.0641f, 13.2f, -13.2f); Matrix3 m4( - -16.3f,6.42f, 6.38f, - 9.05f,11.6f, 11.4f, - -0.0371f,13.1f, -13.3f); + -16.3f, 6.42f, 6.38f, 9.05f, 11.6f, 11.4f, -0.0371f, 13.1f, -13.3f); Matrix3 m5( - -2.43f,13.2f, 12.9f, - 18.5f,1.92f, 1.51f, - -0.257f,13.0f, -13.4f); + -2.43f, 13.2f, 12.9f, 18.5f, 1.92f, 1.51f, -0.257f, 13.0f, -13.4f); Matrix3 m6( - -2.43f, -13.2f, -200.9f, - 18.5f, 1.92f, 1.51f, - 0.257f, 13.0f, 13.4f); - + -2.43f, -13.2f, -200.9f, 18.5f, 1.92f, 1.51f, 0.257f, 13.0f, 13.4f); Matrix3 i1( - -0.05, -0.00, 0.00, - -0.00, 0.04, 0.04, - 0.00, 0.04, -0.04); + -0.05, -0.00, 0.00, -0.00, 0.04, 0.04, 0.00, 0.04, -0.04); Matrix3 i2( - -0.05, 0.00, -0.00, - 0.00, 0.04, 0.04, - 0.00, 0.04, -0.04); + -0.05, 0.00, -0.00, 0.00, 0.04, 0.04, 0.00, 0.04, -0.04); Matrix3 i3( - 0.02, -0.05, -0.00, - -0.04, -0.01, 0.04, - -0.04, -0.01, -0.04); + 0.02, -0.05, -0.00, -0.04, -0.01, 0.04, -0.04, -0.01, -0.04); Matrix3 i4( - -0.05, 0.03, -0.00, - 0.02, 0.03, 0.04, - 0.02, 0.03, -0.04); + -0.05, 0.03, -0.00, 0.02, 0.03, 0.04, 0.02, 0.03, -0.04); Matrix3 i5( - -0.01, 0.05, -0.00, - 0.04, 0.01, 0.04, - 0.04, 0.00, -0.04); - - + -0.01, 0.05, -0.00, 0.04, 0.01, 0.04, 0.04, 0.00, -0.04); Matrix3 t1( - -18.6f, 0.0f, -1.36e-08f, - 1.88e-09f,13.2f, 13.2f, - -6.85e-09f,13.2f, -13.2f); + -18.6f, 0.0f, -1.36e-08f, 1.88e-09f, 13.2f, 13.2f, -6.85e-09f, 13.2f, -13.2f); Matrix3 t2( - -18.6f,8.04e-09f, 3.01e-06f, - 6.91e-06f,13.2f, 13.2f, - 6.76e-06f,13.2f, -13.2f); + -18.6f, 8.04e-09f, 3.01e-06f, 6.91e-06f, 13.2f, 13.2f, 6.76e-06f, 13.2f, -13.2f); Matrix3 t3( - 6.24f,-17.6f, -0.0641f, - -12.4f,-4.46f, 13.2f, - -12.4f, -4.37f, -13.2f); + 6.24f, -17.6f, -0.0641f, -12.4f, -4.46f, 13.2f, -12.4f, -4.37f, -13.2f); Matrix3 t4( - -16.3f,9.05f, -0.0371f, - 6.42f, 11.6f, 13.1f, - 6.38f,11.4f, -13.3f); + -16.3f, 9.05f, -0.0371f, 6.42f, 11.6f, 13.1f, 6.38f, 11.4f, -13.3f); Matrix3 t5( - -2.43f,18.5f, -0.257f, - 13.2f, 1.92f, 13.0f, - 12.9f, 1.51f, -13.4f); - + -2.43f, 18.5f, -0.257f, 13.2f, 1.92f, 13.0f, 12.9f, 1.51f, -13.4f); - -Matrix3* matrices[5] = { &m1, &m2, &m3, &m4, &m5 }; -Matrix3* inverseMatrices[5] = { &i1, &i2, &i3, &i4, &i5 }; -Matrix3* transposeMatrices[5] = { &t1, &t2, &t3, &t4, &t5 }; +Matrix3* matrices[5] = {&m1, &m2, &m3, &m4, &m5}; +Matrix3* inverseMatrices[5] = {&i1, &i2, &i3, &i4, &i5}; +Matrix3* transposeMatrices[5] = {&t1, &t2, &t3, &t4, &t5}; } // anonymous namespace int UtcDaliMatrix3FromMatrix(void) { - float els0[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f}; - Matrix m0(els0); - Matrix3 m1(0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + float els0[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; + Matrix m0(els0); + Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); Matrix3 m2(m0); @@ -147,8 +103,8 @@ int UtcDaliMatrix3FromMatrix(void) int UtcDaliMatrix3CopyConstructor(void) { - Matrix3 m0( Matrix3::IDENTITY ); - Matrix3 m1( m0 ); + Matrix3 m0(Matrix3::IDENTITY); + Matrix3 m1(m0); DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -156,8 +112,8 @@ int UtcDaliMatrix3CopyConstructor(void) int UtcDaliMatrix3MoveConstructor(void) { - Matrix3 m0( Matrix3::IDENTITY ); - Matrix3 m1 = std::move( m0 ); + Matrix3 m0(Matrix3::IDENTITY); + Matrix3 m1 = std::move(m0); DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -165,7 +121,7 @@ int UtcDaliMatrix3MoveConstructor(void) int UtcDaliMatrix3CopyAssignment(void) { - Matrix3 m0( Matrix3::IDENTITY ); + Matrix3 m0(Matrix3::IDENTITY); Matrix3 m1; m1 = m0; DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION); @@ -175,9 +131,9 @@ int UtcDaliMatrix3CopyAssignment(void) int UtcDaliMatrix3MoveAssignment(void) { - Matrix3 m0( Matrix3::IDENTITY ); + Matrix3 m0(Matrix3::IDENTITY); Matrix3 m1; - m1 = std::move( m0 ); + m1 = std::move(m0); DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; @@ -185,15 +141,10 @@ int UtcDaliMatrix3MoveAssignment(void) int UtcDaliMatrix3OperatorAssign01(void) { - float els0[] = { 0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f, - 8.0f, 9.0f, 10.0f, 11.0f, - 12.0f, 13.0f, 14.0f, 15.0f}; + float els0[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f}; Matrix m0(els0); - Matrix3 m1(0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); Matrix3 m2; m2 = m0; @@ -203,16 +154,11 @@ int UtcDaliMatrix3OperatorAssign01(void) END_TEST; } - int UtcDaliMatrix3OperatorAssign02(void) { - Matrix3 m0(0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + Matrix3 m0(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); - Matrix3 m1(0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); Matrix3 m2; m2 = m0; @@ -221,41 +167,33 @@ int UtcDaliMatrix3OperatorAssign02(void) END_TEST; } - - // AsFloat int UtcDaliMatrix3AsFloat(void) { - float values[] = {0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f }; + float values[] = {0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f}; - Matrix3 m1(values[0], values[1], values[2], values[3],values[4], values[5], values[6], values[7],values[8]); + Matrix3 m1(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8]); - for (int i=0;i<9;++i) + for(int i = 0; i < 9; ++i) { - DALI_TEST_EQUALS(m1.AsFloat()[i], values[i], TEST_LOCATION); + DALI_TEST_EQUALS(m1.AsFloat()[i], values[i], TEST_LOCATION); } END_TEST; } - // Invert works int UtcDaliMatrix3Invert(void) { // We're going to invert a whole load of different matrices to make sure we don't // fail on particular orientations. - for (int i=0;i<5;++i) + for(int i = 0; i < 5; ++i) { - Matrix3 m = *matrices[i]; + Matrix3 m = *matrices[i]; Matrix3 inverseResult1 = *inverseMatrices[i]; // Convert to Mat4, perform inverse, and convert back to Mat3 - float* mf = m.AsFloat(); - float els[] = { mf[0], mf[1], mf[2], 0.0f, - mf[3], mf[4], mf[5], 0.0f, - mf[6], mf[7], mf[8], 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; + float* mf = m.AsFloat(); + float els[] = {mf[0], mf[1], mf[2], 0.0f, mf[3], mf[4], mf[5], 0.0f, mf[6], mf[7], mf[8], 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; Matrix mat4(els); mat4.Invert(); Matrix3 inverseResult2 = mat4; @@ -267,7 +205,7 @@ int UtcDaliMatrix3Invert(void) DALI_TEST_EQUALS(mInv, inverseResult2, 0.01f, TEST_LOCATION); Matrix3 m2 = mInv; - m2.Invert(); // double invert - should be back to m + m2.Invert(); // double invert - should be back to m DALI_TEST_EQUALS(m, m2, 0.01f, TEST_LOCATION); } @@ -276,7 +214,7 @@ int UtcDaliMatrix3Invert(void) int UtcDaliMatrix3Transpose(void) { - for (int i=0;i<5;++i) + for(int i = 0; i < 5; ++i) { Matrix3 m0 = *matrices[i]; Matrix3 trans = *transposeMatrices[i]; @@ -297,25 +235,18 @@ int UtcDaliMatrix3Transpose(void) // SetIdentity int UtcDaliMatrix3SetIdentity(void) { - Matrix3 m( 0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + Matrix3 m(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); m.SetIdentity(); DALI_TEST_EQUALS(m, Matrix3::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliMatrix3Scale(void) { - Matrix3 m1( 0.0f, 1.0f, 2.0f, - 4.0f, 5.0f, 6.0f, - 8.0f, 9.0f, 10.0f); + Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f); - Matrix3 m2( 0.0f, 3.0f, 6.0f, - 12.0f, 15.0f, 18.0f, - 24.0f, 27.0f, 30.0f); + Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f); m1.Scale(3.0f); @@ -325,30 +256,25 @@ int UtcDaliMatrix3Scale(void) int UtcDaliMatrix3Magnitude(void) { - Matrix3 m1( 0.0f, 1.0f, -2.0f, - 3.0f, -4.0f, 5.0f, - -6.0f, 7.0f, 8.0f); + Matrix3 m1(0.0f, 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, 8.0f); DALI_TEST_EQUALS(Matrix3::IDENTITY.Magnitude(), 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(m1.Magnitude(), 12.0f, 0.001f, TEST_LOCATION); END_TEST; } - - int UtcDaliMatrix3ScaleInverseTranspose(void) { - Matrix3* matrices[6] = { &m1, &m2, &m3, &m4, &m5, &m6 }; + Matrix3* matrices[6] = {&m1, &m2, &m3, &m4, &m5, &m6}; - - for (int i=0;i<6;++i) + for(int i = 0; i < 6; ++i) { - Matrix3 m0 = *matrices[i]; + Matrix3 m0 = *matrices[i]; Matrix3 m1 = m0; m1.Invert(); m1.Transpose(); - m1.Scale(3.0f/(m1.Magnitude())); + m1.Scale(3.0f / (m1.Magnitude())); Matrix3 m2 = m0; m2.ScaledInverseTranspose(); @@ -362,29 +288,23 @@ int UtcDaliMatrix3OStreamOperator(void) { std::ostringstream oss; - Matrix3 matrix( 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f ); + Matrix3 matrix(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); oss << matrix; std::string expectedOutput = "[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } int UtcDaliMatrix3Multiply(void) { - Matrix3 m1( 0.0f, 3.0f, 6.0f, - 12.0f, 15.0f, 18.0f, - 24.0f, 27.0f, 30.0f); + Matrix3 m1(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f); - Matrix3 m2( 0.0f, 1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f); + Matrix3 m2(0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); - Matrix3 m3( -3.0f, 0.0f, 6.0f, - -15.0f, 12.0f, 18.0f, - -27.0f, 24.0f, 30.0f); + Matrix3 m3(-3.0f, 0.0f, 6.0f, -15.0f, 12.0f, 18.0f, -27.0f, 24.0f, 30.0f); Matrix3 result; Matrix3::Multiply(result, m1, m2); @@ -395,13 +315,9 @@ int UtcDaliMatrix3Multiply(void) int UtcDaliMatrix3EqualityOperator(void) { - Matrix3 m1( 0.0f, 3.0f, 6.0f, - 12.0f, 15.0f, 18.0f, - 24.0f, 27.0f, 30.0f); + Matrix3 m1(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f); - Matrix3 m2( 0.0f, 3.0f, 6.0f, - 12.0f, 15.0f, 18.0f, - 24.0f, 27.0f, 30.0f); + Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f); DALI_TEST_CHECK(m1 == m2); END_TEST; @@ -409,13 +325,9 @@ int UtcDaliMatrix3EqualityOperator(void) int UtcDaliMatrix3InequalityOperator(void) { - Matrix3 m1( 1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 1.0f); + Matrix3 m1(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f); - Matrix3 m2( 0.0f, 3.0f, 6.0f, - 12.0f, 15.0f, 18.0f, - 24.0f, 27.0f, 30.0f); + Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f); DALI_TEST_CHECK(m1 != m2); END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp b/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp index e453dbd..66a80a6 100644 --- a/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp +++ b/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; diff --git a/automated-tests/src/dali/utc-Dali-Mutex.cpp b/automated-tests/src/dali/utc-Dali-Mutex.cpp index 44ca204..edbd1cc 100644 --- a/automated-tests/src/dali/utc-Dali-Mutex.cpp +++ b/automated-tests/src/dali/utc-Dali-Mutex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,15 @@ * */ -#include +#include +#include +#include +#include #include #include + +#include #include -#include -#include -#include -#include using Dali::Mutex; using Dali::Thread; @@ -33,20 +34,20 @@ int UtcDaliMutexSingleThread(void) { Mutex mutex1; - DALI_TEST_EQUALS( false, mutex1.IsLocked(), TEST_LOCATION ); + DALI_TEST_EQUALS(false, mutex1.IsLocked(), TEST_LOCATION); } { - Mutex mutex2; - Mutex::ScopedLock lock( mutex2 ); - DALI_TEST_EQUALS( true, mutex2.IsLocked(), TEST_LOCATION ); + Mutex mutex2; + Mutex::ScopedLock lock(mutex2); + DALI_TEST_EQUALS(true, mutex2.IsLocked(), TEST_LOCATION); } Mutex mutex3; { - Mutex::ScopedLock lock( mutex3 ); + Mutex::ScopedLock lock(mutex3); } - DALI_TEST_EQUALS( false, mutex3.IsLocked(), TEST_LOCATION ); + DALI_TEST_EQUALS(false, mutex3.IsLocked(), TEST_LOCATION); END_TEST; } @@ -54,9 +55,12 @@ int UtcDaliMutexSingleThread(void) namespace // for local variables to avoid name clashes { // make all these volatile to pre-empt any optimization screwing up the logic -volatile int gGlobalValue = 0; -volatile bool gWorkerThreadWait = true; -volatile enum ThreadState { INIT, RUN, LOCKING, TERMINATE } gWorkerThreadState = INIT; +volatile int gGlobalValue = 0; +volatile bool gWorkerThreadWait = true; +volatile enum ThreadState { INIT, + RUN, + LOCKING, + TERMINATE } gWorkerThreadState = INIT; Mutex* volatile gGlobalValueMutex; // volatile pointer to a mutex object class TestThread : public Thread @@ -65,18 +69,18 @@ class TestThread : public Thread { gWorkerThreadState = RUN; { - Mutex::ScopedLock lock( *gGlobalValueMutex ); + Mutex::ScopedLock lock(*gGlobalValueMutex); gWorkerThreadState = LOCKING; - gGlobalValue = -1; - while( gWorkerThreadWait ) // wait till we can exit + gGlobalValue = -1; + while(gWorkerThreadWait) // wait till we can exit { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } } gWorkerThreadState = TERMINATE; } }; -} +} // namespace int UtcDaliMutexMultiThread(void) { @@ -86,45 +90,45 @@ int UtcDaliMutexMultiThread(void) TestThread thread1; // initialize values - gGlobalValue = 0; + gGlobalValue = 0; gWorkerThreadWait = true; - DALI_TEST_EQUALS( INIT, gWorkerThreadState, TEST_LOCATION ); - DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION ); - DALI_TEST_EQUALS( false, gGlobalValueMutex->IsLocked(), TEST_LOCATION ); + DALI_TEST_EQUALS(INIT, gWorkerThreadState, TEST_LOCATION); + DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION); + DALI_TEST_EQUALS(false, gGlobalValueMutex->IsLocked(), TEST_LOCATION); // lock the mutex { - Mutex::ScopedLock lock( *gGlobalValueMutex ); - DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION ); + Mutex::ScopedLock lock(*gGlobalValueMutex); + DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION); thread1.Start(); // wait till the thread is in run state - while( RUN != gWorkerThreadState ) + while(RUN != gWorkerThreadState) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } // now the thread is running and mutex is still locked by this thread so value is not changed - DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION ); + DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION); + DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION); // drop out of scope, releases our lock } // now child thread is allowed to change the value // wait till the thread is in locking state - while( LOCKING != gWorkerThreadState ) + while(LOCKING != gWorkerThreadState) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } // mutex is locked, but not by us, by the child thread - DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION ); + DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION); // value is changed - DALI_TEST_EQUALS( -1, gGlobalValue, TEST_LOCATION ); + DALI_TEST_EQUALS(-1, gGlobalValue, TEST_LOCATION); // let worker finish gWorkerThreadWait = false; // wait till the thread is terminated state - while( TERMINATE != gWorkerThreadState ) + while(TERMINATE != gWorkerThreadState) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } - DALI_TEST_EQUALS( false, gGlobalValueMutex->IsLocked(), TEST_LOCATION ); + DALI_TEST_EQUALS(false, gGlobalValueMutex->IsLocked(), TEST_LOCATION); thread1.Join(); END_TEST; @@ -134,10 +138,8 @@ int UtcDaliMutexNonCopyable(void) { // we want to make sure that mutex is not copyable (its copy constructor is not defined) // this test will stop compiling if Mutex has compiler generated copy constructor - static_assert( !__has_trivial_copy( Mutex ), "Mutex should NOT be copyable" ); + static_assert(!__has_trivial_copy(Mutex), "Mutex should NOT be copyable"); - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } - - diff --git a/automated-tests/src/dali/utc-Dali-ObjectRegistry.cpp b/automated-tests/src/dali/utc-Dali-ObjectRegistry.cpp index 6d2e2dd..9b77c8b 100644 --- a/automated-tests/src/dali/utc-Dali-ObjectRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-ObjectRegistry.cpp @@ -15,17 +15,16 @@ * */ -#include - -#include #include #include +#include + +#include using namespace Dali; namespace { - // Functors to test whether Object created/destroyed signal is emitted for different types of Objects struct TestObjectDestroyedCallback @@ -46,7 +45,7 @@ struct TestObjectDestroyedCallback } } - bool& mSignalVerified; + bool& mSignalVerified; Dali::RefObject*& mObjectPointer; }; @@ -131,9 +130,9 @@ int UtcDaliObjectRegistryGet(void) TestApplication application; ObjectRegistry registry; // like this for ctor code coverage - registry= application.GetCore().GetObjectRegistry(); + registry = application.GetCore().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); + DALI_TEST_CHECK(registry); END_TEST; } @@ -142,9 +141,9 @@ int UtcDaliObjectRegistryCopyConstructor(void) TestApplication application; ObjectRegistry myRegistry; - ObjectRegistry anotherRegistry( myRegistry ); + ObjectRegistry anotherRegistry(myRegistry); - DALI_TEST_EQUALS( myRegistry, anotherRegistry, TEST_LOCATION ); + DALI_TEST_EQUALS(myRegistry, anotherRegistry, TEST_LOCATION); END_TEST; } @@ -153,15 +152,15 @@ int UtcDaliObjectRegistryMoveConstructor(void) TestApplication application; ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); - DALI_TEST_EQUALS( 2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(registry); + DALI_TEST_EQUALS(2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION); - ObjectRegistry move = std::move( registry ); - DALI_TEST_CHECK( move ); + ObjectRegistry move = std::move(registry); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !registry ); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!registry); END_TEST; } @@ -171,16 +170,16 @@ int UtcDaliObjectRegistryMoveAssignment(void) TestApplication application; ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); - DALI_TEST_EQUALS( 2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(registry); + DALI_TEST_EQUALS(2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION); ObjectRegistry move; - move = std::move( registry ); - DALI_TEST_CHECK( move ); + move = std::move(registry); + DALI_TEST_CHECK(move); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !registry ); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!registry); END_TEST; } @@ -189,13 +188,13 @@ int UtcDaliObjectRegistrySignalActorCreated(void) { tet_infoline("Testing GetObjectRegistry()"); TestApplication application; - ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); + DALI_TEST_CHECK(registry); - bool verified = false; + bool verified = false; TestActorCallback test(verified); - Dali::RefObject* objectPointer = NULL; + Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); @@ -203,12 +202,12 @@ int UtcDaliObjectRegistrySignalActorCreated(void) { Actor actor = Actor::New(); - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); - verified = false; + verified = false; objectPointer = actor.GetObjectPtr(); } - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); END_TEST; } @@ -218,10 +217,10 @@ int UtcDaliObjectRegistrySignalCameraCreated(void) ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - bool verified = false; + bool verified = false; TestCameraActorCallback test(verified); - Dali::RefObject* objectPointer = NULL; + Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); @@ -229,24 +228,24 @@ int UtcDaliObjectRegistrySignalCameraCreated(void) { CameraActor actor = CameraActor::New(); - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); - verified = false; + verified = false; objectPointer = actor.GetObjectPtr(); } - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); END_TEST; } int UtcDaliObjectRegistrySignalLayerCreated(void) { TestApplication application; - ObjectRegistry registry = application.GetCore().GetObjectRegistry(); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - bool verified = false; + bool verified = false; TestLayerCallback test(verified); - Dali::RefObject* objectPointer = NULL; + Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); @@ -254,24 +253,24 @@ int UtcDaliObjectRegistrySignalLayerCreated(void) { Layer actor = Layer::New(); - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); - verified = false; + verified = false; objectPointer = actor.GetObjectPtr(); } - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); END_TEST; } int UtcDaliObjectRegistrySignalAnimationCreated(void) { TestApplication application; - ObjectRegistry registry = application.GetCore().GetObjectRegistry(); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); - bool verified = false; + bool verified = false; TestAnimationCallback test(verified); - Dali::RefObject* objectPointer = NULL; + Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); @@ -279,18 +278,18 @@ int UtcDaliObjectRegistrySignalAnimationCreated(void) { Animation animation = Animation::New(1.0f); - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); - verified = false; + verified = false; objectPointer = animation.GetObjectPtr(); } - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); END_TEST; } int UtcDaliObjectRegistryObjectCreatedSignalNegative(void) { - TestApplication application; + TestApplication application; Dali::ObjectRegistry instance; try { @@ -306,7 +305,7 @@ int UtcDaliObjectRegistryObjectCreatedSignalNegative(void) int UtcDaliObjectRegistryObjectDestroyedSignalNegative(void) { - TestApplication application; + TestApplication application; Dali::ObjectRegistry instance; try { diff --git a/automated-tests/src/dali/utc-Dali-PanGesture.cpp b/automated-tests/src/dali/utc-Dali-PanGesture.cpp index 4c6ab70..fdadd3c 100644 --- a/automated-tests/src/dali/utc-Dali-PanGesture.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGesture.cpp @@ -16,12 +16,12 @@ * */ -#include - -#include -#include #include #include +#include +#include + +#include using namespace Dali; @@ -39,30 +39,30 @@ int UtcDaliPanGestureConstructorP(void) { TestApplication application; // Reset all test adapter return codes - PanGesture gesture = DevelPanGesture::New( GestureState::CLEAR ); + PanGesture gesture = DevelPanGesture::New(GestureState::CLEAR); DALI_TEST_EQUALS(GestureState::CLEAR, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION); - PanGesture gesture2 = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture2 = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION); - PanGesture gesture3 = DevelPanGesture::New( GestureState::CONTINUING ); + PanGesture gesture3 = DevelPanGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture3.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture3.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION); - PanGesture gesture4 = DevelPanGesture::New( GestureState::FINISHED ); + PanGesture gesture4 = DevelPanGesture::New(GestureState::FINISHED); DALI_TEST_EQUALS(GestureState::FINISHED, gesture4.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture4.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture4.GetType(), TEST_LOCATION); // Test copy constructor - DevelPanGesture::SetNumberOfTouches( gesture4, 3u ); + DevelPanGesture::SetNumberOfTouches(gesture4, 3u); PanGesture pan(gesture4); DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION); @@ -71,7 +71,7 @@ int UtcDaliPanGestureConstructorP(void) // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); - PanGesture gesture5( std::move( gesture ) ); + PanGesture gesture5(std::move(gesture)); DALI_TEST_CHECK(!gesture); DALI_TEST_EQUALS(GestureType::PAN, gesture5.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture5.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); @@ -82,18 +82,18 @@ int UtcDaliPanGestureConstructorP(void) int UtcDaliPanGestureAssignmentP(void) { // Test Assignment operator - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION); - PanGesture gesture2 = DevelPanGesture::New( GestureState::CONTINUING ); + PanGesture gesture2 = DevelPanGesture::New(GestureState::CONTINUING); DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION); - DevelPanGesture::SetNumberOfTouches( gesture2, 3u ); + DevelPanGesture::SetNumberOfTouches(gesture2, 3u); gesture = gesture2; DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); @@ -114,10 +114,10 @@ int UtcDaliPanGestureAssignmentP(void) int UtcDaliPanGestureGetSpeedP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION); - DevelPanGesture::SetVelocity( gesture, Vector2( 3.0f, -4.0f ) ); + DevelPanGesture::SetVelocity(gesture, Vector2(3.0f, -4.0f)); DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION); END_TEST; @@ -125,10 +125,10 @@ int UtcDaliPanGestureGetSpeedP(void) int UtcDaliPanGestureGetDistanceP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION); - DevelPanGesture::SetDisplacement( gesture, Vector2( -30.0f, -40.0f ) ); + DevelPanGesture::SetDisplacement(gesture, Vector2(-30.0f, -40.0f)); DALI_TEST_EQUALS(50.0f, gesture.GetDistance(), TEST_LOCATION); END_TEST; @@ -136,10 +136,10 @@ int UtcDaliPanGestureGetDistanceP(void) int UtcDaliPanGestureGetScreenSpeedP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(0.0f, gesture.GetScreenSpeed(), TEST_LOCATION); - DevelPanGesture::SetScreenVelocity( gesture, Vector2( 3.0f, -4.0f ) ); + DevelPanGesture::SetScreenVelocity(gesture, Vector2(3.0f, -4.0f)); DALI_TEST_EQUALS(5.0f, gesture.GetScreenSpeed(), TEST_LOCATION); END_TEST; @@ -147,10 +147,10 @@ int UtcDaliPanGestureGetScreenSpeedP(void) int UtcDaliPanGestureGetScreenDistanceP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(0.0f, gesture.GetScreenDistance(), TEST_LOCATION); - DevelPanGesture::SetScreenDisplacement( gesture, Vector2( -30.0f, -40.0f ) ); + DevelPanGesture::SetScreenDisplacement(gesture, Vector2(-30.0f, -40.0f)); DALI_TEST_EQUALS(50.0f, gesture.GetScreenDistance(), TEST_LOCATION); END_TEST; @@ -162,57 +162,57 @@ int UtcDaliPanGestureDetectorRegisterPropertyP(void) GestureDetector detector = PanGestureDetector::New(); - Property::Index index = detector.RegisterProperty( "sceneProperty", 0 ); - DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION ); - detector.SetProperty( index, -99 ); + Property::Index index = detector.RegisterProperty("sceneProperty", 0); + DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetProperty(index), 0, TEST_LOCATION); + detector.SetProperty(index, -99); using Dali::Animation; - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( detector, index ), 99 ); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -99, TEST_LOCATION ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(detector, index), 99); + DALI_TEST_EQUALS(detector.GetProperty(index), -99, TEST_LOCATION); // create another pan gesture GestureDetector detector2 = PanGestureDetector::New(); - DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index ), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(detector2.GetProperty(index), 0, TEST_LOCATION); // Start the animation animation.Play(); application.SendNotification(); - application.Render( 500 /* 50% progress */); - DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0 /*half way*/, TEST_LOCATION ); + application.Render(500 /* 50% progress */); + DALI_TEST_EQUALS(detector.GetCurrentProperty(index), 0 /*half way*/, TEST_LOCATION); // register another pan gesture value - Property::Index index2 = detector2.RegisterProperty( "sceneProperty2", 12 ); - DALI_TEST_EQUALS( index2, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), 12, TEST_LOCATION ); - DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), 12, TEST_LOCATION ); + Property::Index index2 = detector2.RegisterProperty("sceneProperty2", 12); + DALI_TEST_EQUALS(index2, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(detector2.GetProperty(index2), 12, TEST_LOCATION); + DALI_TEST_EQUALS(detector2.GetCurrentProperty(index2), 12, TEST_LOCATION); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99 /*target*/, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetProperty(index), 99 /*target*/, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetCurrentProperty(index), 0, TEST_LOCATION); - Animation animation2 = Animation::New( 1.0f ); - animation2.AnimateTo( Property( detector2, index2 ), -99 ); + Animation animation2 = Animation::New(1.0f); + animation2.AnimateTo(Property(detector2, index2), -99); // Start the animation animation2.Play(); application.SendNotification(); - application.Render( 1000 /* 100% more progress */); + application.Render(1000 /* 100% more progress */); - DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), -99, TEST_LOCATION ); - DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), -99, TEST_LOCATION ); + DALI_TEST_EQUALS(detector2.GetProperty(index2), -99, TEST_LOCATION); + DALI_TEST_EQUALS(detector2.GetCurrentProperty(index2), -99, TEST_LOCATION); - DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 99, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetProperty(index), 99, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetCurrentProperty(index), 99, TEST_LOCATION); END_TEST; } int UtcDaliPanGestureSetGetTimeP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(0, gesture.GetTime(), TEST_LOCATION); - DevelPanGesture::SetTime( gesture, 123123 ); + DevelPanGesture::SetTime(gesture, 123123); DALI_TEST_EQUALS(123123, gesture.GetTime(), TEST_LOCATION); END_TEST; @@ -220,10 +220,10 @@ int UtcDaliPanGestureSetGetTimeP(void) int UtcDaliPanGestureSetGetVelocityP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetVelocity(), TEST_LOCATION); - DevelPanGesture::SetVelocity( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetVelocity(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetVelocity(), TEST_LOCATION); END_TEST; @@ -231,10 +231,10 @@ int UtcDaliPanGestureSetGetVelocityP(void) int UtcDaliPanGestureSetGetDisplacementP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetDisplacement(), TEST_LOCATION); - DevelPanGesture::SetDisplacement( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetDisplacement(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetDisplacement(), TEST_LOCATION); END_TEST; @@ -242,10 +242,10 @@ int UtcDaliPanGestureSetGetDisplacementP(void) int UtcDaliPanGestureSetGetPositionP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetPosition(), TEST_LOCATION); - DevelPanGesture::SetPosition( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetPosition(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetPosition(), TEST_LOCATION); END_TEST; @@ -253,10 +253,10 @@ int UtcDaliPanGestureSetGetPositionP(void) int UtcDaliPanGestureSetGetScreenVelocityP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenVelocity(), TEST_LOCATION); - DevelPanGesture::SetScreenVelocity( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetScreenVelocity(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenVelocity(), TEST_LOCATION); END_TEST; @@ -264,10 +264,10 @@ int UtcDaliPanGestureSetGetScreenVelocityP(void) int UtcDaliPanGestureSetGetScreenDisplacementP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenDisplacement(), TEST_LOCATION); - DevelPanGesture::SetScreenDisplacement( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetScreenDisplacement(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenDisplacement(), TEST_LOCATION); END_TEST; @@ -275,10 +275,10 @@ int UtcDaliPanGestureSetGetScreenDisplacementP(void) int UtcDaliPanGestureSetGetScreenPositionP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenPosition(), TEST_LOCATION); - DevelPanGesture::SetScreenPosition( gesture, Vector2(123.0f, 321.0f) ); + DevelPanGesture::SetScreenPosition(gesture, Vector2(123.0f, 321.0f)); DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenPosition(), TEST_LOCATION); END_TEST; @@ -286,10 +286,10 @@ int UtcDaliPanGestureSetGetScreenPositionP(void) int UtcDaliPanGestureSetGetNumberOfTouchesP(void) { - PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); + PanGesture gesture = DevelPanGesture::New(GestureState::STARTED); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); - DevelPanGesture::SetNumberOfTouches( gesture, 3123 ); + DevelPanGesture::SetNumberOfTouches(gesture, 3123); DALI_TEST_EQUALS(3123, gesture.GetNumberOfTouches(), TEST_LOCATION); END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp index 48790fe..180c1c3 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp @@ -15,18 +15,18 @@ * */ -#include - -#include -#include -#include +#include +#include #include -#include -#include #include -#include +#include +#include +#include +#include #include -#include + +#include +#include using namespace Dali; @@ -43,7 +43,7 @@ void utc_dali_pan_gesture_detector_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { -const int PAN_EVENT_TIME_DELTA = 8; +const int PAN_EVENT_TIME_DELTA = 8; const int PAN_GESTURE_UPDATE_COUNT = 50; // Stores data that is populated in the callback and will be read by the test cases @@ -53,11 +53,12 @@ struct SignalData : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -65,22 +66,25 @@ struct SignalData pannedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; PanGesture receivedGesture; - Actor pannedActor; + Actor pannedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const PanGesture& pan) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = pan; - signalData.pannedActor = actor; + signalData.pannedActor = actor; } void operator()() @@ -94,24 +98,24 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) - : GestureReceivedFunctor( data ), - stateToUnstage( stateToUnstage ), - scene( scene ) + UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene) + : GestureReceivedFunctor(data), + stateToUnstage(stateToUnstage), + scene(scene) { } - void operator()( Actor actor, const PanGesture& pan ) + void operator()(Actor actor, const PanGesture& pan) { - GestureReceivedFunctor::operator()( actor, pan ); + GestureReceivedFunctor::operator()(actor, pan); - if ( pan.GetState() == stateToUnstage ) + if(pan.GetState() == stateToUnstage) { - scene.Remove( actor ); + scene.Remove(actor); } } - GestureState& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -119,8 +123,8 @@ struct UnstageActorFunctor : public GestureReceivedFunctor struct ConstraintData { ConstraintData() - : panning( false ), - called( false ) + : panning(false), + called(false) { } @@ -130,68 +134,71 @@ struct ConstraintData Vector2 localPosition; Vector2 localDisplacement; Vector2 localVelocity; - bool panning; - bool called; + bool panning; + bool called; void Reset() { screenPosition = screenDisplacement = screenVelocity = localPosition = localDisplacement = localVelocity = Vector2::ZERO; - panning = false; - called = false; + panning = false; + called = false; } }; // Constraint used with panning properties struct PanConstraint { - PanConstraint( ConstraintData& data ) : constraintData(data) { } + PanConstraint(ConstraintData& data) + : constraintData(data) + { + } - void operator()( Vector3& current, const PropertyInputContainer& inputs ) + void operator()(Vector3& current, const PropertyInputContainer& inputs) { - constraintData.screenPosition = inputs[0]->GetVector2(); + constraintData.screenPosition = inputs[0]->GetVector2(); constraintData.screenDisplacement = inputs[1]->GetVector2(); - constraintData.screenVelocity = inputs[2]->GetVector2(); - constraintData.localPosition = inputs[3]->GetVector2(); - constraintData.localDisplacement = inputs[4]->GetVector2(); - constraintData.localVelocity = inputs[5]->GetVector2(); - constraintData.panning = inputs[6]->GetBoolean(); - constraintData.called = true; - current = Vector3::ZERO; + constraintData.screenVelocity = inputs[2]->GetVector2(); + constraintData.localPosition = inputs[3]->GetVector2(); + constraintData.localDisplacement = inputs[4]->GetVector2(); + constraintData.localVelocity = inputs[5]->GetVector2(); + constraintData.panning = inputs[6]->GetBoolean(); + constraintData.called = true; + current = Vector3::ZERO; } ConstraintData& constraintData; }; // Generate a PanGesture -PanGesture GeneratePan( unsigned int time, - GestureState state, - Vector2 screenPosition, - Vector2 localPosition, - Vector2 screenDisplacement = Vector2::ONE, - Vector2 localDisplacement = Vector2::ONE, - Vector2 screenVelocity = Vector2::ONE, - Vector2 localVelocity = Vector2::ONE, - unsigned int numberOfTouches = 1 ) +PanGesture GeneratePan(unsigned int time, + GestureState state, + Vector2 screenPosition, + Vector2 localPosition, + Vector2 screenDisplacement = Vector2::ONE, + Vector2 localDisplacement = Vector2::ONE, + Vector2 screenVelocity = Vector2::ONE, + Vector2 localVelocity = Vector2::ONE, + unsigned int numberOfTouches = 1) { - Dali::PanGesture pan = DevelPanGesture::New( state ); + Dali::PanGesture pan = DevelPanGesture::New(state); - DevelPanGesture::SetTime( pan, time ); + DevelPanGesture::SetTime(pan, time); - DevelPanGesture::SetScreenPosition( pan, screenPosition ); - DevelPanGesture::SetPosition( pan, localPosition ); + DevelPanGesture::SetScreenPosition(pan, screenPosition); + DevelPanGesture::SetPosition(pan, localPosition); - DevelPanGesture::SetScreenDisplacement( pan, screenDisplacement ); - DevelPanGesture::SetDisplacement( pan, localDisplacement ); + DevelPanGesture::SetScreenDisplacement(pan, screenDisplacement); + DevelPanGesture::SetDisplacement(pan, localDisplacement); - DevelPanGesture::SetScreenVelocity( pan, screenVelocity ); - DevelPanGesture::SetVelocity( pan, localVelocity ); + DevelPanGesture::SetScreenVelocity(pan, screenVelocity); + DevelPanGesture::SetVelocity(pan, localVelocity); - DevelPanGesture::SetNumberOfTouches( pan, numberOfTouches ); + DevelPanGesture::SetNumberOfTouches(pan, numberOfTouches); return pan; } -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -211,8 +218,8 @@ int UtcDaliPanGestureDetectorCopyConstructorP(void) PanGestureDetector detector = PanGestureDetector::New(); - PanGestureDetector copy( detector ); - DALI_TEST_CHECK( detector ); + PanGestureDetector copy(detector); + DALI_TEST_CHECK(detector); END_TEST; } @@ -224,9 +231,9 @@ int UtcDaliPanGestureDetectorAssignmentOperatorP(void) PanGestureDetector assign; assign = detector; - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(detector); - DALI_TEST_CHECK( detector == assign ); + DALI_TEST_CHECK(detector == assign); END_TEST; } @@ -244,8 +251,8 @@ int UtcDaliPanGestureDetectorNew(void) // Attach an actor and emit a touch event on the actor to ensure complete line coverage Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); detector.Attach(actor); application.GetScene().Add(actor); @@ -255,7 +262,7 @@ int UtcDaliPanGestureDetectorNew(void) application.Render(); // Use long press function for touch event - TestStartLongPress( application ); + TestStartLongPress(application); END_TEST; } @@ -272,17 +279,17 @@ int UtcDaliPanGestureDetectorDownCast(void) PanGestureDetector detector2 = PanGestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - PanGestureDetector detector3 = DownCast< PanGestureDetector >(object); + PanGestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; PanGestureDetector detector4 = PanGestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - PanGestureDetector detector5 = DownCast< PanGestureDetector >(unInitializedObject); + PanGestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); - GestureDetector detector6 = PanGestureDetector::New(); + GestureDetector detector6 = PanGestureDetector::New(); PanGestureDetector detector7 = PanGestureDetector::DownCast(detector6); DALI_TEST_CHECK(detector7); END_TEST; @@ -305,15 +312,15 @@ int UtcDaliPanGestureSetMinimumTouchesRequired(void) // Attach an actor and change the minimum touches Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.Attach(actor); @@ -347,15 +354,15 @@ int UtcDaliPanGestureSetMaximumTouchesRequired(void) // Attach an actor and change the maximum touches Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.Attach(actor); @@ -391,15 +398,15 @@ int UtcDaliPanGestureSignalReceptionNegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -408,19 +415,19 @@ int UtcDaliPanGestureSignalReceptionNegative(void) // Do a pan outside actor's area uint32_t time = 100; - TestStartPan( application, Vector2(110.0f, 110.0f), Vector2(121.0f, 121.0f), time ); + TestStartPan(application, Vector2(110.0f, 110.0f), Vector2(121.0f, 121.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Continue pan into actor's area - we should still not receive the signal data.Reset(); - TestMovePan( application, Vector2(20.0f, 20.0f), time ); + TestMovePan(application, Vector2(20.0f, 20.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Stop panning - we should still not receive the signal data.Reset(); - TestEndPan( application, Vector2(12.0f, 12.0f), time); + TestEndPan(application, Vector2(12.0f, 12.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -431,15 +438,15 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -448,7 +455,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) // Start pan within the actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -461,7 +468,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -475,7 +482,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) // Pan Gesture leaves actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(346.0f, 4.0f), time ); + TestMovePan(application, Vector2(346.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -489,7 +496,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) // Gesture ends - we would receive a finished state data.Reset(); - TestEndPan( application, Vector2(314.0f, 4.0f), time ); + TestEndPan(application, Vector2(314.0f, 4.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -506,15 +513,15 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -523,7 +530,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) // Start pan within the actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -536,7 +543,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -550,7 +557,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) // Gesture ends within actor's area - we would receive a finished state data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -567,15 +574,15 @@ int UtcDaliPanGestureSignalReceptionDetach(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -584,13 +591,13 @@ int UtcDaliPanGestureSignalReceptionDetach(void) // Start pan within the actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -598,7 +605,7 @@ int UtcDaliPanGestureSignalReceptionDetach(void) // Gesture ends within actor's area data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -609,10 +616,10 @@ int UtcDaliPanGestureSignalReceptionDetach(void) // Ensure we are no longer signalled data.Reset(); - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -623,15 +630,15 @@ int UtcDaliPanGestureSignalReceptionDetachWhilePanning(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -640,7 +647,7 @@ int UtcDaliPanGestureSignalReceptionDetachWhilePanning(void) // Start pan within the actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); application.SendNotification(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -648,7 +655,7 @@ int UtcDaliPanGestureSignalReceptionDetachWhilePanning(void) // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -659,7 +666,7 @@ int UtcDaliPanGestureSignalReceptionDetachWhilePanning(void) // Gesture ends within actor's area data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -669,7 +676,7 @@ int UtcDaliPanGestureSignalReceptionActorDestroyedWhilePanning(void) { TestApplication application; - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -678,8 +685,8 @@ int UtcDaliPanGestureSignalReceptionActorDestroyedWhilePanning(void) // Attach a temporary actor to stop detector being removed from PanGestureProcessor when main actor // is destroyed. Actor tempActor = Actor::New(); - tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(tempActor); detector.Attach(tempActor); @@ -688,8 +695,8 @@ int UtcDaliPanGestureSignalReceptionActorDestroyedWhilePanning(void) // Actor lifetime is scoped { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -699,14 +706,14 @@ int UtcDaliPanGestureSignalReceptionActorDestroyedWhilePanning(void) detector.Attach(actor); // Start pan within the actor's area - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -724,7 +731,7 @@ int UtcDaliPanGestureSignalReceptionActorDestroyedWhilePanning(void) // Gesture ends within the area where the actor used to be data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -735,15 +742,15 @@ int UtcDaliPanGestureSignalReceptionRotatedActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -752,41 +759,41 @@ int UtcDaliPanGestureSignalReceptionRotatedActor(void) // Do an entire pan, only check finished value uint32_t time = 100; - TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time ); + TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time); data.Reset(); - TestEndPan( application, Vector2(25.0f, 28.0f), time ); + TestEndPan(application, Vector2(25.0f, 28.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative // Rotate actor again and render a couple of times - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire pan, only check finished value - TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time ); + TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time); data.Reset(); - TestEndPan( application, Vector2(25.0f, 28.0f), time ); + TestEndPan(application, Vector2(25.0f, 28.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative // Rotate actor again and render a couple of times - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire pan, only check finished value - TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time ); + TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time); data.Reset(); - TestEndPan( application, Vector2(25.0f, 28.0f), time ); + TestEndPan(application, Vector2(25.0f, 28.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative @@ -798,26 +805,25 @@ int UtcDaliPanGestureSignalReceptionChildHit(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); // Set child to completely cover parent. // Change rotation of child to be different from parent so that we can check if our local coordinate // conversion of the parent actor is correct. Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); parent.Add(child); - // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -826,11 +832,11 @@ int UtcDaliPanGestureSignalReceptionChildHit(void) // Do an entire pan, only check finished value - hits child area but parent should still receive it uint32_t time = 100; - TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time ); + TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time); data.Reset(); - TestEndPan( application, Vector2(25.0f, 28.0f), time ); + TestEndPan(application, Vector2(25.0f, 28.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, parent == data.pannedActor, TEST_LOCATION); @@ -842,11 +848,11 @@ int UtcDaliPanGestureSignalReceptionChildHit(void) detector.Detach(parent); // Do an entire pan, only check finished value - TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time ); + TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time); data.Reset(); - TestEndPan( application, Vector2(25.0f, 28.0f), time ); + TestEndPan(application, Vector2(25.0f, 28.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, child == data.pannedActor, TEST_LOCATION); @@ -859,21 +865,21 @@ int UtcDaliPanGestureSignalReceptionAttachDetachMany(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -886,7 +892,7 @@ int UtcDaliPanGestureSignalReceptionAttachDetachMany(void) // Start pan within second actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 110.0f, 20.0f ), Vector2( 126.0f, 20.0f ), time ); + TestStartPan(application, Vector2(110.0f, 20.0f), Vector2(126.0f, 20.0f), time); DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION); DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION); @@ -897,7 +903,7 @@ int UtcDaliPanGestureSignalReceptionAttachDetachMany(void) // Pan moves into first actor's area - second actor should receive the pan data.Reset(); - TestMovePan( application, Vector2(126.0f, 20.0f), time ); + TestMovePan(application, Vector2(126.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -909,8 +915,8 @@ int UtcDaliPanGestureSignalReceptionAttachDetachMany(void) // Gesture ends within actor's area data.Reset(); - TestMovePan( application, Vector2(26.0f, 20.0f), time ); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -922,15 +928,15 @@ int UtcDaliPanGestureSignalReceptionActorBecomesUntouchable(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -939,20 +945,20 @@ int UtcDaliPanGestureSignalReceptionActorBecomesUntouchable(void) // Start pan in actor's area uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Pan continues within actor's area data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Actor become invisible - actor should not receive the next pan - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // Render and notify application.SendNotification(); @@ -961,7 +967,7 @@ int UtcDaliPanGestureSignalReceptionActorBecomesUntouchable(void) // Gesture ends within actor's area data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -972,13 +978,13 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(actor2); // Render and notify @@ -986,16 +992,16 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) application.Render(); // Attach actor to one detector - SignalData firstData; + SignalData firstData; GestureReceivedFunctor firstFunctor(firstData); - PanGestureDetector firstDetector = PanGestureDetector::New(); + PanGestureDetector firstDetector = PanGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector - SignalData secondData; + SignalData secondData; GestureReceivedFunctor secondFunctor(secondData); - PanGestureDetector secondDetector = PanGestureDetector::New(); + PanGestureDetector secondDetector = PanGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); @@ -1006,7 +1012,7 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) // Pan in actor's area - both detector's functors should be called uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -1015,7 +1021,7 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) firstData.Reset(); secondData.Reset(); - TestMovePan( application, Vector2(10.0f, 20.0f), time ); + TestMovePan(application, Vector2(10.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); @@ -1026,7 +1032,7 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) firstData.Reset(); secondData.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -1035,7 +1041,7 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) firstData.Reset(); secondData.Reset(); - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -1045,7 +1051,7 @@ int UtcDaliPanGestureSignalReceptionMultipleDetectorsOnActor(void) firstData.Reset(); secondData.Reset(); - TestMovePan( application, Vector2(10.0f, 20.0f), time ); + TestMovePan(application, Vector2(10.0f, 20.0f), time); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION); @@ -1058,23 +1064,23 @@ int UtcDaliPanGestureSignalReceptionEnsureCorrectSignalling(void) TestApplication application; Actor actor1 = Actor::New(); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor1); - SignalData data1; + SignalData data1; GestureReceivedFunctor functor1(data1); - PanGestureDetector detector1 = PanGestureDetector::New(); + PanGestureDetector detector1 = PanGestureDetector::New(); detector1.Attach(actor1); detector1.DetectedSignal().Connect(&application, functor1); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); - actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT); application.GetScene().Add(actor2); - SignalData data2; + SignalData data2; GestureReceivedFunctor functor2(data2); - PanGestureDetector detector2 = PanGestureDetector::New(); + PanGestureDetector detector2 = PanGestureDetector::New(); detector2.Attach(actor2); detector2.DetectedSignal().Connect(&application, functor2); @@ -1084,7 +1090,7 @@ int UtcDaliPanGestureSignalReceptionEnsureCorrectSignalling(void) // Start pan in actor1's area, only data1 should be set uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); @@ -1098,8 +1104,8 @@ int UtcDaliPanGestureSignalReceptionAttachActorAfterDown(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1108,31 +1114,31 @@ int UtcDaliPanGestureSignalReceptionAttachActorAfterDown(void) // Gesture possible in actor's area (using long-press) uint32_t time = 100; - TestStartLongPress( application, 10.0f, 20.0f, time ); + TestStartLongPress(application, 10.0f, 20.0f, time); time += TestGetFrameInterval(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); - PanGestureDetector detector = PanGestureDetector::New(); - detector.DetectedSignal().Connect( &application, functor ); + SignalData data; + GestureReceivedFunctor functor(data); + PanGestureDetector detector = PanGestureDetector::New(); + detector.DetectedSignal().Connect(&application, functor); detector.Attach(actor); // Start a pan, initially it'll only be possible, we shouldn't receive it - TestMovePan( application, Vector2( 10.0f, 20.0f ), time ); + TestMovePan(application, Vector2(10.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Now the pan truly starts, we should receive a signal - TestMovePan( application, Vector2( 26.0f, 20.0f ), time ); + TestMovePan(application, Vector2(26.0f, 20.0f), time); time += TestGetFrameInterval(); - TestMovePan( application, Vector2( 32.0f, 32.0f ), time ); + TestMovePan(application, Vector2(32.0f, 32.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Finish the pan, we should still receive a signal data.Reset(); - TestEndPan( application, Vector2( 32.0f, 32.0f ), time ); + TestEndPan(application, Vector2(32.0f, 32.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; @@ -1146,28 +1152,28 @@ int UtcDaliPanGestureSignalReceptionAttachActorAfterDownAfterInitialPanToAnother TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( parent ); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - parent.Add( child ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + parent.Add(child); // Create detector for parent and attach - SignalData parentData; - GestureReceivedFunctor parentFunctor( parentData ); - PanGestureDetector parentDetector = PanGestureDetector::New(); - parentDetector.DetectedSignal().Connect( &application, parentFunctor ); - parentDetector.Attach( parent ); + SignalData parentData; + GestureReceivedFunctor parentFunctor(parentData); + PanGestureDetector parentDetector = PanGestureDetector::New(); + parentDetector.DetectedSignal().Connect(&application, parentFunctor); + parentDetector.Attach(parent); // Create detector for child but do not attach - SignalData childData; - GestureReceivedFunctor childFunctor( childData ); - PanGestureDetector childDetector = PanGestureDetector::New(); - childDetector.DetectedSignal().Connect( &application, childFunctor ); + SignalData childData; + GestureReceivedFunctor childFunctor(childData); + PanGestureDetector childDetector = PanGestureDetector::New(); + childDetector.DetectedSignal().Connect(&application, childFunctor); // Render and notify application.SendNotification(); @@ -1175,40 +1181,40 @@ int UtcDaliPanGestureSignalReceptionAttachActorAfterDownAfterInitialPanToAnother // Do a full pan in both actors' area, only the parent's functor should be called uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - DALI_TEST_EQUALS( parentData.functorCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + DALI_TEST_EQUALS(parentData.functorCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION); parentData.Reset(); childData.Reset(); - TestEndPan( application, Vector2( 26.0f, 20.0f ), time ); - DALI_TEST_EQUALS( parentData.functorCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION ); + TestEndPan(application, Vector2(26.0f, 20.0f), time); + DALI_TEST_EQUALS(parentData.functorCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION); parentData.Reset(); childData.Reset(); // Gesture possible in both actors' area (using long-press), no functors called - TestStartLongPress( application, 10.0f, 20.0f, time ); + TestStartLongPress(application, 10.0f, 20.0f, time); time += TestGetFrameInterval(); - DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION); // Attach the child as well now - childDetector.Attach( child ); + childDetector.Attach(child); // Now the pan truly starts, we should receive a signal for the child only - TestMovePan( application, Vector2( 26.0f, 20.0f ), time ); + TestMovePan(application, Vector2(26.0f, 20.0f), time); time += TestGetFrameInterval(); - TestMovePan( application, Vector2( 32.0f, 32.0f ), time ); + TestMovePan(application, Vector2(32.0f, 32.0f), time); time += TestGetFrameInterval(); - DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( childData.functorCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(childData.functorCalled, true, TEST_LOCATION); parentData.Reset(); childData.Reset(); // Finish the pan, again only the child should still receive a signal - TestEndPan( application, Vector2( 32.0f, 32.0f ), time ); - DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( childData.functorCalled, true, TEST_LOCATION ); + TestEndPan(application, Vector2(32.0f, 32.0f), time); + DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(childData.functorCalled, true, TEST_LOCATION); END_TEST; } @@ -1218,8 +1224,8 @@ int UtcDaliPanGestureSignalReceptionDifferentPossible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1227,57 +1233,57 @@ int UtcDaliPanGestureSignalReceptionDifferentPossible(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); - PanGestureDetector detector = PanGestureDetector::New(); + SignalData data; + GestureReceivedFunctor functor(data); + PanGestureDetector detector = PanGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Gesture possible in actor's area. uint32_t time = 100; - TestStartLongPress( application, 10.0f, 20.0f, time ); + TestStartLongPress(application, 10.0f, 20.0f, time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor somewhere else - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit STARTED event, we should not receive the pan. - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // LONG_PRESS possible in empty area. - TestStartLongPress( application, 10.0f, 20.0f, time ); + TestStartLongPress(application, 10.0f, 20.0f, time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor in to the long press position. - actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit STARTED event, we should be receiving the pan now. - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Normal pan in actor's area for completeness. data.Reset(); - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1287,8 +1293,8 @@ int UtcDaliPanGestureActorUnstaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1296,23 +1302,23 @@ int UtcDaliPanGestureActorUnstaged(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); - PanGestureDetector detector = PanGestureDetector::New(); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); + PanGestureDetector detector = PanGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit signals uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPan( application, Vector2(26.0f, 20.0f), time ); + TestEndPan(application, Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1332,19 +1338,19 @@ int UtcDaliPanGestureActorUnstaged(void) stateToUnstage = GestureState::CONTINUING; // Emit signals - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1364,21 +1370,21 @@ int UtcDaliPanGestureActorUnstaged(void) stateToUnstage = GestureState::FINISHED; // Emit signals - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully. + tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully. END_TEST; } @@ -1387,15 +1393,15 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Create and add a second actor so that GestureDetector destruction does not come into play. - Actor dummyActor( Actor::New() ); - dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + Actor dummyActor(Actor::New()); + dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(dummyActor); // Render and notify @@ -1403,15 +1409,15 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); - PanGestureDetector detector = PanGestureDetector::New(); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); + PanGestureDetector detector = PanGestureDetector::New(); detector.Attach(actor); detector.Attach(dummyActor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back // before we get a continuing state. As we were removed from the stage, even if we're at the same @@ -1419,7 +1425,7 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) // Emit signals uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1436,13 +1442,13 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -1451,7 +1457,7 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) // Here we delete an actor in started, we should not receive any subsequent signalling. // Emit signals - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1468,13 +1474,13 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPan( application, Vector2(10.0f, 4.0f), time ); + TestEndPan(application, Vector2(10.0f, 4.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -1485,48 +1491,48 @@ int UtcDaliPanGestureAngleHandling(void) TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION); - detector.AddAngle( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 1u, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_LEFT, Radian(Math::PI * 0.25)); + DALI_TEST_EQUALS(detector.GetAngleCount(), 1u, TEST_LOCATION); bool found = false; - for( size_t i = 0; i < detector.GetAngleCount(); i++) + for(size_t i = 0; i < detector.GetAngleCount(); i++) { - if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT ) + if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT) { - tet_result( TET_PASS ); + tet_result(TET_PASS); found = true; break; } } - if(!found ) + if(!found) { - tet_printf("%s, angle not added\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + tet_printf("%s, angle not added\n", TEST_LOCATION); + tet_result(TET_FAIL); } - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Radian( Math::PI * 0.25 ) ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Radian(Math::PI * 0.25)); + DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION); // Remove something not in the container. - detector.RemoveAngle( PanGestureDetector::DIRECTION_UP ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION ); + detector.RemoveAngle(PanGestureDetector::DIRECTION_UP); + DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION); - detector.RemoveAngle( PanGestureDetector::DIRECTION_RIGHT ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 1u, TEST_LOCATION ); - for ( size_t i = 0; i < detector.GetAngleCount(); i++) + detector.RemoveAngle(PanGestureDetector::DIRECTION_RIGHT); + DALI_TEST_EQUALS(detector.GetAngleCount(), 1u, TEST_LOCATION); + for(size_t i = 0; i < detector.GetAngleCount(); i++) { - if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT ) + if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT) { - tet_printf("%s, angle not removed\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + tet_printf("%s, angle not removed\n", TEST_LOCATION); + tet_result(TET_FAIL); break; } } detector.ClearAngles(); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1535,29 +1541,29 @@ int UtcDaliPanGestureGetAngle(void) TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0, TEST_LOCATION); - detector.AddAngle( PanGestureDetector::DIRECTION_LEFT ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 1, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_LEFT); + DALI_TEST_EQUALS(detector.GetAngleCount(), 1, TEST_LOCATION); - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT); + DALI_TEST_EQUALS(detector.GetAngleCount(), 2, TEST_LOCATION); - detector.AddAngle( PanGestureDetector::DIRECTION_UP ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 3, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_UP); + DALI_TEST_EQUALS(detector.GetAngleCount(), 3, TEST_LOCATION); - detector.AddAngle( PanGestureDetector::DIRECTION_DOWN ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 4, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_DOWN); + DALI_TEST_EQUALS(detector.GetAngleCount(), 4, TEST_LOCATION); - DALI_TEST_EQUALS( detector.GetAngle(0).first, PanGestureDetector::DIRECTION_LEFT, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetAngle(1).first, PanGestureDetector::DIRECTION_RIGHT, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetAngle(2).first, PanGestureDetector::DIRECTION_UP, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetAngle(3).first, PanGestureDetector::DIRECTION_DOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngle(0).first, PanGestureDetector::DIRECTION_LEFT, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetAngle(1).first, PanGestureDetector::DIRECTION_RIGHT, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetAngle(2).first, PanGestureDetector::DIRECTION_UP, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetAngle(3).first, PanGestureDetector::DIRECTION_DOWN, TEST_LOCATION); END_TEST; } -inline float RadiansToDegrees( float radian ) +inline float RadiansToDegrees(float radian) { return radian * 180.0f / Math::PI; } @@ -1567,58 +1573,58 @@ int UtcDaliPanGestureAngleOutOfRange(void) TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION); // // Angle // - detector.AddAngle( Degree(180.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-180.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(180.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-180.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(190.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-170.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(190.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-170.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(-190.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(170.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(-190.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(170.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(350.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(350.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-10.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(-350.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(-350.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(370.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(370.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( Degree(-370.0f) ); - DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(Degree(-370.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-10.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); // // Threshold // - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 0.0f ) ); - DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(0.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(0.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(0.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -10.0f ) ); - DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(-10.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -181.0f ) ); - DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(-181.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(180.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); - detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 181.0f ) ); - DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION ); + detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(181.0f)); + DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(180.0f)), 0.000001, TEST_LOCATION); detector.ClearAngles(); END_TEST; } @@ -1628,13 +1634,13 @@ int UtcDaliPanGestureAngleProcessing(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(child); // Render and notify @@ -1643,61 +1649,61 @@ int UtcDaliPanGestureAngleProcessing(void) // Parent detector only requires up pans PanGestureDetector parentDetector = PanGestureDetector::New(); - parentDetector.Attach( parent ); - parentDetector.AddAngle( PanGestureDetector::DIRECTION_UP, Degree( 30.0f ) ); - SignalData parentData; + parentDetector.Attach(parent); + parentDetector.AddAngle(PanGestureDetector::DIRECTION_UP, Degree(30.0f)); + SignalData parentData; GestureReceivedFunctor parentFunctor(parentData); parentDetector.DetectedSignal().Connect(&application, parentFunctor); // Child detector only requires right pans PanGestureDetector childDetector = PanGestureDetector::New(); - childDetector.Attach( child ); - childDetector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 30.0f ) ); - SignalData childData; + childDetector.Attach(child); + childDetector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(30.0f)); + SignalData childData; GestureReceivedFunctor childFunctor(childData); childDetector.DetectedSignal().Connect(&application, childFunctor); // Generate an Up pan gesture, only parent should receive it. uint32_t time = 100; - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 4.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 4.0f), time); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 4.0f), time ); + TestEndPan(application, Vector2(20.0f, 4.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Right pan gesture, only child should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 36.0f, 20.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(36.0f, 20.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(4.0f, 20.0f), time ); + TestEndPan(application, Vector2(4.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Down pan gesture, no one should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 36.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 36.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 36.0f), time ); + TestEndPan(application, Vector2(20.0f, 36.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Left pan gesture, no one should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 20.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 20.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(4.0f, 20.0f), time ); + TestEndPan(application, Vector2(4.0f, 20.0f), time); parentData.Reset(); childData.Reset(); END_TEST; @@ -1708,51 +1714,50 @@ int UtcDaliPanGestureDirectionHandling(void) TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION); - detector.AddDirection( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION ); + detector.AddDirection(PanGestureDetector::DIRECTION_LEFT, Radian(Math::PI * 0.25)); + DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION); bool found = false; - for ( size_t i = 0; detector.GetAngleCount(); i++) + for(size_t i = 0; detector.GetAngleCount(); i++) { - if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT ) + if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT) { - tet_result( TET_PASS ); + tet_result(TET_PASS); found = true; break; } - } - if (!found ) + if(!found) { - tet_printf("%s, angle not added\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + tet_printf("%s, angle not added\n", TEST_LOCATION); + tet_result(TET_FAIL); } found = false; - for( size_t i = 0; i < detector.GetAngleCount(); i++) + for(size_t i = 0; i < detector.GetAngleCount(); i++) { - if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT ) + if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT) { - tet_result( TET_PASS ); + tet_result(TET_PASS); found = true; break; } } - if(!found ) + if(!found) { - tet_printf("%s, angle not added\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + tet_printf("%s, angle not added\n", TEST_LOCATION); + tet_result(TET_FAIL); } // Remove something not in the container. - detector.RemoveDirection( PanGestureDetector::DIRECTION_UP ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION ); + detector.RemoveDirection(PanGestureDetector::DIRECTION_UP); + DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION); - detector.RemoveDirection( PanGestureDetector::DIRECTION_RIGHT ); - DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION ); + detector.RemoveDirection(PanGestureDetector::DIRECTION_RIGHT); + DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1761,13 +1766,13 @@ int UtcDaliPanGestureDirectionProcessing(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(child); // Render and notify @@ -1776,94 +1781,94 @@ int UtcDaliPanGestureDirectionProcessing(void) // Parent detector only requires vertical panning PanGestureDetector parentDetector = PanGestureDetector::New(); - parentDetector.Attach( parent ); - parentDetector.AddDirection( PanGestureDetector::DIRECTION_VERTICAL, Degree( 30.0f ) ); - SignalData parentData; + parentDetector.Attach(parent); + parentDetector.AddDirection(PanGestureDetector::DIRECTION_VERTICAL, Degree(30.0f)); + SignalData parentData; GestureReceivedFunctor parentFunctor(parentData); parentDetector.DetectedSignal().Connect(&application, parentFunctor); // Child detector only requires horizontal panning PanGestureDetector childDetector = PanGestureDetector::New(); - childDetector.Attach( child ); - childDetector.AddDirection( PanGestureDetector::DIRECTION_HORIZONTAL, Degree( 30.0f ) ); - SignalData childData; + childDetector.Attach(child); + childDetector.AddDirection(PanGestureDetector::DIRECTION_HORIZONTAL, Degree(30.0f)); + SignalData childData; GestureReceivedFunctor childFunctor(childData); childDetector.DetectedSignal().Connect(&application, childFunctor); // Generate an Up pan gesture, only parent should receive it. uint32_t time = 100; - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 4.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 4.0f), time); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Right pan gesture, only child should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 36.0f, 20.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(36.0f, 20.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Down pan gesture, only parent should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 36.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 36.0f), time); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a Left pan gesture, only child should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 20.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 20.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a pan at -45 degrees, no one should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 9.0f, 31.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(9.0f, 31.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a pan at 45 degrees, no one should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 31.0f, 31.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(31.0f, 31.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); time += TestGetFrameInterval(); parentData.Reset(); childData.Reset(); // Generate a pan at -135 degrees, no one should receive it. - TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 4.0f ), time ); + TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 4.0f), time); - DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION); - TestEndPan( application, Vector2(20.0f, 20.0f), time ); + TestEndPan(application, Vector2(20.0f, 20.0f), time); parentData.Reset(); childData.Reset(); END_TEST; @@ -1876,57 +1881,57 @@ int UtcDaliPanGestureNoPredictionNoSmoothing(void) Integration::SetPanGestureSmoothingMode(0); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 1.0f, 1.0f ); - Vector2 position( -14.0f, 1.0f ); - Vector2 direction(Vector2::XAXIS * -5.0f); + Vector2 startPosition(1.0f, 1.0f); + Vector2 position(-14.0f, 1.0f); + Vector2 direction(Vector2::XAXIS * -5.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 47; i++ ) + for(int i = 0; i < 47; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -1939,58 +1944,58 @@ int UtcDaliPanGestureNoPredictionSmoothing(void) Integration::SetPanGestureSmoothingMode(1); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 1.0f, 1.0f ); - Vector2 position( -14.0f, 1.0f ); - Vector2 direction(Vector2::XAXIS * -5.0f); + Vector2 startPosition(1.0f, 1.0f); + Vector2 position(-14.0f, 1.0f); + Vector2 direction(Vector2::XAXIS * -5.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 47; i++ ) + for(int i = 0; i < 47; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); // Take into account resampling done when prediction is off. - DALI_TEST_EQUALS( constraintData.screenPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION ); + DALI_TEST_EQUALS(constraintData.screenPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2003,57 +2008,57 @@ int UtcDaliPanGesturePredictionNoSmoothing(void) Integration::SetPanGestureSmoothingMode(0); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 1.0f, 1.0f ); - Vector2 position( -1.0f, 1.0f ); - Vector2 direction(Vector2::XAXIS * -1.0f); + Vector2 startPosition(1.0f, 1.0f); + Vector2 position(-1.0f, 1.0f); + Vector2 direction(Vector2::XAXIS * -1.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 47; i++ ) + for(int i = 0; i < 47; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2066,57 +2071,57 @@ int UtcDaliPanGesturePredictionSmoothing01(void) Integration::SetPanGestureSmoothingMode(1); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 1.0f, 1.0f ); - Vector2 position( -1.0f, 1.0f ); - Vector2 direction(Vector2::XAXIS * -1.0f); + Vector2 startPosition(1.0f, 1.0f); + Vector2 position(-1.0f, 1.0f); + Vector2 direction(Vector2::XAXIS * -1.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 47; i++ ) + for(int i = 0; i < 47; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2125,98 +2130,98 @@ int UtcDaliPanGesturePredictionSmoothing01(void) int UtcDaliPanGesturePredictionSmoothing02(void) { TestApplication application; - Integration::SetPanGesturePredictionMode( 1 ); - Integration::SetPanGestureMaximumPredictionAmount( 1 ); - Integration::SetPanGesturePredictionAmountAdjustment( 2 ); - Integration::SetPanGestureSmoothingMode( 1 ); - Integration::SetPanGestureSmoothingAmount( 0.25f ); + Integration::SetPanGesturePredictionMode(1); + Integration::SetPanGestureMaximumPredictionAmount(1); + Integration::SetPanGesturePredictionAmountAdjustment(2); + Integration::SetPanGestureSmoothingMode(1); + Integration::SetPanGestureSmoothingAmount(0.25f); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 2.0f, 2.0f ); - Vector2 position( 4.0f, 2.0f ); - Vector2 directionX(Vector2::XAXIS); - Vector2 directionY(Vector2::YAXIS); + Vector2 startPosition(2.0f, 2.0f); + Vector2 position(4.0f, 2.0f); + Vector2 directionX(Vector2::XAXIS); + Vector2 directionY(Vector2::YAXIS); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 7; i++ ) + for(int i = 0; i < 7; i++) { position += directionX; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } position += directionX * 10.0f; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - for(int i = 0; i < 2; i++ ) + for(int i = 0; i < 2; i++) { - position += ( directionX * -1.0f ); - TestMovePan( application, position, time ); + position += (directionX * -1.0f); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += directionX; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += directionY; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2226,70 +2231,70 @@ int UtcDaliPanGesturePrediction2SmoothingMultiTap01(void) { TestApplication application; - Integration::SetPanGesturePredictionMode( 2 ); - Integration::SetPanGesturePredictionAmount( 57 ); - Integration::SetPanGestureSmoothingMode( 2 ); - Integration::SetPanGestureUseActualTimes( false ); - Integration::SetPanGestureInterpolationTimeRange( 10 ); - Integration::SetPanGestureScalarOnlyPredictionEnabled( false ); - Integration::SetPanGestureTwoPointPredictionEnabled( true ); - Integration::SetPanGestureTwoPointInterpolatePastTime( 42 ); - Integration::SetPanGestureTwoPointVelocityBias( 0.35f ); - Integration::SetPanGestureTwoPointAccelerationBias( 0.10f ); - Integration::SetPanGestureMultitapSmoothingRange( 34 ); + Integration::SetPanGesturePredictionMode(2); + Integration::SetPanGesturePredictionAmount(57); + Integration::SetPanGestureSmoothingMode(2); + Integration::SetPanGestureUseActualTimes(false); + Integration::SetPanGestureInterpolationTimeRange(10); + Integration::SetPanGestureScalarOnlyPredictionEnabled(false); + Integration::SetPanGestureTwoPointPredictionEnabled(true); + Integration::SetPanGestureTwoPointInterpolatePastTime(42); + Integration::SetPanGestureTwoPointVelocityBias(0.35f); + Integration::SetPanGestureTwoPointAccelerationBias(0.10f); + Integration::SetPanGestureMultitapSmoothingRange(34); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 2.0f, 2.0f ); - Vector2 position( -1.0f, 2.0f ); - Vector2 direction(Vector2::XAXIS * -1.0f); + Vector2 startPosition(2.0f, 2.0f); + Vector2 position(-1.0f, 2.0f); + Vector2 direction(Vector2::XAXIS * -1.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 27; i++ ) + for(int i = 0; i < 27; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2299,103 +2304,103 @@ int UtcDaliPanGesturePrediction2SmoothingMultiTap02(void) { TestApplication application; - Integration::SetPanGesturePredictionMode( 2 ); - Integration::SetPanGestureSmoothingMode( 2 ); - Integration::SetPanGestureUseActualTimes( true ); - Integration::SetPanGestureInterpolationTimeRange( 10 ); - Integration::SetPanGestureScalarOnlyPredictionEnabled( true ); - Integration::SetPanGestureTwoPointPredictionEnabled( true ); - Integration::SetPanGestureTwoPointInterpolatePastTime( 42 ); - Integration::SetPanGestureTwoPointVelocityBias( 0.35f ); - Integration::SetPanGestureTwoPointAccelerationBias( 0.10f ); - Integration::SetPanGestureMultitapSmoothingRange( 34 ); + Integration::SetPanGesturePredictionMode(2); + Integration::SetPanGestureSmoothingMode(2); + Integration::SetPanGestureUseActualTimes(true); + Integration::SetPanGestureInterpolationTimeRange(10); + Integration::SetPanGestureScalarOnlyPredictionEnabled(true); + Integration::SetPanGestureTwoPointPredictionEnabled(true); + Integration::SetPanGestureTwoPointInterpolatePastTime(42); + Integration::SetPanGestureTwoPointVelocityBias(0.35f); + Integration::SetPanGestureTwoPointAccelerationBias(0.10f); + Integration::SetPanGestureMultitapSmoothingRange(34); - Integration::EnableProfiling( Integration::PROFILING_TYPE_PAN_GESTURE ); + Integration::EnableProfiling(Integration::PROFILING_TYPE_PAN_GESTURE); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 2.0f, 2.0f ); - Vector2 position( 17.0f, 2.0f ); - Vector2 direction(Vector2::XAXIS * -1.0f); + Vector2 startPosition(2.0f, 2.0f); + Vector2 position(17.0f, 2.0f); + Vector2 direction(Vector2::XAXIS * -1.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2405,101 +2410,100 @@ int UtcDaliPanGesturePrediction2Smoothing(void) { TestApplication application; - Integration::SetPanGesturePredictionMode( 2 ); - Integration::SetPanGesturePredictionAmount( 57 ); - Integration::SetPanGestureSmoothingMode( 1 ); - Integration::SetPanGestureUseActualTimes( false ); - Integration::SetPanGestureInterpolationTimeRange( 10 ); - Integration::SetPanGestureScalarOnlyPredictionEnabled( true ); - Integration::SetPanGestureTwoPointPredictionEnabled( true ); - Integration::SetPanGestureTwoPointInterpolatePastTime( 42 ); - Integration::SetPanGestureTwoPointVelocityBias( 0.35f ); - Integration::SetPanGestureTwoPointAccelerationBias( 0.10f ); - Integration::SetPanGestureMultitapSmoothingRange( 34 ); + Integration::SetPanGesturePredictionMode(2); + Integration::SetPanGesturePredictionAmount(57); + Integration::SetPanGestureSmoothingMode(1); + Integration::SetPanGestureUseActualTimes(false); + Integration::SetPanGestureInterpolationTimeRange(10); + Integration::SetPanGestureScalarOnlyPredictionEnabled(true); + Integration::SetPanGestureTwoPointPredictionEnabled(true); + Integration::SetPanGestureTwoPointInterpolatePastTime(42); + Integration::SetPanGestureTwoPointVelocityBias(0.35f); + Integration::SetPanGestureTwoPointAccelerationBias(0.10f); + Integration::SetPanGestureMultitapSmoothingRange(34); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 startPosition( 2.0f, 2.0f ); - Vector2 position( 17.0f, 2.0f ); - Vector2 direction(Vector2::XAXIS * -1.0f); + Vector2 startPosition(2.0f, 2.0f); + Vector2 position(17.0f, 2.0f); + Vector2 direction(Vector2::XAXIS * -1.0f); uint32_t time = 100; - TestStartPan( application, startPosition, position, time ); + TestStartPan(application, startPosition, position, time); - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - for(int i = 0; i < 5; i++ ) + for(int i = 0; i < 5; i++) { application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - for(int i = 0; i < 10; i++ ) + for(int i = 0; i < 10; i++) { position += direction; - TestMovePan( application, position, time ); + TestMovePan(application, position, time); time += TestGetFrameInterval(); application.SendNotification(); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); } - TestEndPan( application, position, time ); + TestEndPan(application, position, time); application.Render(TestApplication::DEFAULT_RENDER_INTERVAL); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION); constraintData.Reset(); END_TEST; @@ -2507,36 +2511,36 @@ int UtcDaliPanGesturePrediction2Smoothing(void) int UtcDaliPanGestureSetProperties(void) { - TestApplication application; - TestRenderController& renderController( application.GetRenderController() ); + TestApplication application; + TestRenderController& renderController(application.GetRenderController()); Integration::SetPanGesturePredictionMode(0); Integration::SetPanGestureSmoothingMode(0); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); - Property::Index animatableGestureProperty = detector.RegisterProperty( "Dummy Property", Vector3::ZERO ); // For code coverage + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); + Property::Index animatableGestureProperty = detector.RegisterProperty("Dummy Property", Vector3::ZERO); // For code coverage ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); - constraint.AddSource( Source( detector, animatableGestureProperty ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); + constraint.AddSource(Source(detector, animatableGestureProperty)); constraint.Apply(); // Render and notify @@ -2544,29 +2548,29 @@ int UtcDaliPanGestureSetProperties(void) application.Render(); renderController.Initialize(); - DALI_TEST_EQUALS( renderController.WasCalled( TestRenderController::RequestUpdateFunc ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(renderController.WasCalled(TestRenderController::RequestUpdateFunc), false, TEST_LOCATION); - Vector2 screenPosition( 20.0f, 20.0f ); - Vector2 screenDisplacement( 1.0f, 1.0f ); - Vector2 screenVelocity( 1.3f, 4.0f ); - Vector2 localPosition( 21.0f, 21.0f ); - Vector2 localDisplacement( 0.5f, 0.5f ); - Vector2 localVelocity( 1.5f, 2.5f ); + Vector2 screenPosition(20.0f, 20.0f); + Vector2 screenDisplacement(1.0f, 1.0f); + Vector2 screenVelocity(1.3f, 4.0f); + Vector2 localPosition(21.0f, 21.0f); + Vector2 localDisplacement(0.5f, 0.5f); + Vector2 localVelocity(1.5f, 2.5f); - PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity ) ); - DALI_TEST_EQUALS( renderController.WasCalled( TestRenderController::RequestUpdateFunc ), true, TEST_LOCATION ); + PanGestureDetector::SetPanGestureProperties(GeneratePan(1u, GestureState::STARTED, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity)); + DALI_TEST_EQUALS(renderController.WasCalled(TestRenderController::RequestUpdateFunc), true, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, screenPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, localPosition, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenDisplacement, screenDisplacement, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localDisplacement, localDisplacement, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenVelocity, screenVelocity, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localVelocity, localVelocity, TEST_LOCATION ); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, screenPosition, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, localPosition, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenDisplacement, screenDisplacement, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localDisplacement, localDisplacement, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenVelocity, screenVelocity, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localVelocity, localVelocity, TEST_LOCATION); constraintData.Reset(); END_TEST; } @@ -2577,64 +2581,64 @@ int UtcDaliPanGestureSetPropertiesAlreadyPanning(void) Integration::SetPanGesturePredictionMode(0); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); - Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO ); + Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO); ConstraintData constraintData; - Constraint constraint = Constraint::New( actor, property, PanConstraint( constraintData ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) ); - constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) ); + Constraint constraint = Constraint::New(actor, property, PanConstraint(constraintData)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY)); + constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING)); constraint.Apply(); // Render and notify application.SendNotification(); application.Render(); - Vector2 currentPosition( 20.0f, 4.0f ); + Vector2 currentPosition(20.0f, 4.0f); uint32_t time = 100; - TestStartPan( application, Vector2( 20.0f, 20.0f ), currentPosition, time ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + TestStartPan(application, Vector2(20.0f, 20.0f), currentPosition, time); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - Vector2 screenPosition( 100.0f, 20.0f ); - Vector2 localPosition( 110.0f, 110.0f ); + Vector2 screenPosition(100.0f, 20.0f); + Vector2 localPosition(110.0f, 110.0f); - PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition ) ); + PanGestureDetector::SetPanGestureProperties(GeneratePan(1u, GestureState::STARTED, screenPosition, localPosition)); // Render and notify application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.screenPosition, currentPosition, 0.1, TEST_LOCATION ); - DALI_TEST_EQUALS( constraintData.localPosition, currentPosition, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.screenPosition, currentPosition, 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(constraintData.localPosition, currentPosition, 0.1f, TEST_LOCATION); constraintData.Reset(); END_TEST; } int UtcDaliPanGesturePropertyIndices(void) { - TestApplication application; + TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); Property::IndexContainer indices; - detector.GetPropertyIndices( indices ); - DALI_TEST_CHECK( indices.Size() ); - DALI_TEST_EQUALS( indices.Size(), detector.GetPropertyCount(), TEST_LOCATION ); + detector.GetPropertyIndices(indices); + DALI_TEST_CHECK(indices.Size()); + DALI_TEST_EQUALS(indices.Size(), detector.GetPropertyCount(), TEST_LOCATION); END_TEST; } @@ -2642,40 +2646,39 @@ namespace { struct PropertyStringIndex { - const char * const name; + const char* const name; const Property::Index index; - const Property::Type type; + const Property::Type type; const Property::Value value; }; const PropertyStringIndex PROPERTY_TABLE[] = -{ - { "screenPosition", PanGestureDetector::Property::SCREEN_POSITION, Property::VECTOR2, Vector2::ZERO }, - { "screenDisplacement", PanGestureDetector::Property::SCREEN_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO }, - { "screenVelocity", PanGestureDetector::Property::SCREEN_VELOCITY, Property::VECTOR2, Vector2::ZERO }, - { "localPosition", PanGestureDetector::Property::LOCAL_POSITION, Property::VECTOR2, Vector2::ZERO }, - { "localDisplacement", PanGestureDetector::Property::LOCAL_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO }, - { "localVelocity", PanGestureDetector::Property::LOCAL_VELOCITY, Property::VECTOR2, Vector2::ZERO }, - { "panning", PanGestureDetector::Property::PANNING, Property::BOOLEAN, false }, + { + {"screenPosition", PanGestureDetector::Property::SCREEN_POSITION, Property::VECTOR2, Vector2::ZERO}, + {"screenDisplacement", PanGestureDetector::Property::SCREEN_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO}, + {"screenVelocity", PanGestureDetector::Property::SCREEN_VELOCITY, Property::VECTOR2, Vector2::ZERO}, + {"localPosition", PanGestureDetector::Property::LOCAL_POSITION, Property::VECTOR2, Vector2::ZERO}, + {"localDisplacement", PanGestureDetector::Property::LOCAL_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO}, + {"localVelocity", PanGestureDetector::Property::LOCAL_VELOCITY, Property::VECTOR2, Vector2::ZERO}, + {"panning", PanGestureDetector::Property::PANNING, Property::BOOLEAN, false}, }; -const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] ); +const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]); } // unnamed namespace - int UtcDaliPanGestureProperties(void) { - TestApplication application; + TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i ) + for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i) { - DALI_TEST_EQUALS( detector.GetPropertyName( PROPERTY_TABLE[ i ].index ), std::string( PROPERTY_TABLE[ i ].name ), TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetPropertyIndex( PROPERTY_TABLE[ i ].name ), PROPERTY_TABLE[ i ].index, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.GetPropertyType( PROPERTY_TABLE[ i ].index ), PROPERTY_TABLE[ i ].type, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.IsPropertyWritable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.IsPropertyAnimatable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( PROPERTY_TABLE[ i ].index ), true, TEST_LOCATION ); - detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage + DALI_TEST_EQUALS(detector.GetPropertyName(PROPERTY_TABLE[i].index), std::string(PROPERTY_TABLE[i].name), TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION); + DALI_TEST_EQUALS(detector.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION); + DALI_TEST_EQUALS(detector.IsPropertyWritable(PROPERTY_TABLE[i].index), false, TEST_LOCATION); + DALI_TEST_EQUALS(detector.IsPropertyAnimatable(PROPERTY_TABLE[i].index), false, TEST_LOCATION); + DALI_TEST_EQUALS(detector.IsPropertyAConstraintInput(PROPERTY_TABLE[i].index), true, TEST_LOCATION); + detector.SetProperty(PROPERTY_TABLE[i].index, Property::Value()); // Just for Coverage } END_TEST; @@ -2683,20 +2686,20 @@ int UtcDaliPanGestureProperties(void) int UtcDaliPanGestureGetProperty(void) { - TestApplication application; + TestApplication application; PanGestureDetector detector = PanGestureDetector::New(); - for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i ) + for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i) { - if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 ) + if(PROPERTY_TABLE[i].type == Property::VECTOR2) { - bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >(); - DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION ); + bool value = detector.GetProperty(PROPERTY_TABLE[i].index).Get(); + DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get(), value, TEST_LOCATION); } - else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN ) + else if(PROPERTY_TABLE[i].type == Property::BOOLEAN) { - Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >(); - DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION ); + Vector2 value = detector.GetProperty(PROPERTY_TABLE[i].index).Get(); + DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get(), value, TEST_LOCATION); } } @@ -2708,31 +2711,31 @@ int UtcDaliPanGestureGetPropertyWithSceneObject(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); + detector.Attach(actor); // Render and notify application.SendNotification(); application.Render(); - for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i ) + for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i) { - detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage + detector.SetProperty(PROPERTY_TABLE[i].index, Property::Value()); // Just for Coverage - if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 ) + if(PROPERTY_TABLE[i].type == Property::VECTOR2) { - bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >(); - DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION ); + bool value = detector.GetProperty(PROPERTY_TABLE[i].index).Get(); + DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get(), value, TEST_LOCATION); } - else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN ) + else if(PROPERTY_TABLE[i].type == Property::BOOLEAN) { - Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >(); - DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION ); + Vector2 value = detector.GetProperty(PROPERTY_TABLE[i].index).Get(); + DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get(), value, TEST_LOCATION); } } @@ -2744,22 +2747,22 @@ int UtcDaliPanGestureLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -2768,23 +2771,23 @@ int UtcDaliPanGestureLayerConsumesTouch(void) // Emit signals, should receive uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2(26.0f, 20.0f), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2(26.0f, 20.0f), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -2797,16 +2800,16 @@ int UtcDaliPanGestureNoTimeDiff(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector PanGestureDetector detector = PanGestureDetector::New(); - detector.Attach( actor ); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); // Render and notify application.SendNotification(); @@ -2814,16 +2817,16 @@ int UtcDaliPanGestureNoTimeDiff(void) // As normal helper function adds intervals between presses we must generate the sequence // using other helper functions - TestStartLongPress( application, 10.0f, 20.0f, 100 ); // Used to send a down press event - TestMovePan( application, Vector2(26.0f, 20.0f), 100 ); - TestMovePan( application, Vector2(26.0f, 20.0f), 100 ); // 2 motions required to trigger - TestEndPan( application, Vector2(26.0f, 20.0f), 100 ); + TestStartLongPress(application, 10.0f, 20.0f, 100); // Used to send a down press event + TestMovePan(application, Vector2(26.0f, 20.0f), 100); + TestMovePan(application, Vector2(26.0f, 20.0f), 100); // 2 motions required to trigger + TestEndPan(application, Vector2(26.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().x ) ); - DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().y ) ); - DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().x ) ); - DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().y ) ); + DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetVelocity().x)); + DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetVelocity().y)); + DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetScreenVelocity().x)); + DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetScreenVelocity().y)); data.Reset(); data.Reset(); @@ -2836,19 +2839,19 @@ int UtcDaliPanGestureInterruptedWhenTouchConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); - bool consume = false; + bool consume = false; TouchEventFunctorConsumeSetter touchFunctor(consume); - actor.TouchedSignal().Connect(&application,touchFunctor); + actor.TouchedSignal().Connect(&application, touchFunctor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PanGestureDetector detector = PanGestureDetector::New(); @@ -2857,7 +2860,7 @@ int UtcDaliPanGestureInterruptedWhenTouchConsumed(void) // Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -2866,7 +2869,7 @@ int UtcDaliPanGestureInterruptedWhenTouchConsumed(void) // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture consume = true; - TestMovePan( application, Vector2(26.0f, 4.0f), time ); + TestMovePan(application, Vector2(26.0f, 4.0f), time); time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); @@ -2882,24 +2885,23 @@ int UtcDaliPanGestureDisableDetectionDuringPanN(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a pan detector - PanGestureDetector detector = PanGestureDetector::New(); - bool functorCalled = false; - detector.Attach( actor ); + PanGestureDetector detector = PanGestureDetector::New(); + bool functorCalled = false; + detector.Attach(actor); detector.DetectedSignal().Connect( - &application, - [&detector, &functorCalled](Actor actor, const PanGesture& pan) + &application, + [&detector, &functorCalled](Actor actor, const PanGesture& pan) { + if(pan.GetState() == GestureState::FINISHED) { - if( pan.GetState() == GestureState::FINISHED ) - { - detector.Detach(actor); - functorCalled = true; - } - }); + detector.Detach(actor); + functorCalled = true; + } + }); // Render and notify application.SendNotification(); @@ -2909,15 +2911,15 @@ int UtcDaliPanGestureDisableDetectionDuringPanN(void) try { uint32_t time = 100; - TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); - TestEndPan( application, Vector2(26.0f, 20.0f) ); + TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time); + TestEndPan(application, Vector2(26.0f, 20.0f)); - DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_CHECK(true); // No crash, test has passed DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } catch(...) { - DALI_TEST_CHECK( false ); // If we crash, the test has failed + DALI_TEST_CHECK(false); // If we crash, the test has failed } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp index df4dd07..8fed854 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp @@ -15,32 +15,32 @@ * */ -#include - -#include -#include -#include +#include #include +#include #include -#include +#include +#include + +#include using namespace Dali; /////////////////////////////////////////////////////////////////////////////// namespace { - struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -48,22 +48,25 @@ struct SignalData pannedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; PanGesture receivedGesture; - Actor pannedActor; + Actor pannedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const PanGesture& pan) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = pan; - signalData.pannedActor = actor; + signalData.pannedActor = actor; } void operator()() @@ -74,42 +77,39 @@ struct GestureReceivedFunctor SignalData& signalData; }; - -Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } -Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time ) +Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( stateA ); - point.SetScreenPosition( screenPositionA ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); - point.SetScreenPosition( screenPositionB ); - point.SetState( stateB); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(stateA); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + point.SetState(stateB); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } - -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - int UtcDaliPanGestureRecognizerBasicNoAction(void) { TestApplication application; @@ -117,8 +117,8 @@ int UtcDaliPanGestureRecognizerBasicNoAction(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -127,13 +127,13 @@ int UtcDaliPanGestureRecognizerBasicNoAction(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -149,8 +149,8 @@ int UtcDaliPanGestureRecognizerBasic(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -159,13 +159,13 @@ int UtcDaliPanGestureRecognizerBasic(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152)); application.SendNotification(); @@ -181,8 +181,8 @@ int UtcDaliPanGestureRecognizerBasicInterrupted(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -191,13 +191,13 @@ int UtcDaliPanGestureRecognizerBasicInterrupted(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 30.0f), 152)); application.SendNotification(); @@ -213,8 +213,8 @@ int UtcDaliPanGestureRecognizerBasicShortest(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -223,13 +223,13 @@ int UtcDaliPanGestureRecognizerBasicShortest(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 155 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 155)); application.SendNotification(); @@ -245,8 +245,8 @@ int UtcDaliPanGestureRecognizerBasicFailToStart(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -255,13 +255,13 @@ int UtcDaliPanGestureRecognizerBasicFailToStart(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 40.0f, 40.0f ), 153 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(40.0f, 40.0f), 153)); application.SendNotification(); @@ -277,8 +277,8 @@ int UtcDaliPanGestureRecognizerBasicStationary(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -287,15 +287,15 @@ int UtcDaliPanGestureRecognizerBasicStationary(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), 152 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 20.0f, 50.0f ), 153 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), 154 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), 152)); + application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(20.0f, 50.0f), 153)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), 154)); application.SendNotification(); @@ -314,8 +314,8 @@ int UtcDaliPanGestureRecognizerNewParametersFail(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -324,13 +324,13 @@ int UtcDaliPanGestureRecognizerNewParametersFail(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152)); application.SendNotification(); @@ -349,8 +349,8 @@ int UtcDaliPanGestureRecognizerNewParametersSuccess(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -359,13 +359,13 @@ int UtcDaliPanGestureRecognizerNewParametersSuccess(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152)); application.SendNotification(); @@ -384,8 +384,8 @@ int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches01(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -394,14 +394,14 @@ int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches01(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), 153 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152)); + application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), 153)); application.SendNotification(); @@ -420,8 +420,8 @@ int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches02(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -430,14 +430,14 @@ int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches02(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), PointState::UP, Vector2( 50.0f, 40.0f ), 153 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152)); + application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), PointState::UP, Vector2(50.0f, 40.0f), 153)); application.SendNotification(); @@ -456,8 +456,8 @@ int UtcDaliPanGestureRecognizerNewParametersNoStart(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -466,13 +466,13 @@ int UtcDaliPanGestureRecognizerNewParametersNoStart(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 153 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 153)); application.SendNotification(); @@ -491,8 +491,8 @@ int UtcDaliPanGestureRecognizerNewParametersSlowRelease(void) detector.SetMinimumTouchesRequired(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -501,16 +501,16 @@ int UtcDaliPanGestureRecognizerNewParametersSlowRelease(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 60.0f, 50.0f ), PointState::MOTION, Vector2( 60.0f, 40.0f ), 153 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 70.0f, 50.0f ), PointState::MOTION, Vector2( 70.0f, 40.0f ), 154 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 70.0f, 50.0f ), 155 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(60.0f, 50.0f), PointState::MOTION, Vector2(60.0f, 40.0f), 153)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(70.0f, 50.0f), PointState::MOTION, Vector2(70.0f, 40.0f), 154)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(70.0f, 50.0f), 155)); application.SendNotification(); @@ -526,8 +526,8 @@ int UtcDaliPanGestureRecognizerOtherEvent(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -536,15 +536,15 @@ int UtcDaliPanGestureRecognizerOtherEvent(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 60.0f ), 153 ) ); // Exercise default case in STARTED case. Not sure if realistic - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 65.0f ), 154 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 60.0f), 153)); // Exercise default case in STARTED case. Not sure if realistic + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 65.0f), 154)); application.SendNotification(); @@ -560,8 +560,8 @@ int UtcDaliPanGestureRecognizerSlowMoving(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -570,16 +570,16 @@ int UtcDaliPanGestureRecognizerSlowMoving(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655)); application.SendNotification(); @@ -594,12 +594,11 @@ int UtcDaliPanGestureRecognizerNewParamsMinNum(void) Integration::SetPanGestureMinimumPanEvents(8); - PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -608,16 +607,16 @@ int UtcDaliPanGestureRecognizerNewParamsMinNum(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655)); application.SendNotification(); @@ -635,8 +634,8 @@ int UtcDaliPanGestureRecognizerNewParamsMinDistance(void) PanGestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -645,16 +644,16 @@ int UtcDaliPanGestureRecognizerNewParamsMinDistance(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554)); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655)); application.SendNotification(); diff --git a/automated-tests/src/dali/utc-Dali-Path.cpp b/automated-tests/src/dali/utc-Dali-Path.cpp index 9839b59..13280c4 100644 --- a/automated-tests/src/dali/utc-Dali-Path.cpp +++ b/automated-tests/src/dali/utc-Dali-Path.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; using namespace Dali::Internal; @@ -27,19 +27,19 @@ using namespace Dali::Internal; namespace { // Knots fed into Allegro, which generates control points -static void SetupPath( Dali::Path& path) +static void SetupPath(Dali::Path& path) { - path.AddPoint(Vector3( 30.0, 80.0, 0.0)); - path.AddPoint(Vector3( 70.0, 120.0, 0.0)); + path.AddPoint(Vector3(30.0, 80.0, 0.0)); + path.AddPoint(Vector3(70.0, 120.0, 0.0)); path.AddPoint(Vector3(100.0, 100.0, 0.0)); //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + path.AddControlPoint(Vector3(39.0, 90.0, 0.0)); + path.AddControlPoint(Vector3(56.0, 119.0, 0.0)); //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0) ); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0) ); + path.AddControlPoint(Vector3(78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3(93.0, 104.0, 0.0)); } } // anonymous namespace @@ -49,19 +49,19 @@ int utcDaliPathGetPoint(void) TestApplication application; Dali::Path path = Dali::Path::New(); - path.AddPoint(Vector3( 50.0, 50.0, 0.0)); - path.AddPoint(Vector3(120.0, 70.0, 0.0)); + path.AddPoint(Vector3(50.0, 50.0, 0.0)); + path.AddPoint(Vector3(120.0, 70.0, 0.0)); path.AddPoint(Vector3(190.0, 250.0, 0.0)); path.AddPoint(Vector3(260.0, 260.0, 0.0)); path.AddPoint(Vector3(330.0, 220.0, 0.0)); - path.AddPoint(Vector3(400.0, 50.0, 0.0)); + path.AddPoint(Vector3(400.0, 50.0, 0.0)); - DALI_TEST_EQUALS(path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION); - DALI_TEST_EQUALS(path.GetPoint(1), Vector3(120.0, 70.0, 0.0), TEST_LOCATION); + DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION); + DALI_TEST_EQUALS(path.GetPoint(1), Vector3(120.0, 70.0, 0.0), TEST_LOCATION); DALI_TEST_EQUALS(path.GetPoint(2), Vector3(190.0, 250.0, 0.0), TEST_LOCATION); DALI_TEST_EQUALS(path.GetPoint(3), Vector3(260.0, 260.0, 0.0), TEST_LOCATION); DALI_TEST_EQUALS(path.GetPoint(4), Vector3(330.0, 220.0, 0.0), TEST_LOCATION); - DALI_TEST_EQUALS(path.GetPoint(5), Vector3(400.0, 50.0, 0.0), TEST_LOCATION); + DALI_TEST_EQUALS(path.GetPoint(5), Vector3(400.0, 50.0, 0.0), TEST_LOCATION); END_TEST; } @@ -70,16 +70,16 @@ int utcDaliPathGetPoint02(void) TestApplication application; Dali::Path path = Dali::Path::New(); - path.AddPoint(Vector3( 50.0, 50.0, 0.0f)); + path.AddPoint(Vector3(50.0, 50.0, 0.0f)); try { path.GetPoint(1); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "index < mPoint.Size()", TEST_LOCATION); } END_TEST; @@ -96,9 +96,9 @@ int utcDaliPathGetPoint03(void) path.GetPoint(0); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "index < mPoint.Size()", TEST_LOCATION); } END_TEST; @@ -109,8 +109,8 @@ int utcDaliPathGetControlPoints(void) TestApplication application; Dali::Path path = Dali::Path::New(); - path.AddControlPoint( Vector3(0.0f, 0.0f, 0.0) ); - path.AddControlPoint( Vector3(108.0f, 57.0f, 0.0) ); + path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0)); + path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0)); DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION); DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(108.0f, 57.0f, 0.0f), TEST_LOCATION); @@ -122,17 +122,17 @@ int utcDaliPathGetControlPoints01(void) TestApplication application; Dali::Path path = Dali::Path::New(); - path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0) ); - path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0) ); + path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0)); + path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0)); try { path.GetControlPoint(5); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "index < mControlPoint.Size()", TEST_LOCATION); } END_TEST; @@ -148,9 +148,9 @@ int utcDaliPathGetControlPoints02(void) path.GetControlPoint(0); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "index < mControlPoint.Size()", TEST_LOCATION); } END_TEST; @@ -162,17 +162,17 @@ int utcDaliPathGenerateControlPoints01(void) Dali::Path path = Dali::Path::New(); - path.AddPoint(Vector3( 50.0, 50.0, 0.0)); - path.AddPoint(Vector3(120.0, 70.0, 0.0)); + path.AddPoint(Vector3(50.0, 50.0, 0.0)); + path.AddPoint(Vector3(120.0, 70.0, 0.0)); path.AddPoint(Vector3(190.0, 250.0, 0.0)); path.AddPoint(Vector3(260.0, 260.0, 0.0)); path.AddPoint(Vector3(330.0, 220.0, 0.0)); - path.AddPoint(Vector3(400.0, 50.0, 0.0)); + path.AddPoint(Vector3(400.0, 50.0, 0.0)); path.GenerateControlPoints(0.25); - DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3( 68.0, 55.0, 0.0), 1.0, TEST_LOCATION); - DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(107.0, 58.0, 0.0), 1.0, TEST_LOCATION); + DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3(68.0, 55.0, 0.0), 1.0, TEST_LOCATION); + DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(107.0, 58.0, 0.0), 1.0, TEST_LOCATION); DALI_TEST_EQUALS(path.GetControlPoint(2), Vector3(156.0, 102.0, 0.0), 1.0, TEST_LOCATION); DALI_TEST_EQUALS(path.GetControlPoint(3), Vector3(152.0, 220.0, 0.0), 1.0, TEST_LOCATION); @@ -184,7 +184,7 @@ int utcDaliPathGenerateControlPoints01(void) DALI_TEST_EQUALS(path.GetControlPoint(7), Vector3(317.0, 235.0, 0.0), 1.0, TEST_LOCATION); DALI_TEST_EQUALS(path.GetControlPoint(8), Vector3(360.0, 185.0, 0.0), 1.0, TEST_LOCATION); - DALI_TEST_EQUALS(path.GetControlPoint(9), Vector3(383.0, 93.0, 0.0), 1.0, TEST_LOCATION); + DALI_TEST_EQUALS(path.GetControlPoint(9), Vector3(383.0, 93.0, 0.0), 1.0, TEST_LOCATION); END_TEST; } @@ -192,19 +192,19 @@ int utcDaliPathGenerateControlPoints01(void) int utcDaliPathGetPointCount(void) { TestApplication application; - Dali::Path path = Dali::Path::New(); + Dali::Path path = Dali::Path::New(); DALI_TEST_EQUALS(path.GetPointCount(), 0u, TEST_LOCATION); - path.AddPoint(Vector3( 50.0, 50.0, 0.0)); - path.AddPoint(Vector3(120.0, 70.0, 0.0)); + path.AddPoint(Vector3(50.0, 50.0, 0.0)); + path.AddPoint(Vector3(120.0, 70.0, 0.0)); path.AddPoint(Vector3(190.0, 250.0, 0.0)); path.AddPoint(Vector3(260.0, 260.0, 0.0)); DALI_TEST_EQUALS(path.GetPointCount(), 4u, TEST_LOCATION); path.AddPoint(Vector3(330.0, 220.0, 0.0)); - path.AddPoint(Vector3(400.0, 50.0, 0.0)); + path.AddPoint(Vector3(400.0, 50.0, 0.0)); DALI_TEST_EQUALS(path.GetPointCount(), 6u, TEST_LOCATION); END_TEST; @@ -220,9 +220,9 @@ int utcDaliPathGenerateControlPoints02(void) path.GenerateControlPoints(0.25); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "numSegments > 0", TEST_LOCATION); } END_TEST; @@ -233,15 +233,15 @@ int utcDaliPathGenerateControlPoints03(void) TestApplication application; Dali::Path path = Dali::Path::New(); - path.AddPoint(Vector3(400.0, 50.0, 0.0f)); + path.AddPoint(Vector3(400.0, 50.0, 0.0f)); try { path.GenerateControlPoints(0.25); tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "numSegments > 0", TEST_LOCATION); } END_TEST; @@ -250,45 +250,44 @@ int utcDaliPathGenerateControlPoints03(void) int UtcDaliPathSample01(void) { TestApplication application; - Dali::Path path = Dali::Path::New(); + Dali::Path path = Dali::Path::New(); SetupPath(path); //t = 0 Vector3 position, tangent; - path.Sample(0.0f, position, tangent ); + path.Sample(0.0f, position, tangent); DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); //t = 0.25 - path.Sample(0.25f, position, tangent ); - DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); + path.Sample(0.25f, position, tangent); + DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); // t = 0.5 - path.Sample(0.5f, position, tangent ); - DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); + path.Sample(0.5f, position, tangent); + DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); - + DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); //t = 0.75 - path.Sample(0.75f, position, tangent ); - DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); + path.Sample(0.75f, position, tangent); + DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); // t = 1 - path.Sample(1.0f, position, tangent ); + path.Sample(1.0f, position, tangent); DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); END_TEST; } @@ -297,8 +296,8 @@ int UtcDaliPathDownCast(void) { TestApplication application; - Dali::Path path = Dali::Path::New(); - Handle handle = path; + Dali::Path path = Dali::Path::New(); + Handle handle = path; SetupPath(path); Dali::Path path2 = Dali::Path::DownCast(handle); @@ -306,40 +305,39 @@ int UtcDaliPathDownCast(void) //t = 0 Vector3 position, tangent; - path2.Sample(0.0f, position, tangent ); + path2.Sample(0.0f, position, tangent); DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); //t = 0.25 - path2.Sample(0.25f, position, tangent ); - DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); + path2.Sample(0.25f, position, tangent); + DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); // t = 0.5 - path2.Sample(0.5f, position, tangent ); - DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); + path2.Sample(0.5f, position, tangent); + DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); - + DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); //t = 0.75 - path2.Sample(0.75f, position, tangent ); - DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); + path2.Sample(0.75f, position, tangent); + DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); // t = 1 - path2.Sample(1.0f, position, tangent ); + path2.Sample(1.0f, position, tangent); DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); END_TEST; } @@ -357,40 +355,39 @@ int UtcDaliPathAssignment(void) //t = 0 Vector3 position, tangent; - path2.Sample(0.0f, position, tangent ); + path2.Sample(0.0f, position, tangent); DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); //t = 0.25 - path2.Sample(0.25f, position, tangent ); - DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); + path2.Sample(0.25f, position, tangent); + DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION); // t = 0.5 - path2.Sample(0.5f, position, tangent ); - DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); + path2.Sample(0.5f, position, tangent); + DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); - + DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION); //t = 0.75 - path2.Sample(0.75f, position, tangent ); - DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); + path2.Sample(0.75f, position, tangent); + DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION); // t = 1 - path2.Sample(1.0f, position, tangent ); + path2.Sample(1.0f, position, tangent); DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION); DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); - DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION); END_TEST; } @@ -402,32 +399,32 @@ int UtcDaliPathPropertyPoints(void) Dali::Path path = Dali::Path::New(); Dali::Property::Array points; - points.Add( Vector3( 100.0f, 100.0f, 100.0f ) ) - .Add( Vector3( 200.0f, 200.0f, 200.0f ) ) - .Add( Vector3( 300.0f, 300.0f, 300.0f ) ); - path.SetProperty( Dali::Path::Property::POINTS, points ); + points.Add(Vector3(100.0f, 100.0f, 100.0f)) + .Add(Vector3(200.0f, 200.0f, 200.0f)) + .Add(Vector3(300.0f, 300.0f, 300.0f)); + path.SetProperty(Dali::Path::Property::POINTS, points); { - Property::Value value = path.GetProperty( Dali::Path::Property::POINTS ); + Property::Value value = path.GetProperty(Dali::Path::Property::POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = path.GetCurrentProperty( Dali::Path::Property::POINTS ); + Property::Value value = path.GetCurrentProperty(Dali::Path::Property::POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } @@ -441,32 +438,32 @@ int UtcDaliPathPropertyControlPoints(void) Dali::Path path = Dali::Path::New(); Dali::Property::Array points; - points.Add( Vector3( 0.1f, 0.1f, 0.1f ) ) - .Add( Vector3( 0.2f, 0.2f, 0.2f ) ) - .Add( Vector3( 0.3f, 0.3f, 0.3f ) ); - path.SetProperty( Dali::Path::Property::CONTROL_POINTS, points ); + points.Add(Vector3(0.1f, 0.1f, 0.1f)) + .Add(Vector3(0.2f, 0.2f, 0.2f)) + .Add(Vector3(0.3f, 0.3f, 0.3f)); + path.SetProperty(Dali::Path::Property::CONTROL_POINTS, points); { - Property::Value value = path.GetProperty( Dali::Path::Property::CONTROL_POINTS ); + Property::Value value = path.GetProperty(Dali::Path::Property::CONTROL_POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } { - Property::Value value = path.GetCurrentProperty( Dali::Path::Property::CONTROL_POINTS ); + Property::Value value = path.GetCurrentProperty(Dali::Path::Property::CONTROL_POINTS); Property::Array* array = value.GetArray(); - DALI_TEST_CHECK( array ); + DALI_TEST_CHECK(array); const unsigned int noOfPoints = points.Size(); - for( unsigned int i = 0; i < noOfPoints; ++i ) + for(unsigned int i = 0; i < noOfPoints; ++i) { - DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION ); + DALI_TEST_EQUALS((*array)[i].Get(), points[i].Get(), TEST_LOCATION); } } @@ -479,24 +476,24 @@ int UtcDaliPathRegisterProperty(void) Dali::Path path = Dali::Path::New(); - Property::Index index = path.RegisterProperty( "sceneProperty", 0.f ); - DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( path.GetProperty< float >( index ), 0.f, TEST_LOCATION ); + Property::Index index = path.RegisterProperty("sceneProperty", 0.f); + DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(path.GetProperty(index), 0.f, TEST_LOCATION); - path.SetProperty( index, -1 ); - DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION ); + path.SetProperty(index, -1); + DALI_TEST_EQUALS(path.GetProperty(index), -1.f, TEST_LOCATION); using Dali::Animation; - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( path, index ), 100.f ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(path, index), 100.f); - DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION ); + DALI_TEST_EQUALS(path.GetProperty(index), -1.f, TEST_LOCATION); // Start the animation animation.Play(); application.SendNotification(); - application.Render( 1000 /* 100% progress */); - DALI_TEST_EQUALS( path.GetProperty< float >( index ), 100.0f, TEST_LOCATION ); + application.Render(1000 /* 100% progress */); + DALI_TEST_EQUALS(path.GetProperty(index), 100.0f, TEST_LOCATION); END_TEST; } @@ -506,17 +503,17 @@ int UtcDaliPathMoveConstrcutor(void) TestApplication application; Dali::Path path = Dali::Path::New(); - DALI_TEST_CHECK( path ); - DALI_TEST_EQUALS( 1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(path); + DALI_TEST_EQUALS(1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION); - path.AddPoint(Vector3( 50.0, 50.0, 0.0)); - DALI_TEST_EQUALS( path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION ); + path.AddPoint(Vector3(50.0, 50.0, 0.0)); + DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION); - Dali::Path move = std::move( path ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION ); - DALI_TEST_CHECK( !path ); + Dali::Path move = std::move(path); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION); + DALI_TEST_CHECK(!path); END_TEST; } @@ -526,18 +523,18 @@ int UtcDaliPathMoveAssignment(void) TestApplication application; Dali::Path path = Dali::Path::New(); - DALI_TEST_CHECK( path ); - DALI_TEST_EQUALS( 1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(path); + DALI_TEST_EQUALS(1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION); - path.AddPoint(Vector3( 50.0, 50.0, 0.0)); - DALI_TEST_EQUALS( path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION ); + path.AddPoint(Vector3(50.0, 50.0, 0.0)); + DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION); Dali::Path move; - move = std::move( path ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION ); - DALI_TEST_CHECK( !path ); + move = std::move(path); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION); + DALI_TEST_CHECK(!path); END_TEST; } @@ -545,7 +542,7 @@ int UtcDaliPathMoveAssignment(void) int UtcDaliPathAddControlPointNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { Dali::Vector3 arg1; @@ -562,7 +559,7 @@ int UtcDaliPathAddControlPointNegative(void) int UtcDaliPathGetControlPointNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { unsigned long arg1(0u); @@ -579,7 +576,7 @@ int UtcDaliPathGetControlPointNegative(void) int UtcDaliPathGenerateControlPointsNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { float arg1(0.0f); @@ -596,7 +593,7 @@ int UtcDaliPathGenerateControlPointsNegative(void) int UtcDaliPathAddPointNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { Dali::Vector3 arg1; @@ -613,7 +610,7 @@ int UtcDaliPathAddPointNegative(void) int UtcDaliPathGetPointNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { unsigned long arg1(0u); @@ -630,7 +627,7 @@ int UtcDaliPathGetPointNegative(void) int UtcDaliPathGetPointCountNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { instance.GetPointCount(); @@ -646,13 +643,13 @@ int UtcDaliPathGetPointCountNegative(void) int UtcDaliPathSampleNegative(void) { TestApplication application; - Dali::Path instance; + Dali::Path instance; try { - float arg1(0.0f); + float arg1(0.0f); Dali::Vector3 arg2; Dali::Vector3 arg3; - instance.Sample(arg1,arg2,arg3); + instance.Sample(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp index 0693f23..a25a0e6 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp @@ -15,15 +15,15 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include #include +#include + using namespace Dali; void utc_dali_pinch_gesture_detector_startup(void) @@ -39,7 +39,6 @@ void utc_dali_pinch_gesture_detector_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { @@ -47,11 +46,12 @@ struct SignalData : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -59,22 +59,25 @@ struct SignalData pinchedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; PinchGesture receivedGesture; - Actor pinchedActor; + Actor pinchedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const PinchGesture& pinch) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = pinch; - signalData.pinchedActor = actor; + signalData.pinchedActor = actor; } void operator()() @@ -88,28 +91,28 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) - : GestureReceivedFunctor( data ), - stateToUnstage( stateToUnstage ), - scene( scene ) + UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene) + : GestureReceivedFunctor(data), + stateToUnstage(stateToUnstage), + scene(scene) { } - void operator()( Actor actor, const PinchGesture& pinch ) + void operator()(Actor actor, const PinchGesture& pinch) { - GestureReceivedFunctor::operator()( actor, pinch ); + GestureReceivedFunctor::operator()(actor, pinch); - if ( pinch.GetState() == stateToUnstage ) + if(pinch.GetState() == stateToUnstage) { - scene.Remove( actor ); + scene.Remove(actor); } } - GestureState& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -126,10 +129,11 @@ int UtcDaliPinchGestureDetectorCopyConstructorP(void) { TestApplication application; - PinchGestureDetector detector = PinchGestureDetector::New();; + PinchGestureDetector detector = PinchGestureDetector::New(); + ; - PinchGestureDetector copy( detector ); - DALI_TEST_CHECK( detector ); + PinchGestureDetector copy(detector); + DALI_TEST_CHECK(detector); END_TEST; } @@ -137,13 +141,14 @@ int UtcDaliPinchGestureDetectorAssignmentOperatorP(void) { TestApplication application; - PinchGestureDetector detector = PinchGestureDetector::New();; + PinchGestureDetector detector = PinchGestureDetector::New(); + ; PinchGestureDetector assign; assign = detector; - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(detector); - DALI_TEST_CHECK( detector == assign ); + DALI_TEST_CHECK(detector == assign); END_TEST; } @@ -157,8 +162,8 @@ int UtcDaliPinchGestureDetectorNew(void) // Attach an actor and emit a touch event on the actor to ensure complete line coverage Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -168,17 +173,17 @@ int UtcDaliPinchGestureDetectorNew(void) detector.Attach(actor); Integration::TouchEvent touchEvent(1); - Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + Integration::Point point; + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); Integration::Point point2; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point2); application.ProcessEvent(touchEvent); END_TEST; @@ -196,17 +201,17 @@ int UtcDaliPinchGestureDetectorDownCast(void) PinchGestureDetector detector2 = PinchGestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - PinchGestureDetector detector3 = DownCast< PinchGestureDetector >(object); + PinchGestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; PinchGestureDetector detector4 = PinchGestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - PinchGestureDetector detector5 = DownCast< PinchGestureDetector >(unInitializedObject); + PinchGestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); - GestureDetector detector6 = PinchGestureDetector::New(); + GestureDetector detector6 = PinchGestureDetector::New(); PinchGestureDetector detector7 = PinchGestureDetector::DownCast(detector6); DALI_TEST_CHECK(detector7); END_TEST; @@ -218,15 +223,15 @@ int UtcDaliPinchGestureSignalReceptionNegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -234,22 +239,19 @@ int UtcDaliPinchGestureSignalReceptionNegative(void) detector.DetectedSignal().Connect(&application, functor); // Do a pinch outside actor's area - TestStartPinch( application, Vector2( 112.0f, 62.0f ), Vector2( 112.0f, 162.0f ), - Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), 100 ); + TestStartPinch(application, Vector2(112.0f, 62.0f), Vector2(112.0f, 162.0f), Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Continue pinch into actor's area - we should still not receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Stop pinching - we should still not receive the signal data.Reset(); - TestEndPinch( application, Vector2( 6.0f, 6.0f ), Vector2( 18.0f, 18.0f ), - Vector2( 10.0f, 8.0f ), Vector2( 14.0f, 16.0f ), 300 ); + TestEndPinch(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 300); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -260,15 +262,15 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -276,8 +278,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) detector.DetectedSignal().Connect(&application, functor); // Start pan within the actor's area - TestStartPinch( application, Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(5.0f, 20.0f), Vector2(35.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -287,8 +288,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) // Continue the pan within the actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), 400); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.2666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -298,8 +298,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) // Pinch Gesture leaves actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 ); + TestContinuePinch(application, Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -309,8 +308,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) // Gesture ends - we would receive a finished state data.Reset(); - TestEndPinch( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), - Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500); + TestEndPinch(application, Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), Vector2(305.0f, 10.0f), Vector2(315.0f, 10.0f), 1500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -325,15 +323,15 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -341,8 +339,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) detector.DetectedSignal().Connect(&application, functor); // Start pinch within the actor's area - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.555f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -352,8 +349,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) // Continue the pinch within the actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.277f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -363,8 +359,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) // Gesture ends within actor's area - we would receive a finished state data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -379,15 +374,15 @@ int UtcDaliPinchGestureSignalReceptionDetach(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -395,23 +390,19 @@ int UtcDaliPinchGestureSignalReceptionDetach(void) detector.DetectedSignal().Connect(&application, functor); // Start pinch within the actor's area - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); - // Continue the pinch within the actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Gesture ends within actor's area data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -420,7 +411,7 @@ int UtcDaliPinchGestureSignalReceptionDetach(void) // Ensure we are no longer signalled data.Reset(); - TestGeneratePinch( application ); + TestGeneratePinch(application); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -430,15 +421,15 @@ int UtcDaliPinchGestureSignalReceptionDetachWhilePinching(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -446,15 +437,13 @@ int UtcDaliPinchGestureSignalReceptionDetachWhilePinching(void) detector.DetectedSignal().Connect(&application, functor); // Start pinch within the actor's area - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); // Continue the pinch within the actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); @@ -463,8 +452,7 @@ int UtcDaliPinchGestureSignalReceptionDetachWhilePinching(void) // Gesture ends within actor's area data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -473,7 +461,7 @@ int UtcDaliPinchGestureSignalReceptionActorDestroyedWhilePinching(void) { TestApplication application; - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -482,16 +470,16 @@ int UtcDaliPinchGestureSignalReceptionActorDestroyedWhilePinching(void) // Attach a temporary actor to stop detector being removed from PinchGestureProcessor when main actor // is destroyed. Actor tempActor = Actor::New(); - tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(tempActor); detector.Attach(tempActor); // Actor lifetime is scoped { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -501,15 +489,13 @@ int UtcDaliPinchGestureSignalReceptionActorDestroyedWhilePinching(void) detector.Attach(actor); // Start pinch within the actor's area - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); // Continue the pinch within the actor's area - we should still receive the signal data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); @@ -525,8 +511,7 @@ int UtcDaliPinchGestureSignalReceptionActorDestroyedWhilePinching(void) // Gesture ends within the area where the actor used to be data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -536,15 +521,15 @@ int UtcDaliPinchGestureSignalReceptionRotatedActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); application.GetScene().Add(actor); // Render and notify a couple of times application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -552,11 +537,9 @@ int UtcDaliPinchGestureSignalReceptionRotatedActor(void) detector.DetectedSignal().Connect(&application, functor); // Do an entire pinch, only check finished value - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); @@ -564,16 +547,14 @@ int UtcDaliPinchGestureSignalReceptionRotatedActor(void) DALI_TEST_EQUALS(Vector2(70.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); // Rotate actor again and render and notify - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire pinch, only check finished value - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100); data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); @@ -581,16 +562,14 @@ int UtcDaliPinchGestureSignalReceptionRotatedActor(void) DALI_TEST_EQUALS(Vector2(30.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); // Rotate actor again and render and notify - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire pinch, only check finished value - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 4100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 4100); data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 5000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 5000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); @@ -604,25 +583,25 @@ int UtcDaliPinchGestureSignalReceptionChildHit(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); // Set child to completely cover parent. // Change rotation of child to be different from parent so that we can check if our local coordinate // conversion of the parent actor is correct. Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); parent.Add(child); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -630,11 +609,9 @@ int UtcDaliPinchGestureSignalReceptionChildHit(void) detector.DetectedSignal().Connect(&application, functor); // Do an entire pan, only check finished value - hits child area but parent should still receive it - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, parent == data.pinchedActor, TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -647,11 +624,9 @@ int UtcDaliPinchGestureSignalReceptionChildHit(void) detector.Detach(parent); // Do an entire pan, only check finished value - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100); data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, child == data.pinchedActor, TEST_LOCATION); DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); @@ -666,21 +641,21 @@ int UtcDaliPinchGestureSignalReceptionAttachDetachMany(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -689,15 +664,13 @@ int UtcDaliPinchGestureSignalReceptionAttachDetachMany(void) detector.DetectedSignal().Connect(&application, functor); // Start pinch within second actor's area - TestStartPinch( application, Vector2( 102.0f, 20.0f ), Vector2( 138.0f, 20.0f ), - Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(102.0f, 20.0f), Vector2(138.0f, 20.0f), Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.pinchedActor, TEST_LOCATION); // Pinch moves into first actor's area - second actor should receive the pinch data.Reset(); - TestContinuePinch( application, Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.pinchedActor, TEST_LOCATION); @@ -706,8 +679,7 @@ int UtcDaliPinchGestureSignalReceptionAttachDetachMany(void) // Gesture ends within actor's area data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 119.0f, 20.0f ), Vector2( 121.0f, 20.0f ), 3000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(119.0f, 20.0f), Vector2(121.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -717,15 +689,15 @@ int UtcDaliPinchGestureSignalReceptionActorBecomesUntouchable(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -733,18 +705,16 @@ int UtcDaliPinchGestureSignalReceptionActorBecomesUntouchable(void) detector.DetectedSignal().Connect(&application, functor); // Start pinch in actor's area - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Pan continues within actor's area data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Actor become invisible - actor should not receive the next pinch - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // Render and notify application.SendNotification(); @@ -752,8 +722,7 @@ int UtcDaliPinchGestureSignalReceptionActorBecomesUntouchable(void) // Gesture ends within actor's area data.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -763,13 +732,13 @@ int UtcDaliPinchGestureSignalReceptionMultipleDetectorsOnActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(actor2); // Render and notify @@ -777,16 +746,16 @@ int UtcDaliPinchGestureSignalReceptionMultipleDetectorsOnActor(void) application.Render(); // Attach actor to one detector - SignalData firstData; + SignalData firstData; GestureReceivedFunctor firstFunctor(firstData); - PinchGestureDetector firstDetector = PinchGestureDetector::New(); + PinchGestureDetector firstDetector = PinchGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector - SignalData secondData; + SignalData secondData; GestureReceivedFunctor secondFunctor(secondData); - PinchGestureDetector secondDetector = PinchGestureDetector::New(); + PinchGestureDetector secondDetector = PinchGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); @@ -796,16 +765,14 @@ int UtcDaliPinchGestureSignalReceptionMultipleDetectorsOnActor(void) secondDetector.Attach(actor2); // Pinch in actor's area - both detector's functors should be called - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); // Pinch continues in actor's area - both detector's functors should be called firstData.Reset(); secondData.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -813,16 +780,14 @@ int UtcDaliPinchGestureSignalReceptionMultipleDetectorsOnActor(void) firstDetector.Detach(actor); firstData.Reset(); secondData.Reset(); - TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); // New pinch on actor, only secondDetector has actor attached firstData.Reset(); secondData.Reset(); - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -830,8 +795,7 @@ int UtcDaliPinchGestureSignalReceptionMultipleDetectorsOnActor(void) secondDetector.Detach(actor); firstData.Reset(); secondData.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION); END_TEST; @@ -842,23 +806,23 @@ int UtcDaliPinchGestureSignalReceptionEnsureCorrectSignalling(void) TestApplication application; Actor actor1 = Actor::New(); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor1); - SignalData data1; + SignalData data1; GestureReceivedFunctor functor1(data1); - PinchGestureDetector detector1 = PinchGestureDetector::New(); + PinchGestureDetector detector1 = PinchGestureDetector::New(); detector1.Attach(actor1); detector1.DetectedSignal().Connect(&application, functor1); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); - actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT); application.GetScene().Add(actor2); - SignalData data2; + SignalData data2; GestureReceivedFunctor functor2(data2); - PinchGestureDetector detector2 = PinchGestureDetector::New(); + PinchGestureDetector detector2 = PinchGestureDetector::New(); detector2.Attach(actor2); detector2.DetectedSignal().Connect(&application, functor2); @@ -867,8 +831,7 @@ int UtcDaliPinchGestureSignalReceptionEnsureCorrectSignalling(void) application.Render(); // Start pan in actor1's area, only data1 should be set - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); END_TEST; @@ -879,8 +842,8 @@ int UtcDaliPinchGestureActorUnstaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -888,22 +851,20 @@ int UtcDaliPinchGestureActorUnstaged(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); PinchGestureDetector detector = PinchGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit signals - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -922,16 +883,13 @@ int UtcDaliPinchGestureActorUnstaged(void) stateToUnstage = GestureState::CONTINUING; // Emit signals - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -950,18 +908,15 @@ int UtcDaliPinchGestureActorUnstaged(void) stateToUnstage = GestureState::FINISHED; // Emit signals - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully. + tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully. END_TEST; } @@ -970,15 +925,15 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Create and add a second actor so that GestureDetector destruction does not come into play. - Actor dummyActor( Actor::New() ); - dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + Actor dummyActor(Actor::New()); + dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(dummyActor); // Render and notify @@ -986,23 +941,22 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); PinchGestureDetector detector = PinchGestureDetector::New(); detector.Attach(actor); detector.Attach(dummyActor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back // before we get a continuing state. As we were removed from the stage, even if we're at the same // position, we should still not be signalled. // Emit signals - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1018,20 +972,17 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Here we delete an actor in started, we should not receive any subsequent signalling. // Emit signals - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1047,12 +998,10 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 ); + TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1062,22 +1011,22 @@ int UtcDaliPinchGestureLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); - PinchGestureDetector detector = PinchGestureDetector::New(); + PinchGestureDetector detector = PinchGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -1085,25 +1034,21 @@ int UtcDaliPinchGestureLayerConsumesTouch(void) application.Render(); // Emit signals, should receive - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 2000); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1115,19 +1060,19 @@ int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); - bool consume = false; + bool consume = false; TouchEventFunctorConsumeSetter touchFunctor(consume); - actor.TouchedSignal().Connect(&application,touchFunctor); + actor.TouchedSignal().Connect(&application, touchFunctor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); PinchGestureDetector detector = PinchGestureDetector::New(); @@ -1135,8 +1080,7 @@ int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void) detector.DetectedSignal().Connect(&application, functor); // Start gesture within the actor's area, we should receive the pinch as the touch is NOT being consumed - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -1145,22 +1089,19 @@ int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void) // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture consume = true; - TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); data.Reset(); // Start another pinch, we should not even get the callback this time - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } - int UtcDaliPinchGestureDisableDetectionDuringPinchN(void) { // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached @@ -1168,24 +1109,23 @@ int UtcDaliPinchGestureDisableDetectionDuringPinchN(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - PinchGestureDetector detector = PinchGestureDetector::New(); - bool functorCalled = false; - detector.Attach( actor ); + PinchGestureDetector detector = PinchGestureDetector::New(); + bool functorCalled = false; + detector.Attach(actor); detector.DetectedSignal().Connect( - &application, - [&detector, &functorCalled](Actor actor, const PinchGesture& gesture) + &application, + [&detector, &functorCalled](Actor actor, const PinchGesture& gesture) { + if(gesture.GetState() == GestureState::FINISHED) { - if( gesture.GetState() == GestureState::FINISHED ) - { - detector.Detach(actor); - functorCalled = true; - } - }); + detector.Detach(actor); + functorCalled = true; + } + }); // Render and notify application.SendNotification(); @@ -1194,19 +1134,16 @@ int UtcDaliPinchGestureDisableDetectionDuringPinchN(void) // Try the gesture, should not crash try { - TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); - TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); - TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); - - DALI_TEST_CHECK( true ); // No crash, test has passed + TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); + TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200); + TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); + + DALI_TEST_CHECK(true); // No crash, test has passed DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } catch(...) { - DALI_TEST_CHECK( false ); // If we crash, the test has failed + DALI_TEST_CHECK(false); // If we crash, the test has failed } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp index 72b34fe..90414fa 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp @@ -15,32 +15,32 @@ * */ -#include - -#include -#include -#include +#include #include +#include #include -#include +#include +#include + +#include using namespace Dali; /////////////////////////////////////////////////////////////////////////////// namespace { - struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -48,22 +48,25 @@ struct SignalData pinchedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; PinchGesture receivedGesture; - Actor pinchedActor; + Actor pinchedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const PinchGesture& pinch) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = pinch; - signalData.pinchedActor = actor; + signalData.pinchedActor = actor; } void operator()() @@ -74,42 +77,39 @@ struct GestureReceivedFunctor SignalData& signalData; }; - -Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } -Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time ) +Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( stateA ); - point.SetScreenPosition( screenPositionA ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); - point.SetScreenPosition( screenPositionB ); - point.SetState( stateB); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(stateA); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + point.SetState(stateB); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } - -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - int UtcDaliPinchGestureRecognizerBasicNoAction(void) { TestApplication application; @@ -117,8 +117,8 @@ int UtcDaliPinchGestureRecognizerBasicNoAction(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -127,13 +127,13 @@ int UtcDaliPinchGestureRecognizerBasicNoAction(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -149,8 +149,8 @@ int UtcDaliPinchGestureRecognizerBasic(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -159,15 +159,15 @@ int UtcDaliPinchGestureRecognizerBasic(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190)); application.SendNotification(); @@ -183,8 +183,8 @@ int UtcDaliPinchGestureRecognizerEndEarly01(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -193,16 +193,16 @@ int UtcDaliPinchGestureRecognizerEndEarly01(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 29.0f ), 165 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 29.0f), 165)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190)); application.SendNotification(); @@ -218,8 +218,8 @@ int UtcDaliPinchGestureRecognizerEndEarly02(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -228,17 +228,17 @@ int UtcDaliPinchGestureRecognizerEndEarly02(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::UP, Vector2( 20.0f, 74.0f ), 173 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::DOWN, Vector2( 20.0f, 74.0f ), 178 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::UP, Vector2(20.0f, 74.0f), 173)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::DOWN, Vector2(20.0f, 74.0f), 178)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190)); application.SendNotification(); @@ -254,8 +254,8 @@ int UtcDaliPinchGestureRecognizerRealistic01(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -264,22 +264,22 @@ int UtcDaliPinchGestureRecognizerRealistic01(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 56.0f ), PointState::UP, Vector2( 20.0f, 60.0f ), 150 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 56.0f), PointState::UP, Vector2(20.0f, 60.0f), 150)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155)); application.SendNotification(); @@ -295,8 +295,8 @@ int UtcDaliPinchGestureRecognizerRealistic02(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -305,21 +305,21 @@ int UtcDaliPinchGestureRecognizerRealistic02(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155)); application.SendNotification(); @@ -335,8 +335,8 @@ int UtcDaliPinchGestureRecognizerRealistic03(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -345,26 +345,26 @@ int UtcDaliPinchGestureRecognizerRealistic03(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 77.0f ), 127 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 73.0f ), 133 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 67.0f ), 137 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 53.0f ), PointState::MOTION, Vector2( 20.0f, 63.0f ), 143 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) ); - - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 77.0f), 127)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 47.0f), PointState::MOTION, Vector2(20.0f, 73.0f), 133)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 47.0f), PointState::MOTION, Vector2(20.0f, 67.0f), 137)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 53.0f), PointState::MOTION, Vector2(20.0f, 63.0f), 143)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145)); + + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155)); application.SendNotification(); @@ -378,14 +378,14 @@ int UtcDaliPinchGestureRecognizerMultipleDetectors(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor2.SetProperty( Actor::Property::POSITION_X, 100.0f); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor2.SetProperty(Actor::Property::POSITION_X, 100.0f); application.GetScene().Add(actor2); // Render and notify @@ -398,20 +398,20 @@ int UtcDaliPinchGestureRecognizerMultipleDetectors(void) PinchGestureDetector detector2 = PinchGestureDetector::New(); detector2.Attach(actor2); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - SignalData data2; + SignalData data2; GestureReceivedFunctor functor2(data2); detector2.DetectedSignal().Connect(&application, functor2); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), PointState::DOWN, Vector2( 120.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 28.0f ), PointState::MOTION, Vector2( 120.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 37.0f ), PointState::MOTION, Vector2( 120.0f, 74.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 46.0f ), PointState::MOTION, Vector2( 120.0f, 66.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 55.0f ), PointState::MOTION, Vector2( 120.0f, 58.0f ), 190 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 120.0f, 55.0f ), PointState::UP, Vector2( 120.0f, 58.0f ), 200 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), PointState::DOWN, Vector2(120.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 28.0f), PointState::MOTION, Vector2(120.0f, 82.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 37.0f), PointState::MOTION, Vector2(120.0f, 74.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 46.0f), PointState::MOTION, Vector2(120.0f, 66.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 55.0f), PointState::MOTION, Vector2(120.0f, 58.0f), 190)); + application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(120.0f, 55.0f), PointState::UP, Vector2(120.0f, 58.0f), 200)); application.SendNotification(); @@ -420,11 +420,11 @@ int UtcDaliPinchGestureRecognizerMultipleDetectors(void) DALI_TEST_EQUALS(true, actor2 == data2.pinchedActor, TEST_LOCATION); data2.Reset(); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 250 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 260 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 270 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 280 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 290 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 250)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 260)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 270)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 280)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 290)); application.SendNotification(); @@ -435,7 +435,6 @@ int UtcDaliPinchGestureRecognizerMultipleDetectors(void) END_TEST; } - int UtcDaliPinchGestureRecognizerShortDistance01(void) { TestApplication application; @@ -445,8 +444,8 @@ int UtcDaliPinchGestureRecognizerShortDistance01(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -455,15 +454,15 @@ int UtcDaliPinchGestureRecognizerShortDistance01(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 32.0f), PointState::MOTION, Vector2(20.0f, 78.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 34.0f), PointState::MOTION, Vector2(20.0f, 76.0f), 190)); application.SendNotification(); @@ -479,8 +478,8 @@ int UtcDaliPinchGestureRecognizerShortDistance02(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -489,17 +488,17 @@ int UtcDaliPinchGestureRecognizerShortDistance02(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); Integration::SetPinchGestureMinimumDistance(7.0f); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 32.0f), PointState::MOTION, Vector2(20.0f, 78.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 34.0f), PointState::MOTION, Vector2(20.0f, 76.0f), 190)); application.SendNotification(); @@ -517,8 +516,8 @@ int UtcDaliPinchGestureRecognizerLongDistance01(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -527,14 +526,14 @@ int UtcDaliPinchGestureRecognizerLongDistance01(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 22.0f), PointState::MOTION, Vector2(20.0f, 88.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 24.0f), PointState::MOTION, Vector2(20.0f, 86.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 26.0f), PointState::MOTION, Vector2(20.0f, 84.0f), 180)); application.SendNotification(); @@ -552,8 +551,8 @@ int UtcDaliPinchGestureRecognizerLongDistance02(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -562,15 +561,15 @@ int UtcDaliPinchGestureRecognizerLongDistance02(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 38.0f), PointState::MOTION, Vector2(20.0f, 72.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 42.0f), PointState::MOTION, Vector2(20.0f, 68.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 44.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 190)); application.SendNotification(); @@ -586,8 +585,8 @@ int UtcDaliPinchGestureRecognizerLongDistance03(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -596,16 +595,16 @@ int UtcDaliPinchGestureRecognizerLongDistance03(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); Integration::SetPinchGestureMinimumDistance(14.0f); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 22.0f), PointState::MOTION, Vector2(20.0f, 88.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 24.0f), PointState::MOTION, Vector2(20.0f, 86.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 26.0f), PointState::MOTION, Vector2(20.0f, 84.0f), 180)); application.SendNotification(); @@ -621,8 +620,8 @@ int UtcDaliPinchGestureRecognizerLongDistance04(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -631,17 +630,17 @@ int UtcDaliPinchGestureRecognizerLongDistance04(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); Integration::SetPinchGestureMinimumDistance(14.0f); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 38.0f), PointState::MOTION, Vector2(20.0f, 72.0f), 160)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 42.0f), PointState::MOTION, Vector2(20.0f, 68.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 44.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 190)); application.SendNotification(); @@ -657,38 +656,38 @@ int UtcDaliPinchGestureRecognizerMinimumTouchEvents(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - detector.Attach( actor ); + detector.Attach(actor); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); // Case 1 // 2 touch events make a gesture begin - Integration::SetPinchGestureMinimumTouchEvents( 2 ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + Integration::SetPinchGestureMinimumTouchEvents(2); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); - DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Case 2 // 4 touch events make a gesture begin - Integration::SetPinchGestureMinimumTouchEvents( 4 ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + Integration::SetPinchGestureMinimumTouchEvents(4); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); // Check the gesture is not detected unlike previous case - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -700,19 +699,19 @@ int UtcDaliPinchGestureRecognizerMinimumTouchEventsAfterStart(void) PinchGestureDetector detector = PinchGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - detector.Attach( actor ); + detector.Attach(actor); - SignalData data; - GestureReceivedFunctor functor( data ); - detector.DetectedSignal().Connect( &application, functor ); + SignalData data; + GestureReceivedFunctor functor(data); + detector.DetectedSignal().Connect(&application, functor); // Case 1 // > 2 touch events make a gesture begin @@ -720,21 +719,21 @@ int UtcDaliPinchGestureRecognizerMinimumTouchEventsAfterStart(void) Integration::SetPinchGestureMinimumTouchEvents(2); Integration::SetPinchGestureMinimumTouchEventsAfterStart(6); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 190)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 200)); // > Test : not enough touch events to make the gesture state "CONTINUING" DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 210)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 220)); // > Test : 6 touch events after start make the gesture state "CONTINUING" DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); diff --git a/automated-tests/src/dali/utc-Dali-Pixel.cpp b/automated-tests/src/dali/utc-Dali-Pixel.cpp index 2f40cd5..3c57159 100644 --- a/automated-tests/src/dali/utc-Dali-Pixel.cpp +++ b/automated-tests/src/dali/utc-Dali-Pixel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,17 +15,16 @@ * */ -#include -#include - -#include -#include #include +#include +#include + +#include +#include using std::max; using namespace Dali; - static const float ROTATION_EPSILON = 0.0001f; void utc_dali_pixel_startup(void) @@ -40,8 +39,8 @@ void utc_dali_pixel_cleanup(void) static void TestPixelEnumSize(const int size) { - DALI_TEST_CHECK( (static_cast( Pixel::LAST_VALID_PIXEL_FORMAT ) - static_cast( Pixel::FIRST_VALID_PIXEL_FORMAT ) + 1 ) == size && - "The Pixel::Format enum may have had new formats added. Expand the test cases to include them."); + DALI_TEST_CHECK((static_cast(Pixel::LAST_VALID_PIXEL_FORMAT) - static_cast(Pixel::FIRST_VALID_PIXEL_FORMAT) + 1) == size && + "The Pixel::Format enum may have had new formats added. Expand the test cases to include them."); } int UtcDaliPixelHasAlpha(void) @@ -50,80 +49,80 @@ int UtcDaliPixelHasAlpha(void) tet_infoline("UtcDaliPixelHasAlpha"); - TestPixelEnumSize( 59 ); - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::INVALID ) == false ); // For completeness - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::L8 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB565 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB888 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB8888 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGR8888 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGR565 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_R11_EAC ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SIGNED_R11_EAC ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RG11_EAC ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SIGNED_RG11_EAC ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_ETC2 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ETC2 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_ETC1 ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 ) == false ); - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::A8 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::LA88 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA5551 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA4444 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA8888 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA8888 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA5551 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA4444 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA8_ETC2_EAC ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ) == true ); - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == true ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == true ); - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB16F ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB32F ) == false ); - - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_UNSIGNED_INT ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_FLOAT ) == false ); - DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_STENCIL ) == false ); + TestPixelEnumSize(59); + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::INVALID) == false); // For completeness + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::L8) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB565) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB888) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB8888) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGR8888) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGR565) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_R11_EAC) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SIGNED_R11_EAC) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RG11_EAC) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SIGNED_RG11_EAC) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_ETC2) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ETC2) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_ETC1) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1) == false); + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::A8) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::LA88) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA5551) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA4444) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA8888) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA8888) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA5551) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA4444) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA8_ETC2_EAC) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) == true); + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) == true); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) == true); + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB16F) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB32F) == false); + + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_UNSIGNED_INT) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_FLOAT) == false); + DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_STENCIL) == false); END_TEST; } int UtcDaliPixelHasAlphaN(void) { - DALI_TEST_EQUALS( Pixel::HasAlpha( Pixel::Format( 123123123123 ) ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(Pixel::HasAlpha(Pixel::Format(123123123123)), false, TEST_LOCATION); END_TEST; } @@ -134,85 +133,85 @@ int UtcDaliPixelGetBytesPerPixel(void) tet_infoline("UtcDaliPixelGetBytesPerPixel"); // Be sure that the number of cases tested below is correct: - TestPixelEnumSize( 59 ); + TestPixelEnumSize(59); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::INVALID ) == 0 ); // For completeness + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::INVALID) == 0); // For completeness - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::L8 ) == 1 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::A8 ) == 1 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::L8) == 1); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::A8) == 1); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::LA88 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB565 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA5551 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA4444 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGR565 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA5551 ) == 2 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA4444 ) == 2 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::LA88) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB565) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA5551) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA4444) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGR565) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA5551) == 2); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA4444) == 2); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB888 ) == 3 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB888) == 3); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB8888 ) == 4 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGR8888 ) == 4 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA8888 ) == 4 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA8888 ) == 4 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB8888) == 4); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGR8888) == 4); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA8888) == 4); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA8888) == 4); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::L8 ) == 1 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::L8) == 1); // Compressed formats are marked as 0 bytes per pixel. - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_R11_EAC ) == 0); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SIGNED_R11_EAC ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RG11_EAC ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SIGNED_RG11_EAC ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_ETC2 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ETC2 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_ETC1 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA8_ETC2_EAC ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == 0 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == 0 ); - - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB16F ) == 12 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB32F ) == 24 ); - - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_UNSIGNED_INT ) == 4 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_FLOAT ) == 4 ); - DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_STENCIL ) == 4 ); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_R11_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SIGNED_R11_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RG11_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SIGNED_RG11_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_ETC2) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ETC2) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_ETC1) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA8_ETC2_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) == 0); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) == 0); + + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB16F) == 12); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB32F) == 24); + + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_UNSIGNED_INT) == 4); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_FLOAT) == 4); + DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_STENCIL) == 4); END_TEST; } int UtcDaliPixelGetBytesPerPixelN(void) { - DALI_TEST_EQUALS( Pixel::GetBytesPerPixel( Pixel::Format( 123123123123 ) ), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(Pixel::GetBytesPerPixel(Pixel::Format(123123123123)), 0u, TEST_LOCATION); END_TEST; } @@ -223,136 +222,136 @@ int UtcDaliPixelGetAlphaOffsetAndMaskP(void) tet_infoline("UtcDaliPixelGetAlphaOffsetAndMask"); int byteOffset = 0; - int bitMask = 0; + int bitMask = 0; // Be sure that the number of cases tested below is correct: - TestPixelEnumSize( 59 ); - - Pixel::GetAlphaOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); // For completeness - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - Pixel::GetAlphaOffsetAndMask( Pixel::L8, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::A8, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGB888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGB565, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGB8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::BGR8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::LA88, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0xff ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGBA4444, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x0f ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGBA5551, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x01 ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGBA8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 3 && bitMask == 0xff ); - Pixel::GetAlphaOffsetAndMask( Pixel::BGRA8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 3 && bitMask == 0xff ); - Pixel::GetAlphaOffsetAndMask( Pixel::BGR565, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::BGRA4444, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x0f ); - Pixel::GetAlphaOffsetAndMask( Pixel::BGRA5551, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x01 ); + TestPixelEnumSize(59); + + Pixel::GetAlphaOffsetAndMask(Pixel::INVALID, byteOffset, bitMask); // For completeness + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + + Pixel::GetAlphaOffsetAndMask(Pixel::L8, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::A8, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0xff); + Pixel::GetAlphaOffsetAndMask(Pixel::RGB888, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::RGB565, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::RGB8888, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::BGR8888, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::LA88, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0xff); + Pixel::GetAlphaOffsetAndMask(Pixel::RGBA4444, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x0f); + Pixel::GetAlphaOffsetAndMask(Pixel::RGBA5551, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x01); + Pixel::GetAlphaOffsetAndMask(Pixel::RGBA8888, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 3 && bitMask == 0xff); + Pixel::GetAlphaOffsetAndMask(Pixel::BGRA8888, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 3 && bitMask == 0xff); + Pixel::GetAlphaOffsetAndMask(Pixel::BGR565, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::BGRA4444, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x0f); + Pixel::GetAlphaOffsetAndMask(Pixel::BGRA5551, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x01); // Compressed formats with no meaningful result: - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - Pixel::GetAlphaOffsetAndMask( Pixel::RGB16F, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_UNSIGNED_INT, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_FLOAT, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_STENCIL, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + + Pixel::GetAlphaOffsetAndMask(Pixel::RGB16F, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::RGB32F, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + + Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_UNSIGNED_INT, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_FLOAT, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); + Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_STENCIL, byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0); END_TEST; } @@ -362,26 +361,26 @@ int UtcDaliPixelConvertGlFormat(void) tet_infoline("UtcDaliPixelConvertGlFormat"); unsigned int pixelDataType, internalFormat; - Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_UNSIGNED_INT, pixelDataType, internalFormat ); - DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT ); - DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT ); + Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_UNSIGNED_INT, pixelDataType, internalFormat); + DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_INT); + DALI_TEST_CHECK(internalFormat == GL_DEPTH_COMPONENT); - Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_FLOAT, pixelDataType, internalFormat ); - DALI_TEST_CHECK( pixelDataType == GL_FLOAT ); - DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT ); + Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_FLOAT, pixelDataType, internalFormat); + DALI_TEST_CHECK(pixelDataType == GL_FLOAT); + DALI_TEST_CHECK(internalFormat == GL_DEPTH_COMPONENT); - Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_STENCIL, pixelDataType, internalFormat ); - DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT_24_8 ); - DALI_TEST_CHECK( internalFormat == GL_DEPTH_STENCIL ); + Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_STENCIL, pixelDataType, internalFormat); + DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_INT_24_8); + DALI_TEST_CHECK(internalFormat == GL_DEPTH_STENCIL); END_TEST; } int UtcDaliPixelGetAlphaOffsetAndMaskN(void) { int byteOffset = 200; - int bitMask = 200; - Pixel::GetAlphaOffsetAndMask( Pixel::Format( 123123123123 ), byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 200 ); - DALI_TEST_CHECK( bitMask == 200 ); + int bitMask = 200; + Pixel::GetAlphaOffsetAndMask(Pixel::Format(123123123123), byteOffset, bitMask); + DALI_TEST_CHECK(byteOffset == 200); + DALI_TEST_CHECK(bitMask == 200); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PixelData.cpp b/automated-tests/src/dali/utc-Dali-PixelData.cpp index dd71651..419a4d5 100644 --- a/automated-tests/src/dali/utc-Dali-PixelData.cpp +++ b/automated-tests/src/dali/utc-Dali-PixelData.cpp @@ -15,12 +15,12 @@ * */ -#include #include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -28,17 +28,17 @@ int UtcDaliPixelData01(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGB888 ); + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGB888); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE ); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE); - DALI_TEST_CHECK( pixelData ); - DALI_TEST_CHECK( pixelData.GetWidth() == width ); - DALI_TEST_CHECK( pixelData.GetHeight() == height ); - DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::RGB888 ); + DALI_TEST_CHECK(pixelData); + DALI_TEST_CHECK(pixelData.GetWidth() == width); + DALI_TEST_CHECK(pixelData.GetHeight() == height); + DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::RGB888); END_TEST; } @@ -47,18 +47,18 @@ int UtcDaliPixelData02(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); - unsigned char* buffer = new unsigned char [ bufferSize ]; - buffer[0] = 'a'; + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8); + unsigned char* buffer = new unsigned char[bufferSize]; + buffer[0] = 'a'; - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY); - DALI_TEST_CHECK( pixelData); - DALI_TEST_CHECK( pixelData.GetWidth() == width ); - DALI_TEST_CHECK( pixelData.GetHeight() == height ); - DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::L8 ); + DALI_TEST_CHECK(pixelData); + DALI_TEST_CHECK(pixelData.GetWidth() == width); + DALI_TEST_CHECK(pixelData.GetHeight() == height); + DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::L8); END_TEST; } @@ -67,15 +67,15 @@ int UtcDaliPixelDataCopyConstructor(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); - unsigned char* buffer = new unsigned char [ bufferSize ]; - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8); + unsigned char* buffer = new unsigned char[bufferSize]; + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY); PixelData pixelDataCopy(pixelData); - DALI_TEST_EQUALS( (bool)pixelDataCopy, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)pixelDataCopy, true, TEST_LOCATION); END_TEST; } @@ -83,17 +83,17 @@ int UtcDaliPixelDataAssignmentOperator(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); - unsigned char* buffer = new unsigned char [ bufferSize ]; - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8); + unsigned char* buffer = new unsigned char[bufferSize]; + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY); PixelData pixelData2; - DALI_TEST_EQUALS( (bool)pixelData2, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)pixelData2, false, TEST_LOCATION); pixelData2 = pixelData; - DALI_TEST_EQUALS( (bool)pixelData2, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)pixelData2, true, TEST_LOCATION); END_TEST; } @@ -102,21 +102,21 @@ int UtcDaliPixelDataMoveConstructor(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); - unsigned char* buffer = new unsigned char [ bufferSize ]; + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8); + unsigned char* buffer = new unsigned char[bufferSize]; - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); - DALI_TEST_CHECK( pixelData ); - DALI_TEST_EQUALS( width, pixelData.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( height, pixelData.GetHeight(), TEST_LOCATION ); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY); + DALI_TEST_CHECK(pixelData); + DALI_TEST_EQUALS(width, pixelData.GetWidth(), TEST_LOCATION); + DALI_TEST_EQUALS(height, pixelData.GetHeight(), TEST_LOCATION); - PixelData moved = std::move( pixelData); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( width, moved.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( height, moved.GetHeight(), TEST_LOCATION ); - DALI_TEST_CHECK( !pixelData ); + PixelData moved = std::move(pixelData); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(width, moved.GetWidth(), TEST_LOCATION); + DALI_TEST_EQUALS(height, moved.GetHeight(), TEST_LOCATION); + DALI_TEST_CHECK(!pixelData); END_TEST; } @@ -125,22 +125,22 @@ int UtcDaliPixelDataMoveAssignment(void) { TestApplication application; - unsigned int width = 10u; - unsigned int height = 10u; - unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 ); - unsigned char* buffer = new unsigned char [ bufferSize ]; + unsigned int width = 10u; + unsigned int height = 10u; + unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8); + unsigned char* buffer = new unsigned char[bufferSize]; - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY ); - DALI_TEST_CHECK( pixelData ); - DALI_TEST_EQUALS( width, pixelData.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( height, pixelData.GetHeight(), TEST_LOCATION ); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY); + DALI_TEST_CHECK(pixelData); + DALI_TEST_EQUALS(width, pixelData.GetWidth(), TEST_LOCATION); + DALI_TEST_EQUALS(height, pixelData.GetHeight(), TEST_LOCATION); PixelData moved; - moved = std::move( pixelData); - DALI_TEST_CHECK( moved ); - DALI_TEST_EQUALS( width, moved.GetWidth(), TEST_LOCATION ); - DALI_TEST_EQUALS( height, moved.GetHeight(), TEST_LOCATION ); - DALI_TEST_CHECK( !pixelData ); + moved = std::move(pixelData); + DALI_TEST_CHECK(moved); + DALI_TEST_EQUALS(width, moved.GetWidth(), TEST_LOCATION); + DALI_TEST_EQUALS(height, moved.GetHeight(), TEST_LOCATION); + DALI_TEST_CHECK(!pixelData); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Processors.cpp b/automated-tests/src/dali/utc-Dali-Processors.cpp index fb1d139..9f797fb 100644 --- a/automated-tests/src/dali/utc-Dali-Processors.cpp +++ b/automated-tests/src/dali/utc-Dali-Processors.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +15,17 @@ * */ -#include -#include -#include #include +#include #include +#include +#include using namespace Dali; - class TestProcessor : public Integration::Processor { public: - TestProcessor() : processRun(false) { @@ -41,30 +39,29 @@ public: bool processRun; }; - int UtcDaliCoreProcessorP(void) { TestApplication application; - TestProcessor testProcessor; + TestProcessor testProcessor; Integration::Core& core = application.GetCore(); - core.RegisterProcessor( testProcessor ); + core.RegisterProcessor(testProcessor); tet_infoline("Test that the processor has not been executed yet:"); - DALI_TEST_CHECK( testProcessor.processRun == false ); + DALI_TEST_CHECK(testProcessor.processRun == false); application.SendNotification(); tet_infoline("Test that the processor has been executed:"); - DALI_TEST_CHECK( testProcessor.processRun ); + DALI_TEST_CHECK(testProcessor.processRun); // Clear down for next part of test testProcessor.processRun = false; - core.UnregisterProcessor( testProcessor ); + core.UnregisterProcessor(testProcessor); application.SendNotification(); tet_infoline("Test that the processor has not been executed again:"); - DALI_TEST_CHECK( testProcessor.processRun == false ); + DALI_TEST_CHECK(testProcessor.processRun == false); END_TEST; } @@ -78,43 +75,43 @@ int UtcDaliCoreProcessorMultipleP(void) TestProcessor testProcessor3; Integration::Core& core = application.GetCore(); - core.RegisterProcessor( testProcessor1 ); + core.RegisterProcessor(testProcessor1); tet_infoline("Test that the processor has not been executed yet:"); - DALI_TEST_CHECK( testProcessor1.processRun == false ); + DALI_TEST_CHECK(testProcessor1.processRun == false); application.SendNotification(); tet_infoline("Test that the processor has been executed:"); - DALI_TEST_CHECK( testProcessor1.processRun ); + DALI_TEST_CHECK(testProcessor1.processRun); // Clear down for next part of test testProcessor1.processRun = false; - core.RegisterProcessor( testProcessor2 ); - core.RegisterProcessor( testProcessor3 ); + core.RegisterProcessor(testProcessor2); + core.RegisterProcessor(testProcessor3); tet_infoline("Test that the processors have not been executed yet:"); - DALI_TEST_CHECK( testProcessor1.processRun == false ); - DALI_TEST_CHECK( testProcessor2.processRun == false ); - DALI_TEST_CHECK( testProcessor3.processRun == false ); + DALI_TEST_CHECK(testProcessor1.processRun == false); + DALI_TEST_CHECK(testProcessor2.processRun == false); + DALI_TEST_CHECK(testProcessor3.processRun == false); application.SendNotification(); tet_infoline("Test that the processors have been executed:"); - DALI_TEST_CHECK( testProcessor1.processRun ); - DALI_TEST_CHECK( testProcessor2.processRun ); - DALI_TEST_CHECK( testProcessor3.processRun ); + DALI_TEST_CHECK(testProcessor1.processRun); + DALI_TEST_CHECK(testProcessor2.processRun); + DALI_TEST_CHECK(testProcessor3.processRun); // Clear down for next part of test testProcessor2.processRun = false; - core.UnregisterProcessor( testProcessor2 ); + core.UnregisterProcessor(testProcessor2); application.SendNotification(); tet_infoline("Test that the unregistered processor has not been executed again but others have"); - DALI_TEST_CHECK( testProcessor1.processRun ); - DALI_TEST_CHECK( testProcessor2.processRun == false ); - DALI_TEST_CHECK( testProcessor3.processRun ); + DALI_TEST_CHECK(testProcessor1.processRun); + DALI_TEST_CHECK(testProcessor2.processRun == false); + DALI_TEST_CHECK(testProcessor3.processRun); END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali/utc-Dali-PropertyArray.cpp b/automated-tests/src/dali/utc-Dali-PropertyArray.cpp index 7baa2f7..2858170 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyArray.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,12 @@ * */ -#include - +#include +#include #include + +#include #include -#include -#include using namespace Dali; @@ -38,13 +38,13 @@ int UtcDaliPropertyArrayPushBackP(void) { Property::Array array; - DALI_TEST_CHECK( 0 == array.Size() ); + DALI_TEST_CHECK(0 == array.Size()); - array.PushBack( 1 ); + array.PushBack(1); - DALI_TEST_CHECK( 1 == array.Size() ); + DALI_TEST_CHECK(1 == array.Size()); - DALI_TEST_CHECK( array[0].Get() == 1 ); + DALI_TEST_CHECK(array[0].Get() == 1); END_TEST; } @@ -53,21 +53,21 @@ int UtcDaliPropertyArrayAddP(void) { Property::Array array; - DALI_TEST_CHECK( 0 == array.Size() ); + DALI_TEST_CHECK(0 == array.Size()); - array.Add( 1 ); + array.Add(1); - DALI_TEST_CHECK( 1 == array.Size() ); - DALI_TEST_CHECK( array[0].Get() == 1 ); + DALI_TEST_CHECK(1 == array.Size()); + DALI_TEST_CHECK(array[0].Get() == 1); - array.Add( 2 ) - .Add( 3 ) - .Add( 4.f ); + array.Add(2) + .Add(3) + .Add(4.f); - DALI_TEST_EQUALS( 4u, array.Size(), TEST_LOCATION ); - DALI_TEST_EQUALS( array[1].Get(), 2, TEST_LOCATION ); - DALI_TEST_EQUALS( array[2].Get(), 3, TEST_LOCATION ); - DALI_TEST_EQUALS( array[3].Get(), 4.f, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(4u, array.Size(), TEST_LOCATION); + DALI_TEST_EQUALS(array[1].Get(), 2, TEST_LOCATION); + DALI_TEST_EQUALS(array[2].Get(), 3, TEST_LOCATION); + DALI_TEST_EQUALS(array[3].Get(), 4.f, Math::MACHINE_EPSILON_1, TEST_LOCATION); END_TEST; } @@ -75,46 +75,46 @@ int UtcDaliPropertyArrayAddP(void) int UtcDaliPropertyArrayCapacityP(void) { Property::Array array; - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); array.Reserve(3); - DALI_TEST_CHECK( 3 == array.Capacity() ); + DALI_TEST_CHECK(3 == array.Capacity()); END_TEST; } int UtcDaliPropertyArrayReserveP(void) { Property::Array array; - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); array.Reserve(3); - DALI_TEST_CHECK( 3 == array.Capacity() ); - DALI_TEST_CHECK( 0 == array.Size() ); + DALI_TEST_CHECK(3 == array.Capacity()); + DALI_TEST_CHECK(0 == array.Size()); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); END_TEST; } int UtcDaliPropertyArraySizeP(void) { Property::Array array; - DALI_TEST_CHECK( 0 == array.Capacity() ); - DALI_TEST_CHECK( 0 == array.Size() ); + DALI_TEST_CHECK(0 == array.Capacity()); + DALI_TEST_CHECK(0 == array.Size()); array.Reserve(3); - DALI_TEST_CHECK( 3 == array.Capacity() ); - DALI_TEST_CHECK( 0 == array.Size() ); + DALI_TEST_CHECK(3 == array.Capacity()); + DALI_TEST_CHECK(0 == array.Size()); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); - DALI_TEST_CHECK( 3 == array.Size() ); + DALI_TEST_CHECK(3 == array.Size()); END_TEST; } @@ -122,19 +122,19 @@ int UtcDaliPropertyArraySizeP(void) int UtcDaliPropertyArrayCountP(void) { Property::Array array; - DALI_TEST_CHECK( 0 == array.Capacity() ); - DALI_TEST_CHECK( 0 == array.Count() ); + DALI_TEST_CHECK(0 == array.Capacity()); + DALI_TEST_CHECK(0 == array.Count()); array.Reserve(3); - DALI_TEST_CHECK( 3 == array.Capacity() ); - DALI_TEST_CHECK( 0 == array.Count() ); + DALI_TEST_CHECK(3 == array.Capacity()); + DALI_TEST_CHECK(0 == array.Count()); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); - DALI_TEST_CHECK( 3 == array.Count() ); + DALI_TEST_CHECK(3 == array.Count()); END_TEST; } @@ -142,17 +142,17 @@ int UtcDaliPropertyArrayCountP(void) int UtcDaliPropertyArrayEmptyP(void) { Property::Array array; - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); array.Reserve(3); - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); - DALI_TEST_CHECK( !array.Empty() ); + DALI_TEST_CHECK(!array.Empty()); END_TEST; } @@ -160,21 +160,21 @@ int UtcDaliPropertyArrayEmptyP(void) int UtcDaliPropertyArrayClearP(void) { Property::Array array; - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); array.Reserve(3); - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); - DALI_TEST_CHECK( !array.Empty() ); + DALI_TEST_CHECK(!array.Empty()); array.Clear(); - DALI_TEST_CHECK( array.Empty() ); + DALI_TEST_CHECK(array.Empty()); END_TEST; } @@ -184,13 +184,13 @@ int UtcDaliPropertyArrayIndexOperatorP(void) Property::Array array; array.Reserve(3); - array.PushBack( 1 ); - array.PushBack( "world" ); - array.PushBack( 3 ); + array.PushBack(1); + array.PushBack("world"); + array.PushBack(3); - DALI_TEST_CHECK( array[0].Get() == 1 ); - DALI_TEST_CHECK( array[1].Get() == "world" ); - DALI_TEST_CHECK( array[2].Get() == 3 ); + DALI_TEST_CHECK(array[0].Get() == 1); + DALI_TEST_CHECK(array[1].Get() == "world"); + DALI_TEST_CHECK(array[2].Get() == 3); END_TEST; } @@ -200,15 +200,15 @@ int UtcDaliPropertyArrayConstIndexOperatorP(void) Property::Array anArray; anArray.Reserve(3); - anArray.PushBack( 1 ); - anArray.PushBack( "world" ); - anArray.PushBack( 3 ); + anArray.PushBack(1); + anArray.PushBack("world"); + anArray.PushBack(3); const Property::Array array(anArray); - DALI_TEST_CHECK( array[0].Get() == 1 ); - DALI_TEST_CHECK( array[1].Get() == "world" ); - DALI_TEST_CHECK( array[2].Get() == 3 ); + DALI_TEST_CHECK(array[0].Get() == 1); + DALI_TEST_CHECK(array[1].Get() == "world"); + DALI_TEST_CHECK(array[2].Get() == 3); END_TEST; } @@ -218,15 +218,15 @@ int UtcDaliPropertyArrayAssignmentOperatorP(void) Property::Array anArray; anArray.Reserve(3); - anArray.PushBack( 1 ); - anArray.PushBack( "world" ); - anArray.PushBack( 3 ); + anArray.PushBack(1); + anArray.PushBack("world"); + anArray.PushBack(3); Property::Array array = anArray; - DALI_TEST_CHECK( array[0].Get() == 1 ); - DALI_TEST_CHECK( array[1].Get() == "world" ); - DALI_TEST_CHECK( array[2].Get() == 3 ); + DALI_TEST_CHECK(array[0].Get() == 1); + DALI_TEST_CHECK(array[1].Get() == "world"); + DALI_TEST_CHECK(array[2].Get() == 3); END_TEST; } @@ -236,10 +236,10 @@ int UtcDaliPropertyArrayResize(void) Property::Array array; array.Resize(3); - DALI_TEST_CHECK( array.Count() == 3 ); + DALI_TEST_CHECK(array.Count() == 3); array.Resize(5); - DALI_TEST_CHECK( array.Count() == 5 ); + DALI_TEST_CHECK(array.Count() == 5); END_TEST; } @@ -249,12 +249,12 @@ int UtcDaliPropertyArrayOstream01(void) std::ostringstream oss; Property::Array array; - array.PushBack( 0 ); - array.PushBack( 1 ); - array.PushBack( 2 ); + array.PushBack(0); + array.PushBack(1); + array.PushBack(2); oss << array; - DALI_TEST_EQUALS( oss.str().compare("Array(3) = [0, 1, 2]"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str().compare("Array(3) = [0, 1, 2]"), 0, TEST_LOCATION); END_TEST; } @@ -264,17 +264,17 @@ int UtcDaliPropertyArrayOstream02(void) std::ostringstream oss; Property::Array array1; - array1.PushBack( 0 ); - array1.PushBack( 1 ); - array1.PushBack( 2 ); + array1.PushBack(0); + array1.PushBack(1); + array1.PushBack(2); Property::Array array2; array2.PushBack(array1); - array2.PushBack( 1 ); - array2.PushBack( 2 ); + array2.PushBack(1); + array2.PushBack(2); oss << array2; - DALI_TEST_EQUALS( oss.str().compare("Array(3) = [Array(3) = [0, 1, 2], 1, 2]"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str().compare("Array(3) = [Array(3) = [0, 1, 2], 1, 2]"), 0, TEST_LOCATION); END_TEST; } @@ -282,14 +282,14 @@ int UtcDaliPropertyArrayOstream02(void) int UtcDaliPropertyArrayCopyConstructor(void) { Property::Array array1; - array1.PushBack( 0 ); - array1.PushBack( 1 ); - array1.PushBack( 2 ); - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); + array1.PushBack(0); + array1.PushBack(1); + array1.PushBack(2); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); - Property::Array array2( array1 ); - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); + Property::Array array2(array1); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); + DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); END_TEST; } @@ -297,18 +297,18 @@ int UtcDaliPropertyArrayCopyConstructor(void) int UtcDaliPropertyArrayAssignmentOperator(void) { Property::Array array1; - array1.PushBack( 0 ); - array1.PushBack( 1 ); - array1.PushBack( 2 ); - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); + array1.PushBack(0); + array1.PushBack(1); + array1.PushBack(2); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); Property::Array array2; - array2.PushBack( 4 ); - DALI_TEST_EQUALS( 1u, array2.Size(), TEST_LOCATION ); + array2.PushBack(4); + DALI_TEST_EQUALS(1u, array2.Size(), TEST_LOCATION); array2 = array1; - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); + DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); END_TEST; } @@ -316,26 +316,26 @@ int UtcDaliPropertyArrayAssignmentOperator(void) int UtcDaliPropertyArrayMoveConstructor(void) { Property::Array array1; - array1.PushBack( 0 ); - array1.PushBack( 1 ); - array1.PushBack( 2 ); - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); + array1.PushBack(0); + array1.PushBack(1); + array1.PushBack(2); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); - Property::Array array2( std::move( array1 ) ); - DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); + Property::Array array2(std::move(array1)); + DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); // Calling any methods on array1 will debug assert - const char * exceptionMessage = "Cannot use an object previously used as an r-value"; - DALI_TEST_ASSERTION( array1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.PushBack( Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Clear(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Reserve( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Resize( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Capacity(), exceptionMessage ); - DALI_TEST_ASSERTION( array1[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Array& >( array1 )[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( Property::Array temp; array1 = temp, exceptionMessage ); + const char* exceptionMessage = "Cannot use an object previously used as an r-value"; + DALI_TEST_ASSERTION(array1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(array1.PushBack(Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(array1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(array1.Clear(), exceptionMessage); + DALI_TEST_ASSERTION(array1.Reserve(1), exceptionMessage); + DALI_TEST_ASSERTION(array1.Resize(1), exceptionMessage); + DALI_TEST_ASSERTION(array1.Capacity(), exceptionMessage); + DALI_TEST_ASSERTION(array1[0], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(array1)[0], exceptionMessage); + DALI_TEST_ASSERTION(Property::Array temp; array1 = temp, exceptionMessage); END_TEST; } @@ -343,45 +343,45 @@ int UtcDaliPropertyArrayMoveConstructor(void) int UtcDaliPropertyArrayMoveAssignmentOperator(void) { Property::Array array1; - array1.PushBack( 0 ); - array1.PushBack( 1 ); - array1.PushBack( 2 ); - DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION ); + array1.PushBack(0); + array1.PushBack(1); + array1.PushBack(2); + DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION); Property::Array array2; - array2.PushBack( 4 ); - DALI_TEST_EQUALS( 1u, array2.Size(), TEST_LOCATION ); + array2.PushBack(4); + DALI_TEST_EQUALS(1u, array2.Size(), TEST_LOCATION); - array2 = std::move( array1 ); - DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); + array2 = std::move(array1); + DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); // Calling any methods on array1 will debug assert - const char * exceptionMessage = "Cannot use an object previously used as an r-value"; - DALI_TEST_ASSERTION( array1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.PushBack( Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Clear(), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Reserve( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Resize( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( array1.Capacity(), exceptionMessage ); - DALI_TEST_ASSERTION( array1[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Array& >( array1 )[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( Property::Array temp; array1 = temp, exceptionMessage ); + const char* exceptionMessage = "Cannot use an object previously used as an r-value"; + DALI_TEST_ASSERTION(array1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(array1.PushBack(Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(array1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(array1.Clear(), exceptionMessage); + DALI_TEST_ASSERTION(array1.Reserve(1), exceptionMessage); + DALI_TEST_ASSERTION(array1.Resize(1), exceptionMessage); + DALI_TEST_ASSERTION(array1.Capacity(), exceptionMessage); + DALI_TEST_ASSERTION(array1[0], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(array1)[0], exceptionMessage); + DALI_TEST_ASSERTION(Property::Array temp; array1 = temp, exceptionMessage); // Self assignemnt - array2 = std::move( array2 ); - DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); // still works, no debug assert + array2 = std::move(array2); + DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); // still works, no debug assert END_TEST; } int UtcDaliPropertyArrayInitializerListConstructor(void) { - Property::Array array{ 1, 2, "hello" }; - DALI_TEST_EQUALS( 3u, array.Size(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::INTEGER, array.GetElementAt( 0 ).GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::INTEGER, array.GetElementAt( 1 ).GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( Property::STRING, array.GetElementAt( 2 ).GetType(), TEST_LOCATION ); + Property::Array array{1, 2, "hello"}; + DALI_TEST_EQUALS(3u, array.Size(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::INTEGER, array.GetElementAt(0).GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::INTEGER, array.GetElementAt(1).GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(Property::STRING, array.GetElementAt(2).GetType(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PropertyMap.cpp b/automated-tests/src/dali/utc-Dali-PropertyMap.cpp index dbe8ec3..84d58c2 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyMap.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,12 @@ * */ +#include +#include +#include + #include #include -#include -#include -#include using namespace Dali; @@ -36,46 +37,46 @@ void utc_dali_property_map_cleanup(void) int UtcDaliPropertyMapPopulate(void) { Property::Map map; - DALI_TEST_CHECK( map.Empty() ); - - map[ "hello" ] = 1; - map[ 10 ] = "DALi"; - map[ "world" ] = "world"; - map[ 100 ] = 9; - map[ "world" ] = 3; // same item as line above - DALI_TEST_CHECK( !map.Empty() ); // Should no longer be empty - DALI_TEST_CHECK( map.Count() == 4 ); // Should only have four items, not five!! - DALI_TEST_CHECK( map["hello"].Get() == 1 ); - DALI_TEST_CHECK( map["world"].Get() == 3 ); - DALI_TEST_EQUALS( "DALi", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( map[100].Get() == 9 ); + DALI_TEST_CHECK(map.Empty()); + + map["hello"] = 1; + map[10] = "DALi"; + map["world"] = "world"; + map[100] = 9; + map["world"] = 3; // same item as line above + DALI_TEST_CHECK(!map.Empty()); // Should no longer be empty + DALI_TEST_CHECK(map.Count() == 4); // Should only have four items, not five!! + DALI_TEST_CHECK(map["hello"].Get() == 1); + DALI_TEST_CHECK(map["world"].Get() == 3); + DALI_TEST_EQUALS("DALi", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(map[100].Get() == 9); map.Clear(); - DALI_TEST_CHECK( map.Empty() ); + DALI_TEST_CHECK(map.Empty()); END_TEST; } int UtcDaliPropertyMapCopyAndAssignment(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ 10 ] = "DALi"; + map["hello"] = 1; + map["world"] = 2; + map[10] = "DALi"; Property::Map assignedMap; - assignedMap[ "foo" ] = 3; - assignedMap[ 100 ] = 9; - DALI_TEST_CHECK( assignedMap.Count() == 2 ); + assignedMap["foo"] = 3; + assignedMap[100] = 9; + DALI_TEST_CHECK(assignedMap.Count() == 2); assignedMap = map; - DALI_TEST_CHECK( assignedMap.Count() == 3 ); + DALI_TEST_CHECK(assignedMap.Count() == 3); - Property::Map copiedMap( map ); - DALI_TEST_CHECK( copiedMap.Count() == 3 ); + Property::Map copiedMap(map); + DALI_TEST_CHECK(copiedMap.Count() == 3); // Self assignment - DALI_TEST_CHECK( map.Count() == 3 ); + DALI_TEST_CHECK(map.Count() == 3); map = map; - DALI_TEST_CHECK( map.Count() == 3 ); + DALI_TEST_CHECK(map.Count() == 3); END_TEST; } @@ -83,39 +84,39 @@ int UtcDaliPropertyMapCopyAndAssignment(void) int UtcDaliPropertyMapMoveConstructor(void) { Property::Map map1; - map1[ "hello" ] = 1; - map1[ "world" ] = 2; - map1[ 10 ] = "DALi"; - DALI_TEST_EQUALS( 3u, map1.Count(), TEST_LOCATION ); + map1["hello"] = 1; + map1["world"] = 2; + map1[10] = "DALi"; + DALI_TEST_EQUALS(3u, map1.Count(), TEST_LOCATION); - Property::Map map2( std::move( map1 ) ); - DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION ); + Property::Map map2(std::move(map1)); + DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION); // Calling any methods on map1 will debug assert - const char * exceptionMessage = "Cannot use an object previously used as an r-value"; - DALI_TEST_ASSERTION( map1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Empty(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( (const char *)"key", Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( std::string( "key" ), Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( 0, Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetValue( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKey( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKeyAt( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetPair( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKeyValue( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( (const char *)"key" ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( std::string( "key" ) ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0, "key" ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( "key", Property::INTEGER ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0, Property::INTEGER ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Clear(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Merge( Property::Map() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1[ "key" ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ "key" ], exceptionMessage ); - DALI_TEST_ASSERTION( map1[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( Property::Map temp; map1 = temp, exceptionMessage ); + const char* exceptionMessage = "Cannot use an object previously used as an r-value"; + DALI_TEST_ASSERTION(map1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Empty(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert((const char*)"key", Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert(std::string("key"), Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert(0, Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetValue(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKey(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKeyAt(1), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetPair(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKeyValue(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find((const char*)"key"), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(std::string("key")), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0, "key"), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find("key", Property::INTEGER), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0, Property::INTEGER), exceptionMessage); + DALI_TEST_ASSERTION(map1.Clear(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Merge(Property::Map()), exceptionMessage); + DALI_TEST_ASSERTION(map1["key"], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(map1)["key"], exceptionMessage); + DALI_TEST_ASSERTION(map1[0], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(map1)[0], exceptionMessage); + DALI_TEST_ASSERTION(Property::Map temp; map1 = temp, exceptionMessage); END_TEST; } @@ -123,47 +124,47 @@ int UtcDaliPropertyMapMoveConstructor(void) int UtcDaliPropertyMapMoveAssignmentOperator(void) { Property::Map map1; - map1[ "hello" ] = 1; - map1[ "world" ] = 2; - map1[ 10 ] = "DALi"; - DALI_TEST_EQUALS( 3u, map1.Count(), TEST_LOCATION ); + map1["hello"] = 1; + map1["world"] = 2; + map1[10] = "DALi"; + DALI_TEST_EQUALS(3u, map1.Count(), TEST_LOCATION); Property::Map map2; - map2[ 10 ] = "DALi again"; - DALI_TEST_EQUALS( 1u, map2.Count(), TEST_LOCATION ); + map2[10] = "DALi again"; + DALI_TEST_EQUALS(1u, map2.Count(), TEST_LOCATION); - map2 = std::move( map1 ); - DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION ); + map2 = std::move(map1); + DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION); // Calling any methods on map1 will debug assert - const char * exceptionMessage = "Cannot use an object previously used as an r-value"; - DALI_TEST_ASSERTION( map1.Count(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Empty(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( (const char *)"key", Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( std::string( "key" ), Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Insert( 0, Property::Value() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetValue( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKey( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKeyAt( 1 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetPair( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.GetKeyValue( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( (const char *)"key" ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( std::string( "key" ) ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0 ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0, "key" ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( "key", Property::INTEGER ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Find( 0, Property::INTEGER ), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Clear(), exceptionMessage ); - DALI_TEST_ASSERTION( map1.Merge( Property::Map() ), exceptionMessage ); - DALI_TEST_ASSERTION( map1[ "key" ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ "key" ], exceptionMessage ); - DALI_TEST_ASSERTION( map1[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ 0 ], exceptionMessage ); - DALI_TEST_ASSERTION( Property::Map temp; map1 = temp, exceptionMessage ); + const char* exceptionMessage = "Cannot use an object previously used as an r-value"; + DALI_TEST_ASSERTION(map1.Count(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Empty(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert((const char*)"key", Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert(std::string("key"), Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.Insert(0, Property::Value()), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetValue(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKey(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKeyAt(1), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetPair(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.GetKeyValue(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find((const char*)"key"), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(std::string("key")), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0, "key"), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find("key", Property::INTEGER), exceptionMessage); + DALI_TEST_ASSERTION(map1.Find(0, Property::INTEGER), exceptionMessage); + DALI_TEST_ASSERTION(map1.Clear(), exceptionMessage); + DALI_TEST_ASSERTION(map1.Merge(Property::Map()), exceptionMessage); + DALI_TEST_ASSERTION(map1["key"], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(map1)["key"], exceptionMessage); + DALI_TEST_ASSERTION(map1[0], exceptionMessage); + DALI_TEST_ASSERTION(const_cast(map1)[0], exceptionMessage); + DALI_TEST_ASSERTION(Property::Map temp; map1 = temp, exceptionMessage); // Self assignment - map2 = std::move( map2 ); - DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION ); // No debug assert as nothing should happen + map2 = std::move(map2); + DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION); // No debug assert as nothing should happen END_TEST; } @@ -171,27 +172,27 @@ int UtcDaliPropertyMapMoveAssignmentOperator(void) int UtcDaliPropertyMapConstOperator(void) { Property::Map map; - map[ "hello" ] = 1; - map[ 10 ] = "DALi"; - map[ "world" ] = 2; - DALI_TEST_CHECK( map.Count() == 3 ); + map["hello"] = 1; + map[10] = "DALi"; + map["world"] = 2; + DALI_TEST_CHECK(map.Count() == 3); - const Property::Map& constMap( map ); - DALI_TEST_CHECK( constMap[ "world" ].Get() == 2 ); - DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up + const Property::Map& constMap(map); + DALI_TEST_CHECK(constMap["world"].Get() == 2); + DALI_TEST_CHECK(constMap.Count() == 3); // Ensure count hasn't gone up - DALI_TEST_EQUALS( "DALi", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up + DALI_TEST_EQUALS("DALi", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(constMap.Count() == 3); // Ensure count hasn't gone up // Invalid Key try { - constMap[ "invalidKey" ]; - tet_result( TET_FAIL ); + constMap["invalidKey"]; + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "! \"Invalid Key\"", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "!\"Invalid Key\"", TEST_LOCATION); } END_TEST; @@ -200,29 +201,29 @@ int UtcDaliPropertyMapConstOperator(void) int UtcDaliPropertyMapGetValue(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ Actor::Property::COLOR ] = Color::MAGENTA; + map["hello"] = 1; + map["world"] = 2; + map[Actor::Property::COLOR] = Color::MAGENTA; - Property::Value& value = map.GetValue( 0 ); - DALI_TEST_CHECK( value.Get() == 1 ); + Property::Value& value = map.GetValue(0); + DALI_TEST_CHECK(value.Get() == 1); value = 10; // Allows the actual changing of the value as we have a ref - DALI_TEST_CHECK( map[ "hello" ].Get() == 10 ); + DALI_TEST_CHECK(map["hello"].Get() == 10); - Property::Value& value2 = map.GetValue( 2 ); - DALI_TEST_CHECK( value2.Get() == Color::MAGENTA ); + Property::Value& value2 = map.GetValue(2); + DALI_TEST_CHECK(value2.Get() == Color::MAGENTA); value2 = Color::CYAN; - DALI_TEST_EQUALS( map[ Actor::Property::COLOR].Get(), Color::CYAN, TEST_LOCATION); + DALI_TEST_EQUALS(map[Actor::Property::COLOR].Get(), Color::CYAN, TEST_LOCATION); // Out of bounds try { - map.GetValue( 3 ); - tet_result( TET_FAIL ); + map.GetValue(3); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } END_TEST; @@ -232,59 +233,58 @@ int UtcDaliPropertyMapGetValue(void) int UtcDaliPropertyMapGetKey(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ Actor::Property::COLOR ] = Color::MAGENTA; + map["hello"] = 1; + map["world"] = 2; + map[Actor::Property::COLOR] = Color::MAGENTA; - DALI_TEST_CHECK( map.GetKey( 0 ) == "hello" ); - DALI_TEST_CHECK( map.GetKey( 1 ) == "world" ); + DALI_TEST_CHECK(map.GetKey(0) == "hello"); + DALI_TEST_CHECK(map.GetKey(1) == "world"); // Wrong type try { - map.GetKey( 2 ); - tet_result( TET_FAIL ); + map.GetKey(2); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } // Out of bounds try { - map.GetKey( 3 ); - tet_result( TET_FAIL ); + map.GetKey(3); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } END_TEST; } - int UtcDaliPropertyMapGetKeyAt(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ Actor::Property::COLOR ] = Color::MAGENTA; + map["hello"] = 1; + map["world"] = 2; + map[Actor::Property::COLOR] = Color::MAGENTA; - DALI_TEST_CHECK( map.GetKeyAt( 0 ) == "hello" ); - DALI_TEST_CHECK( map.GetKeyAt( 1 ) == "world" ); - DALI_TEST_CHECK( map.GetKeyAt( 2 ) == Actor::Property::COLOR ); + DALI_TEST_CHECK(map.GetKeyAt(0) == "hello"); + DALI_TEST_CHECK(map.GetKeyAt(1) == "world"); + DALI_TEST_CHECK(map.GetKeyAt(2) == Actor::Property::COLOR); // Out of bounds try { - map.GetKey( 3 ); - tet_result( TET_FAIL ); + map.GetKey(3); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } END_TEST; @@ -293,35 +293,35 @@ int UtcDaliPropertyMapGetKeyAt(void) int UtcDaliPropertyMapGetPair(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ Actor::Property::COLOR ] = Color::MAGENTA; + map["hello"] = 1; + map["world"] = 2; + map[Actor::Property::COLOR] = Color::MAGENTA; - DALI_TEST_CHECK( map.GetPair( 0 ).first == "hello" ); - DALI_TEST_CHECK( map.GetPair( 0 ).second.Get< int >() == 1 ); - DALI_TEST_CHECK( map.GetPair( 1 ).first == "world" ); - DALI_TEST_CHECK( map.GetPair( 1 ).second.Get< int >() == 2 ); + DALI_TEST_CHECK(map.GetPair(0).first == "hello"); + DALI_TEST_CHECK(map.GetPair(0).second.Get() == 1); + DALI_TEST_CHECK(map.GetPair(1).first == "world"); + DALI_TEST_CHECK(map.GetPair(1).second.Get() == 2); // Wrong Type try { - map.GetPair( 2 ); - tet_result( TET_FAIL ); + map.GetPair(2); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } // Out of bounds try { - map.GetPair( 3 ); - tet_result( TET_FAIL ); + map.GetPair(3); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } END_TEST; @@ -330,26 +330,26 @@ int UtcDaliPropertyMapGetPair(void) int UtcDaliPropertyMapGetKeyValue(void) { Property::Map map; - map[ "hello" ] = 1; - map[ "world" ] = 2; - map[ Actor::Property::COLOR ] = Color::MAGENTA; + map["hello"] = 1; + map["world"] = 2; + map[Actor::Property::COLOR] = Color::MAGENTA; - DALI_TEST_CHECK( map.GetKeyValue( 0 ).first == "hello" ); - DALI_TEST_CHECK( map.GetKeyValue( 0 ).second.Get< int >() == 1 ); - DALI_TEST_CHECK( map.GetKeyValue( 1 ).first == "world" ); - DALI_TEST_CHECK( map.GetKeyValue( 1 ).second.Get< int >() == 2 ); - DALI_TEST_CHECK( map.GetKeyValue( 2 ).first == Actor::Property::COLOR ); - DALI_TEST_CHECK( map.GetKeyValue( 2 ).second.Get< Vector4 >() == Color::MAGENTA ); + DALI_TEST_CHECK(map.GetKeyValue(0).first == "hello"); + DALI_TEST_CHECK(map.GetKeyValue(0).second.Get() == 1); + DALI_TEST_CHECK(map.GetKeyValue(1).first == "world"); + DALI_TEST_CHECK(map.GetKeyValue(1).second.Get() == 2); + DALI_TEST_CHECK(map.GetKeyValue(2).first == Actor::Property::COLOR); + DALI_TEST_CHECK(map.GetKeyValue(2).second.Get() == Color::MAGENTA); // Out of bounds try { - map.GetPair( 3 ); - tet_result( TET_FAIL ); + map.GetPair(3); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "position", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "position", TEST_LOCATION); } END_TEST; @@ -358,35 +358,35 @@ int UtcDaliPropertyMapGetKeyValue(void) int UtcDaliPropertyMapFind(void) { Property::Map map; - map[ "hello" ] = 1; - map[ 10 ] = "DALi"; - map[ "world" ] = 2; - map[ 100 ] = 9; + map["hello"] = 1; + map[10] = "DALi"; + map["world"] = 2; + map[100] = 9; Property::Value* value = NULL; - value = map.Find( "hello" ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 1 ); + value = map.Find("hello"); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 1); const std::string world("world"); - value = map.Find( world ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 2 ); + value = map.Find(world); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 2); - value = map.Find( 100 ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 9 ); + value = map.Find(100); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 9); - value = map.Find( 10, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "DALi", value->Get(), TEST_LOCATION ); + value = map.Find(10, Property::STRING); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("DALi", value->Get(), TEST_LOCATION); - value = map.Find( 10, Property::INTEGER ); - DALI_TEST_CHECK( value == NULL ); + value = map.Find(10, Property::INTEGER); + DALI_TEST_CHECK(value == NULL); - value = map.Find( "invalidKey" ); - DALI_TEST_CHECK( !value ); + value = map.Find("invalidKey"); + DALI_TEST_CHECK(!value); END_TEST; } @@ -394,46 +394,43 @@ int UtcDaliPropertyMapFind(void) int UtcDaliPropertyMapFindIndexThenString(void) { // Define the valid keys and values to test with. - std::string stringKeyValid = "bar"; + std::string stringKeyValid = "bar"; std::string stringKeyInvalid = "aardvark"; - int indexKeyValid = 100; - int indexKeyInvalid = 101; + int indexKeyValid = 100; + int indexKeyInvalid = 101; // Define invalid key and value to test with. std::string stringValueValid = "DALi"; - int indexValueValid = 3; + int indexValueValid = 3; // Set up a property map containing the valid keys and values defined above. Property::Map map; - map[ "foo" ] = 1; - map[ 10 ] = "string"; - map[ stringKeyValid ] = stringValueValid; - map[ indexKeyValid ] = indexValueValid; + map["foo"] = 1; + map[10] = "string"; + map[stringKeyValid] = stringValueValid; + map[indexKeyValid] = indexValueValid; Property::Value* value = NULL; // TEST: If both index and string are valid, the Property::Value of the index is returned. - value = map.Find( indexKeyValid, stringKeyValid ); - - DALI_TEST_EQUALS( value->Get(), indexValueValid, TEST_LOCATION ); + value = map.Find(indexKeyValid, stringKeyValid); + DALI_TEST_EQUALS(value->Get(), indexValueValid, TEST_LOCATION); // TEST: If only the index is valid, the Property::Value of the index is returned. - value = map.Find( indexKeyValid, stringKeyInvalid ); - - DALI_TEST_EQUALS( value->Get(), indexValueValid, TEST_LOCATION ); + value = map.Find(indexKeyValid, stringKeyInvalid); + DALI_TEST_EQUALS(value->Get(), indexValueValid, TEST_LOCATION); // TEST: If only the string is valid, the Property::Value of the string is returned. - value = map.Find( indexKeyInvalid, stringKeyValid ); - - DALI_TEST_EQUALS( value->Get(), stringValueValid, TEST_LOCATION ); + value = map.Find(indexKeyInvalid, stringKeyValid); + DALI_TEST_EQUALS(value->Get(), stringValueValid, TEST_LOCATION); // TEST: If neither the index or string are valid, then a NULL pointer is returned. - value = map.Find( indexKeyInvalid, stringKeyInvalid ); + value = map.Find(indexKeyInvalid, stringKeyInvalid); - DALI_TEST_CHECK( value == NULL ); + DALI_TEST_CHECK(value == NULL); END_TEST; } @@ -441,20 +438,20 @@ int UtcDaliPropertyMapFindIndexThenString(void) int UtcDaliPropertyMapOperatorIndex(void) { Property::Map map; - map[ "hello" ] = 1; - map[ 10 ] = "DALi"; - map[ "world" ] = 2; - map[ 100 ] = 9; + map["hello"] = 1; + map[10] = "DALi"; + map["world"] = 2; + map[100] = 9; - const Property::Map map2 = map; + const Property::Map map2 = map; const Property::Value& value10 = map2[10]; - DALI_TEST_EQUALS( value10.Get(), "DALi", TEST_LOCATION ); + DALI_TEST_EQUALS(value10.Get(), "DALi", TEST_LOCATION); const Property::Value& value100 = map2[100]; - DALI_TEST_EQUALS( value100.Get(), 9, TEST_LOCATION ); + DALI_TEST_EQUALS(value100.Get(), 9, TEST_LOCATION); const Property::Value& valueHello = map2["hello"]; - DALI_TEST_EQUALS( valueHello.Get(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(valueHello.Get(), 1, TEST_LOCATION); END_TEST; } @@ -462,62 +459,61 @@ int UtcDaliPropertyMapOperatorIndex(void) int UtcDaliPropertyMapInsertP(void) { Property::Map map; - DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION ); - map.Insert( "foo", "bar"); - DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION ); - Property::Value* value = map.Find( "foo" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "bar", value->Get(), TEST_LOCATION ); - - map.Insert( std::string("foo2"), "testing" ); - DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION ); - value = map.Find( "foo2" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "testing", value->Get(), TEST_LOCATION ); - - map.Insert( 10, "DALi" ); - DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION ); - value = map.Find( 10 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "DALi", value->Get(), TEST_LOCATION ); - - map.Insert( 100, 9 ); - DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION ); - value = map.Find( 100 ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 9 ); + DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION); + map.Insert("foo", "bar"); + DALI_TEST_EQUALS(1u, map.Count(), TEST_LOCATION); + Property::Value* value = map.Find("foo"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("bar", value->Get(), TEST_LOCATION); + + map.Insert(std::string("foo2"), "testing"); + DALI_TEST_EQUALS(2u, map.Count(), TEST_LOCATION); + value = map.Find("foo2"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("testing", value->Get(), TEST_LOCATION); + + map.Insert(10, "DALi"); + DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION); + value = map.Find(10); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("DALi", value->Get(), TEST_LOCATION); + + map.Insert(100, 9); + DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION); + value = map.Find(100); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 9); END_TEST; } - int UtcDaliPropertyMapAddP(void) { Property::Map map; - DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION ); - map.Add( "foo", "bar"); - DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION ); - Property::Value* value = map.Find( "foo" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "bar", value->Get(), TEST_LOCATION ); - - map.Add( std::string("foo2"), "testing" ); - DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION ); - value = map.Find( "foo2" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "testing", value->Get(), TEST_LOCATION ); - - map.Add( 10, "DALi" ); - DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION ); - value = map.Find( 10 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "DALi", value->Get(), TEST_LOCATION ); - - map.Add( 100, 9 ); - DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION ); - value = map.Find( 100 ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 9 ); + DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION); + map.Add("foo", "bar"); + DALI_TEST_EQUALS(1u, map.Count(), TEST_LOCATION); + Property::Value* value = map.Find("foo"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("bar", value->Get(), TEST_LOCATION); + + map.Add(std::string("foo2"), "testing"); + DALI_TEST_EQUALS(2u, map.Count(), TEST_LOCATION); + value = map.Find("foo2"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("testing", value->Get(), TEST_LOCATION); + + map.Add(10, "DALi"); + DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION); + value = map.Find(10); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("DALi", value->Get(), TEST_LOCATION); + + map.Add(100, 9); + DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION); + value = map.Find(100); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 9); END_TEST; } @@ -525,30 +521,30 @@ int UtcDaliPropertyMapAddP(void) int UtcDaliPropertyMapAddChainP(void) { Property::Map map; - DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION); map - .Add( "foo", "bar") - .Add( std::string("foo2"), "testing" ) - .Add( 10, "DALi" ) - .Add( 100, 9 ); + .Add("foo", "bar") + .Add(std::string("foo2"), "testing") + .Add(10, "DALi") + .Add(100, 9); - DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION); - Property::Value* value = map.Find( "foo" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "bar", value->Get(), TEST_LOCATION ); + Property::Value* value = map.Find("foo"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("bar", value->Get(), TEST_LOCATION); - value = map.Find( "foo2" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "testing", value->Get(), TEST_LOCATION ); + value = map.Find("foo2"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("testing", value->Get(), TEST_LOCATION); - value = map.Find( 10 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "DALi", value->Get(), TEST_LOCATION ); + value = map.Find(10); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("DALi", value->Get(), TEST_LOCATION); - value = map.Find( 100 ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 9 ); + value = map.Find(100); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 9); END_TEST; } @@ -565,97 +561,92 @@ int UtcDaliPropertyMapAnonymousAddChainP(void) Property::Map mMap; }; - TestMap mapTest( Property::Map().Add( "foo", "bar") - .Add( std::string("foo2"), "testing" ) - .Add( 10, "DALi" ) - .Add( 100, 9 )); - + TestMap mapTest(Property::Map().Add("foo", "bar").Add(std::string("foo2"), "testing").Add(10, "DALi").Add(100, 9)); - Property::Value* value = mapTest.mMap.Find( "foo" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "bar", value->Get(), TEST_LOCATION ); + Property::Value* value = mapTest.mMap.Find("foo"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("bar", value->Get(), TEST_LOCATION); - value = mapTest.mMap.Find( "foo2" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "testing", value->Get(), TEST_LOCATION ); + value = mapTest.mMap.Find("foo2"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("testing", value->Get(), TEST_LOCATION); - value = mapTest.mMap.Find( 10 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( "DALi", value->Get(), TEST_LOCATION ); + value = mapTest.mMap.Find(10); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS("DALi", value->Get(), TEST_LOCATION); - value = mapTest.mMap.Find( 100 ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 9 ); + value = mapTest.mMap.Find(100); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 9); END_TEST; } - int UtcDaliPropertyMapMerge(void) { Property::Map map; - map[ "hello" ] = 1; - map[ 10 ] = "DALi"; - map[ "world" ] = 2; + map["hello"] = 1; + map[10] = "DALi"; + map["world"] = 2; - DALI_TEST_CHECK( map.Count() == 3 ); + DALI_TEST_CHECK(map.Count() == 3); // Create another map with the same keys but different values Property::Map map2; - map2[ "hello" ] = 3; - map2[ "world" ] = 4; - map[ 10 ] = "3DEngine"; + map2["hello"] = 3; + map2["world"] = 4; + map[10] = "3DEngine"; // Merge map2 into map1, count should still be 2, map values should be from map2 - map.Merge( map2 ); - DALI_TEST_CHECK( map.Count() == 3 ); - DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 ); - DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 ); - DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get(), TEST_LOCATION ); + map.Merge(map2); + DALI_TEST_CHECK(map.Count() == 3); + DALI_TEST_CHECK(map["hello"].Get() == 3); + DALI_TEST_CHECK(map["world"].Get() == 4); + DALI_TEST_EQUALS("3DEngine", map[10].Get(), TEST_LOCATION); // Create another map with different keys Property::Map map3; - map3[ "foo" ] = 5; - map3[ 100 ] = 6; + map3["foo"] = 5; + map3[100] = 6; // Merge map3 into map1, count should increase, existing values should match previous and new values should match map3 - map.Merge( map3 ); - DALI_TEST_CHECK( map.Count() == 5 ); - DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 ); - DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 ); - DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 ); - DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( map[ 100].Get< int >() == 6 ); + map.Merge(map3); + DALI_TEST_CHECK(map.Count() == 5); + DALI_TEST_CHECK(map["hello"].Get() == 3); + DALI_TEST_CHECK(map["world"].Get() == 4); + DALI_TEST_CHECK(map["foo"].Get() == 5); + DALI_TEST_EQUALS("3DEngine", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(map[100].Get() == 6); // Create an empty map and attempt to merge, should be successful, nothing should change Property::Map map4; - DALI_TEST_CHECK( map4.Empty() ); - map.Merge( map4 ); - DALI_TEST_CHECK( map4.Empty() ); - DALI_TEST_CHECK( map.Count() == 5 ); - DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 ); - DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 ); - DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 ); - DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 ); + DALI_TEST_CHECK(map4.Empty()); + map.Merge(map4); + DALI_TEST_CHECK(map4.Empty()); + DALI_TEST_CHECK(map.Count() == 5); + DALI_TEST_CHECK(map["hello"].Get() == 3); + DALI_TEST_CHECK(map["world"].Get() == 4); + DALI_TEST_CHECK(map["foo"].Get() == 5); + DALI_TEST_EQUALS("3DEngine", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(map[100].Get() == 6); // Merge map into map4, map4 should be the same as map now. - map4.Merge( map ); - DALI_TEST_CHECK( map4.Count() == 5 ); - DALI_TEST_CHECK( map4[ "hello" ].Get< int >() == 3 ); - DALI_TEST_CHECK( map4[ "world"].Get< int >() == 4 ); - DALI_TEST_CHECK( map4[ "foo"].Get< int >() == 5 ); - DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( map4[ 100 ].Get< int >() == 6 ); + map4.Merge(map); + DALI_TEST_CHECK(map4.Count() == 5); + DALI_TEST_CHECK(map4["hello"].Get() == 3); + DALI_TEST_CHECK(map4["world"].Get() == 4); + DALI_TEST_CHECK(map4["foo"].Get() == 5); + DALI_TEST_EQUALS("3DEngine", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(map4[100].Get() == 6); // Attempt to merge into itself, should be successful, nothing should change - map.Merge( map ); - DALI_TEST_CHECK( map.Count() == 5 ); - DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 ); - DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 ); - DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 ); - DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get(), TEST_LOCATION ); - DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 ); + map.Merge(map); + DALI_TEST_CHECK(map.Count() == 5); + DALI_TEST_CHECK(map["hello"].Get() == 3); + DALI_TEST_CHECK(map["world"].Get() == 4); + DALI_TEST_CHECK(map["foo"].Get() == 5); + DALI_TEST_EQUALS("3DEngine", map[10].Get(), TEST_LOCATION); + DALI_TEST_CHECK(map[100].Get() == 6); END_TEST; } @@ -665,9 +656,9 @@ int UtcDaliPropertyMapOstream01(void) Property::Map map; map.Insert("duration", 5.0f); - map.Insert( 10, "DALi" ); + map.Insert(10, "DALi"); map.Insert("delay", 1.0f); - map.Insert( 100, 9 ); + map.Insert(100, 9); map.Insert("value", 100); std::ostringstream oss; @@ -676,21 +667,20 @@ int UtcDaliPropertyMapOstream01(void) tet_printf("Testing ouput of map: %s\n", oss.str().c_str()); // string-value pairs first, then index-value pairs - DALI_TEST_EQUALS( oss.str().compare("Map(5) = {duration:5, delay:1, value:100, 10:DALi, 100:9}"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str().compare("Map(5) = {duration:5, delay:1, value:100, 10:DALi, 100:9}"), 0, TEST_LOCATION); END_TEST; } - int UtcDaliPropertyMapOstream02(void) { Property::Map map, map2; map2.Insert("duration", 5.0f); map2.Insert("delay", 1.0f); - map2.Insert( 10, "DALi" ); + map2.Insert(10, "DALi"); map.Insert("timePeriod", map2); - map.Insert( 100, 9 ); + map.Insert(100, 9); map.Insert("value", 100); std::ostringstream oss; @@ -699,78 +689,77 @@ int UtcDaliPropertyMapOstream02(void) tet_printf("Testing ouput of map: %s\n", oss.str().c_str()); // string-value pairs first, then index-value pairs - DALI_TEST_EQUALS( oss.str().compare("Map(3) = {timePeriod:Map(3) = {duration:5, delay:1, 10:DALi}, value:100, 100:9}"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str().compare("Map(3) = {timePeriod:Map(3) = {duration:5, delay:1, 10:DALi}, value:100, 100:9}"), 0, TEST_LOCATION); END_TEST; } int UtcDaliPropertyKeyConstructorP(void) { - Property::Key key1( "aKey" ); - DALI_TEST_EQUALS( key1.type, Property::Key::STRING, TEST_LOCATION ); - DALI_TEST_EQUALS( key1.stringKey, "aKey", TEST_LOCATION ); - DALI_TEST_EQUALS( key1.indexKey, Property::INVALID_INDEX, TEST_LOCATION ); - - Property::Key key2( Actor::Property::COLOR ); - DALI_TEST_EQUALS( key2.type, Property::Key::INDEX, TEST_LOCATION ); - DALI_TEST_EQUALS( key2.indexKey, (Dali::Property::Index)Actor::Property::COLOR, TEST_LOCATION ); + Property::Key key1("aKey"); + DALI_TEST_EQUALS(key1.type, Property::Key::STRING, TEST_LOCATION); + DALI_TEST_EQUALS(key1.stringKey, "aKey", TEST_LOCATION); + DALI_TEST_EQUALS(key1.indexKey, Property::INVALID_INDEX, TEST_LOCATION); + + Property::Key key2(Actor::Property::COLOR); + DALI_TEST_EQUALS(key2.type, Property::Key::INDEX, TEST_LOCATION); + DALI_TEST_EQUALS(key2.indexKey, (Dali::Property::Index)Actor::Property::COLOR, TEST_LOCATION); END_TEST; } int UtcDaliPropertyKeyEqualityOperatorP(void) { - Property::Key key1( "aKey" ); - Property::Key key2( 113 ); + Property::Key key1("aKey"); + Property::Key key2(113); - DALI_TEST_CHECK( key1 == "aKey" ); - DALI_TEST_CHECK( ! (key1 == "notTheKey") ); - DALI_TEST_CHECK( ! (key1 == 1) ); + DALI_TEST_CHECK(key1 == "aKey"); + DALI_TEST_CHECK(!(key1 == "notTheKey")); + DALI_TEST_CHECK(!(key1 == 1)); - DALI_TEST_CHECK( key2 == 113 ); - DALI_TEST_CHECK( ! (key2 == 0) ); - DALI_TEST_CHECK( ! (key2 == "One hundred and thirteen" ) ); + DALI_TEST_CHECK(key2 == 113); + DALI_TEST_CHECK(!(key2 == 0)); + DALI_TEST_CHECK(!(key2 == "One hundred and thirteen")); - DALI_TEST_CHECK( ! (key1 == key2) ); - DALI_TEST_CHECK( key1 != key2 ); + DALI_TEST_CHECK(!(key1 == key2)); + DALI_TEST_CHECK(key1 != key2); - Property::Key key1B( "aKey" ); - Property::Key key2B( 113 ); + Property::Key key1B("aKey"); + Property::Key key2B(113); - DALI_TEST_CHECK( key1 == key1B ); - DALI_TEST_CHECK( key2 == key2B ); + DALI_TEST_CHECK(key1 == key1B); + DALI_TEST_CHECK(key2 == key2B); END_TEST; } int UtcDaliPropertyKeyInequalityOperatorP(void) { - Property::Key key1( "aKey" ); - Property::Key key2( 113 ); + Property::Key key1("aKey"); + Property::Key key2(113); - DALI_TEST_CHECK( key1 != "notTheKey" ); - DALI_TEST_CHECK( key1 != 1 ); + DALI_TEST_CHECK(key1 != "notTheKey"); + DALI_TEST_CHECK(key1 != 1); - DALI_TEST_CHECK( key2 != 0 ); - DALI_TEST_CHECK( key2 != "One hundred and thirteen" ); + DALI_TEST_CHECK(key2 != 0); + DALI_TEST_CHECK(key2 != "One hundred and thirteen"); - DALI_TEST_CHECK( key1 != key2 ); + DALI_TEST_CHECK(key1 != key2); END_TEST; } - int UtcDaliPropertyKeyOutputStream(void) { - Property::Key key1( "aKey" ); - Property::Key key2( 113 ); + Property::Key key1("aKey"); + Property::Key key2(113); std::ostringstream oss; oss << key1; - DALI_TEST_EQUALS( oss.str(), "aKey", TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str(), "aKey", TEST_LOCATION); std::ostringstream oss2; oss2 << key2; - DALI_TEST_EQUALS( oss2.str(), "113", TEST_LOCATION ); + DALI_TEST_EQUALS(oss2.str(), "113", TEST_LOCATION); END_TEST; } @@ -778,68 +767,66 @@ int UtcDaliPropertyKeyOutputStream(void) int UtcDaliPropertyMapInitializerListConstructor(void) { auto map = Property::Map{ - {"number mapped to string", 1}, - {10, "string mapped to number"}, - {"string mapped", "to string"}, - {100, 3}, + {"number mapped to string", 1}, + {10, "string mapped to number"}, + {"string mapped", "to string"}, + {100, 3}, }; - DALI_TEST_CHECK( !map.Empty() ); // Should not be empty - DALI_TEST_EQUALS( 4, map.Count(), TEST_LOCATION ); // Should have four items + DALI_TEST_CHECK(!map.Empty()); // Should not be empty + DALI_TEST_EQUALS(4, map.Count(), TEST_LOCATION); // Should have four items - DALI_TEST_EQUALS( 1, map[ "number mapped to string" ].Get< int >(), TEST_LOCATION ); - DALI_TEST_EQUALS( "string mapped to number", map[ 10 ].Get< std::string >(), TEST_LOCATION ); - DALI_TEST_EQUALS( "to string", map[ "string mapped" ].Get< std::string >(), TEST_LOCATION ); - DALI_TEST_EQUALS( 3, map[ 100 ].Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, map["number mapped to string"].Get(), TEST_LOCATION); + DALI_TEST_EQUALS("string mapped to number", map[10].Get(), TEST_LOCATION); + DALI_TEST_EQUALS("to string", map["string mapped"].Get(), TEST_LOCATION); + DALI_TEST_EQUALS(3, map[100].Get(), TEST_LOCATION); END_TEST; } int UtcDaliPropertyMapNestedInitializerListConstructor(void) { - auto map = Property::Map - { + auto map = Property::Map{ {1, 1}, {2, {{2, 2}}}, - {3, {{3, {{3, 3}}}}} - }; + {3, {{3, {{3, 3}}}}}}; - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_EQUALS( 3, map.Count(), TEST_LOCATION ); + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_EQUALS(3, map.Count(), TEST_LOCATION); // Check first item { - DALI_TEST_EQUALS( 1, map[ 1 ].Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, map[1].Get(), TEST_LOCATION); } // Check second item { - auto& value1 = map[ 2 ]; - DALI_TEST_EQUALS( Property::MAP, value1.GetType(), TEST_LOCATION ); + auto& value1 = map[2]; + DALI_TEST_EQUALS(Property::MAP, value1.GetType(), TEST_LOCATION); auto& map2 = *(value1.GetMap()); - DALI_TEST_EQUALS( 1, map2.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, map2.Count(), TEST_LOCATION); // check the value - DALI_TEST_EQUALS( 2, map2[ 2 ].Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS(2, map2[2].Get(), TEST_LOCATION); } // Check the third item { - auto& value1 = map[ 3 ]; - DALI_TEST_EQUALS( Property::MAP, value1.GetType(), TEST_LOCATION ); + auto& value1 = map[3]; + DALI_TEST_EQUALS(Property::MAP, value1.GetType(), TEST_LOCATION); auto& map2 = *(value1.GetMap()); - DALI_TEST_EQUALS( 1, map2.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, map2.Count(), TEST_LOCATION); - auto& value2 = map2[ 3 ]; - DALI_TEST_EQUALS( Property::MAP, value2.GetType(), TEST_LOCATION ); + auto& value2 = map2[3]; + DALI_TEST_EQUALS(Property::MAP, value2.GetType(), TEST_LOCATION); auto& map3 = *(value2.GetMap()); - DALI_TEST_EQUALS( 1, map3.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, map3.Count(), TEST_LOCATION); // check the value - DALI_TEST_EQUALS( 3, map3[ 3 ].Get< int >(), TEST_LOCATION ); + DALI_TEST_EQUALS(3, map3[3].Get(), TEST_LOCATION); } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp b/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp index 7e65a8e..460c011 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyNotification.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -33,8 +33,8 @@ void utc_dali_property_notification_cleanup(void) test_return_value = TET_PASS; } -namespace { - +namespace +{ static bool gCallBackCalled; static void TestCallback(PropertyNotification& source) @@ -42,16 +42,14 @@ static void TestCallback(PropertyNotification& source) gCallBackCalled = true; } -const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS) -const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check. - +const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS) +const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check. class TestClass : public ConnectionTracker { public: - - TestClass(Integration::Scene scene ) - : mScene( scene ) + TestClass(Integration::Scene scene) + : mScene(scene) { } @@ -62,14 +60,14 @@ public: void Initialize() { mActor = Actor::New(); - mScene.Add( mActor ); - mNotification = mActor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) ); - mNotification.NotifySignal().Connect( this, &TestClass::OnPropertyNotify ); + mScene.Add(mActor); + mNotification = mActor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); + mNotification.NotifySignal().Connect(this, &TestClass::OnPropertyNotify); } void RemovePropertyNotification() { - mActor.RemovePropertyNotification( mNotification ); + mActor.RemovePropertyNotification(mNotification); } void RemovePropertyNotifications() @@ -79,23 +77,22 @@ public: void Terminate() { - mScene.Remove( mActor ); + mScene.Remove(mActor); mActor.Reset(); mNotification.Reset(); } - void OnPropertyNotify( PropertyNotification& source ) + void OnPropertyNotify(PropertyNotification& source) { tet_infoline(" OnPropertyNotify"); gCallBackCalled = true; } - Actor mActor; + Actor mActor; PropertyNotification mNotification; - Integration::Scene mScene; + Integration::Scene mScene; }; - /* * Simulate time passed by. * @@ -109,7 +106,7 @@ int Wait(TestApplication& application, int duration = 0) { int time = 0; - for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + for(int i = 0; i <= (duration / RENDER_FRAME_INTERVAL); i++) { application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); @@ -121,28 +118,26 @@ int Wait(TestApplication& application, int duration = 0) } // unnamed namespace - // Positive test case for a method int UtcDaliPropertyNotificationDownCast(void) { TestApplication application; tet_infoline(" UtcDaliPropertyNotificationDownCast"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - BaseHandle handle = notification; + BaseHandle handle = notification; PropertyNotification notificationHandle; DALI_TEST_CHECK(notification); DALI_TEST_CHECK(handle); DALI_TEST_CHECK(!notificationHandle); - notificationHandle = PropertyNotification::DownCast( handle ); + notificationHandle = PropertyNotification::DownCast(handle); DALI_TEST_CHECK(notificationHandle); END_TEST; } - // Negative test case for a method int UtcDaliPropertyNotificationDownCastNegative(void) { @@ -154,10 +149,10 @@ int UtcDaliPropertyNotificationDownCastNegative(void) Actor actor = Actor::New(); actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - BaseHandle handle = somethingElse; + BaseHandle handle = somethingElse; PropertyNotification notificationHandle; - notificationHandle = PropertyNotification::DownCast( handle ); + notificationHandle = PropertyNotification::DownCast(handle); DALI_TEST_CHECK(!notificationHandle); END_TEST; } @@ -169,28 +164,28 @@ int UtcDaliPropertyNotificationMoveConstructor(void) Actor actor = Actor::New(); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - DALI_TEST_CHECK( notification ); - DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(notification); + DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION); - PropertyNotification movedNotification = std::move( notification ); - DALI_TEST_CHECK( movedNotification ); + PropertyNotification movedNotification = std::move(notification); + DALI_TEST_CHECK(movedNotification); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !notification ); + DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!notification); PropertyCondition condition = movedNotification.GetCondition(); - DALI_TEST_CHECK( condition ); - DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION ); + DALI_TEST_CHECK(condition); + DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION); - PropertyCondition movedCondition = std::move( condition ); - DALI_TEST_CHECK( movedCondition ); + PropertyCondition movedCondition = std::move(condition); + DALI_TEST_CHECK(movedCondition); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !condition ); + DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION); + DALI_TEST_CHECK(!condition); END_TEST; } @@ -202,30 +197,30 @@ int UtcDaliPropertyNotificationMoveAssignment(void) Actor actor = Actor::New(); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - DALI_TEST_CHECK( notification ); - DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(notification); + DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION); PropertyNotification movedNotification; - movedNotification = std::move( notification ); - DALI_TEST_CHECK( movedNotification ); + movedNotification = std::move(notification); + DALI_TEST_CHECK(movedNotification); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !notification ); + DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!notification); PropertyCondition condition = movedNotification.GetCondition(); - DALI_TEST_CHECK( condition ); - DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION ); + DALI_TEST_CHECK(condition); + DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION); PropertyCondition movedCondition; - movedCondition = std::move( condition ); - DALI_TEST_CHECK( movedCondition ); + movedCondition = std::move(condition); + DALI_TEST_CHECK(movedCondition); // Check that object is moved (not copied, so ref count keeps the same) - DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !condition ); + DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION); + DALI_TEST_CHECK(!condition); END_TEST; } @@ -237,10 +232,10 @@ int UtcDaliAddPropertyNotification(void) Actor actor = Actor::New(); - PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f )); - DALI_TEST_CHECK( notification ); - DALI_TEST_CHECK( notification2 ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); + PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f)); + DALI_TEST_CHECK(notification); + DALI_TEST_CHECK(notification2); END_TEST; } @@ -257,31 +252,31 @@ int UtcDaliAddPropertyNotificationCallback(void) gCallBackCalled = false; tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition true, should receive a notification"); - object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); gCallBackCalled = false; tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition false, should not receive a notification"); - object->mActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + object->mActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); gCallBackCalled = false; tet_infoline(" UtcDaliAddPropertyNotificationCallback - Deleting notification and it's owning object, should not receive a notification"); - object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); object->Terminate(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing notification and it's owning object, should not receive a notification"); object->Initialize(); @@ -291,12 +286,12 @@ int UtcDaliAddPropertyNotificationCallback(void) object->RemovePropertyNotification(); - object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing all notifications and it's owning object, should not receive a notification"); object->Initialize(); @@ -306,13 +301,12 @@ int UtcDaliAddPropertyNotificationCallback(void) object->RemovePropertyNotifications(); - object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_CHECK( !gCallBackCalled ); - + DALI_TEST_CHECK(!gCallBackCalled); delete object; END_TEST; @@ -327,11 +321,11 @@ int UtcDaliAddPropertyNotificationTypeProperty(void) // Currently, Type registry properties cannot be animated try { - actor.AddPropertyNotification( PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition( 100.0f ) ); + actor.AddPropertyNotification(PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition(100.0f)); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property notification added to event side only property", TEST_LOCATION); } END_TEST; } @@ -345,11 +339,11 @@ int UtcDaliAddPropertyNotificationEventSidePropertyN(void) // Currently, Type registry properties cannot be animated try { - actor.AddPropertyNotification( PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition( 100.0f ) ); + actor.AddPropertyNotification(PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition(100.0f)); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property notification added to event side only property", TEST_LOCATION); } END_TEST; } @@ -361,8 +355,8 @@ int UtcDaliAddPropertyNotificationSize(void) Actor actor = Actor::New(); - PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f )); - DALI_TEST_CHECK( notification ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f)); + DALI_TEST_CHECK(notification); END_TEST; } @@ -373,20 +367,18 @@ int UtcDaliPropertyNotificationGetCondition(void) Actor actor = Actor::New(); - PropertyCondition condition = GreaterThanCondition(100.0f); + PropertyCondition condition = GreaterThanCondition(100.0f); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition); - DALI_TEST_CHECK( condition == notification.GetCondition() ); + DALI_TEST_CHECK(condition == notification.GetCondition()); END_TEST; } class PropertyNotificationConstWrapper { public: - PropertyNotificationConstWrapper(PropertyNotification propertyNotification) - :mPropertyNotification(propertyNotification) + : mPropertyNotification(propertyNotification) { - } /** @@ -408,14 +400,14 @@ int UtcDaliPropertyNotificationGetConditionConst(void) Actor actor = Actor::New(); - PropertyCondition condition = GreaterThanCondition(100.0f); - PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition); + PropertyCondition condition = GreaterThanCondition(100.0f); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition); PropertyNotificationConstWrapper notificationConst(notification); - const PropertyCondition& conditionReference1 = notificationConst.GetCondition(); - const PropertyCondition& conditionReference2 = notificationConst.GetCondition(); + const PropertyCondition& conditionReference1 = notificationConst.GetCondition(); + const PropertyCondition& conditionReference2 = notificationConst.GetCondition(); - DALI_TEST_CHECK( (&conditionReference1) == (&conditionReference2) ); - DALI_TEST_CHECK( conditionReference1 == condition ); + DALI_TEST_CHECK((&conditionReference1) == (&conditionReference2)); + DALI_TEST_CHECK(conditionReference1 == condition); END_TEST; } @@ -424,14 +416,14 @@ int UtcDaliPropertyNotificationGetTarget(void) TestApplication application; tet_infoline(" UtcDaliPropertyNotificationGetTarget"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); Actor actor2 = Actor::New(); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - Actor targetActor = Actor::DownCast( notification.GetTarget() ); + Actor targetActor = Actor::DownCast(notification.GetTarget()); - DALI_TEST_CHECK( targetActor == actor ); + DALI_TEST_CHECK(targetActor == actor); END_TEST; } @@ -442,11 +434,11 @@ int UtcDaliPropertyNotificationGetProperty(void) Actor actor = Actor::New(); - PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); - Property::Index targetProperty = notification.GetTargetProperty(); + Property::Index targetProperty = notification.GetTargetProperty(); - DALI_TEST_EQUALS( targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION ); + DALI_TEST_EQUALS(targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION); END_TEST; } @@ -462,7 +454,7 @@ int UtcDaliPropertyNotificationGetNotifyMode(void) notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED); PropertyNotification::NotifyMode notifyMode = notification.GetNotifyMode(); - DALI_TEST_EQUALS( notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION ); + DALI_TEST_EQUALS(notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION); END_TEST; } @@ -477,9 +469,9 @@ int UtcDaliPropertyNotificationGetNotifyResultP(void) GreaterThanCondition(100.0f)); notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED); gCallBackCalled = false; - notification.NotifySignal().Connect( &TestCallback ); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); @@ -488,7 +480,7 @@ int UtcDaliPropertyNotificationGetNotifyResultP(void) bool notifyResult = notification.GetNotifyResult(); - DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION ); + DALI_TEST_EQUALS(notifyResult, false, TEST_LOCATION); END_TEST; } @@ -501,30 +493,30 @@ int UtcDaliPropertyNotificationGreaterThan(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move right to satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move left to un-satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); // Move right to satisfy condition again. gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -536,30 +528,30 @@ int UtcDaliPropertyNotificationLessThan(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(100.0f ) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, LessThanCondition(100.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move left to satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move right to un-satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); // Move left to satisfy condition again. gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -571,30 +563,30 @@ int UtcDaliPropertyNotificationInside(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move inside to satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move outside (right) to un-satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); // Move inside to satisfy condition again. gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -606,30 +598,30 @@ int UtcDaliPropertyNotificationOutside(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move outside (left) to satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move inside to un-satisfy condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); // Move outside (right) to satisfy condition again. gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -641,44 +633,44 @@ int UtcDaliPropertyNotificationVectorComponentGreaterThan(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, GreaterThanCondition(100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, GreaterThanCondition(100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, GreaterThanCondition(100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, GreaterThanCondition(0.5f) ); - notification.NotifySignal().Connect( &TestCallback ); - - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, GreaterThanCondition(100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, GreaterThanCondition(100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, GreaterThanCondition(100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, GreaterThanCondition(0.5f)); + notification.NotifySignal().Connect(&TestCallback); + + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move right to satisfy XAxis condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move down to satisfy YAxis condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move forward to satisfy ZAxis gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Change alpha Colour to satisfy w/alpha component condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -690,44 +682,44 @@ int UtcDaliPropertyNotificationVectorComponentLessThan(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, LessThanCondition(-100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, LessThanCondition(-100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, LessThanCondition(-100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, LessThanCondition(0.5f) ); - notification.NotifySignal().Connect( &TestCallback ); - - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, LessThanCondition(-100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, LessThanCondition(-100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, LessThanCondition(-100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, LessThanCondition(0.5f)); + notification.NotifySignal().Connect(&TestCallback); + + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move left to satisfy XAxis condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move up to satisfy YAxis condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move back to satisfy ZAxis gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Change alpha Colour to satisfy w/alpha component condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -739,45 +731,45 @@ int UtcDaliPropertyNotificationVectorComponentInside(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f)); + notification.NotifySignal().Connect(&TestCallback); // set outside all conditions - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move x to inside condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move y to inside condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move z to inside condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // change alpha to inside condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } @@ -789,62 +781,62 @@ int UtcDaliPropertyNotificationVectorComponentOutside(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f) ); - notification.NotifySignal().Connect( &TestCallback ); - notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f)); + notification.NotifySignal().Connect(&TestCallback); + notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f)); + notification.NotifySignal().Connect(&TestCallback); // set inside all conditions - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f)); Wait(application, DEFAULT_WAIT_PERIOD); // Move x to outside condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move y to outside condition gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // Move z to outside condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); // change alpha to outside condition gCallBackCalled = false; Wait(application, DEFAULT_WAIT_PERIOD); - actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); END_TEST; } int UtcDaliPropertyNotificationSetSizeResultP(void) { TestApplication application; - bool notifyResult; + bool notifyResult; tet_infoline(" UtcDaliPropertyNotificationSetSizeResultP"); Actor actor = Actor::New(); - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f)); notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED); gCallBackCalled = false; - notification.NotifySignal().Connect( &TestCallback ); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); @@ -853,11 +845,11 @@ int UtcDaliPropertyNotificationSetSizeResultP(void) notifyResult = notification.GetNotifyResult(); - DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION ); + DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION); gCallBackCalled = false; - actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); @@ -866,7 +858,7 @@ int UtcDaliPropertyNotificationSetSizeResultP(void) notifyResult = notification.GetNotifyResult(); - DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION ); + DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION); END_TEST; } @@ -876,19 +868,19 @@ int UtcDaliPropertyConditionGetArguments(void) TestApplication application; tet_infoline(" UtcDaliPropertyConditionGetArguments"); - PropertyCondition condition = GreaterThanCondition( 50.0f ); + PropertyCondition condition = GreaterThanCondition(50.0f); - DALI_TEST_EQUALS( condition.GetArgumentCount(), 1u, TEST_LOCATION ); - float value = condition.GetArgument( 0 ); - DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(condition.GetArgumentCount(), 1u, TEST_LOCATION); + float value = condition.GetArgument(0); + DALI_TEST_EQUALS(value, 50.0f, TEST_LOCATION); - condition = InsideCondition( 125.0f, 250.0f ); + condition = InsideCondition(125.0f, 250.0f); - DALI_TEST_EQUALS( condition.GetArgumentCount(), 2u, TEST_LOCATION ); - float value1 = condition.GetArgument( 0 ); - float value2 = condition.GetArgument( 1 ); - DALI_TEST_EQUALS( value1, 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( value2, 250.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(condition.GetArgumentCount(), 2u, TEST_LOCATION); + float value1 = condition.GetArgument(0); + float value2 = condition.GetArgument(1); + DALI_TEST_EQUALS(value1, 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(value2, 250.0f, TEST_LOCATION); END_TEST; } @@ -900,44 +892,44 @@ int UtcDaliPropertyNotificationStepVector4(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - const float step = 10.0f; - float initValue = 5.0f; + const float step = 10.0f; + float initValue = 5.0f; - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::COLOR, StepCondition(step * 2, 0.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::COLOR, StepCondition(step * 2, 0.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // test both directions - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to positive gCallBackCalled = false; - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } initValue = -5.0f; - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to negative gCallBackCalled = false; - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue -(i++ * step), 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::COLOR, Vector4(initValue -(i++ * step), 0.0f, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } END_TEST; } @@ -950,46 +942,46 @@ int UtcDaliPropertyNotificationStepFloat(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - const float step = 10.0f; - float initValue = 5.0f; + const float step = 10.0f; + float initValue = 5.0f; // float - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, StepCondition(step * 2, 0.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, StepCondition(step * 2, 0.0f)); + notification.NotifySignal().Connect(&TestCallback); // set initial position - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // test both directions - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to positive gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } initValue = -5.0f; - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to negative gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue -(i++ * step), 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue -(i++ * step), 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } END_TEST; } @@ -1002,46 +994,46 @@ int UtcDaliPropertyNotificationStepVector2(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - const float step = 10.0f; - float initValue = 5.0f; + const float step = 10.0f; + float initValue = 5.0f; - Property::Index propertyIndex = actor.RegisterProperty( "testProperty", Vector2::ZERO ); + Property::Index propertyIndex = actor.RegisterProperty("testProperty", Vector2::ZERO); - PropertyNotification notification = actor.AddPropertyNotification( propertyIndex, StepCondition(step * 2, 0.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(propertyIndex, StepCondition(step * 2, 0.0f)); + notification.NotifySignal().Connect(&TestCallback); - actor.SetProperty( propertyIndex, Vector2(initValue, 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // test both directions - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to positive gCallBackCalled = false; - actor.SetProperty( propertyIndex, Vector2(initValue + (i++ * step), 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( propertyIndex, Vector2(initValue + (i++ * step), 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } initValue = -5.0f; - actor.SetProperty( propertyIndex, Vector2(initValue, 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to negative gCallBackCalled = false; - actor.SetProperty( propertyIndex, Vector2(initValue -(i++ * step), 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( propertyIndex, Vector2(initValue -(i++ * step), 0.0f)); + actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } END_TEST; } @@ -1054,46 +1046,46 @@ int UtcDaliPropertyNotificationStepVector3(void) Actor actor = Actor::New(); application.GetScene().Add(actor); - const float step = 10.0f; - float initValue = 5.0f; + const float step = 10.0f; + float initValue = 5.0f; // float - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, StepCondition(step * 2, 0.0f) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, StepCondition(step * 2, 0.0f)); + notification.NotifySignal().Connect(&TestCallback); // set initial position - actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); // test both directions - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to positive position gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3( initValue + (i++ * step), 0.0f, 0.0f) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::POSITION, Vector3( initValue + (i++ * step), 0.0f, 0.0f) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } initValue = -5.0f; - actor.SetProperty( Actor::Property::POSITION, Vector3( initValue, 0.0f, 0.0f) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - for( int i = 1 ; i < 10 ; ) + for(int i = 1; i < 10;) { // Move x to negative position gCallBackCalled = false; - actor.SetProperty( Actor::Property::POSITION, Vector3( initValue -(i++ * step), 0.0f, 0.0f) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( !gCallBackCalled ); + DALI_TEST_CHECK(!gCallBackCalled); - actor.SetProperty( Actor::Property::POSITION, Vector3( initValue -(i++ * step), 0.0f, 0.0f) ); + actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } END_TEST; } @@ -1110,32 +1102,32 @@ int UtcDaliPropertyNotificationVariableStep(void) const float averageStep = 100.0f; - for( int i = 1 ; i < 10 ; i++ ) + for(int i = 1; i < 10; i++) { values.PushBack(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f))); } // float - PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, VariableStepCondition(values) ); - notification.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, VariableStepCondition(values)); + notification.NotifySignal().Connect(&TestCallback); // set initial position lower than first position in list - actor.SetProperty( Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i ) + for(unsigned int i = 0; i < values.Count() - 1; ++i) { gCallBackCalled = false; // set position half way between the current values float position = values[i] + (0.5f * (values[i + 1] - values[i])); - actor.SetProperty( Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f)); Wait(application, DEFAULT_WAIT_PERIOD); - DALI_TEST_CHECK( gCallBackCalled ); + DALI_TEST_CHECK(gCallBackCalled); } END_TEST; } static bool gCallBack2Called = false; -void TestCallback2(PropertyNotification& source) +void TestCallback2(PropertyNotification& source) { gCallBack2Called = true; } @@ -1147,13 +1139,13 @@ int UtcDaliPropertyNotificationOrder(void) Actor actor = Actor::New(); application.GetScene().Add(actor); // this should complete in first frame - PropertyNotification notification1 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(90.0f) ); - notification1.NotifySignal().Connect( &TestCallback ); + PropertyNotification notification1 = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(90.0f)); + notification1.NotifySignal().Connect(&TestCallback); // this should complete in second frame - PropertyNotification notification2 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(150.0f) ); - notification2.NotifySignal().Connect( &TestCallback2 ); - Animation animation = Animation::New( 0.032f ); // finishes in 32 ms - animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR ); + PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(150.0f)); + notification2.NotifySignal().Connect(&TestCallback2); + Animation animation = Animation::New(0.032f); // finishes in 32 ms + animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(200.0f, 0.0f, 0.0f), AlphaFunction::LINEAR); animation.Play(); // flush the queue @@ -1161,36 +1153,36 @@ int UtcDaliPropertyNotificationOrder(void) // first frame application.Render(RENDER_FRAME_INTERVAL); // no notifications yet - DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION ); - gCallBackCalled = false; + DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION); + gCallBackCalled = false; gCallBack2Called = false; // dont serve the notifications but run another update & render // this simulates situation where there is a notification in event side but it's not been picked up by event thread // second frame application.Render(RENDER_FRAME_INTERVAL); - DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION); // serve the notifications application.SendNotification(); - DALI_TEST_EQUALS( gCallBackCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( gCallBack2Called, true, TEST_LOCATION ); + DALI_TEST_EQUALS(gCallBackCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(gCallBack2Called, true, TEST_LOCATION); - gCallBackCalled = false; + gCallBackCalled = false; gCallBack2Called = false; application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); - DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION ); + DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION); END_TEST; } int UtcDaliPropertyConditionGetArgumentNegative(void) { - TestApplication application; + TestApplication application; Dali::PropertyCondition instance; instance.Reset(); try @@ -1208,7 +1200,7 @@ int UtcDaliPropertyConditionGetArgumentNegative(void) int UtcDaliPropertyConditionGetArgumentCountNegative(void) { - TestApplication application; + TestApplication application; Dali::PropertyCondition instance; instance.Reset(); try diff --git a/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp b/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp index 97c433d..d2f1fe8 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,113 +15,114 @@ * */ -#include -#include -#include -#include #include +#include +#include + +#include +#include using namespace Dali; int UtcDaliPropertyTypesGetNameP(void) { - DALI_TEST_EQUALS( "NONE", Dali::PropertyTypes::GetName(Property::NONE ), TEST_LOCATION ); - DALI_TEST_EQUALS( "BOOLEAN", Dali::PropertyTypes::GetName(Property::BOOLEAN ), TEST_LOCATION ); - DALI_TEST_EQUALS( "FLOAT", Dali::PropertyTypes::GetName(Property::FLOAT ), TEST_LOCATION ); - DALI_TEST_EQUALS( "INTEGER", Dali::PropertyTypes::GetName(Property::INTEGER ), TEST_LOCATION ); - DALI_TEST_EQUALS( "VECTOR2", Dali::PropertyTypes::GetName(Property::VECTOR2 ), TEST_LOCATION ); - DALI_TEST_EQUALS( "VECTOR3", Dali::PropertyTypes::GetName(Property::VECTOR3 ), TEST_LOCATION ); - DALI_TEST_EQUALS( "VECTOR4", Dali::PropertyTypes::GetName(Property::VECTOR4 ), TEST_LOCATION ); - DALI_TEST_EQUALS( "MATRIX3", Dali::PropertyTypes::GetName(Property::MATRIX3 ), TEST_LOCATION ); - DALI_TEST_EQUALS( "MATRIX", Dali::PropertyTypes::GetName(Property::MATRIX ), TEST_LOCATION ); - DALI_TEST_EQUALS( "RECTANGLE", Dali::PropertyTypes::GetName(Property::RECTANGLE ), TEST_LOCATION ); - DALI_TEST_EQUALS( "ROTATION", Dali::PropertyTypes::GetName(Property::ROTATION ), TEST_LOCATION ); - DALI_TEST_EQUALS( "STRING", Dali::PropertyTypes::GetName(Property::STRING ), TEST_LOCATION ); - DALI_TEST_EQUALS( "ARRAY", Dali::PropertyTypes::GetName(Property::ARRAY ), TEST_LOCATION ); - DALI_TEST_EQUALS( "MAP", Dali::PropertyTypes::GetName(Property::MAP ), TEST_LOCATION ); + DALI_TEST_EQUALS("NONE", Dali::PropertyTypes::GetName(Property::NONE), TEST_LOCATION); + DALI_TEST_EQUALS("BOOLEAN", Dali::PropertyTypes::GetName(Property::BOOLEAN), TEST_LOCATION); + DALI_TEST_EQUALS("FLOAT", Dali::PropertyTypes::GetName(Property::FLOAT), TEST_LOCATION); + DALI_TEST_EQUALS("INTEGER", Dali::PropertyTypes::GetName(Property::INTEGER), TEST_LOCATION); + DALI_TEST_EQUALS("VECTOR2", Dali::PropertyTypes::GetName(Property::VECTOR2), TEST_LOCATION); + DALI_TEST_EQUALS("VECTOR3", Dali::PropertyTypes::GetName(Property::VECTOR3), TEST_LOCATION); + DALI_TEST_EQUALS("VECTOR4", Dali::PropertyTypes::GetName(Property::VECTOR4), TEST_LOCATION); + DALI_TEST_EQUALS("MATRIX3", Dali::PropertyTypes::GetName(Property::MATRIX3), TEST_LOCATION); + DALI_TEST_EQUALS("MATRIX", Dali::PropertyTypes::GetName(Property::MATRIX), TEST_LOCATION); + DALI_TEST_EQUALS("RECTANGLE", Dali::PropertyTypes::GetName(Property::RECTANGLE), TEST_LOCATION); + DALI_TEST_EQUALS("ROTATION", Dali::PropertyTypes::GetName(Property::ROTATION), TEST_LOCATION); + DALI_TEST_EQUALS("STRING", Dali::PropertyTypes::GetName(Property::STRING), TEST_LOCATION); + DALI_TEST_EQUALS("ARRAY", Dali::PropertyTypes::GetName(Property::ARRAY), TEST_LOCATION); + DALI_TEST_EQUALS("MAP", Dali::PropertyTypes::GetName(Property::MAP), TEST_LOCATION); END_TEST; } int UtcDaliPropertyTypesGet02P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::BOOLEAN ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::BOOLEAN); END_TEST; } int UtcDaliPropertyTypesGet03P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::FLOAT ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::FLOAT); END_TEST; } int UtcDaliPropertyTypesGet04P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::INTEGER ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::INTEGER); END_TEST; } int UtcDaliPropertyTypesGet06P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::VECTOR2 ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::VECTOR2); END_TEST; } int UtcDaliPropertyTypesGet07P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::VECTOR3 ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::VECTOR3); END_TEST; } int UtcDaliPropertyTypesGet08P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::VECTOR4 ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::VECTOR4); END_TEST; } int UtcDaliPropertyTypesGet09P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::MATRIX3 ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::MATRIX3); END_TEST; } int UtcDaliPropertyTypesGet10(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::MATRIX ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::MATRIX); END_TEST; } int UtcDaliPropertyTypesGet11P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::ROTATION ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::ROTATION); END_TEST; } int UtcDaliPropertyTypesGet12P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::ROTATION ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::ROTATION); END_TEST; } int UtcDaliPropertyTypesGet13P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::STRING ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::STRING); END_TEST; } int UtcDaliPropertyTypesGet14P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get >() == Property::RECTANGLE ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get >() == Property::RECTANGLE); END_TEST; } int UtcDaliPropertyTypesGet15P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::MAP ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::MAP); END_TEST; } int UtcDaliPropertyTypesGet16P(void) { - DALI_TEST_CHECK( Dali::PropertyTypes::Get() == Property::ARRAY ); + DALI_TEST_CHECK(Dali::PropertyTypes::Get() == Property::ARRAY); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-PropertyValue.cpp b/automated-tests/src/dali/utc-Dali-PropertyValue.cpp index 712f60f..762e99a 100644 --- a/automated-tests/src/dali/utc-Dali-PropertyValue.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,24 +15,24 @@ * */ -#include -#include -#include -#include #include +#include +#include + +#include +#include using namespace Dali; namespace { - -template +template struct CheckCopyCtorP { CheckCopyCtorP(Property::Value value) { - Property::Value copy( value ); - DALI_TEST_CHECK( value.Get() == copy.Get() ); + Property::Value copy(value); + DALI_TEST_CHECK(value.Get() == copy.Get()); } }; @@ -48,21 +48,20 @@ void utc_dali_property_value_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliPropertyValueConstructorsNoneP(void) { Property::Value value; - DALI_TEST_CHECK( value.GetType() == Property::NONE ); + DALI_TEST_CHECK(value.GetType() == Property::NONE); END_TEST; } int UtcDaliPropertyValueConstructorsNoneTypeP(void) { - Property::Value value( Property::NONE ); + Property::Value value(Property::NONE); - DALI_TEST_CHECK( value.GetType() == Property::NONE ); + DALI_TEST_CHECK(value.GetType() == Property::NONE); END_TEST; } @@ -71,8 +70,8 @@ int UtcDaliPropertyValueConstructorsBoolP(void) { Property::Value value(true); - DALI_TEST_CHECK( value.GetType() == Property::BOOLEAN ); - DALI_TEST_CHECK( value.Get() == true ); + DALI_TEST_CHECK(value.GetType() == Property::BOOLEAN); + DALI_TEST_CHECK(value.Get() == true); END_TEST; } @@ -81,8 +80,8 @@ int UtcDaliPropertyValueConstructorBoolTypeP(void) { Property::Value value(Property::BOOLEAN); - DALI_TEST_CHECK( value.GetType() == Property::BOOLEAN ); - DALI_TEST_CHECK( value.Get() == false ); + DALI_TEST_CHECK(value.GetType() == Property::BOOLEAN); + DALI_TEST_CHECK(value.Get() == false); END_TEST; } @@ -91,8 +90,8 @@ int UtcDaliPropertyValueConstructorsFloatP(void) { Property::Value value(2.f); - DALI_TEST_CHECK( value.GetType() == Property::FLOAT ); - DALI_TEST_CHECK( value.Get() == 2.f ); + DALI_TEST_CHECK(value.GetType() == Property::FLOAT); + DALI_TEST_CHECK(value.Get() == 2.f); END_TEST; } @@ -101,8 +100,8 @@ int UtcDaliPropertyValueConstructorsFloatTypeP(void) { Property::Value value(Property::FLOAT); - DALI_TEST_CHECK( value.GetType() == Property::FLOAT ); - DALI_TEST_CHECK( value.Get() == 0.f ); + DALI_TEST_CHECK(value.GetType() == Property::FLOAT); + DALI_TEST_CHECK(value.Get() == 0.f); END_TEST; } @@ -111,8 +110,8 @@ int UtcDaliPropertyValueConstructorsIntP(void) { Property::Value value(1); - DALI_TEST_CHECK( value.GetType() == Property::INTEGER ); - DALI_TEST_CHECK( value.Get() == 1 ); + DALI_TEST_CHECK(value.GetType() == Property::INTEGER); + DALI_TEST_CHECK(value.Get() == 1); END_TEST; } @@ -121,192 +120,192 @@ int UtcDaliPropertyValueConstructorsIntTypeP(void) { Property::Value value(Property::INTEGER); - DALI_TEST_CHECK( value.GetType() == Property::INTEGER ); - DALI_TEST_CHECK( value.Get() == 0 ); + DALI_TEST_CHECK(value.GetType() == Property::INTEGER); + DALI_TEST_CHECK(value.Get() == 0); END_TEST; } int UtcDaliPropertyValueConstructorsVector2P(void) { - Vector2 v(1,1); + Vector2 v(1, 1); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR2 ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR2); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsVector2TypeP(void) { - Property::Value value( Property::VECTOR2 ); + Property::Value value(Property::VECTOR2); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR2 ); - DALI_TEST_CHECK( value.Get() == Vector2::ZERO ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR2); + DALI_TEST_CHECK(value.Get() == Vector2::ZERO); END_TEST; } int UtcDaliPropertyValueConstructorsVector3P(void) { - Vector3 v(1.f,2.f,3.f); + Vector3 v(1.f, 2.f, 3.f); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR3 ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR3); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsVector3TypeP(void) { - Property::Value value( Property::VECTOR3 ); + Property::Value value(Property::VECTOR3); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR3 ); - DALI_TEST_CHECK( value.Get() == Vector3() ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR3); + DALI_TEST_CHECK(value.Get() == Vector3()); END_TEST; } int UtcDaliPropertyValueConstructorsVector4P(void) { - Vector4 v(1.f,1.f,1.f,0.9f); + Vector4 v(1.f, 1.f, 1.f, 0.9f); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR4); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsVector4TypeP(void) { - Property::Value value( Property::VECTOR4 ); + Property::Value value(Property::VECTOR4); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 ); - DALI_TEST_CHECK( value.Get() == Vector4() ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR4); + DALI_TEST_CHECK(value.Get() == Vector4()); END_TEST; } int UtcDaliPropertyValueConstructorsMatrix3P(void) { - Matrix3 v(1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0,1.0); + Matrix3 v(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::MATRIX3 ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::MATRIX3); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsMatrix3TypeP(void) { - Property::Value value( Property::MATRIX3 ); + Property::Value value(Property::MATRIX3); - DALI_TEST_CHECK( value.GetType() == Property::MATRIX3 ); - DALI_TEST_CHECK( value.Get() == Matrix3() ); + DALI_TEST_CHECK(value.GetType() == Property::MATRIX3); + DALI_TEST_CHECK(value.Get() == Matrix3()); END_TEST; } int UtcDaliPropertyValueConstructorsMatrixP(void) { - float a[] = {1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0}; - Matrix v(a); + float a[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; + Matrix v(a); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::MATRIX ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::MATRIX); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsMatrixTypeP(void) { - Property::Value value( Property::MATRIX ); + Property::Value value(Property::MATRIX); - DALI_TEST_CHECK( value.GetType() == Property::MATRIX ); - DALI_TEST_CHECK( value.Get() == Matrix() ); + DALI_TEST_CHECK(value.GetType() == Property::MATRIX); + DALI_TEST_CHECK(value.Get() == Matrix()); END_TEST; } int UtcDaliPropertyValueConstructorsRectP(void) { - Rect v(1.0,1.0,1.0,1.0); + Rect v(1.0, 1.0, 1.0, 1.0); Property::Value value(v); - DALI_TEST_EQUALS( value.GetType(), Property::RECTANGLE, TEST_LOCATION ); - DALI_TEST_CHECK( value.Get >() == v ); + DALI_TEST_EQUALS(value.GetType(), Property::RECTANGLE, TEST_LOCATION); + DALI_TEST_CHECK(value.Get >() == v); END_TEST; } int UtcDaliPropertyValueConstructorsRectTypeP(void) { - Property::Value value( Property::RECTANGLE ); + Property::Value value(Property::RECTANGLE); - DALI_TEST_CHECK( value.GetType() == Property::RECTANGLE ); - DALI_TEST_CHECK( value.Get >() == Rect(0,0,0,0) ); + DALI_TEST_CHECK(value.GetType() == Property::RECTANGLE); + DALI_TEST_CHECK(value.Get >() == Rect(0, 0, 0, 0)); END_TEST; } int UtcDaliPropertyValueConstructorsAngleAxisP(void) { - AngleAxis input( Dali::ANGLE_90, Vector3::XAXIS ); - Property::Value value( input ); + AngleAxis input(Dali::ANGLE_90, Vector3::XAXIS); + Property::Value value(input); - DALI_TEST_CHECK( value.GetType() == Property::ROTATION ); + DALI_TEST_CHECK(value.GetType() == Property::ROTATION); AngleAxis result = value.Get(); - DALI_TEST_EQUALS( result.angle, input.angle, TEST_LOCATION ); - DALI_TEST_EQUALS( result.axis, input.axis, TEST_LOCATION ); + DALI_TEST_EQUALS(result.angle, input.angle, TEST_LOCATION); + DALI_TEST_EQUALS(result.axis, input.axis, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueConstructorsQuaternionP(void) { - Quaternion v( Radian( Math::PI ), Vector3::ZAXIS ); + Quaternion v(Radian(Math::PI), Vector3::ZAXIS); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::ROTATION ); - DALI_TEST_EQUALS( v, value.Get(), 0.001, TEST_LOCATION); + DALI_TEST_CHECK(value.GetType() == Property::ROTATION); + DALI_TEST_EQUALS(v, value.Get(), 0.001, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueConstructorsRotationTypeP(void) { - Property::Value value( Property::ROTATION ); + Property::Value value(Property::ROTATION); - DALI_TEST_CHECK( value.GetType() == Property::ROTATION ); + DALI_TEST_CHECK(value.GetType() == Property::ROTATION); AngleAxis result = value.Get(); - DALI_TEST_EQUALS( result.angle, Radian(0.f), TEST_LOCATION ); - DALI_TEST_EQUALS( result.axis, Vector3::ZERO, TEST_LOCATION ); // identity quaternion returns a zero angle-axis + DALI_TEST_EQUALS(result.angle, Radian(0.f), TEST_LOCATION); + DALI_TEST_EQUALS(result.axis, Vector3::ZERO, TEST_LOCATION); // identity quaternion returns a zero angle-axis END_TEST; } int UtcDaliPropertyValueConstructorsStringP(void) { - std::string v("1"); + std::string v("1"); Property::Value value(v); - DALI_TEST_CHECK( value.GetType() == Property::STRING ); - DALI_TEST_CHECK( value.Get() == v ); + DALI_TEST_CHECK(value.GetType() == Property::STRING); + DALI_TEST_CHECK(value.Get() == v); END_TEST; } int UtcDaliPropertyValueConstructorsStringTypeP(void) { - Property::Value value( Property::STRING ); + Property::Value value(Property::STRING); - DALI_TEST_CHECK( value.GetType() == Property::STRING ); - DALI_TEST_CHECK( value.Get() == std::string() ); + DALI_TEST_CHECK(value.GetType() == Property::STRING); + DALI_TEST_CHECK(value.Get() == std::string()); END_TEST; } @@ -314,10 +313,10 @@ int UtcDaliPropertyValueConstructorsStringTypeP(void) int UtcDaliPropertyValueConstructorsArrayP(void) { Property::Array foo; - Property::Value value( foo ); + Property::Value value(foo); - DALI_TEST_CHECK( value.GetType() == Property::ARRAY ); - DALI_TEST_CHECK( value.Get().Count() == 0 ); + DALI_TEST_CHECK(value.GetType() == Property::ARRAY); + DALI_TEST_CHECK(value.Get().Count() == 0); END_TEST; } @@ -325,11 +324,11 @@ int UtcDaliPropertyValueConstructorsArrayP(void) int UtcDaliPropertyValueConstructorsArray2P(void) { Property::Array foo; - foo.PushBack( Property::Value() ); - Property::Value value( foo ); + foo.PushBack(Property::Value()); + Property::Value value(foo); - DALI_TEST_CHECK( value.GetType() == Property::ARRAY ); - DALI_TEST_CHECK( value.Get().Count() == 1 ); + DALI_TEST_CHECK(value.GetType() == Property::ARRAY); + DALI_TEST_CHECK(value.Get().Count() == 1); END_TEST; } @@ -338,19 +337,19 @@ int UtcDaliPropertyValueConstructorsArrayTypeP(void) { Property::Value value(Property::ARRAY); - DALI_TEST_CHECK( value.GetType() == Property::ARRAY ); - DALI_TEST_CHECK( value.Get().Count() == 0 ); + DALI_TEST_CHECK(value.GetType() == Property::ARRAY); + DALI_TEST_CHECK(value.Get().Count() == 0); END_TEST; } int UtcDaliPropertyValueConstructorsMapP(void) { - Property::Map map; - Property::Value value( map ); + Property::Map map; + Property::Value value(map); - DALI_TEST_CHECK( value.GetType() == Property::MAP ); - DALI_TEST_CHECK( value.Get().Count() == 0 ); + DALI_TEST_CHECK(value.GetType() == Property::MAP); + DALI_TEST_CHECK(value.Get().Count() == 0); END_TEST; } @@ -358,11 +357,11 @@ int UtcDaliPropertyValueConstructorsMapP(void) int UtcDaliPropertyValueConstructorsMap2P(void) { Property::Map map; - map.Insert( "", "" ); - Property::Value value( map ); + map.Insert("", ""); + Property::Value value(map); - DALI_TEST_CHECK( value.GetType() == Property::MAP ); - DALI_TEST_CHECK( value.Get().Count() == 1 ); + DALI_TEST_CHECK(value.GetType() == Property::MAP); + DALI_TEST_CHECK(value.Get().Count() == 1); END_TEST; } @@ -371,28 +370,28 @@ int UtcDaliPropertyValueConstructorsMapTypeP(void) { Property::Value value(Property::MAP); - DALI_TEST_CHECK( value.GetType() == Property::MAP ); - DALI_TEST_CHECK( value.Get().Count() == 0 ); + DALI_TEST_CHECK(value.GetType() == Property::MAP); + DALI_TEST_CHECK(value.Get().Count() == 0); END_TEST; } int UtcDaliPropertyValueConstructorsExtentsTypeP(void) { - Property::Value value( Property::EXTENTS ); + Property::Value value(Property::EXTENTS); - DALI_TEST_CHECK( value.GetType() == Property::EXTENTS ); - DALI_TEST_CHECK( value.Get() == Extents( 0u, 0u, 0u, 0u ) ); + DALI_TEST_CHECK(value.GetType() == Property::EXTENTS); + DALI_TEST_CHECK(value.Get() == Extents(0u, 0u, 0u, 0u)); END_TEST; } int UtcDaliPropertyValueConstructorsExtentsType2P(void) { - Property::Value value( Property::VECTOR4 ); + Property::Value value(Property::VECTOR4); - DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 ); - DALI_TEST_CHECK( value.Get() == Extents( 0u, 0u, 0u, 0u ) ); + DALI_TEST_CHECK(value.GetType() == Property::VECTOR4); + DALI_TEST_CHECK(value.Get() == Extents(0u, 0u, 0u, 0u)); END_TEST; } @@ -400,10 +399,10 @@ int UtcDaliPropertyValueConstructorsExtentsType2P(void) int UtcDaliPropertyValueCopyConstructorP(void) { Property::Value value; - Property::Value value2( value ); - DALI_TEST_EQUALS( value.GetType(), value2.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( value.GetMap(), value2.GetMap(), TEST_LOCATION ); - DALI_TEST_EQUALS( value.GetArray(), value2.GetArray(), TEST_LOCATION ); + Property::Value value2(value); + DALI_TEST_EQUALS(value.GetType(), value2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(value.GetMap(), value2.GetMap(), TEST_LOCATION); + DALI_TEST_EQUALS(value.GetArray(), value2.GetArray(), TEST_LOCATION); END_TEST; } @@ -427,25 +426,25 @@ int UtcDaliPropertyValueCopyConstructorIntP(void) int UtcDaliPropertyValueCopyConstructoVector2P(void) { - CheckCopyCtorP check( Vector2(2,1) ); + CheckCopyCtorP check(Vector2(2, 1)); END_TEST; } int UtcDaliPropertyValueCopyConstructorVector3P(void) { - CheckCopyCtorP check( Vector3(3.f,2.f,1.f) ); + CheckCopyCtorP check(Vector3(3.f, 2.f, 1.f)); END_TEST; } int UtcDaliPropertyValueCopyConstructorVector4P(void) { - CheckCopyCtorP check( Vector4(4.f,3.f,2.f,1.f) ); + CheckCopyCtorP check(Vector4(4.f, 3.f, 2.f, 1.f)); END_TEST; } int UtcDaliPropertyValueCopyConstructorMatrix3P(void) { - CheckCopyCtorP check( Matrix3::IDENTITY ); + CheckCopyCtorP check(Matrix3::IDENTITY); END_TEST; } @@ -457,37 +456,37 @@ int UtcDaliPropertyValueCopyConstructorMatrixP(void) int UtcDaliPropertyValueCopyConstructorRectP(void) { - CheckCopyCtorP > check( Rect(1.0,1.0,1.0,1.0) ); + CheckCopyCtorP > check(Rect(1.0, 1.0, 1.0, 1.0)); END_TEST; } int UtcDaliPropertyValueCopyConstructorAngleAxisP(void) { - CheckCopyCtorP check( AngleAxis(Degree(1.0), Vector3(1.0,1.0,1.0)) ); + CheckCopyCtorP check(AngleAxis(Degree(1.0), Vector3(1.0, 1.0, 1.0))); END_TEST; } int UtcDaliPropertyValueCopyConstructorQuaternionP(void) { - CheckCopyCtorP check( Quaternion( Vector4(1.0, 1.0, 1.0, 1.0) ) ); + CheckCopyCtorP check(Quaternion(Vector4(1.0, 1.0, 1.0, 1.0))); END_TEST; } int UtcDaliPropertyValueCopyConstructorStringP(void) { - CheckCopyCtorP check( std::string("1") ); + CheckCopyCtorP check(std::string("1")); END_TEST; } int UtcDaliPropertyValueCopyConstructorArrayP(void) { - Property::Value value1(Property::ARRAY); - Property::Array* array= value1.GetArray(); + Property::Value value1(Property::ARRAY); + Property::Array* array = value1.GetArray(); array->PushBack(Property::Value(1)); - Property::Value value2( value1 ); - DALI_TEST_EQUALS( value1.GetType(), value2.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( value1.GetArray()->Count(), value2.GetArray()->Count(), TEST_LOCATION ); + Property::Value value2(value1); + DALI_TEST_EQUALS(value1.GetType(), value2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(value1.GetArray()->Count(), value2.GetArray()->Count(), TEST_LOCATION); END_TEST; } @@ -495,32 +494,32 @@ int UtcDaliPropertyValueCopyConstructorArrayP(void) int UtcDaliPropertyValueCopyConstructorMapP(void) { Property::Value value1(Property::MAP); - Property::Map* map = value1.GetMap(); - (*map)["1"] = Property::Value(1); + Property::Map* map = value1.GetMap(); + (*map)["1"] = Property::Value(1); - Property::Value value2( value1 ); - DALI_TEST_EQUALS( value1.GetType(), value2.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( value1.GetMap()->Count(), value2.GetMap()->Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( value1.GetMap()->GetKey( 0 ), value2.GetMap()->GetKey( 0 ), TEST_LOCATION ); + Property::Value value2(value1); + DALI_TEST_EQUALS(value1.GetType(), value2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(value1.GetMap()->Count(), value2.GetMap()->Count(), TEST_LOCATION); + DALI_TEST_EQUALS(value1.GetMap()->GetKey(0), value2.GetMap()->GetKey(0), TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueMoveConstructor(void) { - Property::Value value1( Vector4::ONE ); - DALI_TEST_EQUALS( Property::VECTOR4, value1.GetType(), TEST_LOCATION ); + Property::Value value1(Vector4::ONE); + DALI_TEST_EQUALS(Property::VECTOR4, value1.GetType(), TEST_LOCATION); Vector4 valueVector; - DALI_TEST_EQUALS( true, value1.Get( valueVector ), TEST_LOCATION ); // Able to convert - DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value1.Get(valueVector), TEST_LOCATION); // Able to convert + DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION); - Property::Value value2( std::move( value1 ) ); - DALI_TEST_EQUALS( Property::NONE, value1.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value1.Get( valueVector ), TEST_LOCATION ); // Unable to convert, but no crash either - DALI_TEST_EQUALS( Property::VECTOR4, value2.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value2.Get( valueVector ), TEST_LOCATION ); // Able to convert - DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION ); + Property::Value value2(std::move(value1)); + DALI_TEST_EQUALS(Property::NONE, value1.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value1.Get(valueVector), TEST_LOCATION); // Unable to convert, but no crash either + DALI_TEST_EQUALS(Property::VECTOR4, value2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value2.Get(valueVector), TEST_LOCATION); // Able to convert + DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION); END_TEST; } @@ -528,17 +527,17 @@ int UtcDaliPropertyValueMoveConstructor(void) int UtcDaliPropertyValueMoveConstructorArray(void) { Property::Array array; - array.PushBack( 1 ); - array.PushBack( 2 ); - array.PushBack( 3 ); - DALI_TEST_EQUALS( 3u, array.Size(), TEST_LOCATION ); + array.PushBack(1); + array.PushBack(2); + array.PushBack(3); + DALI_TEST_EQUALS(3u, array.Size(), TEST_LOCATION); - Property::Value value( std::move( array ) ); - DALI_TEST_ASSERTION( array.Size(), "Cannot use an object previously used as an r-value" ); // Our local variable should become invalid + Property::Value value(std::move(array)); + DALI_TEST_ASSERTION(array.Size(), "Cannot use an object previously used as an r-value"); // Our local variable should become invalid Property::Array* arrayPtr = value.GetArray(); - DALI_TEST_CHECK( arrayPtr ); - DALI_TEST_EQUALS( 3u, arrayPtr->Size(), TEST_LOCATION ); + DALI_TEST_CHECK(arrayPtr); + DALI_TEST_EQUALS(3u, arrayPtr->Size(), TEST_LOCATION); END_TEST; } @@ -546,29 +545,29 @@ int UtcDaliPropertyValueMoveConstructorArray(void) int UtcDaliPropertyValueMoveConstructorMap(void) { Property::Map map; - map[ 1 ] = 1; - map[ 2 ] = 2; - map[ 3 ] = 3; - DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION ); + map[1] = 1; + map[2] = 2; + map[3] = 3; + DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION); - Property::Value value( std::move( map ) ); - DALI_TEST_ASSERTION( map.Count(), "Cannot use an object previously used as an r-value" ); // Our local variable should become invalid + Property::Value value(std::move(map)); + DALI_TEST_ASSERTION(map.Count(), "Cannot use an object previously used as an r-value"); // Our local variable should become invalid Property::Map* mapPtr = value.GetMap(); - DALI_TEST_CHECK( mapPtr ); - DALI_TEST_EQUALS( 3u, mapPtr->Count(), TEST_LOCATION ); + DALI_TEST_CHECK(mapPtr); + DALI_TEST_EQUALS(3u, mapPtr->Count(), TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueAssignmentSelfP(void) { - Property::Value value; + Property::Value value; Property::Value* self = &value; - value = *self; - DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION ); - DALI_TEST_CHECK( value.GetMap() == NULL ); - DALI_TEST_CHECK( value.GetArray() == NULL ); + value = *self; + DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION); + DALI_TEST_CHECK(value.GetMap() == NULL); + DALI_TEST_CHECK(value.GetArray() == NULL); END_TEST; } @@ -576,10 +575,10 @@ int UtcDaliPropertyValueAssignmentOperatorNoneP(void) { Property::Value value; value = Property::Value(); // type match - DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION ); - Property::Value copy( false ); + DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION); + Property::Value copy(false); copy = value; // type mismatch - DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION ); + DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION); END_TEST; } @@ -587,10 +586,10 @@ int UtcDaliPropertyValueAssignmentOperatorBoolP(void) { Property::Value value; value = Property::Value(true); // type mismatch - DALI_TEST_CHECK( true == value.Get() ); - Property::Value copy( false ); + DALI_TEST_CHECK(true == value.Get()); + Property::Value copy(false); copy = value; // type match - DALI_TEST_CHECK( true == copy.Get() ); + DALI_TEST_CHECK(true == copy.Get()); END_TEST; } @@ -598,10 +597,10 @@ int UtcDaliPropertyValueAssignmentOperatorIntP(void) { Property::Value value; value = Property::Value(10); // type mismatch - DALI_TEST_CHECK( 10 == value.Get() ); - Property::Value copy( 99 ); + DALI_TEST_CHECK(10 == value.Get()); + Property::Value copy(99); copy = value; // type match - DALI_TEST_CHECK( 10 == copy.Get() ); + DALI_TEST_CHECK(10 == copy.Get()); END_TEST; } @@ -609,108 +608,107 @@ int UtcDaliPropertyValueAssignmentOperatorFloatP(void) { Property::Value value; value = Property::Value(10.f); // mismatch - DALI_TEST_CHECK( Dali::Equals(10.f, value.Get() ) ); + DALI_TEST_CHECK(Dali::Equals(10.f, value.Get())); Property::Value copy(321.f); copy = value; // match - DALI_TEST_CHECK( Dali::Equals(10.f, copy.Get() ) ); + DALI_TEST_CHECK(Dali::Equals(10.f, copy.Get())); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorVector2P(void) { Property::Value value; - value = Property::Value( Vector2(1,2) ); // mismatch - DALI_TEST_CHECK( Vector2(1,2) == value.Get() ); - Property::Value copy( Property::VECTOR2 ); + value = Property::Value(Vector2(1, 2)); // mismatch + DALI_TEST_CHECK(Vector2(1, 2) == value.Get()); + Property::Value copy(Property::VECTOR2); copy = value; // match - DALI_TEST_CHECK( Vector2(1,2) == copy.Get() ); + DALI_TEST_CHECK(Vector2(1, 2) == copy.Get()); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorVector3P(void) { Property::Value value; - value = Property::Value( Vector3(1.f,2.f,3.f) ); // mismatch - DALI_TEST_CHECK( Vector3(1.f,2.f,3.f) == value.Get() ); - Property::Value copy( Property::VECTOR3 ); + value = Property::Value(Vector3(1.f, 2.f, 3.f)); // mismatch + DALI_TEST_CHECK(Vector3(1.f, 2.f, 3.f) == value.Get()); + Property::Value copy(Property::VECTOR3); copy = value; // match - DALI_TEST_CHECK( Vector3(1.f,2.f,3.f) == copy.Get() ); + DALI_TEST_CHECK(Vector3(1.f, 2.f, 3.f) == copy.Get()); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorVector4P(void) { Property::Value value; - value = Property::Value( Vector4(1,2,3,4) ); // mismatch - DALI_TEST_CHECK( Vector4(1,2,3,4) == value.Get() ); - Property::Value copy( Vector4(0,1,2,3) ); + value = Property::Value(Vector4(1, 2, 3, 4)); // mismatch + DALI_TEST_CHECK(Vector4(1, 2, 3, 4) == value.Get()); + Property::Value copy(Vector4(0, 1, 2, 3)); copy = value; // match - DALI_TEST_CHECK( Vector4(1,2,3,4) == copy.Get() ); + DALI_TEST_CHECK(Vector4(1, 2, 3, 4) == copy.Get()); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorMatrix3P(void) { Property::Value value; - value = Property::Value( Matrix3::IDENTITY ); // mismatch - DALI_TEST_CHECK( Matrix3::IDENTITY == value.Get() ); - Property::Value copy( Property::MATRIX3 ); + value = Property::Value(Matrix3::IDENTITY); // mismatch + DALI_TEST_CHECK(Matrix3::IDENTITY == value.Get()); + Property::Value copy(Property::MATRIX3); copy = value; // match - DALI_TEST_CHECK( Matrix3::IDENTITY == copy.Get() ); + DALI_TEST_CHECK(Matrix3::IDENTITY == copy.Get()); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorMatrixP(void) { Property::Value value; - value = Property::Value( Matrix::IDENTITY ); // mismatch - DALI_TEST_CHECK( Matrix::IDENTITY == value.Get() ); - Matrix foo; - Property::Value copy( foo ); + value = Property::Value(Matrix::IDENTITY); // mismatch + DALI_TEST_CHECK(Matrix::IDENTITY == value.Get()); + Matrix foo; + Property::Value copy(foo); copy = value; // match - DALI_TEST_CHECK( Matrix::IDENTITY == copy.Get() ); + DALI_TEST_CHECK(Matrix::IDENTITY == copy.Get()); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorRectP(void) { - Property::Value value; + Property::Value value; typedef Dali::Rect Rectangle; - value = Property::Value( Rectangle(4,3,2,1) ); // mismatch - DALI_TEST_CHECK( Rectangle(4,3,2,1) == value.Get() ); - Property::Value copy( Property::RECTANGLE ); + value = Property::Value(Rectangle(4, 3, 2, 1)); // mismatch + DALI_TEST_CHECK(Rectangle(4, 3, 2, 1) == value.Get()); + Property::Value copy(Property::RECTANGLE); copy = value; // match Rectangle copyRect; copy.Get(copyRect); - DALI_TEST_CHECK( Rectangle(4,3,2,1) == copyRect ); + DALI_TEST_CHECK(Rectangle(4, 3, 2, 1) == copyRect); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorQuaternionP(void) { Property::Value value; - Quaternion result( Radian( Math::PI_2 ), Vector3::YAXIS ); - value = Property::Value( result ); + Quaternion result(Radian(Math::PI_2), Vector3::YAXIS); + value = Property::Value(result); - DALI_TEST_EQUALS( value.Get(), result, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(value.Get(), result, 0.001, TEST_LOCATION); - Property::Value copy( Property::ROTATION ); + Property::Value copy(Property::ROTATION); copy = value; // match - DALI_TEST_EQUALS( copy.Get(), result, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(copy.Get(), result, 0.001, TEST_LOCATION); END_TEST; } - int UtcDaliPropertyValueAssignmentOperatorAngleAxisP(void) { Property::Value value; - value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS ) ); // mismatch - DALI_TEST_EQUALS( value.Get().axis, Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( value.Get().angle, Radian(Math::PI_2), TEST_LOCATION ); - Property::Value copy( Property::ROTATION ); + value = Property::Value(AngleAxis(Radian(Math::PI_2), Vector3::XAXIS)); // mismatch + DALI_TEST_EQUALS(value.Get().axis, Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(value.Get().angle, Radian(Math::PI_2), TEST_LOCATION); + Property::Value copy(Property::ROTATION); copy = value; // match - DALI_TEST_EQUALS( value.Get().axis, copy.Get().axis, TEST_LOCATION ); - DALI_TEST_EQUALS( value.Get().angle, copy.Get().angle, TEST_LOCATION ); + DALI_TEST_EQUALS(value.Get().axis, copy.Get().axis, TEST_LOCATION); + DALI_TEST_EQUALS(value.Get().angle, copy.Get().angle, TEST_LOCATION); END_TEST; } @@ -718,10 +716,10 @@ int UtcDaliPropertyValueAssignmentOperatorStringP(void) { Property::Value value; value = Property::Value("yes"); // mismatch - DALI_TEST_CHECK( "yes" == value.Get() ); + DALI_TEST_CHECK("yes" == value.Get()); Property::Value copy("no"); copy = value; // match - DALI_TEST_CHECK( "yes" == copy.Get() ); + DALI_TEST_CHECK("yes" == copy.Get()); END_TEST; } @@ -730,14 +728,14 @@ int UtcDaliPropertyValueAssignmentOperatorArrayP(void) Property::Value value; value = Property::Value(Property::ARRAY); // mismatch value.GetArray()->PushBack(10); - DALI_TEST_CHECK( value.GetArray() ); + DALI_TEST_CHECK(value.GetArray()); Property::Value copy(Property::ARRAY); copy = value; // match Property::Array array; - copy.Get( array ); + copy.Get(array); int getItem = 0; - array[0].Get( getItem ); - DALI_TEST_CHECK( getItem == 10 ); + array[0].Get(getItem); + DALI_TEST_CHECK(getItem == 10); END_TEST; } @@ -746,55 +744,55 @@ int UtcDaliPropertyValueAssignmentOperatorMapP(void) Property::Value value; value = Property::Value(Property::MAP); // mismatch value.GetMap()->Insert("key", "value"); - Property::Value copy( Property::MAP ); // match + Property::Value copy(Property::MAP); // match copy = value; Property::Map map; - copy.Get( map ); - DALI_TEST_CHECK( map.GetKey(0) == "key" ); + copy.Get(map); + DALI_TEST_CHECK(map.GetKey(0) == "key"); END_TEST; } int UtcDaliPropertyValueAssignmentOperatorExtentsP(void) { Property::Value value; - value = Property::Value( Extents( 4, 3, 2, 1 ) ); // mismatch - DALI_TEST_CHECK( Extents( 4, 3, 2, 1 ) == value.Get() ); - Property::Value copy( Property::EXTENTS ); + value = Property::Value(Extents(4, 3, 2, 1)); // mismatch + DALI_TEST_CHECK(Extents(4, 3, 2, 1) == value.Get()); + Property::Value copy(Property::EXTENTS); copy = value; // match Extents copyExtents; copy.Get(copyExtents); - DALI_TEST_CHECK( Extents( 4, 3, 2, 1 ) == copyExtents ); + DALI_TEST_CHECK(Extents(4, 3, 2, 1) == copyExtents); END_TEST; } int UtcDaliPropertyValueMoveAssignmentOperator(void) { - Property::Value value1( Vector4::ONE ); - DALI_TEST_EQUALS( Property::VECTOR4, value1.GetType(), TEST_LOCATION ); + Property::Value value1(Vector4::ONE); + DALI_TEST_EQUALS(Property::VECTOR4, value1.GetType(), TEST_LOCATION); Vector4 valueVector; - DALI_TEST_EQUALS( true, value1.Get( valueVector ), TEST_LOCATION ); // Able to convert - DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value1.Get(valueVector), TEST_LOCATION); // Able to convert + DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION); Property::Value value2; - value2 = std::move( value1 ); - DALI_TEST_EQUALS( Property::NONE, value1.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value1.Get( valueVector ), TEST_LOCATION ); // Unable to convert, but no crash either - DALI_TEST_EQUALS( Property::VECTOR4, value2.GetType(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value2.Get( valueVector ), TEST_LOCATION ); // Able to convert - DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION ); + value2 = std::move(value1); + DALI_TEST_EQUALS(Property::NONE, value1.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value1.Get(valueVector), TEST_LOCATION); // Unable to convert, but no crash either + DALI_TEST_EQUALS(Property::VECTOR4, value2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value2.Get(valueVector), TEST_LOCATION); // Able to convert + DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION); // Change to another value type - value2 = std::move( Property::Value( 1.0f ) ); - DALI_TEST_EQUALS( false, value2.Get( valueVector ), TEST_LOCATION ); // Should not be able to convert to a Vector4 now + value2 = std::move(Property::Value(1.0f)); + DALI_TEST_EQUALS(false, value2.Get(valueVector), TEST_LOCATION); // Should not be able to convert to a Vector4 now float valueFloat; - DALI_TEST_EQUALS( true, value2.Get( valueFloat ), TEST_LOCATION ); // Should be able to convert to a float now - DALI_TEST_EQUALS( valueFloat, 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION); // Should be able to convert to a float now + DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION); // Ensure self assignment doesn't do anything silly - value2 = std::move( value2 ); - DALI_TEST_EQUALS( true, value2.Get( valueFloat ), TEST_LOCATION ); - DALI_TEST_EQUALS( valueFloat, 1.0f, TEST_LOCATION ); + value2 = std::move(value2); + DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION); + DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION); END_TEST; } @@ -802,44 +800,44 @@ int UtcDaliPropertyValueMoveAssignmentOperator(void) int UtcDaliPropertyValueGetTypeP(void) { Property::Value value; - DALI_TEST_CHECK( value.GetType() == Property::NONE ); + DALI_TEST_CHECK(value.GetType() == Property::NONE); END_TEST; } int UtcDaliPropertyValueGetBoolP(void) { Property::Value value(true); - bool boolean( false ); - DALI_TEST_CHECK( value.Get( boolean ) == true ); - DALI_TEST_CHECK( value.Get() == true ); + bool boolean(false); + DALI_TEST_CHECK(value.Get(boolean) == true); + DALI_TEST_CHECK(value.Get() == true); std::string string; - DALI_TEST_CHECK( value.Get( string ) == false ); + DALI_TEST_CHECK(value.Get(string) == false); value = Property::Value(1.f); - DALI_TEST_CHECK( value.Get() == 1.f ); + DALI_TEST_CHECK(value.Get() == 1.f); END_TEST; } int UtcDaliPropertyValueGetBoolN(void) { Property::Value value; - DALI_TEST_CHECK( value.Get() == false ); - bool boolean( false ); - DALI_TEST_CHECK( value.Get( boolean ) == false ); + DALI_TEST_CHECK(value.Get() == false); + bool boolean(false); + DALI_TEST_CHECK(value.Get(boolean) == false); END_TEST; } int UtcDaliPropertyValueGetFloatP(void) { Property::Value value(1.1f); - float flow( 0.0f ); - DALI_TEST_EQUALS( 1.1f, value.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( flow ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.1f, flow, TEST_LOCATION ); + float flow(0.0f); + DALI_TEST_EQUALS(1.1f, value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(flow), TEST_LOCATION); + DALI_TEST_EQUALS(1.1f, flow, TEST_LOCATION); Property::Value intValue(100); - DALI_TEST_EQUALS( 100.f, intValue.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, intValue.Get( flow ), TEST_LOCATION ); - DALI_TEST_EQUALS( 100.f, flow, TEST_LOCATION ); + DALI_TEST_EQUALS(100.f, intValue.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, intValue.Get(flow), TEST_LOCATION); + DALI_TEST_EQUALS(100.f, flow, TEST_LOCATION); END_TEST; } @@ -847,27 +845,27 @@ int UtcDaliPropertyValueGetFloatP(void) int UtcDaliPropertyValueGetFloatN(void) { Property::Value value; - float result( 1.0f ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, result, TEST_LOCATION ); // result is not modified - Property::Value value2( "" ); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1.0f, result, TEST_LOCATION ); // result is not modified + float result(1.0f); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, result, TEST_LOCATION); // result is not modified + Property::Value value2(""); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1.0f, result, TEST_LOCATION); // result is not modified END_TEST; } int UtcDaliPropertyValueGetIntP(void) { Property::Value value(123); - int result( 10 ); - DALI_TEST_EQUALS( 123, value.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 123, result, TEST_LOCATION ); + int result(10); + DALI_TEST_EQUALS(123, value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(123, result, TEST_LOCATION); Property::Value floatValue(21.f); - DALI_TEST_EQUALS( 21, floatValue.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, floatValue.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 21, result, TEST_LOCATION ); + DALI_TEST_EQUALS(21, floatValue.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, floatValue.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(21, result, TEST_LOCATION); END_TEST; } @@ -875,243 +873,243 @@ int UtcDaliPropertyValueGetIntP(void) int UtcDaliPropertyValueGetIntN(void) { Property::Value value; - int result( 10 ); - DALI_TEST_EQUALS( 0, value.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 10, result, TEST_LOCATION ); // result is not modified + int result(10); + DALI_TEST_EQUALS(0, value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(10, result, TEST_LOCATION); // result is not modified Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 10, result, TEST_LOCATION ); // result is not modified + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(10, result, TEST_LOCATION); // result is not modified END_TEST; } int UtcDaliPropertyValueGetRectP(void) { - Property::Value value( Rect(1,2,3,4) ); - Rect result(4,3,2,1); - DALI_TEST_EQUALS( Rect(1,2,3,4), value.Get< Rect >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Rect(1,2,3,4), result, TEST_LOCATION ); + Property::Value value(Rect(1, 2, 3, 4)); + Rect result(4, 3, 2, 1); + DALI_TEST_EQUALS(Rect(1, 2, 3, 4), value.Get >(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Rect(1, 2, 3, 4), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetRectN(void) { Property::Value value; - Rect result(4,3,2,1); - DALI_TEST_EQUALS( Rect(0,0,0,0), value.Get< Rect >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Rect(4,3,2,1), result, TEST_LOCATION ); + Rect result(4, 3, 2, 1); + DALI_TEST_EQUALS(Rect(0, 0, 0, 0), value.Get >(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Rect(4, 3, 2, 1), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Rect(4,3,2,1), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Rect(4, 3, 2, 1), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector2P(void) { - Property::Value value( Vector2(1.0f,2.0f) ); - Vector2 result; - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION ); + Property::Value value(Vector2(1.0f, 2.0f)); + Vector2 result; + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector2fromVector3P(void) { - Property::Value value( Vector3(1.f,2.f,3.f) ); - Vector2 result; - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION ); + Property::Value value(Vector3(1.f, 2.f, 3.f)); + Vector2 result; + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector2fromVector4P(void) { - Property::Value value( Vector4(1.f,2.f,3.f,4.f) ); - Vector2 result; - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION ); + Property::Value value(Vector4(1.f, 2.f, 3.f, 4.f)); + Vector2 result; + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector2N(void) { Property::Value value; - Vector2 result; - DALI_TEST_EQUALS( Vector2(0.f,0.f), value.Get< Vector2 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(), result, TEST_LOCATION ); + Vector2 result; + DALI_TEST_EQUALS(Vector2(0.f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2(), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector3P(void) { - Property::Value value( Vector3(1.0f,2.0f,-1.f) ); - Vector3 result; - DALI_TEST_EQUALS( Vector3(1.0f,2.0f,-1.f), value.Get< Vector3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(1.0f,2.0f,-1.f), result, TEST_LOCATION ); + Property::Value value(Vector3(1.0f, 2.0f, -1.f)); + Vector3 result; + DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, -1.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, -1.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector3FromVector2P(void) { - Property::Value value( Vector2(1.0f,2.0f) ); - Vector3 result(99.f,88.f,77.f); - DALI_TEST_EQUALS( Vector3(1.0f,2.0f,0.f), value.Get< Vector3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(1.0f,2.0f,0.f), result, TEST_LOCATION ); + Property::Value value(Vector2(1.0f, 2.0f)); + Vector3 result(99.f, 88.f, 77.f); + DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, 0.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector3FromVector4P(void) { - Property::Value value( Vector4(4.f,3.f,2.f,1.f) ); - Vector3 result; - DALI_TEST_EQUALS( Vector3(4.f,3.f,2.f), value.Get< Vector3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(4.f,3.f,2.f), result, TEST_LOCATION ); + Property::Value value(Vector4(4.f, 3.f, 2.f, 1.f)); + Vector3 result; + DALI_TEST_EQUALS(Vector3(4.f, 3.f, 2.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(4.f, 3.f, 2.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector3N(void) { Property::Value value; - Vector3 result; - DALI_TEST_EQUALS( Vector3(0.f,0.f,0.f), value.Get< Vector3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(), result, TEST_LOCATION ); + Vector3 result; + DALI_TEST_EQUALS(Vector3(0.f, 0.f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3(), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector4P(void) { - Property::Value value( Vector4(1.f,2.f,-1.f,-3.f) ); - Vector4 result; - DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,-3.f), value.Get< Vector4 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,-3.f), result, TEST_LOCATION ); + Property::Value value(Vector4(1.f, 2.f, -1.f, -3.f)); + Vector4 result; + DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, -3.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, -3.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector4FromVector2P(void) { - Property::Value value( Vector2(-1.f,-3.f) ); - Vector4 result(99.f,88.f,77.f,66.f); - DALI_TEST_EQUALS( Vector4(-1.f,-3.f,0.f,0.f), value.Get< Vector4 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(-1.f,-3.f,0.f,0.f), result, TEST_LOCATION ); + Property::Value value(Vector2(-1.f, -3.f)); + Vector4 result(99.f, 88.f, 77.f, 66.f); + DALI_TEST_EQUALS(Vector4(-1.f, -3.f, 0.f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(-1.f, -3.f, 0.f, 0.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector4FromVector3P(void) { - Property::Value value( Vector3(1.f,2.f,-1.f) ); - Vector4 result(99.f,88.f,77.f,66.f); - DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,0.f), value.Get< Vector4 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,0.f), result, TEST_LOCATION ); + Property::Value value(Vector3(1.f, 2.f, -1.f)); + Vector4 result(99.f, 88.f, 77.f, 66.f); + DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, 0.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetVector4N(void) { Property::Value value; - Vector4 result; - DALI_TEST_EQUALS( Vector4(0.f,0.f,0.f,0.f), value.Get< Vector4 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(), result, TEST_LOCATION ); + Vector4 result; + DALI_TEST_EQUALS(Vector4(0.f, 0.f, 0.f, 0.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Vector4(), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Vector4(), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetMatrix3P(void) { - Property::Value value( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f) ); - Matrix3 result; - DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), value.Get< Matrix3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION ); + Property::Value value(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f)); + Matrix3 result; + DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetMatrix3N(void) { Property::Value value; - Matrix3 result(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f); - DALI_TEST_EQUALS( Matrix3(), value.Get< Matrix3 >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION ); + Matrix3 result(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f); + DALI_TEST_EQUALS(Matrix3(), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetMatrixP(void) { - float matrixValues[16] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 }; - Matrix input( matrixValues ); - Property::Value value( input ); - Matrix result; - DALI_TEST_EQUALS( input, value.Get< Matrix >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( input, result, TEST_LOCATION ); + float matrixValues[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + Matrix input(matrixValues); + Property::Value value(input); + Matrix result; + DALI_TEST_EQUALS(input, value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(input, result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetMatrixN(void) { Property::Value value; - Matrix result( Matrix::IDENTITY ); - DALI_TEST_EQUALS( Matrix(), value.Get< Matrix >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix::IDENTITY, result, TEST_LOCATION ); + Matrix result(Matrix::IDENTITY); + DALI_TEST_EQUALS(Matrix(), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Matrix::IDENTITY, result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix::IDENTITY, result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Matrix::IDENTITY, result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetAngleAxisP(void) { - AngleAxis input( Dali::ANGLE_90, Vector3::XAXIS ); - Property::Value value( input ); - AngleAxis result = value.Get(); - DALI_TEST_EQUALS( input.angle, result.angle, TEST_LOCATION ); - DALI_TEST_EQUALS( input.axis, result.axis, TEST_LOCATION ); + AngleAxis input(Dali::ANGLE_90, Vector3::XAXIS); + Property::Value value(input); + AngleAxis result = value.Get(); + DALI_TEST_EQUALS(input.angle, result.angle, TEST_LOCATION); + DALI_TEST_EQUALS(input.axis, result.axis, TEST_LOCATION); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( input, result, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(input, result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetAngleAxisN(void) { Property::Value value; - AngleAxis b = value.Get(); - AngleAxis result; - DALI_TEST_EQUALS( (Radian)0.f, b.angle, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3::ZERO, b.axis, TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( AngleAxis(), result, TEST_LOCATION ); + AngleAxis b = value.Get(); + AngleAxis result; + DALI_TEST_EQUALS((Radian)0.f, b.angle, TEST_LOCATION); + DALI_TEST_EQUALS(Vector3::ZERO, b.axis, TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(AngleAxis(), result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( AngleAxis(), result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(AngleAxis(), result, TEST_LOCATION); END_TEST; } @@ -1120,103 +1118,103 @@ int UtcDaliPropertyValueGetQuaternionP(void) Vector3 axis(1, 1, 0); axis.Normalize(); - Quaternion result( Radian( 1.f ), axis ); - Property::Value value( result ); + Quaternion result(Radian(1.f), axis); + Property::Value value(result); - DALI_TEST_EQUALS( result, value.Get< Quaternion >(), TEST_LOCATION ); + DALI_TEST_EQUALS(result, value.Get(), TEST_LOCATION); Quaternion test2; - DALI_TEST_EQUALS( true, value.Get( test2 ), TEST_LOCATION ); + DALI_TEST_EQUALS(true, value.Get(test2), TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetQuaternionN(void) { Property::Value value; - Vector3 axis(1, 1, 0); + Vector3 axis(1, 1, 0); axis.Normalize(); - Quaternion result( Radian( 1.f ), axis ); + Quaternion result(Radian(1.f), axis); Quaternion test(result); - DALI_TEST_EQUALS( Quaternion(), value.Get< Quaternion >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( test ), TEST_LOCATION ); - DALI_TEST_EQUALS( test, result, TEST_LOCATION ); + DALI_TEST_EQUALS(Quaternion(), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(test), TEST_LOCATION); + DALI_TEST_EQUALS(test, result, TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( test ), TEST_LOCATION ); - DALI_TEST_EQUALS( test, result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(test), TEST_LOCATION); + DALI_TEST_EQUALS(test, result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetStringP(void) { - Property::Value value( std::string("hello") ); - std::string result; - DALI_TEST_EQUALS( std::string("hello"), value.Get< std::string >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( std::string("hello"), result, TEST_LOCATION ); + Property::Value value(std::string("hello")); + std::string result; + DALI_TEST_EQUALS(std::string("hello"), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(std::string("hello"), result, TEST_LOCATION); - Property::Value value2( "C hi!" ); - DALI_TEST_EQUALS( "C hi!", value2.Get< std::string >(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( "C hi!", result, TEST_LOCATION ); + Property::Value value2("C hi!"); + DALI_TEST_EQUALS("C hi!", value2.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS("C hi!", result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetStringN(void) { Property::Value value; - std::string result("doesn't change"); - DALI_TEST_EQUALS( std::string(), value.Get< std::string >(), TEST_LOCATION ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( "doesn't change", result, TEST_LOCATION ); + std::string result("doesn't change"); + DALI_TEST_EQUALS(std::string(), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS("doesn't change", result, TEST_LOCATION); Property::Value value2(10); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( "doesn't change", result, TEST_LOCATION ); + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS("doesn't change", result, TEST_LOCATION); Property::Value value3((char*)NULL); - DALI_TEST_EQUALS( true, value3.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( std::string(), result, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value3.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(std::string(), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueGetArrayP(void) { - Property::Value value( Property::ARRAY ); - DALI_TEST_CHECK( NULL != value.GetArray() ); - value.GetArray()->PushBack( Property::Value(1) ); + Property::Value value(Property::ARRAY); + DALI_TEST_CHECK(NULL != value.GetArray()); + value.GetArray()->PushBack(Property::Value(1)); Property::Array got = value.Get(); - DALI_TEST_CHECK( got[0].Get() == 1); + DALI_TEST_CHECK(got[0].Get() == 1); Property::Array result; - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_CHECK( result[0].Get() == 1); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_CHECK(result[0].Get() == 1); END_TEST; } int UtcDaliPropertyValueGetArrayN(void) { Property::Value value; - DALI_TEST_CHECK( NULL == value.GetArray() ); + DALI_TEST_CHECK(NULL == value.GetArray()); Property::Array result; - result.PushBack( Property::Value( 10 ) ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified + result.PushBack(Property::Value(10)); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified END_TEST; } int UtcDaliPropertyValueGetMapP(void) { Property::Value value(Property::MAP); - DALI_TEST_CHECK( NULL == value.GetArray() ); - DALI_TEST_CHECK( NULL != value.GetMap() ); + DALI_TEST_CHECK(NULL == value.GetArray()); + DALI_TEST_CHECK(NULL != value.GetMap()); value.GetMap()->Insert("key", Property::Value(1)); Property::Map result = value.Get(); DALI_TEST_CHECK(result.Find("key")->Get() == 1); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); DALI_TEST_CHECK(result.Find("key")->Get() == 1); END_TEST; } @@ -1224,41 +1222,45 @@ int UtcDaliPropertyValueGetMapP(void) int UtcDaliPropertyValueGetMapN(void) { Property::Value value; - DALI_TEST_CHECK( NULL == value.GetMap() ); - DALI_TEST_EQUALS( 0u, value.Get().Count(), TEST_LOCATION ); + DALI_TEST_CHECK(NULL == value.GetMap()); + DALI_TEST_EQUALS(0u, value.Get().Count(), TEST_LOCATION); Property::Map result; - result.Insert("key", "value" ); - DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); + result.Insert("key", "value"); + DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); Property::Value value2(""); - DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified + DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified END_TEST; } int UtcDaliPropertyValueGetExtentsP(void) { - Property::Value value( Extents( 1u, 2u, 3u, 4u ) ); - Extents result( 4u, 3u, 2u, 1u ); - DALI_TEST_EQUALS( Extents( 1u, 2u, 3u, 4u ), value.Get(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( Extents( 1u, 2u, 3u, 4u ), result, TEST_LOCATION ); + Property::Value value(Extents(1u, 2u, 3u, 4u)); + Extents result(4u, 3u, 2u, 1u); + DALI_TEST_EQUALS(Extents(1u, 2u, 3u, 4u), value.Get(), TEST_LOCATION); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(Extents(1u, 2u, 3u, 4u), result, TEST_LOCATION); END_TEST; } int UtcDaliPropertyValueEnum(void) { - enum class E { zero, e }; - Property::Value value( E::e ); - DALI_TEST_EQUALS( static_cast(E::e), static_cast(value.Get()), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(E::e), value.Get(), TEST_LOCATION ); + enum class E + { + zero, + e + }; + Property::Value value(E::e); + DALI_TEST_EQUALS(static_cast(E::e), static_cast(value.Get()), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(E::e), value.Get(), TEST_LOCATION); E result; - DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(E::e), static_cast(result), TEST_LOCATION ); + DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(E::e), static_cast(result), TEST_LOCATION); int result2; - DALI_TEST_EQUALS( true, value.Get( result2 ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(E::e), result2, TEST_LOCATION ); + DALI_TEST_EQUALS(true, value.Get(result2), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(E::e), result2, TEST_LOCATION); END_TEST; } @@ -1272,92 +1274,92 @@ int UtcDaliPropertyValueOutputStream(void) { std::ostringstream stream; stream << value; - DALI_TEST_CHECK( stream.str() == "1" ) + DALI_TEST_CHECK(stream.str() == "1") } { - Property::Value empty; + Property::Value empty; std::ostringstream stream; stream << empty; - DALI_TEST_EQUALS( stream.str(), "undefined type", TEST_LOCATION ); + DALI_TEST_EQUALS(stream.str(), "undefined type", TEST_LOCATION); } { - Property::Value empty( Property::NONE ); + Property::Value empty(Property::NONE); std::ostringstream stream; stream << empty; - DALI_TEST_CHECK( stream.str() == "undefined type" ) + DALI_TEST_CHECK(stream.str() == "undefined type") } { value = Property::Value(20.2f); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "20.2" ) + stream << value; + DALI_TEST_CHECK(stream.str() == "20.2") } { value = Property::Value(-25); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "-25" ) + stream << value; + DALI_TEST_CHECK(stream.str() == "-25") } { - value = Property::Value( Vector2(1.f,1.f) ); + value = Property::Value(Vector2(1.f, 1.f)); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[1, 1]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[1, 1]"); } { - value = Property::Value( Vector3(1.f,1.f,1.f) ); + value = Property::Value(Vector3(1.f, 1.f, 1.f)); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[1, 1, 1]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[1, 1, 1]"); } { - value = Property::Value( Vector4(-4.f,-3.f,-2.f,-1.f) ); + value = Property::Value(Vector4(-4.f, -3.f, -2.f, -1.f)); std::ostringstream stream; - stream << value; - DALI_TEST_EQUALS( stream.str(), "[-4, -3, -2, -1]", TEST_LOCATION ); + stream << value; + DALI_TEST_EQUALS(stream.str(), "[-4, -3, -2, -1]", TEST_LOCATION); } { - value = Property::Value( Matrix3::IDENTITY ); + value = Property::Value(Matrix3::IDENTITY); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]"); } { - value = Property::Value( Matrix::IDENTITY ); + value = Property::Value(Matrix::IDENTITY); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]"); } { - value = Property::Value( Rectangle(1,2,3,4) ); + value = Property::Value(Rectangle(1, 2, 3, 4)); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[1, 2, 3, 4]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[1, 2, 3, 4]"); } { - value = Property::Value( AngleAxis( Dali::ANGLE_120, Vector3::XAXIS ) ); + value = Property::Value(AngleAxis(Dali::ANGLE_120, Vector3::XAXIS)); std::ostringstream stream; - stream << value; - tet_printf("angle axis = %s \n", stream.str().c_str() ); - DALI_TEST_EQUALS( stream.str(), "[ Axis: [1, 0, 0], Angle: 120 degrees ]", TEST_LOCATION ); + stream << value; + tet_printf("angle axis = %s \n", stream.str().c_str()); + DALI_TEST_EQUALS(stream.str(), "[ Axis: [1, 0, 0], Angle: 120 degrees ]", TEST_LOCATION); } { - value = Property::Value( std::string( "Foo" ) ); + value = Property::Value(std::string("Foo")); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "Foo" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "Foo"); } { @@ -1366,27 +1368,27 @@ int UtcDaliPropertyValueOutputStream(void) map.Insert("duration", 10); map.Insert("color", Vector4(1.0, 0.5, 1.0, 1.0)); - value = Property::Value( map ); + value = Property::Value(map); std::ostringstream stream; stream << value; tet_printf("Checking Property::Value is %s", stream.str().c_str()); - DALI_TEST_CHECK( !stream.str().compare("Map(3) = {key:value, duration:10, color:[1, 0.5, 1, 1]}")); + DALI_TEST_CHECK(!stream.str().compare("Map(3) = {key:value, duration:10, color:[1, 0.5, 1, 1]}")); } { Property::Array array; array.PushBack(0); array.PushBack(2); array.PushBack(3); - value = Property::Value( array ); + value = Property::Value(array); std::ostringstream stream; - stream << value; + stream << value; tet_printf("Checking Property::Value is %s", stream.str().c_str()); - DALI_TEST_CHECK( !stream.str().compare("Array(3) = [0, 2, 3]") ); + DALI_TEST_CHECK(!stream.str().compare("Array(3) = [0, 2, 3]")); } { - Property::Map map; - Property::Map map2; + Property::Map map; + Property::Map map2; Property::Array array; map2.Insert("key", "value"); @@ -1398,21 +1400,21 @@ int UtcDaliPropertyValueOutputStream(void) array.PushBack(Vector2(1, 0)); array.PushBack(Vector2(0, 0.5)); map.Insert("texCoords", array); - value = Property::Value( map ); + value = Property::Value(map); std::ostringstream stream; stream << value; tet_printf("Checking Property::Value is %s", stream.str().c_str()); - DALI_TEST_CHECK( !stream.str().compare("Map(3) = {color:[1, 0.5, 1, 1], timePeriod:Map(2) = {key:value, duration:10}, texCoords:Array(4) = [[1, 0], [0, 1], [1, 0], [0, 0.5]]}")); + DALI_TEST_CHECK(!stream.str().compare("Map(3) = {color:[1, 0.5, 1, 1], timePeriod:Map(2) = {key:value, duration:10}, texCoords:Array(4) = [[1, 0], [0, 1], [1, 0], [0, 0.5]]}")); } { - value = Property::Value( Extents( 1u, 2u, 3u, 4u ) ); + value = Property::Value(Extents(1u, 2u, 3u, 4u)); std::ostringstream stream; - stream << value; - DALI_TEST_CHECK( stream.str() == "[1, 2, 3, 4]" ); + stream << value; + DALI_TEST_CHECK(stream.str() == "[1, 2, 3, 4]"); } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-Quaternion.cpp b/automated-tests/src/dali/utc-Dali-Quaternion.cpp index b581cda..d8c4f45 100644 --- a/automated-tests/src/dali/utc-Dali-Quaternion.cpp +++ b/automated-tests/src/dali/utc-Dali-Quaternion.cpp @@ -15,16 +15,15 @@ * */ +#include +#include +#include + #include #include -#include -#include -#include - using namespace Dali; - void utc_dali_quaternion_startup(void) { test_return_value = TET_UNDEF; @@ -35,89 +34,85 @@ void utc_dali_quaternion_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliQuaternionCtorDefaultP(void) { Quaternion q; - DALI_TEST_EQUALS( q.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().x, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().y, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().z, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(q.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().x, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().y, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().z, 0.0f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorCosSinThetaP(void) { - Quaternion q( 1.0f, 0.1f, 0.2f, 0.3f ); + Quaternion q(1.0f, 0.1f, 0.2f, 0.3f); - DALI_TEST_EQUALS( q.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().x, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().y, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().z, 0.3f, TEST_LOCATION ); + DALI_TEST_EQUALS(q.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().x, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().y, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().z, 0.3f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorVector4P(void) { - Quaternion q( Vector4( 1.0f, 0.1f, 0.2f, 0.3f ) ); + Quaternion q(Vector4(1.0f, 0.1f, 0.2f, 0.3f)); - DALI_TEST_EQUALS( q.AsVector().x, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().y, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().z, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().w, 0.3f, TEST_LOCATION ); + DALI_TEST_EQUALS(q.AsVector().x, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().y, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().z, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().w, 0.3f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorAxisAngleVector3P(void) { - Quaternion q( Dali::ANGLE_90, Vector3( 1.0f, 2.0f, 3.0f ) ); + Quaternion q(Dali::ANGLE_90, Vector3(1.0f, 2.0f, 3.0f)); // This will be normalised: - DALI_TEST_EQUALS( q.AsVector().w, 0.707f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().x, 0.189f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().y, 0.378f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q.AsVector().z, 0.567f, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q.AsVector().w, 0.707f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().x, 0.189f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().y, 0.378f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q.AsVector().z, 0.567f, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorEulerAngleP(void) { Quaternion q1(0.924f, 0.383f, 0.0f, 0.0f); - Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f); + Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f); Quaternion q2(0.793f, 0.0f, 0.609f, 0.0f); - Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f); + Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f); Quaternion q3(0.383f, 0.0f, 0.0f, 0.924f); - Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f); + Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f); Quaternion q4(0.795f, 0.478f, 0.374f, 0.006f); - Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f); + Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f); - Quaternion q5( -0.149f, -0.697f, 0.145f, -0.686f); - Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f); + Quaternion q5(-0.149f, -0.697f, 0.145f, -0.686f); + Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f); DALI_TEST_EQUALS(q1.EulerAngles(), r1, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(q2.EulerAngles(), r2, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(q3.EulerAngles(), r3, 0.001, TEST_LOCATION); - DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION); - DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorMatrixP01(void) { // angle: 60 deg, axis: [1,2,3] - float Mref_raw[16] = { 0.535714f, 0.765794f, -0.355767f, 0.0f, - -0.622936f, 0.642857f, 0.445741f, 0.0f, - 0.570053f, -0.0171693f, 0.821429f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f}; - Matrix Mref( Mref_raw ); + float Mref_raw[16] = {0.535714f, 0.765794f, -0.355767f, 0.0f, -0.622936f, 0.642857f, 0.445741f, 0.0f, 0.570053f, -0.0171693f, 0.821429f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + Matrix Mref(Mref_raw); - Quaternion q1( Radian(M_PI/3.0f), Vector3( 1.0f, 2.0f, 3.0f ) ); - Quaternion q2( Mref ); + Quaternion q1(Radian(M_PI / 3.0f), Vector3(1.0f, 2.0f, 3.0f)); + Quaternion q2(Mref); - DALI_TEST_EQUALS( q1, q2, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q2, 0.001, TEST_LOCATION); END_TEST; } @@ -126,62 +121,62 @@ int UtcDaliQuaternionCtorMatrixP02(void) // IDENTITY rotation Quaternion q; - Matrix m( q ); // Convert to matrix + Matrix m(q); // Convert to matrix - Quaternion q2( m ); // and back to a quaternion + Quaternion q2(m); // and back to a quaternion - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( m, Matrix::IDENTITY, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(m, Matrix::IDENTITY, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorMatrixP03(void) { // Create an arbitrary forward vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { - Vector3 vForward( x, y, z ); + Vector3 vForward(x, y, z); vForward.Normalize(); // Construct an up vector from a sideways move Vector3 vSide; - Vector3 vUp = vForward.Cross( Vector3( vForward.x+1.0f, vForward.y, vForward.z ) ); - if( vUp.Length() > 0.01 ) + Vector3 vUp = vForward.Cross(Vector3(vForward.x + 1.0f, vForward.y, vForward.z)); + if(vUp.Length() > 0.01) { vUp.Normalize(); - vSide = vUp.Cross( vForward ); + vSide = vUp.Cross(vForward); vSide.Normalize(); } else { - vSide = vForward.Cross( Vector3( vForward.x, vForward.y+1.0f, vForward.z ) ); + vSide = vForward.Cross(Vector3(vForward.x, vForward.y + 1.0f, vForward.z)); vSide.Normalize(); - vUp = vForward.Cross( vSide ); + vUp = vForward.Cross(vSide); vUp.Normalize(); } // Generate a matrix, and then a quaternion from it - Matrix rotMatrix( Matrix::IDENTITY ); - rotMatrix.SetXAxis( vSide ); - rotMatrix.SetYAxis( vUp ); - rotMatrix.SetZAxis( vForward ); - Quaternion q( rotMatrix ); + Matrix rotMatrix(Matrix::IDENTITY); + rotMatrix.SetXAxis(vSide); + rotMatrix.SetYAxis(vUp); + rotMatrix.SetZAxis(vForward); + Quaternion q(rotMatrix); // Generate a matrix from the quaternion, check they are the same - Matrix resultMatrix( q ); - DALI_TEST_EQUALS( resultMatrix, rotMatrix, 0.001f, TEST_LOCATION ); + Matrix resultMatrix(q); + DALI_TEST_EQUALS(resultMatrix, rotMatrix, 0.001f, TEST_LOCATION); // Rotate an arbitrary vector by both quaternion and rotation matrix, // check the result is the same - Vector4 aVector( -2.983f, -3.213f, 8.2239f, 1.0f ); - Vector3 aVectorRotatedByQ = q.Rotate( Vector3( aVector ) ); - Vector4 aVectorRotatedByR = rotMatrix*aVector; - DALI_TEST_EQUALS( aVectorRotatedByQ, Vector3( aVectorRotatedByR ), 0.001f, TEST_LOCATION ); + Vector4 aVector(-2.983f, -3.213f, 8.2239f, 1.0f); + Vector3 aVectorRotatedByQ = q.Rotate(Vector3(aVector)); + Vector4 aVectorRotatedByR = rotMatrix * aVector; + DALI_TEST_EQUALS(aVectorRotatedByQ, Vector3(aVectorRotatedByR), 0.001f, TEST_LOCATION); } } } @@ -190,50 +185,50 @@ int UtcDaliQuaternionCtorMatrixP03(void) int UtcDaliQuaternionCopyConstructor(void) { - Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f ); - Quaternion q1( q0 ); - DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION ); + Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f); + Quaternion q1(q0); + DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionMoveConstructor(void) { - Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f ); - Quaternion q1 = std::move( q0 ); - DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION ); + Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f); + Quaternion q1 = std::move(q0); + DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCopyAssignment(void) { - Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f ); + Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f); Quaternion q1; q1 = q0; - DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionMoveAssignment(void) { - Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f ); + Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f); Quaternion q1; - q1 = std::move( q0 ); - DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION ); - DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION ); + q1 = std::move(q0); + DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION); + DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION); END_TEST; } @@ -241,92 +236,88 @@ int UtcDaliQuaternionMoveAssignment(void) int UtcDaliQuaternionCtorAxesP01(void) { // angle: 60 deg, axis: [1,2,3] - float Mref_raw[16] = { 0.535714f, 0.765794f, -0.355767f, 0.0f, - -0.622936f, 0.642857f, 0.445741f, 0.0f, - 0.570053f, -0.0171693f, 0.821429f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f}; - Matrix Mref( Mref_raw ); + float Mref_raw[16] = {0.535714f, 0.765794f, -0.355767f, 0.0f, -0.622936f, 0.642857f, 0.445741f, 0.0f, 0.570053f, -0.0171693f, 0.821429f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + Matrix Mref(Mref_raw); - Quaternion q1( Radian(M_PI/3.0f), Vector3( 1.0f, 2.0f, 3.0f ) ); - Quaternion q2( Mref.GetXAxis(), Mref.GetYAxis(), Mref.GetZAxis() ); + Quaternion q1(Radian(M_PI / 3.0f), Vector3(1.0f, 2.0f, 3.0f)); + Quaternion q2(Mref.GetXAxis(), Mref.GetYAxis(), Mref.GetZAxis()); - DALI_TEST_EQUALS( q1, q2, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q2, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionCtorAxesP02(void) { - Vector3 xAxis( Vector3::XAXIS ); - Vector3 yAxis( Vector3::YAXIS ); - Vector3 zAxis( Vector3::ZAXIS ); + Vector3 xAxis(Vector3::XAXIS); + Vector3 yAxis(Vector3::YAXIS); + Vector3 zAxis(Vector3::ZAXIS); - Quaternion q1( xAxis, yAxis, zAxis ); + Quaternion q1(xAxis, yAxis, zAxis); - DALI_TEST_EQUALS( q1, Quaternion::IDENTITY, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, Quaternion::IDENTITY, TEST_LOCATION); - xAxis = Vector3( 1.0f, 1.0f, 0.0f ); + xAxis = Vector3(1.0f, 1.0f, 0.0f); xAxis.Normalize(); - yAxis = Vector3( -1.0f, 1.0f, 0.0f ); // 45 degrees anticlockwise ( +ve ) around z + yAxis = Vector3(-1.0f, 1.0f, 0.0f); // 45 degrees anticlockwise ( +ve ) around z yAxis.Normalize(); - zAxis = xAxis.Cross( yAxis ); + zAxis = xAxis.Cross(yAxis); zAxis.Normalize(); - Quaternion q2( xAxis, yAxis, zAxis ); + Quaternion q2(xAxis, yAxis, zAxis); - DALI_TEST_EQUALS( q2, Quaternion( Radian( Degree( 45 ) ), Vector3::ZAXIS ), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, Quaternion(Radian(Degree(45)), Vector3::ZAXIS), 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionCtorAxesP03(void) { // Create an arbitrary forward vector - for( float x=-1.0f; x<=1.0f; x+=0.1f ) + for(float x = -1.0f; x <= 1.0f; x += 0.1f) { - for( float y=-1.0f; y<1.0f; y+=0.1f ) + for(float y = -1.0f; y < 1.0f; y += 0.1f) { - for( float z=-1.0f; z<1.0f; z+=0.1f ) + for(float z = -1.0f; z < 1.0f; z += 0.1f) { - Vector3 vForward( x, y, z ); + Vector3 vForward(x, y, z); vForward.Normalize(); // Construct an up vector from a sideways move Vector3 vSide; - Vector3 vUp = vForward.Cross( Vector3( vForward.x+1.0f, vForward.y, vForward.z ) ); - if( vUp.Length() > 0.01 ) + Vector3 vUp = vForward.Cross(Vector3(vForward.x + 1.0f, vForward.y, vForward.z)); + if(vUp.Length() > 0.01) { vUp.Normalize(); - vSide = vUp.Cross( vForward ); + vSide = vUp.Cross(vForward); vSide.Normalize(); } else { - vSide = vForward.Cross( Vector3( vForward.x, vForward.y+1.0f, vForward.z ) ); + vSide = vForward.Cross(Vector3(vForward.x, vForward.y + 1.0f, vForward.z)); vSide.Normalize(); - vUp = vForward.Cross( vSide ); + vUp = vForward.Cross(vSide); vUp.Normalize(); } // Generate a quaternion - Quaternion q( vSide, vUp, vForward ); + Quaternion q(vSide, vUp, vForward); Matrix rotMatrix; - rotMatrix.SetXAxis( vSide ); - rotMatrix.SetYAxis( vUp ); - rotMatrix.SetZAxis( vForward ); + rotMatrix.SetXAxis(vSide); + rotMatrix.SetYAxis(vUp); + rotMatrix.SetZAxis(vForward); // Generate a matrix from the quaternion, check they are the same - Matrix m( q ); - DALI_TEST_EQUALS( m.GetXAxis(), vSide, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( m.GetYAxis(), vUp, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( m.GetZAxis(), vForward, 0.001f, TEST_LOCATION ); + Matrix m(q); + DALI_TEST_EQUALS(m.GetXAxis(), vSide, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(m.GetYAxis(), vUp, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(m.GetZAxis(), vForward, 0.001f, TEST_LOCATION); // Rotate an arbitrary vector by both quaternion and rotation matrix, // check the result is the same - Vector4 aVector( 2.043f, 12.8f, -3.872f, 1.0f ); - Vector3 aVectorRotatedByQ = q.Rotate( Vector3( aVector ) ); - Vector4 aVectorRotatedByR = rotMatrix*aVector; - DALI_TEST_EQUALS( aVectorRotatedByQ, Vector3( aVectorRotatedByR ), 0.001f, TEST_LOCATION ); + Vector4 aVector(2.043f, 12.8f, -3.872f, 1.0f); + Vector3 aVectorRotatedByQ = q.Rotate(Vector3(aVector)); + Vector4 aVectorRotatedByR = rotMatrix * aVector; + DALI_TEST_EQUALS(aVectorRotatedByQ, Vector3(aVectorRotatedByR), 0.001f, TEST_LOCATION); } } } @@ -335,50 +326,50 @@ int UtcDaliQuaternionCtorAxesP03(void) int UtcDaliQuaternionCtorTwoVectorsP(void) { - Vector3 v0( 1.0f, 2.0f, 3.0f ); - Vector3 v1( -2.0f, 10.0f, -1.0f ); + Vector3 v0(1.0f, 2.0f, 3.0f); + Vector3 v1(-2.0f, 10.0f, -1.0f); v0.Normalize(); v1.Normalize(); - Quaternion q( v0, v1 ); + Quaternion q(v0, v1); - DALI_TEST_EQUALS( q*v0, v1, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q * v0, v1, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionAsVectorP(void) { - Vector4 v( 1.0f, 0.1f, 0.2f, 0.3f ); - Quaternion q( v ); + Vector4 v(1.0f, 0.1f, 0.2f, 0.3f); + Quaternion q(v); - DALI_TEST_EQUALS( v, q.AsVector(), TEST_LOCATION ); + DALI_TEST_EQUALS(v, q.AsVector(), TEST_LOCATION); END_TEST; } int UtcDaliQuaternionToAxisAngleVector3P(void) { - Quaternion q( 0.932f, 1.1f, 3.4f, 2.7f ); - Radian angle; - Vector3 axis; - bool converted = q.ToAxisAngle( axis, angle ); - DALI_TEST_EQUALS( converted, true, TEST_LOCATION ); - DALI_TEST_EQUALS( angle.radian, 0.74f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.x, 3.03f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.y, 9.38f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.z, 7.45f, 0.01f, TEST_LOCATION ); + Quaternion q(0.932f, 1.1f, 3.4f, 2.7f); + Radian angle; + Vector3 axis; + bool converted = q.ToAxisAngle(axis, angle); + DALI_TEST_EQUALS(converted, true, TEST_LOCATION); + DALI_TEST_EQUALS(angle.radian, 0.74f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.x, 3.03f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 9.38f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 7.45f, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionToAxisAngleVector3N(void) { - Quaternion q( 1, 2, 3, 4 ); - Radian angle; - Vector3 axis; - bool converted = q.ToAxisAngle( axis, angle ); - DALI_TEST_EQUALS( converted, false, TEST_LOCATION ); - DALI_TEST_EQUALS( angle.radian, 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.x, 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.y, 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.z, 0.0f, 0.01f, TEST_LOCATION ); + Quaternion q(1, 2, 3, 4); + Radian angle; + Vector3 axis; + bool converted = q.ToAxisAngle(axis, angle); + DALI_TEST_EQUALS(converted, false, TEST_LOCATION); + DALI_TEST_EQUALS(angle.radian, 0.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.x, 0.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 0.0f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 0.0f, 0.01f, TEST_LOCATION); END_TEST; } @@ -386,146 +377,142 @@ int UtcDaliQuaternionSetEulerP(void) { // Test from euler angles Quaternion e1; - e1.SetEuler( Dali::ANGLE_45, Dali::ANGLE_0, Dali::ANGLE_0 ); - Vector4 r1( 0.383f, 0.0f, 0.0f, 0.924f ); + e1.SetEuler(Dali::ANGLE_45, Dali::ANGLE_0, Dali::ANGLE_0); + Vector4 r1(0.383f, 0.0f, 0.0f, 0.924f); Quaternion e2; - e2.SetEuler( Dali::ANGLE_0, Radian( Degree( 75 ) ), Dali::ANGLE_0 ); - Vector4 r2( 0.0f, 0.609f, 0.0f, 0.793f ); + e2.SetEuler(Dali::ANGLE_0, Radian(Degree(75)), Dali::ANGLE_0); + Vector4 r2(0.0f, 0.609f, 0.0f, 0.793f); Quaternion e3; - e3.SetEuler( Dali::ANGLE_0, Dali::ANGLE_0, Radian( Degree( 135 ) ) ); - Vector4 r3( 0.0f, 0.0f, 0.924f, 0.383f ); + e3.SetEuler(Dali::ANGLE_0, Dali::ANGLE_0, Radian(Degree(135))); + Vector4 r3(0.0f, 0.0f, 0.924f, 0.383f); Quaternion e4; - e4.SetEuler( Radian( Degree( 71 ) ), Radian( Degree( 36 ) ), Radian( Degree( 27 ) ) ); - Vector4 r4( 0.478f, 0.374f, 0.006f, 0.795f ); + e4.SetEuler(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27))); + Vector4 r4(0.478f, 0.374f, 0.006f, 0.795f); Quaternion e5; - e5.SetEuler( Radian( Degree( -31 ) ), Radian( Degree( -91 ) ), Radian( Degree( -173 ) ) ); - Vector4 r5( -0.697f, 0.145f, -0.686f, -0.149f ); + e5.SetEuler(Radian(Degree(-31)), Radian(Degree(-91)), Radian(Degree(-173))); + Vector4 r5(-0.697f, 0.145f, -0.686f, -0.149f); - DALI_TEST_EQUALS( e1.AsVector(), r1, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( e2.AsVector(), r2, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( e3.AsVector(), r3, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( e4.AsVector(), r4, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( e5.AsVector(), r5, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(e1.AsVector(), r1, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(e2.AsVector(), r2, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(e3.AsVector(), r3, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(e4.AsVector(), r4, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(e5.AsVector(), r5, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionEulerAnglesP(void) { - Quaternion q1( 0.924f, 0.383f, 0.0f, 0.0f ); - Vector4 r1( Radian( Degree( 45 ) ), 0.0f, 0.0f, 0.0f ); + Quaternion q1(0.924f, 0.383f, 0.0f, 0.0f); + Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f); - Quaternion q2( 0.793f, 0.0f, 0.609f, 0.0f ); - Vector4 r2( 0.0f, Radian( Degree( 75 ) ), 0.0f, 0.0f ); + Quaternion q2(0.793f, 0.0f, 0.609f, 0.0f); + Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f); - Quaternion q3( 0.383f, 0.0f, 0.0f, 0.924f ); - Vector4 r3( 0.0f, 0.0f, Radian( Degree( 135 ) ), 0.0f ); + Quaternion q3(0.383f, 0.0f, 0.0f, 0.924f); + Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f); - Quaternion q4( 0.795f, 0.478f, 0.374f, 0.006f ); - Vector4 r4( Radian( Degree( 71 ) ), Radian( Degree( 36 ) ), Radian( Degree( 27 ) ), 0.0f ); + Quaternion q4(0.795f, 0.478f, 0.374f, 0.006f); + Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f); - Quaternion q5( -0.149f, -0.697f, 0.145f, -0.686f ); - Vector4 r5( Radian( Degree( 148.0 ) ), Radian( Degree( -88.2 ) ), Radian( Degree( 8.0 ) ), 0.0f ); + Quaternion q5(-0.149f, -0.697f, 0.145f, -0.686f); + Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f); - DALI_TEST_EQUALS( q1.EulerAngles(), r1, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q2.EulerAngles(), r2, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q3.EulerAngles(), r3, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( q4.EulerAngles(), r4, 0.01, TEST_LOCATION ); - DALI_TEST_EQUALS( q5.EulerAngles(), r5, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS(q1.EulerAngles(), r1, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q2.EulerAngles(), r2, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q3.EulerAngles(), r3, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionToMatrixP01(void) { - Quaternion q( Radian( 0.69813 ), Vector3( 1.0f, 0.0f, 0.0f ) ); // 40 degree rotation around X axis + Quaternion q(Radian(0.69813), Vector3(1.0f, 0.0f, 0.0f)); // 40 degree rotation around X axis // Result calculated using a different maths library ( with appropriate row/col ordering ) - float els[] = { 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.766f, 0.643f, 0.0f, - 0.0f, -0.643f, 0.766f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f }; - Matrix mRes( els ); - Matrix m( q ); + float els[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.766f, 0.643f, 0.0f, 0.0f, -0.643f, 0.766f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + Matrix mRes(els); + Matrix m(q); - DALI_TEST_EQUALS( m, mRes, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS(m, mRes, 0.01, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionToMatrixP02(void) { // rotation around arbitrary axis - Quaternion q2( Radian( -1.23918f ), Vector3( 7.0f, -13.0f, 11.0f ) ); + Quaternion q2(Radian(-1.23918f), Vector3(7.0f, -13.0f, 11.0f)); - float els[] = { 0.423f, -0.746f, -0.514f, 0.00f, - 0.384f, 0.662f, -0.644f, 0.00f, - 0.821f, 0.075f, 0.566f, 0.00f, - 0.000f, 0.000f, 0.000f, 1.00f }; - Matrix mRes2( els ); + float els[] = {0.423f, -0.746f, -0.514f, 0.00f, 0.384f, 0.662f, -0.644f, 0.00f, 0.821f, 0.075f, 0.566f, 0.00f, 0.000f, 0.000f, 0.000f, 1.00f}; + Matrix mRes2(els); - Matrix m2( q2 ); + Matrix m2(q2); - DALI_TEST_EQUALS( m2, mRes2, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS(m2, mRes2, 0.01, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionOperatorAdditionP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f); - Quaternion r1( 0.383f, 0.609f, 0.0f, 1.717f ); + Quaternion r1(0.383f, 0.609f, 0.0f, 1.717f); - DALI_TEST_EQUALS( q1+q2, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1 + q2, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorSubtractionP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q2( 0.383f, 0.690f, 0.234f, 1.917f ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q2(0.383f, 0.690f, 0.234f, 1.917f); - Quaternion r1( 0.0f, 0.240f, 0.111f, 0.993f ); + Quaternion r1(0.0f, 0.240f, 0.111f, 0.993f); - DALI_TEST_EQUALS( q2-q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2 - q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionConjugateP(void) { - float s1 = 0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f ); - float s2 = 0.697f; Vector3 v2( 0.612, 0.344, -0.144 ); + float s1 = 0.784f; + Vector3 v1(0.045f, 0.443f, 0.432f); + float s2 = 0.697f; + Vector3 v2(0.612, 0.344, -0.144); - Quaternion q1( s1, v1.x, v1.y, v1.z ); - Quaternion q2( s2, v2.x, v2.y, v2.z ); + Quaternion q1(s1, v1.x, v1.y, v1.z); + Quaternion q2(s2, v2.x, v2.y, v2.z); q1.Conjugate(); q2.Conjugate(); - Quaternion r1( s1, -v1.x, -v1.y, -v1.z ); - Quaternion r2( s2, -v2.x, -v2.y, -v2.z ); + Quaternion r1(s1, -v1.x, -v1.y, -v1.z); + Quaternion r2(s2, -v2.x, -v2.y, -v2.z); - DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplicationQuaternionP(void) { - float s1=0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f ); - float s2=0.697f; Vector3 v2( 0.612, 0.344, -0.144 ); + float s1 = 0.784f; + Vector3 v1(0.045f, 0.443f, 0.432f); + float s2 = 0.697f; + Vector3 v2(0.612, 0.344, -0.144); - Quaternion q1( s1, v1.x, v1.y, v1.z ); - Quaternion q2( s2, v2.x, v2.y, v2.z ); + Quaternion q1(s1, v1.x, v1.y, v1.z); + Quaternion q2(s2, v2.x, v2.y, v2.z); - Vector3 vp = v1.Cross( v2 ) + v2*s1 + v1*s2; - Quaternion r1( s1*s2-v1.Dot( v2 ), vp.x, vp.y, vp.z ); + Vector3 vp = v1.Cross(v2) + v2 * s1 + v1 * s2; + Quaternion r1(s1 * s2 - v1.Dot(v2), vp.x, vp.y, vp.z); - DALI_TEST_EQUALS( q1*q2, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1 * q2, r1, 0.001f, TEST_LOCATION); END_TEST; } @@ -533,54 +520,54 @@ int UtcDaliQuaternionOperatorMultiplicationQuaternionP(void) int UtcDaliQuaternionOperatorMultiplicationVector3P(void) { // Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1 - Vector3 v( 2, 3, 4 ); - Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS ); + Vector3 v(2, 3, 4); + Quaternion q(Radian(Degree(72)), Vector3::ZAXIS); Quaternion qI = q; qI.Invert(); - Quaternion qv( 0.0f, v.x, v.y, v.z ); - Quaternion r1 = ( q * qv ) * qI; + Quaternion qv(0.0f, v.x, v.y, v.z); + Quaternion r1 = (q * qv) * qI; Vector3 r2 = q * v; - DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplicationFloatP01(void) { // Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1 - Quaternion q( Vector4( 0.1f, 0.2f, 0.3f, 1.0f ) ); + Quaternion q(Vector4(0.1f, 0.2f, 0.3f, 1.0f)); Quaternion q2 = q * 2.f; - Vector4 v2( 0.2f, 0.4f, 0.6f, 2.0f ); + Vector4 v2(0.2f, 0.4f, 0.6f, 2.0f); - DALI_TEST_EQUALS( q2.AsVector(), v2, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q2.AsVector(), v2, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplicationFloatP02(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f); - DALI_TEST_EQUALS( q1 * 2.0f, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1 * 2.0f, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplicationFloatP03(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion r1( 0.5f* 0.383f, 0.0f, 0.0f, 0.5f * 0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion r1(0.5f * 0.383f, 0.0f, 0.0f, 0.5f * 0.924f); - DALI_TEST_EQUALS( q1 / 2.0f, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1 / 2.0f, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorDivisionQuaternionP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f); // q1 / q2 = q1 * q2^-1 // q2^-1 = q2* / ||q2||^2 @@ -588,527 +575,515 @@ int UtcDaliQuaternionOperatorDivisionQuaternionP(void) Quaternion r1 = q2; r1.Conjugate(); - r1 *= 1.0f/q2.LengthSquared(); + r1 *= 1.0f / q2.LengthSquared(); Quaternion r2 = q1 * r1; - DALI_TEST_EQUALS( q1 / q2, r2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1 / q2, r2, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorDivisionFloatP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f); - DALI_TEST_EQUALS( q1, r1/2.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1 / 2.0f, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorDivideAssignedFloatP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f); r1 /= 2.0f; - DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorNegationP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion r1( -0.383f, -0.0f, -0.0f, -0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion r1(-0.383f, -0.0f, -0.0f, -0.924f); - DALI_TEST_EQUALS( -q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(-q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorAddAssignP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); - Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); + Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f); - Quaternion r1( 0.383f, 0.609f, 0.0f, 1.717f ); + Quaternion r1(0.383f, 0.609f, 0.0f, 1.717f); q1 += q2; - DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorSubtractAssignP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q2( 0.383f, 0.690f, 0.234f, 1.917f ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q2(0.383f, 0.690f, 0.234f, 1.917f); - Quaternion r1( 0.0f, 0.240f, 0.111f, 0.993f ); + Quaternion r1(0.0f, 0.240f, 0.111f, 0.993f); q2 -= q1; - DALI_TEST_EQUALS( q2, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplyAssignQuaternionP(void) { - float s1=0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f ); - float s2=0.697f; Vector3 v2( 0.612, 0.344, -0.144 ); + float s1 = 0.784f; + Vector3 v1(0.045f, 0.443f, 0.432f); + float s2 = 0.697f; + Vector3 v2(0.612, 0.344, -0.144); - Quaternion q1( s1, v1.x, v1.y, v1.z ); - Quaternion q2( s2, v2.x, v2.y, v2.z ); + Quaternion q1(s1, v1.x, v1.y, v1.z); + Quaternion q2(s2, v2.x, v2.y, v2.z); Quaternion r3 = q2 * q1; q2 *= q1; - DALI_TEST_EQUALS( q2, r3, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r3, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplyAssignFloatP01(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - float scale = 2.5f; - Quaternion r1( scale*0.383f, scale*0.450f, scale*0.123f, scale*0.924f ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + float scale = 2.5f; + Quaternion r1(scale * 0.383f, scale * 0.450f, scale * 0.123f, scale * 0.924f); q1 *= scale; - DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorMultiplyAssignFloatP02(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - float scale = 2.5f; - Quaternion r1( 0.383f/scale, 0.450f/scale, 0.123f/scale, 0.924f/scale ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + float scale = 2.5f; + Quaternion r1(0.383f / scale, 0.450f / scale, 0.123f / scale, 0.924f / scale); q1 /= scale; - DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionOperatorEqualityP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q2( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q3( 0.383f, 0.450f, 0.123f, 0.800f ); - Quaternion q4( 0.383f, 0.450f, 0.100f, 0.800f ); - Quaternion q5( 0.383f, 0.100f, 0.100f, 0.800f ); - Quaternion q6( 0.100f, 0.100f, 0.100f, 0.800f ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q2(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q3(0.383f, 0.450f, 0.123f, 0.800f); + Quaternion q4(0.383f, 0.450f, 0.100f, 0.800f); + Quaternion q5(0.383f, 0.100f, 0.100f, 0.800f); + Quaternion q6(0.100f, 0.100f, 0.100f, 0.800f); - Quaternion q7( -0.383f, -0.450f, -0.123f, -0.924f ); - Quaternion q8( -0.383f, -0.450f, -0.123f, 0.924f ); - Quaternion q9( -0.383f, -0.450f, 0.123f, 0.924f ); - Quaternion q10( -0.383f, 0.450f, 0.123f, 0.924f ); + Quaternion q7(-0.383f, -0.450f, -0.123f, -0.924f); + Quaternion q8(-0.383f, -0.450f, -0.123f, 0.924f); + Quaternion q9(-0.383f, -0.450f, 0.123f, 0.924f); + Quaternion q10(-0.383f, 0.450f, 0.123f, 0.924f); - DALI_TEST_CHECK( q1 == q2 ); - DALI_TEST_CHECK( !( q1 == q3 ) ); - DALI_TEST_CHECK( !( q1 == q4 ) ); - DALI_TEST_CHECK( !( q1 == q5 ) ); - DALI_TEST_CHECK( !( q1 == q6 ) ); - DALI_TEST_CHECK( ( q1 == q7 ) ); - DALI_TEST_CHECK( !( q1 == q8 ) ); - DALI_TEST_CHECK( !( q1 == q9 ) ); - DALI_TEST_CHECK( !( q1 == q10 ) ); + DALI_TEST_CHECK(q1 == q2); + DALI_TEST_CHECK(!(q1 == q3)); + DALI_TEST_CHECK(!(q1 == q4)); + DALI_TEST_CHECK(!(q1 == q5)); + DALI_TEST_CHECK(!(q1 == q6)); + DALI_TEST_CHECK((q1 == q7)); + DALI_TEST_CHECK(!(q1 == q8)); + DALI_TEST_CHECK(!(q1 == q9)); + DALI_TEST_CHECK(!(q1 == q10)); END_TEST; } int UtcDaliQuaternionOperatorInequalityP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q2( 0.383f, 0.450f, 0.123f, 0.924f ); - Quaternion q3( -0.383f, -0.0f, -0.0f, -0.924f ); - DALI_TEST_CHECK( !( q1 != q2 ) ); - DALI_TEST_CHECK( q1 != q3 ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q2(0.383f, 0.450f, 0.123f, 0.924f); + Quaternion q3(-0.383f, -0.0f, -0.0f, -0.924f); + DALI_TEST_CHECK(!(q1 != q2)); + DALI_TEST_CHECK(q1 != q3); END_TEST; } int UtcDaliQuaternionLengthP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - float length = sqrtf( 0.383f*0.383f + 0.450f*0.450f + 0.123f*0.123f + 0.924f*0.924f ); - DALI_TEST_EQUALS( q1.Length(), length, 0.001f, TEST_LOCATION ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + float length = sqrtf(0.383f * 0.383f + 0.450f * 0.450f + 0.123f * 0.123f + 0.924f * 0.924f); + DALI_TEST_EQUALS(q1.Length(), length, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionLengthSquaredP(void) { - Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f ); - float lengthSquared = 0.383f*0.383f + 0.450f*0.450f + 0.123f*0.123f + 0.924f*0.924f; - DALI_TEST_EQUALS( q1.LengthSquared(), lengthSquared, 0.01f, TEST_LOCATION ); + Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f); + float lengthSquared = 0.383f * 0.383f + 0.450f * 0.450f + 0.123f * 0.123f + 0.924f * 0.924f; + DALI_TEST_EQUALS(q1.LengthSquared(), lengthSquared, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionNormalizeP(void) { - Quaternion q1( 0.118f, 0.692f, -0.127f, 0.701f ); + Quaternion q1(0.118f, 0.692f, -0.127f, 0.701f); Quaternion q2 = q1; q2 *= 5.0f; q2.Normalize(); - DALI_TEST_EQUALS( q1, q2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q2, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionNormalizedP(void) { - Quaternion q1( 0.118f, 0.692f, -0.127f, 0.701f ); + Quaternion q1(0.118f, 0.692f, -0.127f, 0.701f); Quaternion q2 = q1; q2 *= 5.0f; - DALI_TEST_EQUALS( q1, q2.Normalized(), 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q2.Normalized(), 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionIsIdentityP(void) { - Quaternion q( 1.0f, 0.0f, 0.0f, 0.0f ); - DALI_TEST_EQUALS( q.IsIdentity(), true, TEST_LOCATION ); + Quaternion q(1.0f, 0.0f, 0.0f, 0.0f); + DALI_TEST_EQUALS(q.IsIdentity(), true, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionIsIdentityN(void) { - Quaternion q( 1.0f, 0.1f, 0.0f, 0.0f ); - DALI_TEST_EQUALS( q.IsIdentity(), false, TEST_LOCATION ); + Quaternion q(1.0f, 0.1f, 0.0f, 0.0f); + DALI_TEST_EQUALS(q.IsIdentity(), false, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionInvertP(void) { - Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f ); + Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f); // q1^-1 = q1* / ||q1||^2 // = Conjugate of q1 / Square of Norm of q1 Quaternion r1 = q1; r1.Conjugate(); - r1 *= 1.0f/q1.LengthSquared(); + r1 *= 1.0f / q1.LengthSquared(); Quaternion q2 = q1; q2.Invert(); - DALI_TEST_EQUALS( q2, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r1, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionDotP(void) { // q.q' = s*s' + v dot v' - float s1 = 0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f ); - float s2 = 0.697f; Vector3 v2( 0.612, 0.344, -0.144 ); + float s1 = 0.784f; + Vector3 v1(0.045f, 0.443f, 0.432f); + float s2 = 0.697f; + Vector3 v2(0.612, 0.344, -0.144); - Quaternion q1( s1, v1.x, v1.y, v1.z ); - Quaternion q2( s2, v2.x, v2.y, v2.z ); + Quaternion q1(s1, v1.x, v1.y, v1.z); + Quaternion q2(s2, v2.x, v2.y, v2.z); - float r1 = s1*s2 + v1.Dot( v2 ); + float r1 = s1 * s2 + v1.Dot(v2); - DALI_TEST_EQUALS( Quaternion::Dot( q1, q2 ), r1, TEST_LOCATION ); + DALI_TEST_EQUALS(Quaternion::Dot(q1, q2), r1, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionRotateVector3P(void) { // Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1 - Vector3 v( 2, 3, 4 ); - Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS ); + Vector3 v(2, 3, 4); + Quaternion q(Radian(Degree(72)), Vector3::ZAXIS); Quaternion qI = q; qI.Invert(); - Quaternion qv( 0.0f, v.x, v.y, v.z ); + Quaternion qv(0.0f, v.x, v.y, v.z); Quaternion r1 = q * qv * qI; - Vector3 r2 = q.Rotate( v ); + Vector3 r2 = q.Rotate(v); - DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001f, TEST_LOCATION); - DALI_TEST_EQUALS( q.Rotate( v ), q*v, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q.Rotate(v), q * v, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionRotateVector4P(void) { // Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1 - Vector4 v( 2, 3, 4, 5 ); - Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS ); + Vector4 v(2, 3, 4, 5); + Quaternion q(Radian(Degree(72)), Vector3::ZAXIS); Quaternion qI = q; qI.Invert(); - Quaternion qv( 0.0f, v.x, v.y, v.z ); + Quaternion qv(0.0f, v.x, v.y, v.z); Quaternion r1 = q * qv * qI; - Vector4 r2 = q.Rotate( v ); + Vector4 r2 = q.Rotate(v); - DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( r1.mVector.w, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(r1.mVector.w, 0.0f, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionExpP01(void) { - Quaternion q1( 0.0f, 1.0f, 1.2f, 1.3f ); + Quaternion q1(0.0f, 1.0f, 1.2f, 1.3f); Quaternion q2 = q1.Exp(); - Quaternion r2( -0.4452, 0.4406, 0.5287, 0.5728 ); + Quaternion r2(-0.4452, 0.4406, 0.5287, 0.5728); - DALI_TEST_EQUALS( q2.Length(), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2.Length(), 1.0f, 0.01f, TEST_LOCATION); - DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION); // Note, this trick only works when |v| < pi, which it is! Quaternion q3 = q2.Log(); - DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionExpP02(void) { - Quaternion q1( 0.0f, 0.0f, 0.0f, 0.0f ); + Quaternion q1(0.0f, 0.0f, 0.0f, 0.0f); Quaternion q2 = q1.Exp(); - Quaternion r2( 1.0f, 0.0f, 0.0f, 0.0f ); + Quaternion r2(1.0f, 0.0f, 0.0f, 0.0f); - DALI_TEST_EQUALS( q2.Length(), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2.Length(), 1.0f, 0.01f, TEST_LOCATION); - DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION); // Note, this trick only works when |v| < pi, which it is! Quaternion q3 = q2.Log(); - DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionExpN(void) { - Quaternion q( Radian( 0.0f ), Vector3(5.0f, 6.0f, 7.0f) ); + Quaternion q(Radian(0.0f), Vector3(5.0f, 6.0f, 7.0f)); // q.w is non-zero. Should assert. try { q.Exp(); - DALI_TEST_CHECK( false ); + DALI_TEST_CHECK(false); } - catch( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; } - int UtcDaliQuaternionLogP01(void) { - Quaternion q( Radian( Math::PI*0.73f ), Vector3(2,3,4) ); + Quaternion q(Radian(Math::PI * 0.73f), Vector3(2, 3, 4)); Quaternion q2 = q; q2.Normalize(); Quaternion r = q2.Log(); - DALI_TEST_EQUALS( r.mVector.w, 0.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(r.mVector.w, 0.0f, 0.01f, TEST_LOCATION); Quaternion r2 = r.Exp(); - DALI_TEST_EQUALS( r2, q2, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(r2, q2, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionLogP02(void) { - Quaternion q1( 1.0f, 0.0f, 0.0f, 0.0f ); - Quaternion r1( 0.0f, 0.0f, 0.0f, 0.0f ); + Quaternion q1(1.0f, 0.0f, 0.0f, 0.0f); + Quaternion r1(0.0f, 0.0f, 0.0f, 0.0f); Quaternion q2 = q1.Log(); - DALI_TEST_EQUALS( q2, r1, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q2, r1, 0.01f, TEST_LOCATION); Quaternion q3 = q2.Exp(); - DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionLerpP(void) { - Quaternion q1( Radian( Degree( -80 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); - Quaternion q2( Radian( Degree( 80 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); + Quaternion q1(Radian(Degree(-80)), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Radian(Degree(80)), Vector3(0.0f, 0.0f, 1.0f)); - Quaternion p = Quaternion::Lerp( q1, q2, 0.0f ); - DALI_TEST_EQUALS( p, q1, 0.001f, TEST_LOCATION ); + Quaternion p = Quaternion::Lerp(q1, q2, 0.0f); + DALI_TEST_EQUALS(p, q1, 0.001f, TEST_LOCATION); - p = Quaternion::Lerp( q1, q2, 1.0f ); - DALI_TEST_EQUALS( p, q2, 0.001f, TEST_LOCATION ); + p = Quaternion::Lerp(q1, q2, 1.0f); + DALI_TEST_EQUALS(p, q2, 0.001f, TEST_LOCATION); - p = Quaternion::Lerp( q1, q2, 0.5f ); - Quaternion r1 = ( q1 + q2 ) * 0.5f; + p = Quaternion::Lerp(q1, q2, 0.5f); + Quaternion r1 = (q1 + q2) * 0.5f; r1.Normalize(); - DALI_TEST_EQUALS( p, r1, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(p, r1, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliQuaternionSlerpP01(void) { - Quaternion q1(Radian(M_PI/4.0f), Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q2(Radian(-M_PI/4.0f), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q1(Radian(M_PI / 4.0f), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Radian(-M_PI / 4.0f), Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q = Quaternion::Slerp( q1, q2, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + Quaternion q = Quaternion::Slerp(q1, q2, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::Slerp( q1, q2, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + q = Quaternion::Slerp(q1, q2, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); // @ 25%, will be at M_PI/8 - q = Quaternion::Slerp( q1, q2, 0.25f ); + q = Quaternion::Slerp(q1, q2, 0.25f); Vector3 axis; - Radian angle; - bool converted = q.ToAxisAngle( axis, angle ); - DALI_TEST_EQUALS( converted, true, TEST_LOCATION ); - DALI_TEST_EQUALS( angle.radian, Math::PI/8.0f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.x, 0.0f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.y, 0.0f, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.z, 1.0f, 0.001, TEST_LOCATION ); + Radian angle; + bool converted = q.ToAxisAngle(axis, angle); + DALI_TEST_EQUALS(converted, true, TEST_LOCATION); + DALI_TEST_EQUALS(angle.radian, Math::PI / 8.0f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(axis.x, 0.0f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 0.0f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 1.0f, 0.001, TEST_LOCATION); END_TEST; } - - int UtcDaliQuaternionSlerpP02(void) { - Quaternion q1( Dali::ANGLE_30, Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q2( Dali::ANGLE_90, Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q1(Dali::ANGLE_30, Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Dali::ANGLE_90, Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q = Quaternion::Slerp( q1, q2, 0.0f ); + Quaternion q = Quaternion::Slerp(q1, q2, 0.0f); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::Slerp( q1, q2, 1.0f ); + q = Quaternion::Slerp(q1, q2, 1.0f); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); // @ 50%, will be at M_PI/3 around z - q = Quaternion::Slerp( q1, q2, 0.5f ); + q = Quaternion::Slerp(q1, q2, 0.5f); - Quaternion r( Dali::ANGLE_60, Vector3( 0.0f, 0.0f, 1.0f)); - DALI_TEST_EQUALS( q, r, 0.001, TEST_LOCATION ); + Quaternion r(Dali::ANGLE_60, Vector3(0.0f, 0.0f, 1.0f)); + DALI_TEST_EQUALS(q, r, 0.001, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionSlerpP03(void) { - Quaternion q1( Radian( Degree( 125 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); - Quaternion q2( Radian( Degree( -125 ) ), Vector3( 0.002f, 0.001f, 1.001f ) ); + Quaternion q1(Radian(Degree(125)), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Radian(Degree(-125)), Vector3(0.002f, 0.001f, 1.001f)); - Quaternion q = Quaternion::Slerp( q1, q2, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + Quaternion q = Quaternion::Slerp(q1, q2, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::Slerp( q1, q2, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + q = Quaternion::Slerp(q1, q2, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); q = Quaternion::Slerp(q1, q2, 0.05f); Vector3 axis; - Radian angle; - bool converted = q.ToAxisAngle(axis, angle); + Radian angle; + bool converted = q.ToAxisAngle(axis, angle); DALI_TEST_EQUALS(converted, true, TEST_LOCATION); - DALI_TEST_EQUALS( axis.x, 0.0f, 0.01, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.y, 0.0f, 0.01, TEST_LOCATION ); - DALI_TEST_EQUALS( axis.z, 1.0f, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION); END_TEST; } - - int UtcDaliQuaternionSlerpP04(void) { - Quaternion q1( Radian( Degree( 120 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); - Quaternion q2( Radian( Degree( 130 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); + Quaternion q1(Radian(Degree(120)), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Radian(Degree(130)), Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q = Quaternion::Slerp( q1, q2, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + Quaternion q = Quaternion::Slerp(q1, q2, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::Slerp( q1, q2, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + q = Quaternion::Slerp(q1, q2, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); q = Quaternion::Slerp(q1, q2, 0.5f); Vector3 axis; - Radian angle; - bool converted = q.ToAxisAngle(axis, angle); + Radian angle; + bool converted = q.ToAxisAngle(axis, angle); DALI_TEST_EQUALS(converted, true, TEST_LOCATION); DALI_TEST_EQUALS(angle.radian, float(Radian(Degree(125))), 0.01f, TEST_LOCATION); - DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION); - DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION); - DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION); END_TEST; } - - int UtcDaliQuaternionSlerpNoInvertP01(void) { - Quaternion q1( Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q1(Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f)); Quaternion q2(-Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q = Quaternion::SlerpNoInvert( q1, q2, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + Quaternion q = Quaternion::SlerpNoInvert(q1, q2, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::SlerpNoInvert( q1, q2, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + q = Quaternion::SlerpNoInvert(q1, q2, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); // @ 25%, will be at M_PI/8 q = Quaternion::SlerpNoInvert(q1, q2, 0.25f); Vector3 axis; - Radian angle; - bool converted = q.ToAxisAngle(axis, angle); + Radian angle; + bool converted = q.ToAxisAngle(axis, angle); DALI_TEST_EQUALS(converted, true, TEST_LOCATION); - DALI_TEST_EQUALS(angle.radian, Math::PI/8.0f, 0.001, TEST_LOCATION); + DALI_TEST_EQUALS(angle.radian, Math::PI / 8.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(axis.x, 0.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(axis.y, 0.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(axis.z, 1.0f, 0.001, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionSlerpNoInvertP02(void) { - Quaternion q1( Radian( Degree( 120 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); - Quaternion q2( Radian( Degree( 130 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); + Quaternion q1(Radian(Degree(120)), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q2(Radian(Degree(130)), Vector3(0.0f, 0.0f, 1.0f)); - Quaternion q = Quaternion::SlerpNoInvert( q1, q2, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION ); + Quaternion q = Quaternion::SlerpNoInvert(q1, q2, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION); - q = Quaternion::SlerpNoInvert( q1, q2, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION ); + q = Quaternion::SlerpNoInvert(q1, q2, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION); q = Quaternion::SlerpNoInvert(q1, q2, 0.5f); Vector3 axis; - Radian angle; - bool converted = q.ToAxisAngle(axis, angle); + Radian angle; + bool converted = q.ToAxisAngle(axis, angle); DALI_TEST_EQUALS(converted, true, TEST_LOCATION); DALI_TEST_EQUALS(angle.radian, float(Radian(Degree(125))), 0.01f, TEST_LOCATION); - DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION); - DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION); - DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION); + DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION); END_TEST; } - int UtcDaliQuaternionSquadP(void) { - Quaternion q1( Radian( Degree( 45 ) ), Vector3( 0.0f, 0.0f, 1.0f ) ); - Quaternion q1out( Radian( Degree( 40 ) ), Vector3( 0.0f, 1.0f, 2.0f ) ); - Quaternion q2in( Radian( Degree( 35 ) ), Vector3( 0.0f, 2.0f, 3.0f ) ); - Quaternion q2( Radian( Degree( 30 ) ), Vector3( 0.0f, 1.0f, 3.0f ) ); + Quaternion q1(Radian(Degree(45)), Vector3(0.0f, 0.0f, 1.0f)); + Quaternion q1out(Radian(Degree(40)), Vector3(0.0f, 1.0f, 2.0f)); + Quaternion q2in(Radian(Degree(35)), Vector3(0.0f, 2.0f, 3.0f)); + Quaternion q2(Radian(Degree(30)), Vector3(0.0f, 1.0f, 3.0f)); - Quaternion q = Quaternion::Squad( q1, q2, q1out, q2in, 0.0f ); - DALI_TEST_EQUALS( q, q1, 0.001f, TEST_LOCATION ); + Quaternion q = Quaternion::Squad(q1, q2, q1out, q2in, 0.0f); + DALI_TEST_EQUALS(q, q1, 0.001f, TEST_LOCATION); - q = Quaternion::Squad( q1, q2, q1out, q2in, 1.0f ); - DALI_TEST_EQUALS( q, q2, 0.001f, TEST_LOCATION ); + q = Quaternion::Squad(q1, q2, q1out, q2in, 1.0f); + DALI_TEST_EQUALS(q, q2, 0.001f, TEST_LOCATION); // Don't know what actual value should be, but can make some informed guesses. q = Quaternion::Squad(q1, q2, q1out, q2in, 0.5f); - Radian angle; + Radian angle; Vector3 axis; q.Normalize(); - q.ToAxisAngle( axis, angle ); + q.ToAxisAngle(axis, angle); - if( angle < 0.0f ) + if(angle < 0.0f) { q = -q; // Might get negative quat - q.ToAxisAngle( axis, angle ); + q.ToAxisAngle(axis, angle); } float deg = Degree(angle).degree; DALI_TEST_CHECK(deg >= 0 && deg <= 90); @@ -1119,37 +1094,37 @@ int UtcDaliQuaternionSquadP(void) int UtcDaliAngleBetweenP(void) { - Quaternion q1( ANGLE_45, ANGLE_0, ANGLE_0 ); - Quaternion q2(Radian(Degree(47)), ANGLE_0, ANGLE_0 ); + Quaternion q1(ANGLE_45, ANGLE_0, ANGLE_0); + Quaternion q2(Radian(Degree(47)), ANGLE_0, ANGLE_0); DALI_TEST_EQUALS(Quaternion::AngleBetween(q1, q2), fabsf(Radian(Degree(45)) - Radian(Degree(47))), 0.001f, TEST_LOCATION); - Quaternion q3( Radian( Degree( 80 ) ), Vector3::YAXIS ); - Quaternion q4( Radian( Degree( 90 ) ), Vector3::YAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q3, q4 ), fabsf( Radian( Degree( 80 ) ) - Radian( Degree( 90 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q3(Radian(Degree(80)), Vector3::YAXIS); + Quaternion q4(Radian(Degree(90)), Vector3::YAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q3, q4), fabsf(Radian(Degree(80)) - Radian(Degree(90))), 0.001f, TEST_LOCATION); - Quaternion q5( Radian( Degree( 0 ) ), Vector3::YAXIS ); - Quaternion q6( Radian( Degree( 90 ) ), Vector3::XAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q5, q6 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 90 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q5(Radian(Degree(0)), Vector3::YAXIS); + Quaternion q6(Radian(Degree(90)), Vector3::XAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q5, q6), fabsf(Radian(Degree(0)) - Radian(Degree(90))), 0.001f, TEST_LOCATION); - Quaternion q7( Radian( Degree( 0 ) ), Vector3::YAXIS ); - Quaternion q8( Radian( Degree( 0 ) ), Vector3::XAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q7, q8 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 0 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q7(Radian(Degree(0)), Vector3::YAXIS); + Quaternion q8(Radian(Degree(0)), Vector3::XAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q7, q8), fabsf(Radian(Degree(0)) - Radian(Degree(0))), 0.001f, TEST_LOCATION); - Quaternion q9( Radian( Degree( 0 ) ), Vector3::XAXIS ); - Quaternion q10( Radian( Degree( 180 ) ), Vector3::XAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q9, q10 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 180 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q9(Radian(Degree(0)), Vector3::XAXIS); + Quaternion q10(Radian(Degree(180)), Vector3::XAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q9, q10), fabsf(Radian(Degree(0)) - Radian(Degree(180))), 0.001f, TEST_LOCATION); - Quaternion q11( Radian( Degree( 1 ) ), Vector3::YAXIS ); - Quaternion q12( Radian( Degree( 240 ) ), Vector3::YAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q11, q12 ), fabsf( Radian( Degree( 1 - 240 + 360 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q11(Radian(Degree(1)), Vector3::YAXIS); + Quaternion q12(Radian(Degree(240)), Vector3::YAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q11, q12), fabsf(Radian(Degree(1 - 240 + 360))), 0.001f, TEST_LOCATION); - Quaternion q13( Radian( Degree( 240 ) ), Vector3::YAXIS ); - Quaternion q14( Radian( Degree( 1 ) ), Vector3::YAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q13, q14 ), fabsf( Radian( Degree( 240 - 1 - 360 ) ) ), 0.001f, TEST_LOCATION ); + Quaternion q13(Radian(Degree(240)), Vector3::YAXIS); + Quaternion q14(Radian(Degree(1)), Vector3::YAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q13, q14), fabsf(Radian(Degree(240 - 1 - 360))), 0.001f, TEST_LOCATION); - Quaternion q15( Radian( Degree( 240 ) ), Vector3::YAXIS ); - Quaternion q16( Radian( Degree( 1 ) ), Vector3::ZAXIS ); - DALI_TEST_EQUALS( Quaternion::AngleBetween( q15, q16 ), Quaternion::AngleBetween( q16, q15 ), 0.001f, TEST_LOCATION ); + Quaternion q15(Radian(Degree(240)), Vector3::YAXIS); + Quaternion q16(Radian(Degree(1)), Vector3::ZAXIS); + DALI_TEST_EQUALS(Quaternion::AngleBetween(q15, q16), Quaternion::AngleBetween(q16, q15), 0.001f, TEST_LOCATION); END_TEST; } @@ -1157,12 +1132,12 @@ int UtcDaliQuaternionOStreamOperatorP(void) { std::ostringstream oss; - Quaternion quaternion( Dali::ANGLE_180, Vector3::YAXIS ); + Quaternion quaternion(Dali::ANGLE_180, Vector3::YAXIS); oss << quaternion; std::string expectedOutput = "[ Axis: [0, 1, 0], Angle: 180 degrees ]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION ); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Radian.cpp b/automated-tests/src/dali/utc-Dali-Radian.cpp index 5528b26..2efab55 100644 --- a/automated-tests/src/dali/utc-Dali-Radian.cpp +++ b/automated-tests/src/dali/utc-Dali-Radian.cpp @@ -15,14 +15,13 @@ * */ -#include - -#include -#include #include +#include +#include -using namespace Dali; +#include +using namespace Dali; void utc_dali_radian_startup(void) { @@ -34,66 +33,65 @@ void utc_dali_radian_cleanup(void) test_return_value = TET_PASS; } - // Positive test case for constructors int UtcDaliRadianConstructors01(void) { // Default constructor, does not initialise the value - Radian radian0( 0.0f ); + Radian radian0(0.0f); // Test float assignment operator radian0 = Math::PI; - DALI_TEST_EQUALS( float(radian0), Math::PI, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(float(radian0), Math::PI, 0.001f, TEST_LOCATION); // Constructor from float value - Radian radian1( Math::PI ); - DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION ); + Radian radian1(Math::PI); + DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION); // Constructor from a Degree - Radian radian2( Degree( 180.0f ) ); - DALI_TEST_EQUALS( float(radian2), Math::PI, 0.001f, TEST_LOCATION ); + Radian radian2(Degree(180.0f)); + DALI_TEST_EQUALS(float(radian2), Math::PI, 0.001f, TEST_LOCATION); // Assignment from Degree - Radian radian3( 0.0f ); - radian3 = Degree( 180.0f ); - DALI_TEST_EQUALS( float(radian3), Math::PI, 0.001f, TEST_LOCATION ); + Radian radian3(0.0f); + radian3 = Degree(180.0f); + DALI_TEST_EQUALS(float(radian3), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliRadianCopyConstructor(void) { - Radian radian0( Math::PI ); - Radian radian1( radian0 ); - DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION ); + Radian radian0(Math::PI); + Radian radian1(radian0); + DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliRadianMoveConstructor(void) { - Radian radian0( Math::PI ); - Radian radian1 = std::move( radian0 ); - DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION ); + Radian radian0(Math::PI); + Radian radian1 = std::move(radian0); + DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliRadianCopyAssignment(void) { - Radian radian0( Math::PI ); + Radian radian0(Math::PI); Radian radian1; radian1 = radian0; - DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } int UtcDaliRadianMoveAssignment(void) { - Radian radian0( Math::PI ); + Radian radian0(Math::PI); Radian radian1; - radian1 = std::move( radian0 ); - DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION ); + radian1 = std::move(radian0); + DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } @@ -102,61 +100,59 @@ int UtcDaliRadianMoveAssignment(void) int UtcDaliRadianComparison01(void) { // Comparison between radians - Radian radian0( Math::PI_2 ); - Radian radian1( Math::PI_2 ); - Radian radian2( Math::PI ); + Radian radian0(Math::PI_2); + Radian radian1(Math::PI_2); + Radian radian2(Math::PI); - DALI_TEST_CHECK( radian0 == radian1 ); - DALI_TEST_CHECK( radian0 != radian2 ); + DALI_TEST_CHECK(radian0 == radian1); + DALI_TEST_CHECK(radian0 != radian2); // Comparison between radian to degree - Radian radian3( Math::PI ); - Radian radian4( Math::PI_2 ); - Degree degree0( 180.0f ); + Radian radian3(Math::PI); + Radian radian4(Math::PI_2); + Degree degree0(180.0f); - DALI_TEST_CHECK( radian3 == Radian(degree0) ); - DALI_TEST_CHECK( radian4 != Radian(degree0) ); + DALI_TEST_CHECK(radian3 == Radian(degree0)); + DALI_TEST_CHECK(radian4 != Radian(degree0)); // Comparison with float - Radian radian5( Math::PI_2 ); + Radian radian5(Math::PI_2); - DALI_TEST_CHECK( radian5 == Math::PI_2 ); - DALI_TEST_CHECK( radian5 != Math::PI ); + DALI_TEST_CHECK(radian5 == Math::PI_2); + DALI_TEST_CHECK(radian5 != Math::PI); END_TEST; } - // test case for cast operators int UtcDaliRadianCastOperators01(void) { - Radian radian0( Math::PI ); + Radian radian0(Math::PI); - const float& value0( radian0.radian ); - DALI_TEST_EQUALS( value0, Math::PI, 0.001f, TEST_LOCATION ); + const float& value0(radian0.radian); + DALI_TEST_EQUALS(value0, Math::PI, 0.001f, TEST_LOCATION); radian0 = Math::PI_2; - DALI_TEST_EQUALS( value0, Math::PI_2, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(value0, Math::PI_2, 0.001f, TEST_LOCATION); - float value1( radian0 ); - DALI_TEST_EQUALS( value1, Math::PI_2, 0.001f, TEST_LOCATION ); + float value1(radian0); + DALI_TEST_EQUALS(value1, Math::PI_2, 0.001f, TEST_LOCATION); radian0 = Math::PI; - DALI_TEST_EQUALS( float(radian0), Math::PI, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(float(radian0), Math::PI, 0.001f, TEST_LOCATION); END_TEST; } - int UtcDaliRadianCastOperatorEquals(void) { Radian a(Math::PI_2); Radian b(Math::PI_2); Radian c(Math::PI); - DALI_TEST_EQUALS( a == a, true, TEST_LOCATION ); - DALI_TEST_EQUALS( a == b, true, TEST_LOCATION ); - DALI_TEST_EQUALS( a == c, false, TEST_LOCATION ); - DALI_TEST_EQUALS( Degree(c) == c, true, TEST_LOCATION ); + DALI_TEST_EQUALS(a == a, true, TEST_LOCATION); + DALI_TEST_EQUALS(a == b, true, TEST_LOCATION); + DALI_TEST_EQUALS(a == c, false, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(c) == c, true, TEST_LOCATION); END_TEST; } @@ -166,10 +162,10 @@ int UtcDaliRadianCastOperatorNotEquals(void) Radian b(Math::PI_2); Radian c(Math::PI); - DALI_TEST_EQUALS( a != a, false, TEST_LOCATION ); - DALI_TEST_EQUALS( a != b, false, TEST_LOCATION ); - DALI_TEST_EQUALS( a != c, true, TEST_LOCATION ); - DALI_TEST_EQUALS( Degree(a) != c, true, TEST_LOCATION ); + DALI_TEST_EQUALS(a != a, false, TEST_LOCATION); + DALI_TEST_EQUALS(a != b, false, TEST_LOCATION); + DALI_TEST_EQUALS(a != c, true, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(a) != c, true, TEST_LOCATION); END_TEST; } @@ -178,7 +174,7 @@ int UtcDaliRadianCastOperatorLessThan(void) Radian a(Math::PI_4); Radian b(Math::PI_2); Radian c(Math::PI); - Radian d(2.0f*Math::PI); + Radian d(2.0f * Math::PI); Radian e(-Math::PI); DALI_TEST_EQUALS(a < a, false, TEST_LOCATION); @@ -193,13 +189,13 @@ int UtcDaliRadianCastOperatorLessThan(void) DALI_TEST_EQUALS(d < b, false, TEST_LOCATION); DALI_TEST_EQUALS(e < b, true, TEST_LOCATION); - DALI_TEST_EQUALS( Radian(Math::PI_2) < Degree(180.0f), true, TEST_LOCATION); - DALI_TEST_EQUALS( Radian(Math::PI_2) < Degree(90.0f), false, TEST_LOCATION); - DALI_TEST_EQUALS( Radian(Math::PI_2) > Degree(45.0f), true, TEST_LOCATION); + DALI_TEST_EQUALS(Radian(Math::PI_2) < Degree(180.0f), true, TEST_LOCATION); + DALI_TEST_EQUALS(Radian(Math::PI_2) < Degree(90.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(Radian(Math::PI_2) > Degree(45.0f), true, TEST_LOCATION); - DALI_TEST_EQUALS( Degree(180.0f) > Radian(Math::PI_2), true, TEST_LOCATION); - DALI_TEST_EQUALS( Degree(90.0f) > Radian(Math::PI_2), false, TEST_LOCATION); - DALI_TEST_EQUALS( Degree(45.0f) < Radian(Math::PI_2), true, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(180.0f) > Radian(Math::PI_2), true, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(90.0f) > Radian(Math::PI_2), false, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(45.0f) < Radian(Math::PI_2), true, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Random.cpp b/automated-tests/src/dali/utc-Dali-Random.cpp index a3c8670..fdfb5c0 100644 --- a/automated-tests/src/dali/utc-Dali-Random.cpp +++ b/automated-tests/src/dali/utc-Dali-Random.cpp @@ -15,28 +15,28 @@ * */ -#include - -#include -#include #include +#include +#include -using namespace Dali; +#include +using namespace Dali; int UtcDaliRandomRangeMethod(void) { TestApplication application; // Reset all test adapter return codes - float a=0, b=1; - for(size_t i=0; i<100; i++) + float a = 0, b = 1; + for(size_t i = 0; i < 100; i++) { float r = Dali::Random::Range(a, b); DALI_TEST_CHECK(r >= a && r <= b); } - a=100; b=-100; - for(size_t i=0; i<100; i++) + a = 100; + b = -100; + for(size_t i = 0; i < 100; i++) { float r = Dali::Random::Range(a, b); DALI_TEST_CHECK(r >= b && r <= a); @@ -44,12 +44,11 @@ int UtcDaliRandomRangeMethod(void) END_TEST; } - int UtcDaliRandomAxisMethod(void) { TestApplication application; // Reset all test adapter return codes - for(size_t i=0; i<100; i++) + for(size_t i = 0; i < 100; i++) { Vector4 axis = Dali::Random::Axis(); DALI_TEST_EQUALS(axis.Length(), 1.0f, 0.0001f, TEST_LOCATION); diff --git a/automated-tests/src/dali/utc-Dali-Rect.cpp b/automated-tests/src/dali/utc-Dali-Rect.cpp index 6675e9d..349989c 100644 --- a/automated-tests/src/dali/utc-Dali-Rect.cpp +++ b/automated-tests/src/dali/utc-Dali-Rect.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -33,7 +33,6 @@ void utc_dali_rect_cleanup(void) test_return_value = TET_PASS; } - // Positive test case for a method int UtcDaliRectCons01(void) { @@ -95,7 +94,7 @@ int UtcDaliRectMoveConstructor(void) Rect rect(10.0f, 20.0f, 400.0f, 200.0f); - Rect r2 = std::move( rect ); + Rect r2 = std::move(rect); DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION); @@ -111,7 +110,7 @@ int UtcDaliRectMoveAssignmentOperator(void) Rect rect(10.0f, 20.0f, 400.0f, 200.0f); Rect r2; - r2 = std::move( rect ); + r2 = std::move(rect); DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION); @@ -171,12 +170,12 @@ int UtcDaliRectIsEmpty(void) { TestApplication application; - Rect ri; - Rect rf(10.0f, 20.0f, 400.0f, 200.0f); - Rect rf2; - Rect rf3(10.0f, 20.0f, 0.0f, 200.0f); - Rect rf4(10.0f, 20.0f, 400.0f, 0.0f); - Rect rd(10.0, 20.0, 0.0, 200.0); + Rect ri; + Rect rf(10.0f, 20.0f, 400.0f, 200.0f); + Rect rf2; + Rect rf3(10.0f, 20.0f, 0.0f, 200.0f); + Rect rf4(10.0f, 20.0f, 400.0f, 0.0f); + Rect rd(10.0, 20.0, 0.0, 200.0); Rect ru(0u, 0u, 4u, 0u); DALI_TEST_CHECK(!rf.IsEmpty()); @@ -229,7 +228,6 @@ int UtcDaliRectBottom(void) END_TEST; } - int UtcDaliRectArea(void) { TestApplication application; @@ -240,16 +238,15 @@ int UtcDaliRectArea(void) END_TEST; } - int UtcDaliRectIntersects(void) { TestApplication application; - Rect rf1( 10.0f, 20.0f, 200.0f, 200.0f); - Rect rf2( 10.0f, 120.0f, 200.0f, 200.0f); - Rect rf3( 10.0f, -80.0f, 200.0f, 200.0f); - Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); - Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); + Rect rf1(10.0f, 20.0f, 200.0f, 200.0f); + Rect rf2(10.0f, 120.0f, 200.0f, 200.0f); + Rect rf3(10.0f, -80.0f, 200.0f, 200.0f); + Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); + Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); Rect rf6(1000.0f, 1200.0f, 10.0f, 10.0f); DALI_TEST_CHECK(rf1.Intersects(rf2)); @@ -260,26 +257,24 @@ int UtcDaliRectIntersects(void) END_TEST; } - - int UtcDaliRectContains(void) { TestApplication application; - Rect rf1( 10.0f, 20.0f, 200.0f, 200.0f); + Rect rf1(10.0f, 20.0f, 200.0f, 200.0f); - Rect rf2( 10.0f, 120.0f, 200.0f, 200.0f); - Rect rf3( 10.0f, -80.0f, 200.0f, 200.0f); - Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); - Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); + Rect rf2(10.0f, 120.0f, 200.0f, 200.0f); + Rect rf3(10.0f, -80.0f, 200.0f, 200.0f); + Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); + Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); Rect rf6(1000.0f, 1200.0f, 10.0f, 10.0f); - Rect rf7( 50.0f, 70.0f, 50.0f, 50.0f); + Rect rf7(50.0f, 70.0f, 50.0f, 50.0f); - Rect rf8( 10.0f, 20.0f, 100.0f, 100.0f); - Rect rf9( 110.0f, 20.0f, 100.0f, 100.0f); - Rect rf10( 110.0f, 120.0f, 100.0f, 100.0f); - Rect rf11( 10.0f, 120.0f, 100.0f, 100.0f); + Rect rf8(10.0f, 20.0f, 100.0f, 100.0f); + Rect rf9(110.0f, 20.0f, 100.0f, 100.0f); + Rect rf10(110.0f, 120.0f, 100.0f, 100.0f); + Rect rf11(10.0f, 120.0f, 100.0f, 100.0f); DALI_TEST_CHECK(rf1.Contains(rf1)); DALI_TEST_CHECK(!rf1.Contains(rf2)); @@ -297,22 +292,21 @@ int UtcDaliRectContains(void) END_TEST; } - int UtcDaliRectOperatorNotEquals(void) { TestApplication application; - Rect rf1( 10.0f, 20.0f, 200.0f, 200.0f); - Rect rf2( 10.0f, 120.0f, 200.0f, 200.0f); - Rect rf3( 10.0f, -80.0f, 200.0f, 200.0f); - Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); - Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); + Rect rf1(10.0f, 20.0f, 200.0f, 200.0f); + Rect rf2(10.0f, 120.0f, 200.0f, 200.0f); + Rect rf3(10.0f, -80.0f, 200.0f, 200.0f); + Rect rf4(110.0f, 20.0f, 200.0f, 200.0f); + Rect rf5(-90.0f, 20.0f, 200.0f, 200.0f); Rect rf6(1000.0f, 1200.0f, 10.0f, 10.0f); - Rect rf7( 50.0f, 70.0f, 50.0f, 50.0f); - Rect rf8( 10.0f, 20.0f, 100.0f, 100.0f); - Rect rf9( 110.0f, 20.0f, 100.0f, 100.0f); - Rect rf10( 110.0f, 120.0f, 100.0f, 100.0f); - Rect rf11( 10.0f, 120.0f, 100.0f, 100.0f); + Rect rf7(50.0f, 70.0f, 50.0f, 50.0f); + Rect rf8(10.0f, 20.0f, 100.0f, 100.0f); + Rect rf9(110.0f, 20.0f, 100.0f, 100.0f); + Rect rf10(110.0f, 120.0f, 100.0f, 100.0f); + Rect rf11(10.0f, 120.0f, 100.0f, 100.0f); DALI_TEST_CHECK(rf1 != rf2); DALI_TEST_CHECK(rf1 != rf3); @@ -327,20 +321,19 @@ int UtcDaliRectOperatorNotEquals(void) END_TEST; } - int UtcDaliRectOperatorEquals(void) { TestApplication application; - Rect rf1( 10.0f, 20.0f, 200.0f, 200.0f); - Rect rf1p( 10.0f, 20.0f, 200.0f, 200.0f); + Rect rf1(10.0f, 20.0f, 200.0f, 200.0f); + Rect rf1p(10.0f, 20.0f, 200.0f, 200.0f); - Rect rf2(110.0f, 20.0f, 200.0f, 200.0f); - Rect rf3( 10.0f, 120.0f, 200.0f, 200.0f); - Rect rf4( 10.0f, 20.0f, 300.0f, 200.0f); - Rect rf5( 10.0f, 20.0f, 200.0f, 500.0f); + Rect rf2(110.0f, 20.0f, 200.0f, 200.0f); + Rect rf3(10.0f, 120.0f, 200.0f, 200.0f); + Rect rf4(10.0f, 20.0f, 300.0f, 200.0f); + Rect rf5(10.0f, 20.0f, 200.0f, 500.0f); - Rect rf6( 0.0f, 0.0f, 9.0f, 10.0f); + Rect rf6(0.0f, 0.0f, 9.0f, 10.0f); DALI_TEST_CHECK(rf1 == rf1p); DALI_TEST_CHECK(rf1 == rf1); @@ -350,10 +343,9 @@ int UtcDaliRectOperatorEquals(void) DALI_TEST_CHECK(!(rf1 == rf5)); DALI_TEST_CHECK(!(rf1 == rf6)); - // integers - Rect ri1( 10, 20, 200, 200 ); - Rect ri1p( 10, 20, 200, 200 ); + Rect ri1(10, 20, 200, 200); + Rect ri1p(10, 20, 200, 200); DALI_TEST_CHECK(ri1 == ri1p); END_TEST; @@ -361,15 +353,15 @@ int UtcDaliRectOperatorEquals(void) int UtcDaliRectOStreamOperatorP(void) { - TestApplication application; + TestApplication application; std::ostringstream oss; - Rect rect( 1, 2, 10, 10 ); + Rect rect(1, 2, 10, 10); oss << rect; std::string expectedOutput = "[1, 2, 10, 10]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index d879ddc..d60bc54 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -15,17 +15,17 @@ * */ -#include -#include -#include -#include #include +#include #include +#include +#include +#include #include -#include +#include -#define BOOLSTR(x) ((x)?"T":"F") +#define BOOLSTR(x) ((x) ? "T" : "F") //& set: DaliRenderTask @@ -79,8 +79,7 @@ void utc_dali_render_task_cleanup(void) namespace // unnamed namespace { - -const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) /* * Simulate time passed by. @@ -95,7 +94,7 @@ int Wait(TestApplication& application, int duration = 0) { int time = 0; - for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + for(int i = 0; i <= (duration / RENDER_FRAME_INTERVAL); i++) { application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); @@ -107,12 +106,12 @@ int Wait(TestApplication& application, int duration = 0) struct RenderTaskFinished { - RenderTaskFinished( bool& finished ) - : finished( finished ) + RenderTaskFinished(bool& finished) + : finished(finished) { } - void operator()( RenderTask& renderTask ) + void operator()(RenderTask& renderTask) { finished = true; } @@ -122,49 +121,48 @@ struct RenderTaskFinished struct RenderTaskFinishedRemoveSource { - RenderTaskFinishedRemoveSource( bool& finished ) - : finished( finished ), + RenderTaskFinishedRemoveSource(bool& finished) + : finished(finished), finishedOnce(false) { } - void operator()( RenderTask& renderTask ) + void operator()(RenderTask& renderTask) { DALI_TEST_CHECK(finishedOnce == false); - finished = true; - finishedOnce = true; + finished = true; + finishedOnce = true; Actor srcActor = renderTask.GetSourceActor(); UnparentAndReset(srcActor); } bool& finished; - bool finishedOnce; + bool finishedOnce; }; struct RenderTaskFinishedRenderAgain { - RenderTaskFinishedRenderAgain( bool& finished ) - : finished( finished ), + RenderTaskFinishedRenderAgain(bool& finished) + : finished(finished), finishedOnce(false) { } - void operator()( RenderTask& renderTask ) + void operator()(RenderTask& renderTask) { DALI_TEST_CHECK(finishedOnce == false); - finished = true; + finished = true; finishedOnce = true; renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE); } bool& finished; - bool finishedOnce; + bool finishedOnce; }; - -bool TestScreenToFrameBufferFunction( Vector2& coordinates ) +bool TestScreenToFrameBufferFunction(Vector2& coordinates) { - coordinates = coordinates + Vector2( 1, 2 ); + coordinates = coordinates + Vector2(1, 2); return true; } @@ -172,7 +170,7 @@ bool TestScreenToFrameBufferFunction( Vector2& coordinates ) Actor CreateRenderableActorSuccess(TestApplication& application, std::string filename) { Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 80.0f, 80.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(80.0f, 80.0f)); return actor; } @@ -182,40 +180,40 @@ Texture CreateTexture() } RenderTask CreateRenderTask(TestApplication& application, - CameraActor offscreenCamera, - Actor rootActor, // Reset default render task to point at this actor - Actor secondRootActor, // Source actor - unsigned int refreshRate, - bool glSync) + CameraActor offscreenCamera, + Actor rootActor, // Reset default render task to point at this actor + Actor secondRootActor, // Source actor + unsigned int refreshRate, + bool glSync) { // Change main render task to use a different root RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - taskList.GetTask(0u).SetSourceActor( rootActor ); + taskList.GetTask(0u).SetSourceActor(rootActor); - FrameBuffer frameBuffer = FrameBuffer::New(10,10); - if( glSync ) + FrameBuffer frameBuffer = FrameBuffer::New(10, 10); + if(glSync) { NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); - Texture texture = Texture::New(*testNativeImagePtr); + Texture texture = Texture::New(*testNativeImagePtr); frameBuffer.AttachColorTexture(texture); } // Don't draw output framebuffer // ' RenderTask newTask = taskList.CreateTask(); - newTask.SetCameraActor( offscreenCamera ); - newTask.SetSourceActor( secondRootActor ); - newTask.SetInputEnabled( false ); - newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) ); - newTask.SetClearEnabled( true ); - newTask.SetExclusive( true ); - newTask.SetRefreshRate( refreshRate ); - newTask.SetFrameBuffer( frameBuffer ); - newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, glSync ); + newTask.SetCameraActor(offscreenCamera); + newTask.SetSourceActor(secondRootActor); + newTask.SetInputEnabled(false); + newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f)); + newTask.SetClearEnabled(true); + newTask.SetExclusive(true); + newTask.SetRefreshRate(refreshRate); + newTask.SetFrameBuffer(frameBuffer); + newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, glSync); return newTask; } -bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating, int lineNumber ) +bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating, int lineNumber) { finishedSig = false; callStack.Reset(); @@ -226,19 +224,19 @@ bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool application.SendNotification(); bool sigPassed = false; - if( testFinished ) + if(testFinished) { sigPassed = finishedSig; } else { - sigPassed = ! finishedSig; + sigPassed = !finishedSig; } bool drawResult = callStack.FindMethod("DrawElements") || callStack.FindMethod("DrawArrays"); bool drawPassed = false; - if( testDrawn ) + if(testDrawn) { drawPassed = drawResult; } @@ -247,9 +245,9 @@ bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool drawPassed = !drawResult; } - bool keepUpdating = (application.GetUpdateStatus() != 0); + bool keepUpdating = (application.GetUpdateStatus() != 0); bool keepUpdatingPassed = false; - if( testKeepUpdating ) + if(testKeepUpdating) { keepUpdatingPassed = keepUpdating; } @@ -261,17 +259,20 @@ bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool bool result = (sigPassed && drawPassed && keepUpdatingPassed); tet_printf("UpdateRender: Expected: Draw:%s Signal:%s KeepUpdating: %s Actual: Draw:%s Signal:%s KeepUpdating: %s %s, line %d\n", - BOOLSTR(testDrawn), BOOLSTR(testFinished), BOOLSTR(testKeepUpdating), - BOOLSTR(drawResult), BOOLSTR(finishedSig), BOOLSTR(keepUpdating), - result ? "Passed":"Failed", - lineNumber ); + BOOLSTR(testDrawn), + BOOLSTR(testFinished), + BOOLSTR(testKeepUpdating), + BOOLSTR(drawResult), + BOOLSTR(finishedSig), + BOOLSTR(keepUpdating), + result ? "Passed" : "Failed", + lineNumber); return result; } } // unnamed namespace - /****************************************************************************************************/ /****************************************************************************************************/ /******************************** TEST CASES BELOW **********************************************/ @@ -286,14 +287,14 @@ int UtcDaliRenderTaskDownCast01(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - BaseHandle base = taskList.GetTask( 0u ); - DALI_TEST_CHECK( base ); + BaseHandle base = taskList.GetTask(0u); + DALI_TEST_CHECK(base); - RenderTask task = RenderTask::DownCast( base ); - DALI_TEST_CHECK( task ); + RenderTask task = RenderTask::DownCast(base); + DALI_TEST_CHECK(task); // Try calling a method - DALI_TEST_CHECK( task.GetSourceActor() ); + DALI_TEST_CHECK(task.GetSourceActor()); END_TEST; } @@ -305,8 +306,8 @@ int UtcDaliRenderTaskDownCast02(void) Actor actor = Actor::New(); - RenderTask task = RenderTask::DownCast( actor ); - DALI_TEST_CHECK( ! task ); + RenderTask task = RenderTask::DownCast(actor); + DALI_TEST_CHECK(!task); END_TEST; } @@ -319,47 +320,46 @@ int UtcDaliRenderTaskSetSourceActorN(void) Actor srcActor; - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask renderTask = taskList.CreateTask(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); renderTask.SetSourceActor(srcActor); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( ! renderTask.GetSourceActor() ); + DALI_TEST_CHECK(!renderTask.GetSourceActor()); END_TEST; } - int UtcDaliRenderTaskSetSourceActorP01(void) { TestApplication application; tet_infoline("Testing RenderTask::SetSourceActor() Positive - check that setting a non-renderable actor stops existing source actor being rendered "); - Integration::Scene stage = application.GetScene(); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + Integration::Scene stage = application.GetScene(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor newActor = CreateRenderableActor( img ); - newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - stage.Add( newActor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor newActor = CreateRenderableActor(img); + newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + stage.Add(newActor); Actor nonRenderableActor = Actor::New(); - stage.Add( nonRenderableActor ); + stage.Add(nonRenderableActor); // Stop the newActor from being rendered by changing the source actor - DALI_TEST_CHECK( nonRenderableActor ); - task.SetSourceActor( nonRenderableActor ); - DALI_TEST_CHECK( task.GetSourceActor() != actor ); - DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor ); + DALI_TEST_CHECK(nonRenderableActor); + task.SetSourceActor(nonRenderableActor); + DALI_TEST_CHECK(task.GetSourceActor() != actor); + DALI_TEST_CHECK(task.GetSourceActor() == nonRenderableActor); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); // Update & Render nothing! @@ -368,12 +368,11 @@ int UtcDaliRenderTaskSetSourceActorP01(void) application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION); END_TEST; } - int UtcDaliRenderTaskSetSourceActorP02(void) { TestApplication application; @@ -384,29 +383,28 @@ int UtcDaliRenderTaskSetSourceActorP02(void) RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); - + DALI_TEST_CHECK(actor); - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor newActor = CreateRenderableActor( img ); - newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - stage.Add( newActor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor newActor = CreateRenderableActor(img); + newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + stage.Add(newActor); Actor nonRenderableActor = Actor::New(); - stage.Add( nonRenderableActor ); + stage.Add(nonRenderableActor); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); // Stop the newActor from being rendered by changing the source actor - DALI_TEST_CHECK( nonRenderableActor ); - task.SetSourceActor( nonRenderableActor ); - DALI_TEST_CHECK( task.GetSourceActor() != actor ); - DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor ); + DALI_TEST_CHECK(nonRenderableActor); + task.SetSourceActor(nonRenderableActor); + DALI_TEST_CHECK(task.GetSourceActor() != actor); + DALI_TEST_CHECK(task.GetSourceActor() == nonRenderableActor); // Update & Render nothing! application.GetGlAbstraction().ClearBoundTextures(); @@ -414,13 +412,13 @@ int UtcDaliRenderTaskSetSourceActorP02(void) application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION); drawTrace.Reset(); // Set newActor as the new source Actor - task.SetSourceActor( newActor ); - DALI_TEST_CHECK( task.GetSourceActor() != actor ); - DALI_TEST_CHECK( task.GetSourceActor() == newActor ); + task.SetSourceActor(newActor); + DALI_TEST_CHECK(task.GetSourceActor() != actor); + DALI_TEST_CHECK(task.GetSourceActor() == newActor); // Update & Render the newActor application.GetGlAbstraction().ClearBoundTextures(); @@ -428,7 +426,7 @@ int UtcDaliRenderTaskSetSourceActorP02(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); END_TEST; } @@ -438,21 +436,21 @@ int UtcDaliRenderTaskSetSourceActorOffScene(void) tet_infoline("Testing RenderTask::SetSourceActor (on/off stage testing)"); - Integration::Scene stage = application.GetScene(); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + Integration::Scene stage = application.GetScene(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor newActor = CreateRenderableActor( img ); - newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - task.SetSourceActor( newActor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor newActor = CreateRenderableActor(img); + newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + task.SetSourceActor(newActor); // Don't add newActor to stage yet //' // Update & Render with the actor initially off-stage @@ -460,10 +458,10 @@ int UtcDaliRenderTaskSetSourceActorOffScene(void) application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION); // Now add to stage - stage.Add( newActor ); + stage.Add(newActor); // Update & Render with the actor on-stage application.GetGlAbstraction().ClearBoundTextures(); @@ -471,16 +469,16 @@ int UtcDaliRenderTaskSetSourceActorOffScene(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); drawTrace.Reset(); // Now remove from stage - stage.Remove( newActor ); + stage.Remove(newActor); // Update & Render with the actor off-stage application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION); END_TEST; } @@ -491,27 +489,27 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) tet_infoline("Testing RenderTask::SetSourceActor (empty handle case)"); - Integration::Scene stage = application.GetScene(); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + Integration::Scene stage = application.GetScene(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor newActor = CreateRenderableActor( img ); - newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - stage.Add( newActor ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor newActor = CreateRenderableActor(img); + newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + stage.Add(newActor); Actor nonRenderableActor = Actor::New(); - stage.Add( nonRenderableActor ); + stage.Add(nonRenderableActor); // Set with empty handle - task.SetSourceActor( Actor() ); - DALI_TEST_CHECK( ! task.GetSourceActor() ); + task.SetSourceActor(Actor()); + DALI_TEST_CHECK(!task.GetSourceActor()); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); // Update & Render nothing! @@ -519,11 +517,11 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) application.Render(); // Check that nothing was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION); // Set with non-empty handle - task.SetSourceActor( newActor ); - DALI_TEST_CHECK( task.GetSourceActor() == newActor ); + task.SetSourceActor(newActor); + DALI_TEST_CHECK(task.GetSourceActor() == newActor); // Update & Render the newActor application.GetGlAbstraction().ClearBoundTextures(); @@ -531,7 +529,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) application.Render(); // Check that the newActor was rendered - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); END_TEST; } @@ -539,34 +537,34 @@ int UtcDaliRenderTaskSetSourceActorDestroyed(void) { TestApplication application; - tet_infoline( "Testing RenderTask::SetSourceActor - Set a source actor and destroy the source actor" ); + tet_infoline("Testing RenderTask::SetSourceActor - Set a source actor and destroy the source actor"); - Integration::Scene stage = application.GetScene(); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + Integration::Scene stage = application.GetScene(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); - Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); + Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); - Actor newActor = CreateRenderableActor( img ); - newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - stage.Add( newActor ); + Actor newActor = CreateRenderableActor(img); + newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + stage.Add(newActor); - task.SetSourceActor( newActor ); + task.SetSourceActor(newActor); - DALI_TEST_CHECK( task.GetSourceActor() != actor ); - DALI_TEST_CHECK( task.GetSourceActor() == newActor ); + DALI_TEST_CHECK(task.GetSourceActor() != actor); + DALI_TEST_CHECK(task.GetSourceActor() == newActor); application.SendNotification(); application.Render(); // Destroy the source actor - stage.Remove( newActor ); + stage.Remove(newActor); newActor.Reset(); - DALI_TEST_CHECK( !task.GetSourceActor() ); // The source actor should be an empty handle. + DALI_TEST_CHECK(!task.GetSourceActor()); // The source actor should be an empty handle. END_TEST; } @@ -579,14 +577,14 @@ int UtcDaliRenderTaskGetSourceActorP01(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetSourceActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); // By default the entire scene should be rendered - Actor root = application.GetScene().GetLayer( 0 ); - DALI_TEST_CHECK( root == actor ); + Actor root = application.GetScene().GetLayer(0); + DALI_TEST_CHECK(root == actor); END_TEST; } @@ -597,12 +595,12 @@ int UtcDaliRenderTaskGetSourceActorP02(void) tet_infoline("Testing RenderTask::GetSourceActor() Create a new render task, Add a new actor to the stage and set it as the source of the new render task. Get its source actor and check that it is equivalent to what was set."); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); - Actor actor = Actor::New(); + RenderTask task = taskList.CreateTask(); + Actor actor = Actor::New(); application.GetScene().Add(actor); - task.SetSourceActor( actor ); + task.SetSourceActor(actor); - DALI_TEST_EQUALS( actor, task.GetSourceActor(), TEST_LOCATION ); + DALI_TEST_EQUALS(actor, task.GetSourceActor(), TEST_LOCATION); END_TEST; } @@ -618,9 +616,9 @@ int UtcDaliRenderTaskGetSourceActorN(void) { Actor actor = task.GetSourceActor(); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } @@ -638,43 +636,43 @@ int UtcDaliRenderTaskSetExclusive(void) // Manipulate the GenTextures behaviour, to identify different actors std::vector ids; - ids.push_back( 8 ); // 8 = actor1 - ids.push_back( 9 ); // 9 = actor2 - ids.push_back( 10 ); // 10 = actor3 - application.GetGlAbstraction().SetNextTextureIds( ids ); + ids.push_back(8); // 8 = actor1 + ids.push_back(9); // 9 = actor2 + ids.push_back(10); // 10 = actor3 + application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor actor1 = CreateRenderableActor( img1 ); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - application.GetScene().Add( actor1 ); + Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor actor1 = CreateRenderableActor(img1); + actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + application.GetScene().Add(actor1); // Update & Render actor1 application.SendNotification(); application.Render(); // Check that the actor1 was rendered - const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 ); - DALI_TEST_GREATER( boundTextures.size(), static_cast::size_type>( 0 ), TEST_LOCATION ); + const std::vector& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0); + DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(0), TEST_LOCATION); - if ( boundTextures.size() ) + if(boundTextures.size()) { int c = 0; - DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION ); - if( boundTextures.size() > 1 ) + DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); + if(boundTextures.size() > 1) { - DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); } } - Texture img2 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); + Texture img2 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); - Actor actor2 = CreateRenderableActor( img2 ); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); + Actor actor2 = CreateRenderableActor(img2); + actor2.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); // Force actor2 to be rendered before actor1 Layer layer = Layer::New(); - application.GetScene().Add( layer ); - layer.Add( actor2 ); + application.GetScene().Add(layer); + layer.Add(actor2); layer.LowerToBottom(); // Update & Render @@ -683,27 +681,27 @@ int UtcDaliRenderTaskSetExclusive(void) application.Render(); // Check that the actors were rendered - DALI_TEST_GREATER( boundTextures.size(), static_cast::size_type>( 1 ), TEST_LOCATION ); + DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(1), TEST_LOCATION); - if ( boundTextures.size() ) + if(boundTextures.size()) { int c = 0; - DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION ); - if( boundTextures.size() > 2 ) + DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); + if(boundTextures.size() > 2) { - DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor1*/, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor1*/, TEST_LOCATION); } - DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); } - Texture img3 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor actor3 = CreateRenderableActor( img3 ); - actor3.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); + Texture img3 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor actor3 = CreateRenderableActor(img3); + actor3.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); // Force actor3 to be rendered before actor2 layer = Layer::New(); - application.GetScene().Add( layer ); - layer.Add( actor3 ); + application.GetScene().Add(layer); + layer.Add(actor3); layer.LowerToBottom(); // Update & Render all actors @@ -712,30 +710,30 @@ int UtcDaliRenderTaskSetExclusive(void) application.Render(); // Check that the actors were rendered - DALI_TEST_GREATER( boundTextures.size(), static_cast::size_type>( 2 ), TEST_LOCATION ); + DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(2), TEST_LOCATION); - if ( boundTextures.size() ) + if(boundTextures.size()) { int c = 0; - DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor3*/, TEST_LOCATION ); - if( boundTextures.size() > 3 ) + DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor3*/, TEST_LOCATION); + if(boundTextures.size() > 3) { - DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor2*/, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor2*/, TEST_LOCATION); } - DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION ); - DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); } // Both actors are now connected to the root node // Setup 2 render-tasks - the first will render from the root-node, and the second from actor2 // Not exclusive is the default - RenderTask task1 = taskList.GetTask( 0u ); - DALI_TEST_CHECK( false == task1.IsExclusive() ); + RenderTask task1 = taskList.GetTask(0u); + DALI_TEST_CHECK(false == task1.IsExclusive()); RenderTask task2 = taskList.CreateTask(); - DALI_TEST_CHECK( false == task2.IsExclusive() ); - task2.SetSourceActor( actor2 ); + DALI_TEST_CHECK(false == task2.IsExclusive()); + task2.SetSourceActor(actor2); // Task1 should render all actors, and task 2 should render only actor2 @@ -743,23 +741,23 @@ int UtcDaliRenderTaskSetExclusive(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( boundTextures.size(), 4u, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures.size(), 4u, TEST_LOCATION); - if ( boundTextures.size() == 4 ) + if(boundTextures.size() == 4) { // Test that task 1 renders actor3, then actor2 & then actor1 - DALI_TEST_CHECK( boundTextures[0] == 10u ); - DALI_TEST_CHECK( boundTextures[1] == 9u ); - DALI_TEST_CHECK( boundTextures[2] == 8u ); + DALI_TEST_CHECK(boundTextures[0] == 10u); + DALI_TEST_CHECK(boundTextures[1] == 9u); + DALI_TEST_CHECK(boundTextures[2] == 8u); // Test that task 2 renders actor2 - DALI_TEST_EQUALS( boundTextures[3], 9u, TEST_LOCATION ); + DALI_TEST_EQUALS(boundTextures[3], 9u, TEST_LOCATION); } // Make actor2 exclusive to task2 - task2.SetExclusive( true ); - DALI_TEST_CHECK( true == task2.IsExclusive() ); + task2.SetExclusive(true); + DALI_TEST_CHECK(true == task2.IsExclusive()); // Task1 should render only actor1, and task 2 should render only actor2 @@ -767,21 +765,21 @@ int UtcDaliRenderTaskSetExclusive(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( boundTextures.size(), 3u, TEST_LOCATION ); - if ( boundTextures.size() == 3 ) + DALI_TEST_EQUALS(boundTextures.size(), 3u, TEST_LOCATION); + if(boundTextures.size() == 3) { // Test that task 1 renders actor3 & actor1 - DALI_TEST_CHECK( boundTextures[0] == 10u ); - DALI_TEST_CHECK( boundTextures[1] == 8u ); + DALI_TEST_CHECK(boundTextures[0] == 10u); + DALI_TEST_CHECK(boundTextures[1] == 8u); // Test that task 2 renders actor2 - DALI_TEST_CHECK( boundTextures[2] == 9u ); + DALI_TEST_CHECK(boundTextures[2] == 9u); } // Create a renderable actor and replace the source actor in task2 auto actor4 = CreateRenderableActor(); - task2.SetSourceActor( actor3 ); - DALI_TEST_EQUALS( actor3, task2.GetSourceActor(), TEST_LOCATION ); + task2.SetSourceActor(actor3); + DALI_TEST_EQUALS(actor3, task2.GetSourceActor(), TEST_LOCATION); END_TEST; } @@ -793,29 +791,29 @@ int UtcDaliRenderTaskSetExclusive02(void) tet_infoline("Testing RenderTask::SetExclusive() Check that changing from exclusive to not-exclusive works"); std::vector ids; - ids.push_back( 8 ); // 8 = actor1 - application.GetGlAbstraction().SetNextTextureIds( ids ); + ids.push_back(8); // 8 = actor1 + application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); - Actor actor1 = CreateRenderableActor( img1 ); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); - application.GetScene().Add( actor1 ); + Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Actor actor1 = CreateRenderableActor(img1); + actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); + application.GetScene().Add(actor1); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); + RenderTask task = taskList.CreateTask(); - task.SetSourceActor( actor1 ); + task.SetSourceActor(actor1); task.SetExclusive(true); // Actor should only render once - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); // Update & Render actor1 application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); // Set task to non-exclusive - actor1 should render twice: drawTrace.Reset(); @@ -823,7 +821,7 @@ int UtcDaliRenderTaskSetExclusive02(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION); END_TEST; } @@ -839,9 +837,9 @@ int UtcDaliRenderTaskSetExclusiveN(void) { task.SetExclusive(true); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -856,11 +854,11 @@ int UtcDaliRenderTaskIsExclusive01(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); // Not exclusive is the default - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( false == task.IsExclusive() ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(false == task.IsExclusive()); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( false == newTask.IsExclusive() ); + DALI_TEST_CHECK(false == newTask.IsExclusive()); END_TEST; } @@ -875,10 +873,10 @@ int UtcDaliRenderTaskIsExclusive02(void) // Not exclusive is the default RenderTask newTask = taskList.CreateTask(); - DALI_TEST_EQUALS( newTask.IsExclusive(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(newTask.IsExclusive(), false, TEST_LOCATION); newTask.SetExclusive(true); - DALI_TEST_EQUALS( newTask.IsExclusive(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(newTask.IsExclusive(), true, TEST_LOCATION); END_TEST; } @@ -892,11 +890,11 @@ int UtcDaliRenderTaskIsExclusiveN(void) try { bool x = task.IsExclusive(); - (void) x; + (void)x; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -911,14 +909,14 @@ int UtcDaliRenderTaskSetInputEnabled(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); // Input is enabled by default - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( true == task.GetInputEnabled() ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(true == task.GetInputEnabled()); - task.SetInputEnabled( false ); - DALI_TEST_CHECK( false == task.GetInputEnabled() ); + task.SetInputEnabled(false); + DALI_TEST_CHECK(false == task.GetInputEnabled()); - task.SetInputEnabled( true ); - DALI_TEST_CHECK( true == task.GetInputEnabled() ); + task.SetInputEnabled(true); + DALI_TEST_CHECK(true == task.GetInputEnabled()); END_TEST; } @@ -931,14 +929,14 @@ int UtcDaliRenderTaskGetInputEnabled(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); // Input is enabled by default - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_EQUALS( true, task.GetInputEnabled(), TEST_LOCATION ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_EQUALS(true, task.GetInputEnabled(), TEST_LOCATION); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_EQUALS( true, newTask.GetInputEnabled(), TEST_LOCATION ); + DALI_TEST_EQUALS(true, newTask.GetInputEnabled(), TEST_LOCATION); newTask.SetInputEnabled(false); - DALI_TEST_EQUALS( false, newTask.GetInputEnabled(), TEST_LOCATION ); + DALI_TEST_EQUALS(false, newTask.GetInputEnabled(), TEST_LOCATION); END_TEST; } @@ -951,21 +949,20 @@ int UtcDaliRenderTaskSetCameraActorP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Actor defaultCameraActor = task.GetCameraActor(); - DALI_TEST_CHECK( defaultCameraActor ); + DALI_TEST_CHECK(defaultCameraActor); CameraActor newCameraActor = CameraActor::New(); - DALI_TEST_CHECK( newCameraActor ); + DALI_TEST_CHECK(newCameraActor); - task.SetCameraActor( newCameraActor ); - DALI_TEST_CHECK( task.GetCameraActor() != defaultCameraActor ); - DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION ); + task.SetCameraActor(newCameraActor); + DALI_TEST_CHECK(task.GetCameraActor() != defaultCameraActor); + DALI_TEST_EQUALS(task.GetCameraActor(), newCameraActor, TEST_LOCATION); END_TEST; } - int UtcDaliRenderTaskSetCameraActorN(void) { TestApplication application; @@ -974,16 +971,16 @@ int UtcDaliRenderTaskSetCameraActorN(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Actor actor = task.GetCameraActor(); - DALI_TEST_CHECK( actor ); + DALI_TEST_CHECK(actor); CameraActor cameraActor; - task.SetCameraActor( cameraActor ); - DALI_TEST_EQUALS( (bool)task.GetCameraActor(), false, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCameraActor(), cameraActor, TEST_LOCATION ); + task.SetCameraActor(cameraActor); + DALI_TEST_EQUALS((bool)task.GetCameraActor(), false, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCameraActor(), cameraActor, TEST_LOCATION); END_TEST; } @@ -991,22 +988,22 @@ int UtcDaliRenderTaskSetCameraActorDestroyed(void) { TestApplication application; - tet_infoline( "Testing RenderTask::SetCameraActor - Set a camera actor and destroy the camera actor" ); + tet_infoline("Testing RenderTask::SetCameraActor - Set a camera actor and destroy the camera actor"); - Integration::Scene stage = application.GetScene(); - RenderTaskList taskList = stage.GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + Integration::Scene stage = application.GetScene(); + RenderTaskList taskList = stage.GetRenderTaskList(); + RenderTask task = taskList.GetTask(0u); CameraActor newCameraActor = CameraActor::New(); - task.SetCameraActor( newCameraActor ); + task.SetCameraActor(newCameraActor); - DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCameraActor(), newCameraActor, TEST_LOCATION); // Destroy the camera actor newCameraActor.Reset(); CameraActor camera = task.GetCameraActor(); - DALI_TEST_CHECK( !camera ); // The camera actor should be an empty handle. + DALI_TEST_CHECK(!camera); // The camera actor should be an empty handle. END_TEST; } @@ -1019,12 +1016,12 @@ int UtcDaliRenderTaskGetCameraActorP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); CameraActor actor = task.GetCameraActor(); - DALI_TEST_CHECK( actor ); - DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION ); - DALI_TEST_GREATER( actor.GetFieldOfView(), 0.0f, TEST_LOCATION ); + DALI_TEST_CHECK(actor); + DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION); + DALI_TEST_GREATER(actor.GetFieldOfView(), 0.0f, TEST_LOCATION); END_TEST; } @@ -1039,9 +1036,9 @@ int UtcDaliRenderTaskGetCameraActorN(void) { Actor actor = task.GetCameraActor(); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } @@ -1056,11 +1053,11 @@ int UtcDaliRenderTaskSetFrameBufferP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); - FrameBuffer newFrameBuffer = FrameBuffer::New( 128u, 128u, FrameBuffer::Attachment::NONE ); - task.SetFrameBuffer( newFrameBuffer ); - DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer ); + FrameBuffer newFrameBuffer = FrameBuffer::New(128u, 128u, FrameBuffer::Attachment::NONE); + task.SetFrameBuffer(newFrameBuffer); + DALI_TEST_CHECK(task.GetFrameBuffer() == newFrameBuffer); END_TEST; } @@ -1072,10 +1069,10 @@ int UtcDaliRenderTaskSetFrameBufferN(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); FrameBuffer newFrameBuffer; // Empty handle - task.SetFrameBuffer( newFrameBuffer ); - DALI_TEST_EQUALS( (bool)task.GetFrameBuffer(), false, TEST_LOCATION ); + task.SetFrameBuffer(newFrameBuffer); + DALI_TEST_EQUALS((bool)task.GetFrameBuffer(), false, TEST_LOCATION); END_TEST; } @@ -1087,11 +1084,11 @@ int UtcDaliRenderTaskGetFrameBufferP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); - FrameBuffer newFrameBuffer = FrameBuffer::New( 1u, 1u, FrameBuffer::Attachment::NONE ); - task.SetFrameBuffer( newFrameBuffer ); - DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer ); + FrameBuffer newFrameBuffer = FrameBuffer::New(1u, 1u, FrameBuffer::Attachment::NONE); + task.SetFrameBuffer(newFrameBuffer); + DALI_TEST_CHECK(task.GetFrameBuffer() == newFrameBuffer); END_TEST; } @@ -1103,11 +1100,11 @@ int UtcDaliRenderTaskGetFrameBufferN(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); // By default render-tasks do not render off-screen FrameBuffer frameBuffer = task.GetFrameBuffer(); - DALI_TEST_CHECK( !frameBuffer ); + DALI_TEST_CHECK(!frameBuffer); END_TEST; } @@ -1120,24 +1117,24 @@ int UtcDaliRenderTaskSetScreenToFrameBufferFunctionP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); - task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); + task.SetScreenToFrameBufferFunction(TestScreenToFrameBufferFunction); - Vector2 coordinates( 5, 10 ); - Vector2 convertedCoordinates( 6, 12 ); // + Vector(1, 2) + Vector2 coordinates(5, 10); + Vector2 convertedCoordinates(6, 12); // + Vector(1, 2) RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction(); - DALI_TEST_CHECK( func( coordinates ) ); - DALI_TEST_CHECK( coordinates == convertedCoordinates ); + DALI_TEST_CHECK(func(coordinates)); + DALI_TEST_CHECK(coordinates == convertedCoordinates); - task.SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION ); + task.SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION); func = task.GetScreenToFrameBufferFunction(); - DALI_TEST_CHECK( func( coordinates ) ); + DALI_TEST_CHECK(func(coordinates)); - task.SetScreenToFrameBufferFunction( RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION ); + task.SetScreenToFrameBufferFunction(RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION); func = task.GetScreenToFrameBufferFunction(); - DALI_TEST_CHECK( ! func( coordinates ) ); + DALI_TEST_CHECK(!func(coordinates)); END_TEST; } @@ -1150,11 +1147,11 @@ int UtcDaliRenderTaskSetScreenToFrameBufferFunctionN(void) RenderTask task; // Empty handle try { - task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction ); + task.SetScreenToFrameBufferFunction(TestScreenToFrameBufferFunction); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1168,14 +1165,14 @@ int UtcDaliRenderTaskGetScreenToFrameBufferFunctionP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); - Vector2 originalCoordinates( 5, 10 ); - Vector2 coordinates( 5, 10 ); + Vector2 originalCoordinates(5, 10); + Vector2 coordinates(5, 10); RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction(); - DALI_TEST_CHECK( !func( coordinates ) ); // conversion should fail by default - DALI_TEST_CHECK( coordinates == originalCoordinates ); // coordinates should not be modified + DALI_TEST_CHECK(!func(coordinates)); // conversion should fail by default + DALI_TEST_CHECK(coordinates == originalCoordinates); // coordinates should not be modified END_TEST; } @@ -1189,32 +1186,30 @@ int UtcDaliRenderTaskGetScreenToFrameBufferFunctionN(void) try { RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction(); - (void) func; + (void)func; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; } - int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorP(void) { TestApplication application; tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor "); - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask renderTask = taskList.CreateTask(); - Actor mappingActor = Actor::New(); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); + Actor mappingActor = Actor::New(); renderTask.SetScreenToFrameBufferMappingActor(mappingActor); - DALI_TEST_EQUALS( mappingActor, renderTask.GetScreenToFrameBufferMappingActor(), TEST_LOCATION ); + DALI_TEST_EQUALS(mappingActor, renderTask.GetScreenToFrameBufferMappingActor(), TEST_LOCATION); END_TEST; } - int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorN(void) { TestApplication application; @@ -1226,9 +1221,9 @@ int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorN(void) Actor mappingActor; task.SetScreenToFrameBufferMappingActor(mappingActor); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1239,12 +1234,12 @@ int UtcDaliRenderTaskGetScreenToFrameBufferMappingActor02N(void) TestApplication application; tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor with empty task handle"); - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask renderTask = taskList.CreateTask(); - Actor actor; + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTask renderTask = taskList.CreateTask(); + Actor actor; renderTask.SetScreenToFrameBufferMappingActor(actor); - DALI_TEST_EQUALS( (bool)renderTask.GetScreenToFrameBufferMappingActor(), false, TEST_LOCATION); + DALI_TEST_EQUALS((bool)renderTask.GetScreenToFrameBufferMappingActor(), false, TEST_LOCATION); END_TEST; } @@ -1255,13 +1250,13 @@ int UtcDaliRenderTaskGetViewportP01(void) tet_infoline("Testing RenderTask::GetViewport() on default task"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - Viewport viewport = task.GetViewport(); + RenderTask task = taskList.GetTask(0u); + Viewport viewport = task.GetViewport(); // By default the viewport should match the stage width/height - Vector2 stageSize = application.GetScene().GetSize(); - Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); - DALI_TEST_CHECK( viewport == expectedViewport ); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport expectedViewport(0, 0, stageSize.width, stageSize.height); + DALI_TEST_CHECK(viewport == expectedViewport); END_TEST; } @@ -1272,13 +1267,13 @@ int UtcDaliRenderTaskGetViewportP02(void) tet_infoline("Testing RenderTask::GetViewport() on new task"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); - Viewport viewport = task.GetViewport(); + RenderTask task = taskList.CreateTask(); + Viewport viewport = task.GetViewport(); // By default the viewport should match the stage width/height - Vector2 stageSize = application.GetScene().GetSize(); - Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); - DALI_TEST_CHECK( viewport == expectedViewport ); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport expectedViewport(0, 0, stageSize.width, stageSize.height); + DALI_TEST_CHECK(viewport == expectedViewport); END_TEST; } @@ -1292,17 +1287,16 @@ int UtcDaliRenderTaskGetViewportN(void) try { Viewport viewport = task.GetViewport(); - (void) viewport; + (void)viewport; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; } - int UtcDaliRenderTaskSetViewportP(void) { TestApplication application; @@ -1311,16 +1305,16 @@ int UtcDaliRenderTaskSetViewportP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - Vector2 stageSize = application.GetScene().GetSize(); - Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f ); - task.SetViewport( newViewport ); + RenderTask task = taskList.GetTask(0u); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport newViewport(0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f); + task.SetViewport(newViewport); // Update (viewport is a property) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( task.GetViewport() == newViewport ); + DALI_TEST_CHECK(task.GetViewport() == newViewport); END_TEST; } @@ -1335,20 +1329,19 @@ int UtcDaliRenderTaskSetViewportN(void) RenderTask task; try { - Vector2 stageSize = application.GetScene().GetSize(); - Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f ); - task.SetViewport( newViewport ); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport newViewport(0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f); + task.SetViewport(newViewport); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; } - int UtcDaliRenderTaskSetViewportPosition(void) { TestApplication application; @@ -1357,69 +1350,69 @@ int UtcDaliRenderTaskSetViewportPosition(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Viewport viewport = task.GetViewport(); // By default the viewport should match the stage width/height - Vector2 stageSize = application.GetScene().GetSize(); - Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); - DALI_TEST_CHECK( viewport == expectedViewport ); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport expectedViewport(0, 0, stageSize.width, stageSize.height); + DALI_TEST_CHECK(viewport == expectedViewport); // 'Setter' test Vector2 newPosition(25.0f, 50.0f); - task.SetViewportPosition( newPosition ); + task.SetViewportPosition(newPosition); // Update (viewport is a property) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition, Math::MACHINE_EPSILON_1, TEST_LOCATION); // Set by Property test Vector2 newPosition2(32.0f, 32.0f); - task.SetProperty( RenderTask::Property::VIEWPORT_POSITION, newPosition2 ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition, TEST_LOCATION ); // still the old position + task.SetProperty(RenderTask::Property::VIEWPORT_POSITION, newPosition2); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition, TEST_LOCATION); // still the old position // Update application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition2, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition2, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION); - Vector2 newPosition3(64.0f, 0.0f); + Vector2 newPosition3(64.0f, 0.0f); Animation animation = Animation::New(1.0f); - animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(task, RenderTask::Property::VIEWPORT_POSITION), newPosition3, AlphaFunction::LINEAR); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION); // Create another animation which animates by a certain value - const Vector2 newPosition4( 75.0f, 45.0f ); - const Vector2 relativePosition( newPosition4 - newPosition3 ); - animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_POSITION ), relativePosition ); + const Vector2 newPosition4(75.0f, 45.0f); + const Vector2 relativePosition(newPosition4 - newPosition3); + animation = Animation::New(1.0f); + animation.AnimateBy(Property(task, RenderTask::Property::VIEWPORT_POSITION), relativePosition); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition3, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION); END_TEST; } @@ -1432,68 +1425,68 @@ int UtcDaliRenderTaskSetViewportSize(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); Viewport viewport = task.GetViewport(); // By default the viewport should match the stage width/height - Vector2 stageSize = application.GetScene().GetSize(); - Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height ); - DALI_TEST_CHECK( viewport == expectedViewport ); + Vector2 stageSize = application.GetScene().GetSize(); + Viewport expectedViewport(0, 0, stageSize.width, stageSize.height); + DALI_TEST_CHECK(viewport == expectedViewport); Vector2 newSize(128.0f, 64.0f); - task.SetViewportSize( newSize ); + task.SetViewportSize(newSize); // Update (viewport is a property) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize, Math::MACHINE_EPSILON_1, TEST_LOCATION); // Set by Property test Vector2 newSize2(50.0f, 50.0f); - task.SetProperty( RenderTask::Property::VIEWPORT_SIZE, newSize2 ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize, TEST_LOCATION ); // still the old position + task.SetProperty(RenderTask::Property::VIEWPORT_SIZE, newSize2); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize, TEST_LOCATION); // still the old position // Update application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize2, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize2, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION); - Vector2 newSize3(10.0f, 10.0f); + Vector2 newSize3(10.0f, 10.0f); Animation animation = Animation::New(1.0f); - animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(task, RenderTask::Property::VIEWPORT_SIZE), newSize3, AlphaFunction::LINEAR); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION); // Create another animation which animates by a certain value - const Vector2 newSize4( 75.0f, 45.0f ); - const Vector2 relativeSize( newSize4 - newSize3 ); - animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_SIZE ), relativeSize ); + const Vector2 newSize4(75.0f, 45.0f); + const Vector2 relativeSize(newSize4 - newSize3); + animation = Animation::New(1.0f); + animation.AnimateBy(Property(task, RenderTask::Property::VIEWPORT_SIZE), relativeSize); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize3, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION); END_TEST; } @@ -1504,59 +1497,59 @@ int UtcDaliRenderTaskSetClearColorP(void) tet_infoline("Testing RenderTask::SetClearColor()"); - Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f ); - Vector4 testColor2( 5.0f, 6.0f, 7.0f, 8.0f ); + Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f); + Vector4 testColor2(5.0f, 6.0f, 7.0f, 8.0f); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( task.GetClearColor() != testColor ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(task.GetClearColor() != testColor); - task.SetClearColor( testColor ); + task.SetClearColor(testColor); // Wait a frame. Wait(application); - DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION); - task.SetProperty( RenderTask::Property::CLEAR_COLOR, testColor2 ); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor, TEST_LOCATION ); // still the old color + task.SetProperty(RenderTask::Property::CLEAR_COLOR, testColor2); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), testColor, TEST_LOCATION); // still the old color // Wait a frame. Wait(application); - DALI_TEST_EQUALS( task.GetClearColor(), testColor2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetClearColor(), testColor2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION); - Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f); + Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f); Animation animation = Animation::New(1.0f); - animation.AnimateTo( Property( task, RenderTask::Property::CLEAR_COLOR ), newColor3, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(task, RenderTask::Property::CLEAR_COLOR), newColor3, AlphaFunction::LINEAR); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION); // Create another animation which animates by a certain value - const Vector4 newColor4( 0.45f, 0.35f, 0.25f, 0.1f ); - const Vector4 relativeColor( newColor4 - newColor3 ); - animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( task, RenderTask::Property::CLEAR_COLOR ), relativeColor ); + const Vector4 newColor4(0.45f, 0.35f, 0.25f, 0.1f); + const Vector4 relativeColor(newColor4 - newColor3); + animation = Animation::New(1.0f); + animation.AnimateBy(Property(task, RenderTask::Property::CLEAR_COLOR), relativeColor); animation.Play(); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION); // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); - DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION ); - DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCurrentProperty(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION); + DALI_TEST_EQUALS(task.GetProperty(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION); END_TEST; } @@ -1570,11 +1563,11 @@ int UtcDaliRenderTaskSetClearColorN(void) RenderTask task; try { - task.SetClearColor( Vector4::ZERO ); + task.SetClearColor(Vector4::ZERO); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1587,8 +1580,8 @@ int UtcDaliRenderTaskGetClearColorP(void) tet_infoline("Testing RenderTask::GetClearColor()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_EQUALS( task.GetClearColor(), RenderTask::DEFAULT_CLEAR_COLOR, TEST_LOCATION ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_EQUALS(task.GetClearColor(), RenderTask::DEFAULT_CLEAR_COLOR, TEST_LOCATION); END_TEST; } @@ -1602,11 +1595,11 @@ int UtcDaliRenderTaskGetClearColorN(void) try { Vector4 color = task.GetClearColor(); - (void) color; + (void)color; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1620,14 +1613,14 @@ int UtcDaliRenderTaskSetClearEnabledP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(task.GetClearEnabled()); // defaults to true - task.SetClearEnabled( false ); - DALI_TEST_EQUALS( task.GetClearEnabled(), false, TEST_LOCATION ); + task.SetClearEnabled(false); + DALI_TEST_EQUALS(task.GetClearEnabled(), false, TEST_LOCATION); - task.SetClearEnabled( true ); - DALI_TEST_EQUALS( task.GetClearEnabled(), true, TEST_LOCATION ); + task.SetClearEnabled(true); + DALI_TEST_EQUALS(task.GetClearEnabled(), true, TEST_LOCATION); END_TEST; } @@ -1642,9 +1635,9 @@ int UtcDaliRenderTaskSetClearEnabledN(void) { task.SetClearEnabled(true); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1658,12 +1651,11 @@ int UtcDaliRenderTaskGetClearEnabledP(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(task.GetClearEnabled()); // defaults to true END_TEST; } - int UtcDaliRenderTaskGetClearEnabledN(void) { TestApplication application; @@ -1674,11 +1666,11 @@ int UtcDaliRenderTaskGetClearEnabledN(void) try { bool x = task.GetClearEnabled(); - (void) x; + (void)x; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1691,12 +1683,12 @@ int UtcDaliRenderTaskSetCullModeP(void) tet_infoline("Testing RenderTask::SetCullMode()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_EQUALS(task.GetCullMode(), true, TEST_LOCATION); - task.SetCullMode( false ); + task.SetCullMode(false); - DALI_TEST_EQUALS( task.GetCullMode(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetCullMode(), false, TEST_LOCATION); END_TEST; } @@ -1710,11 +1702,11 @@ int UtcDaliRenderTaskSetCullModeN(void) RenderTask task; try { - task.SetCullMode( false ); + task.SetCullMode(false); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; @@ -1727,8 +1719,8 @@ int UtcDaliRenderTaskGetCullModeP(void) tet_infoline("Testing RenderTask::GetCullMode()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_EQUALS(task.GetCullMode(), true, TEST_LOCATION); END_TEST; } @@ -1742,17 +1734,16 @@ int UtcDaliRenderTaskGetCullModeN(void) try { bool x = task.GetCullMode(); - (void) x; + (void)x; } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION); } END_TEST; } - int UtcDaliRenderTaskSetRefreshRate(void) { TestApplication application; @@ -1762,14 +1753,14 @@ int UtcDaliRenderTaskSetRefreshRate(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); // By default tasks will be processed every frame - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate()); - task.SetRefreshRate( 2u ); // every-other frame - DALI_TEST_CHECK( 2u == task.GetRefreshRate() ); + task.SetRefreshRate(2u); // every-other frame + DALI_TEST_CHECK(2u == task.GetRefreshRate()); - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + task.SetRefreshRate(RenderTask::REFRESH_ALWAYS); + DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate()); END_TEST; } @@ -1782,11 +1773,11 @@ int UtcDaliRenderTaskGetRefreshRate(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); // By default tasks will be processed every frame - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate()); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate() ); + DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate()); END_TEST; } @@ -1796,38 +1787,38 @@ int UtcDaliRenderTaskSignalFinished(void) tet_infoline("Testing RenderTask::SignalFinished()"); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); CameraActor offscreenCameraActor = CameraActor::New(); - application.GetScene().Add( offscreenCameraActor ); + application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); - Actor rootActor = CreateRenderableActor( image ); - rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); - application.GetScene().Add( rootActor ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Actor rootActor = CreateRenderableActor(image); + rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + application.GetScene().Add(rootActor); - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); - Texture frameBufferTexture = Texture::New( *testNativeImagePtr ); - FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(),frameBufferTexture.GetHeight()); + Texture frameBufferTexture = Texture::New(*testNativeImagePtr); + FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight()); frameBuffer.AttachColorTexture(frameBufferTexture); RenderTask newTask = taskList.CreateTask(); - newTask.SetCameraActor( offscreenCameraActor ); - newTask.SetSourceActor( rootActor ); - newTask.SetInputEnabled( false ); - newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) ); - newTask.SetClearEnabled( true ); - newTask.SetExclusive( true ); - newTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); - newTask.SetFrameBuffer( frameBuffer ); - newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); - - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + newTask.SetCameraActor(offscreenCameraActor); + newTask.SetSourceActor(rootActor); + newTask.SetInputEnabled(false); + newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f)); + newTask.SetClearEnabled(true); + newTask.SetExclusive(true); + newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + newTask.SetFrameBuffer(frameBuffer); + newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true); + + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); // Flush the queue and render. application.SendNotification(); @@ -1837,36 +1828,35 @@ int UtcDaliRenderTaskSignalFinished(void) application.Render(); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); - DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); application.Render(); - DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION); application.SendNotification(); - DALI_TEST_CHECK( ! finished ); + DALI_TEST_CHECK(!finished); - sync.SetObjectSynced( lastSyncObj, true ); + sync.SetObjectSynced(lastSyncObj, true); application.Render(); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); application.Render(); application.SendNotification(); - DALI_TEST_CHECK( finished ); + DALI_TEST_CHECK(finished); - DALI_TEST_EQUALS( application.GetUpdateStatus(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(application.GetUpdateStatus(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliRenderTaskContinuous01(void) { TestApplication application; @@ -1874,25 +1864,25 @@ int UtcDaliRenderTaskContinuous01(void) tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (source actor not staged)\nPOST:continuous renders, no Finished signal"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__)); application.GetPlatform().ClearReadyResources(); // ADD SOURCE ACTOR TO STAGE - expect continuous renders to start, no finished signal @@ -1900,11 +1890,10 @@ int UtcDaliRenderTaskContinuous01(void) application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); END_TEST; } - int UtcDaliRenderTaskContinuous02(void) { TestApplication application; @@ -1912,36 +1901,36 @@ int UtcDaliRenderTaskContinuous02(void) tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (source actor not visible)\nPOST:continuous renders, no Finished signal"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - secondRootActor.SetProperty( Actor::Property::VISIBLE,false); + secondRootActor.SetProperty(Actor::Property::VISIBLE, false); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__)); application.GetPlatform().ClearReadyResources(); // MAKE SOURCE ACTOR VISIBLE - expect continuous renders to start, no finished signal - secondRootActor.SetProperty( Actor::Property::VISIBLE,true); + secondRootActor.SetProperty(Actor::Property::VISIBLE, true); application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); END_TEST; } @@ -1952,37 +1941,36 @@ int UtcDaliRenderTaskContinuous03(void) tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (camera actor not staged)\nPOST:continuous renders, no Finished signal"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__)); application.GetPlatform().ClearReadyResources(); // ADD CAMERA ACTOR TO STAGE - expect continuous renders to start, no finished signal - application.GetScene().Add( offscreenCameraActor ); + application.GetScene().Add(offscreenCameraActor); application.SendNotification(); // CONTINUE PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); END_TEST; } - int UtcDaliRenderTaskContinuous04(void) { TestApplication application; @@ -1990,26 +1978,26 @@ int UtcDaliRenderTaskContinuous04(void) tet_infoline("Testing RenderTask Render Continuous using loaded image"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); END_TEST; } @@ -2020,34 +2008,34 @@ int UtcDaliRenderTaskOnce01(void) tet_infoline("Testing RenderTask Render Once GlSync, using loaded image"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } @@ -2058,45 +2046,45 @@ int UtcDaliRenderTaskOnce02(void) tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); - Shader shader = CreateShader(); - Texture image = CreateTexture(); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); + renderer.SetTextures(textureSet); Actor secondRootActor = Actor::New(); secondRootActor.AddRenderer(renderer); - secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); - END_TEST; + END_TEST; } int UtcDaliRenderTaskOnce03(void) @@ -2106,93 +2094,92 @@ int UtcDaliRenderTaskOnce03(void) tet_infoline("Testing RenderTask Render Once GlSync, using loaded image. Switch from render always after ready to render once\n"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } - int UtcDaliRenderTaskOnce04(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n" - "Switch from render always after ready to render once\n" - ); + tet_infoline( + "Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n" + "Switch from render always after ready to render once\n"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); - Shader shader = CreateShader(); - Texture image = CreateTexture(); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); + renderer.SetTextures(textureSet); Actor secondRootActor = Actor::New(); secondRootActor.AddRenderer(renderer); - secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); - sync.SetObjectSynced( lastSyncObj, true ); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } @@ -2204,26 +2191,26 @@ int UtcDaliRenderTaskOnceNoSync01(void) tet_infoline("Testing RenderTask Render Once, \nPRE: Resources ready\nPOST: Finished signal sent once only"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } @@ -2231,40 +2218,41 @@ int UtcDaliRenderTaskOnceNoSync02(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loaded image.\n" - "PRE: Resources ready\nPOST: Finished signal sent once only"); + tet_infoline( + "Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loaded image.\n" + "PRE: Resources ready\nPOST: Finished signal sent once only"); // SETUP AN OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); - Shader shader = CreateShader(); - Texture image = CreateTexture(); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); + renderer.SetTextures(textureSet); Actor secondRootActor = Actor::New(); secondRootActor.AddRenderer(renderer); - secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); application.GetPlatform().ClearReadyResources(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } @@ -2273,35 +2261,36 @@ int UtcDaliRenderTaskOnceNoSync03(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once, using loaded image. Switch from render always after ready to render once\n" - "PRE: Render task ready, Image loaded\n" - "POST: Finished signal sent only once"); + tet_infoline( + "Testing RenderTask Render Once, using loaded image. Switch from render always after ready to render once\n" + "PRE: Render task ready, Image loaded\n" + "POST: Finished signal sent only once"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); END_TEST; } @@ -2309,53 +2298,53 @@ int UtcDaliRenderTaskOnceNoSync04(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n" - "Switch from render always after ready to render once\n" - "PRE: Render task ready, Image not loaded\n" - "POST: Finished signal sent only once"); + tet_infoline( + "Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n" + "Switch from render always after ready to render once\n" + "PRE: Render task ready, Image not loaded\n" + "POST: Finished signal sent only once"); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); - Shader shader = CreateShader(); - Texture image = CreateTexture(); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = CreateShader(); + Texture image = CreateTexture(); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader); - renderer.SetTextures( textureSet ); + renderer.SetTextures(textureSet); Actor secondRootActor = Actor::New(); secondRootActor.AddRenderer(renderer); - secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.GetScene().Add(secondRootActor); - - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); + TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); + DALI_TEST_CHECK(lastSyncObj == NULL); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); // Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__)); lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj == NULL ); + DALI_TEST_CHECK(lastSyncObj == NULL); END_TEST; } @@ -2364,90 +2353,90 @@ int UtcDaliRenderTaskOnceNoSync05(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once\n" - "SetRefreshRate(ONCE), resource load failed, completes render task.\n" - "PRE: resources failed to load\n" - "POST: No finished signal sent."); + tet_infoline( + "Testing RenderTask Render Once\n" + "SetRefreshRate(ONCE), resource load failed, completes render task.\n" + "PRE: resources failed to load\n" + "POST: No finished signal sent."); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(secondRootActor); - RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); application.SendNotification(); // START PROCESS/RENDER Input, Expected Input, Expected - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); // CHANGE TO RENDER ONCE, newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); END_TEST; } - - int UtcDaliRenderTaskOnceChain01(void) { TestApplication application; - tet_infoline("Testing RenderTask Render Once Chained render tasks\n" - "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n" - "PRE: resources ready\n" - "POST: 2 finished signals sent."); + tet_infoline( + "Testing RenderTask Render Once Chained render tasks\n" + "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n" + "PRE: resources ready\n" + "POST: 2 finished signals sent."); // SETUP A CONTINUOUS OFFSCREEN RENDER TASK - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor defaultRootActor = Actor::New(); // Root for default RT - application.GetScene().Add( defaultRootActor ); + application.GetScene().Add(defaultRootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); Actor firstRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); application.GetScene().Add(firstRootActor); // first render task - RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false); - bool firstFinished = false; - RenderTaskFinished renderTask1Finished( firstFinished ); - firstTask.FinishedSignal().Connect( &application, renderTask1Finished ); + RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false); + bool firstFinished = false; + RenderTaskFinished renderTask1Finished(firstFinished); + firstTask.FinishedSignal().Connect(&application, renderTask1Finished); // Second render task - FrameBuffer fbo = firstTask.GetFrameBuffer(); - Actor secondRootActor = CreateRenderableActor( fbo.GetColorTexture() ); + FrameBuffer fbo = firstTask.GetFrameBuffer(); + Actor secondRootActor = CreateRenderableActor(fbo.GetColorTexture()); application.GetScene().Add(secondRootActor); - RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); - bool secondFinished = false; - RenderTaskFinished renderTask2Finished( secondFinished ); - secondTask.FinishedSignal().Connect( &application, renderTask2Finished ); + RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false); + bool secondFinished = false; + RenderTaskFinished renderTask2Finished(secondFinished); + secondTask.FinishedSignal().Connect(&application, renderTask2Finished); application.SendNotification(); //Both render tasks are executed. - DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) ); - DALI_TEST_CHECK( firstFinished == false ); - DALI_TEST_CHECK( secondFinished == false ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__)); + DALI_TEST_CHECK(firstFinished == false); + DALI_TEST_CHECK(secondFinished == false); //Nothing else to render and both render task should have finished now - DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, firstFinished, true, false, __LINE__ ) ); - DALI_TEST_CHECK( firstFinished == true ); - DALI_TEST_CHECK( secondFinished == true ); + DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, firstFinished, true, false, __LINE__)); + DALI_TEST_CHECK(firstFinished == true); + DALI_TEST_CHECK(secondFinished == true); END_TEST; } @@ -2459,9 +2448,9 @@ int UtcDaliRenderTaskProperties(void) RenderTask task = application.GetScene().GetRenderTaskList().CreateTask(); Property::IndexContainer indices; - task.GetPropertyIndices( indices ); - DALI_TEST_CHECK( indices.Size() ); - DALI_TEST_EQUALS( indices.Size(), task.GetPropertyCount(), TEST_LOCATION ); + task.GetPropertyIndices(indices); + DALI_TEST_CHECK(indices.Size()); + DALI_TEST_EQUALS(indices.Size(), task.GetPropertyCount(), TEST_LOCATION); END_TEST; } @@ -2471,23 +2460,23 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) tet_infoline("Testing RenderTask::FinishInvisibleSourceActor()"); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); CameraActor offscreenCameraActor = CameraActor::New(); - application.GetScene().Add( offscreenCameraActor ); + application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); - Actor rootActor = CreateRenderableActor( image ); - rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); - rootActor.SetProperty( Actor::Property::VISIBLE,false); - application.GetScene().Add( rootActor ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Actor rootActor = CreateRenderableActor(image); + rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + rootActor.SetProperty(Actor::Property::VISIBLE, false); + application.GetScene().Add(rootActor); - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10); - Texture frameBufferTexture = Texture::New( *testNativeImagePtr ); - FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight()); + Texture frameBufferTexture = Texture::New(*testNativeImagePtr); + FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight()); frameBuffer.AttachColorTexture(frameBufferTexture); // Flush all outstanding messages @@ -2495,21 +2484,21 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) application.Render(); RenderTask newTask = taskList.CreateTask(); - newTask.SetCameraActor( offscreenCameraActor ); - newTask.SetSourceActor( rootActor ); - newTask.SetInputEnabled( false ); - newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) ); - newTask.SetClearEnabled( true ); - newTask.SetExclusive( true ); - newTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); - newTask.SetFrameBuffer( frameBuffer ); - newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); + newTask.SetCameraActor(offscreenCameraActor); + newTask.SetSourceActor(rootActor); + newTask.SetInputEnabled(false); + newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f)); + newTask.SetClearEnabled(true); + newTask.SetExclusive(true); + newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + newTask.SetFrameBuffer(frameBuffer); + newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true); // Framebuffer doesn't actually get created until Connected, i.e. by previous line - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); // Flush the queue and render. application.SendNotification(); @@ -2519,35 +2508,35 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) application.Render(); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); - DALI_TEST_CHECK( lastSyncObj != NULL ); + DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); - DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); application.Render(); - DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION ); + DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION); application.SendNotification(); - DALI_TEST_CHECK( ! finished ); + DALI_TEST_CHECK(!finished); - sync.SetObjectSynced( lastSyncObj, true ); + sync.SetObjectSynced(lastSyncObj, true); application.Render(); application.SendNotification(); - DALI_TEST_CHECK( !finished ); + DALI_TEST_CHECK(!finished); application.Render(); application.SendNotification(); - DALI_TEST_CHECK( finished ); + DALI_TEST_CHECK(finished); finished = false; application.Render(); // Double check no more finished signal application.SendNotification(); - DALI_TEST_CHECK( ! finished ); + DALI_TEST_CHECK(!finished); END_TEST; } @@ -2561,26 +2550,26 @@ int UtcDaliRenderTaskFinishMissingImage(void) Integration::Scene stage = application.GetScene(); - Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); - Actor rootActor = CreateRenderableActor( image ); - rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); - stage.Add( rootActor ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Actor rootActor = CreateRenderableActor(image); + rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + stage.Add(rootActor); - Actor actorWithMissingImage = CreateRenderableActor( Texture() ); - actorWithMissingImage.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); - stage.Add( actorWithMissingImage ); + Actor actorWithMissingImage = CreateRenderableActor(Texture()); + actorWithMissingImage.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + stage.Add(actorWithMissingImage); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask newTask = taskList.CreateTask(); - newTask.SetInputEnabled( false ); - newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) ); - newTask.SetClearEnabled( true ); - newTask.SetExclusive( true ); - newTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); + RenderTask newTask = taskList.CreateTask(); + newTask.SetInputEnabled(false); + newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f)); + newTask.SetClearEnabled(true); + newTask.SetExclusive(true); + newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); - bool finished = false; - RenderTaskFinished renderTaskFinished( finished ); - newTask.FinishedSignal().Connect( &application, renderTaskFinished ); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); // 1 render to process render task, then 1 before finished msg is sent from update to the event thread. application.SendNotification(); @@ -2588,23 +2577,23 @@ int UtcDaliRenderTaskFinishMissingImage(void) application.Render(); application.SendNotification(); - DALI_TEST_CHECK( finished ); + DALI_TEST_CHECK(finished); END_TEST; } int UtcDaliRenderTaskWorldToViewport(void) { - TestApplication application( 400u, 400u ); // square surface + TestApplication application(400u, 400u); // square surface RenderTaskList taskList = application.GetScene().GetRenderTaskList(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0)); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.5) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.5) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.5)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.5)); application.GetScene().Add(actor); @@ -2612,7 +2601,7 @@ int UtcDaliRenderTaskWorldToViewport(void) application.Render(); application.SendNotification(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); CameraActor camera = task.GetCameraActor(); @@ -2621,47 +2610,46 @@ int UtcDaliRenderTaskWorldToViewport(void) float screenX = 0.0; float screenY = 0.0; - bool ok = task.WorldToViewport(actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), screenX, screenY); + bool ok = task.WorldToViewport(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), screenX, screenY); DALI_TEST_CHECK(ok == true); - DALI_TEST_EQUALS(screenX, screenSize.x/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); - DALI_TEST_EQUALS(screenY, screenSize.y/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenX, screenSize.x / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenY, screenSize.y / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); - Actor actor2 = Actor::New(); + Actor actor2 = Actor::New(); float actor2Size = 100.f; - actor2.SetProperty( Actor::Property::SIZE, Vector2( actor2Size, actor2Size ) ); - actor2.SetProperty( Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0) ); - actor2.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.0) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.0) ); - application.GetScene().Add( actor2 ); + actor2.SetProperty(Actor::Property::SIZE, Vector2(actor2Size, actor2Size)); + actor2.SetProperty(Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0)); + actor2.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.0)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.0)); + application.GetScene().Add(actor2); actor2.Add(actor); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0,0,0) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0, 0, 0)); application.SendNotification(); application.Render(); application.SendNotification(); - ok = task.WorldToViewport(actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), screenX, screenY); + ok = task.WorldToViewport(actor.GetCurrentProperty(Actor::Property::WORLD_POSITION), screenX, screenY); DALI_TEST_CHECK(ok == true); - DALI_TEST_EQUALS(screenX, screenSize.x/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); - DALI_TEST_EQUALS(screenY, screenSize.y/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenX, screenSize.x / 2 - actor2Size / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); + DALI_TEST_EQUALS(screenY, screenSize.y / 2 - actor2Size / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION); END_TEST; } - int UtcDaliRenderTaskViewportToLocal(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::POSITION, Vector2(10.0f, 10.0f)); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f)); application.GetScene().Add(actor); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); + RenderTask task = taskList.GetTask(0u); // flush the queue and render once application.SendNotification(); @@ -2678,37 +2666,36 @@ int UtcDaliRenderTaskViewportToLocal(void) float screenX = 50.0f; float screenY = 50.0f; - DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) ); + DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, screenX, screenY)); - DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) ); + DALI_TEST_CHECK(task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY)); DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION); END_TEST; - } int UtcDaliRenderTaskOffscreenViewportToLocal(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::POSITION, Vector2( 10.0f, 10.0f )); - application.GetScene().Add( actor ); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f)); + application.GetScene().Add(actor); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.CreateTask(); + RenderTask task = taskList.CreateTask(); FrameBuffer newFrameBuffer = FrameBuffer::New(10, 10); - task.SetFrameBuffer( newFrameBuffer ); - task.SetSourceActor( actor ); - task.SetScreenToFrameBufferMappingActor( actor ); + task.SetFrameBuffer(newFrameBuffer); + task.SetSourceActor(actor); + task.SetScreenToFrameBufferMappingActor(actor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); - task.SetCameraActor( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); + task.SetCameraActor(offscreenCameraActor); // flush the queue and render once application.SendNotification(); @@ -2725,9 +2712,9 @@ int UtcDaliRenderTaskOffscreenViewportToLocal(void) float screenX = 50.0f; float screenY = 50.0f; - DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) ); + DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, screenX, screenY)); - DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) ); + DALI_TEST_CHECK(task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY)); DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION); @@ -2738,18 +2725,18 @@ int UtcDaliRenderTaskOffscreenViewportToLocal(void) int UtcDaliRenderTaskRequiresSync(void) { TestApplication application; - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); RenderTask newTask = taskList.CreateTask(); - newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, false ); + newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, false); - DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( newTask.GetCurrentProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(newTask.GetProperty(RenderTask::Property::REQUIRES_SYNC), false, TEST_LOCATION); + DALI_TEST_EQUALS(newTask.GetCurrentProperty(RenderTask::Property::REQUIRES_SYNC), false, TEST_LOCATION); - newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true ); + newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true); - DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( newTask.GetCurrentProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(newTask.GetProperty(RenderTask::Property::REQUIRES_SYNC), true, TEST_LOCATION); + DALI_TEST_EQUALS(newTask.GetCurrentProperty(RenderTask::Property::REQUIRES_SYNC), true, TEST_LOCATION); END_TEST; } @@ -2760,38 +2747,38 @@ int UtcDaliRenderTaskSetClearEnabled(void) tet_infoline("UtcDaliRenderTaskSetClearEnabled"); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); TestGlAbstraction& gl = application.GetGlAbstraction(); - Actor renderableActor = CreateRenderableActorSuccess( application, "aFile.jpg" ); - application.GetScene().Add( renderableActor ); + Actor renderableActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + application.GetScene().Add(renderableActor); Actor rootActor = Actor::New(); - application.GetScene().Add( rootActor ); + application.GetScene().Add(rootActor); - CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); - Actor sourceActor = CreateRenderableActorSuccess( application, "aFile.jpg" ); - application.GetScene().Add( sourceActor ); + Actor sourceActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + application.GetScene().Add(sourceActor); - RenderTask newTask = CreateRenderTask( application, offscreenCameraActor, rootActor, sourceActor, RenderTask::REFRESH_ALWAYS, false ); + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, sourceActor, RenderTask::REFRESH_ALWAYS, false); - DALI_TEST_EQUALS( gl.GetClearCountCalled(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetClearCountCalled(), 0, TEST_LOCATION); application.SendNotification(); application.Render(); // glClear should be called twice - default task and the new task. - DALI_TEST_EQUALS( gl.GetClearCountCalled(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetClearCountCalled(), 2, TEST_LOCATION); - newTask.SetClearEnabled( false ); + newTask.SetClearEnabled(false); application.SendNotification(); application.Render(); // The count should increase by 1 - default task only. - DALI_TEST_EQUALS( gl.GetClearCountCalled(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetClearCountCalled(), 3, TEST_LOCATION); END_TEST; } @@ -2800,26 +2787,26 @@ int UtcDaliRenderTaskMoveConstrctor(void) { TestApplication application; - Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f ); + Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( task ); - DALI_TEST_EQUALS( 2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( task.GetClearColor() != testColor ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(task); + DALI_TEST_EQUALS(2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(task.GetClearColor() != testColor); - task.SetClearColor( testColor ); + task.SetClearColor(testColor); // Wait a frame. Wait(application); - DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION); - RenderTask move = std::move( task ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetClearColor(), testColor, TEST_LOCATION ); - DALI_TEST_CHECK( !task ); + RenderTask move = std::move(task); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetClearColor(), testColor, TEST_LOCATION); + DALI_TEST_CHECK(!task); END_TEST; } @@ -2828,34 +2815,34 @@ int UtcDaliRenderTaskMoveAssignment(void) { TestApplication application; - Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f ); + Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask task = taskList.GetTask( 0u ); - DALI_TEST_CHECK( task ); - DALI_TEST_EQUALS( 2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( task.GetClearColor() != testColor ); + RenderTask task = taskList.GetTask(0u); + DALI_TEST_CHECK(task); + DALI_TEST_EQUALS(2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(task.GetClearColor() != testColor); - task.SetClearColor( testColor ); + task.SetClearColor(testColor); // Wait a frame. Wait(application); - DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION ); + DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION); RenderTask move; - move = std::move( task ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetClearColor(), testColor, TEST_LOCATION ); - DALI_TEST_CHECK( !task ); + move = std::move(task); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetClearColor(), testColor, TEST_LOCATION); + DALI_TEST_CHECK(!task); END_TEST; } int UtcDaliRenderTaskSetCullModeNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2872,7 +2859,7 @@ int UtcDaliRenderTaskSetCullModeNegative(void) int UtcDaliRenderTaskSetViewportNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2889,7 +2876,7 @@ int UtcDaliRenderTaskSetViewportNegative(void) int UtcDaliRenderTaskSetExclusiveNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2906,7 +2893,7 @@ int UtcDaliRenderTaskSetExclusiveNegative(void) int UtcDaliRenderTaskSetClearColorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2923,7 +2910,7 @@ int UtcDaliRenderTaskSetClearColorNegative(void) int UtcDaliRenderTaskFinishedSignalNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2939,7 +2926,7 @@ int UtcDaliRenderTaskFinishedSignalNegative(void) int UtcDaliRenderTaskSetCameraActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2956,7 +2943,7 @@ int UtcDaliRenderTaskSetCameraActorNegative(void) int UtcDaliRenderTaskSetFrameBufferNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2973,7 +2960,7 @@ int UtcDaliRenderTaskSetFrameBufferNegative(void) int UtcDaliRenderTaskSetRefreshRateNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -2990,7 +2977,7 @@ int UtcDaliRenderTaskSetRefreshRateNegative(void) int UtcDaliRenderTaskSetSourceActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3007,7 +2994,7 @@ int UtcDaliRenderTaskSetSourceActorNegative(void) int UtcDaliRenderTaskSetClearEnabledNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3024,7 +3011,7 @@ int UtcDaliRenderTaskSetClearEnabledNegative(void) int UtcDaliRenderTaskSetInputEnabledNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3041,7 +3028,7 @@ int UtcDaliRenderTaskSetInputEnabledNegative(void) int UtcDaliRenderTaskSetViewportSizeNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3058,7 +3045,7 @@ int UtcDaliRenderTaskSetViewportSizeNegative(void) int UtcDaliRenderTaskSetViewportPositionNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3075,7 +3062,7 @@ int UtcDaliRenderTaskSetViewportPositionNegative(void) int UtcDaliRenderTaskSetScreenToFrameBufferFunctionNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3092,7 +3079,7 @@ int UtcDaliRenderTaskSetScreenToFrameBufferFunctionNegative(void) int UtcDaliRenderTaskSetScreenToFrameBufferMappingActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3109,7 +3096,7 @@ int UtcDaliRenderTaskSetScreenToFrameBufferMappingActorNegative(void) int UtcDaliRenderTaskGetCullModeNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3125,7 +3112,7 @@ int UtcDaliRenderTaskGetCullModeNegative(void) int UtcDaliRenderTaskGetViewportNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3141,7 +3128,7 @@ int UtcDaliRenderTaskGetViewportNegative(void) int UtcDaliRenderTaskIsExclusiveNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3157,7 +3144,7 @@ int UtcDaliRenderTaskIsExclusiveNegative(void) int UtcDaliRenderTaskGetClearColorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3173,7 +3160,7 @@ int UtcDaliRenderTaskGetClearColorNegative(void) int UtcDaliRenderTaskGetCameraActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3189,7 +3176,7 @@ int UtcDaliRenderTaskGetCameraActorNegative(void) int UtcDaliRenderTaskGetFrameBufferNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3205,7 +3192,7 @@ int UtcDaliRenderTaskGetFrameBufferNegative(void) int UtcDaliRenderTaskGetRefreshRateNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3221,7 +3208,7 @@ int UtcDaliRenderTaskGetRefreshRateNegative(void) int UtcDaliRenderTaskGetSourceActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3237,7 +3224,7 @@ int UtcDaliRenderTaskGetSourceActorNegative(void) int UtcDaliRenderTaskGetClearEnabledNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3253,7 +3240,7 @@ int UtcDaliRenderTaskGetClearEnabledNegative(void) int UtcDaliRenderTaskGetInputEnabledNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3269,16 +3256,16 @@ int UtcDaliRenderTaskGetInputEnabledNegative(void) int UtcDaliRenderTaskViewportToLocalNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { Dali::Actor arg1(Actor::New()); - float arg2(0.0f); - float arg3(0.0f); - float arg4(0.0f); - float arg5(0.0f); - instance.ViewportToLocal(arg1,arg2,arg3,arg4,arg5); + float arg2(0.0f); + float arg3(0.0f); + float arg4(0.0f); + float arg5(0.0f); + instance.ViewportToLocal(arg1, arg2, arg3, arg4, arg5); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -3290,14 +3277,14 @@ int UtcDaliRenderTaskViewportToLocalNegative(void) int UtcDaliRenderTaskWorldToViewportNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { Dali::Vector3 arg1; - float arg2(0.0f); - float arg3(0.0f); - instance.WorldToViewport(arg1,arg2,arg3); + float arg2(0.0f); + float arg3(0.0f); + instance.WorldToViewport(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -3309,7 +3296,7 @@ int UtcDaliRenderTaskWorldToViewportNegative(void) int UtcDaliRenderTaskGetCurrentViewportSizeNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3325,7 +3312,7 @@ int UtcDaliRenderTaskGetCurrentViewportSizeNegative(void) int UtcDaliRenderTaskGetCurrentViewportPositionNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3341,7 +3328,7 @@ int UtcDaliRenderTaskGetCurrentViewportPositionNegative(void) int UtcDaliRenderTaskGetScreenToFrameBufferFunctionNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { @@ -3357,7 +3344,7 @@ int UtcDaliRenderTaskGetScreenToFrameBufferFunctionNegative(void) int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTask instance; try { diff --git a/automated-tests/src/dali/utc-Dali-RenderTaskList.cpp b/automated-tests/src/dali/utc-Dali-RenderTaskList.cpp index b9ad58f..c024dff 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTaskList.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTaskList.cpp @@ -15,11 +15,11 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -41,7 +41,7 @@ int UtcDaliRenderTaskListDefaultConstructor(void) RenderTaskList taskList; - DALI_TEST_CHECK( ! taskList ); + DALI_TEST_CHECK(!taskList); END_TEST; } @@ -53,9 +53,9 @@ int UtcDaliRenderTaskListCopyConstructor(void) RenderTaskList taskList1; - RenderTaskList taskList2( taskList1 ); + RenderTaskList taskList2(taskList1); - DALI_TEST_CHECK( ! taskList2 ); + DALI_TEST_CHECK(!taskList2); END_TEST; } @@ -71,7 +71,7 @@ int UtcDaliRenderTaskListAssignment(void) taskList1 = taskList2; - DALI_TEST_CHECK( ! taskList1 ); + DALI_TEST_CHECK(!taskList1); END_TEST; } @@ -80,15 +80,15 @@ int UtcDaliRenderTaskListMoveConstructor(void) TestApplication application; RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( taskList ); - DALI_TEST_EQUALS( 2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(taskList); + DALI_TEST_EQUALS(2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); - RenderTaskList move = std::move( taskList ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( 1u == move.GetTaskCount() ); - DALI_TEST_CHECK( !taskList ); + RenderTaskList move = std::move(taskList); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(1u == move.GetTaskCount()); + DALI_TEST_CHECK(!taskList); END_TEST; } @@ -98,16 +98,16 @@ int UtcDaliRenderTaskListMoveAssignment(void) TestApplication application; RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( taskList ); - DALI_TEST_EQUALS( 2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(taskList); + DALI_TEST_EQUALS(2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); RenderTaskList move; - move = std::move( taskList ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( 1u == move.GetTaskCount() ); - DALI_TEST_CHECK( !taskList ); + move = std::move(taskList); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(1u == move.GetTaskCount()); + DALI_TEST_CHECK(!taskList); END_TEST; } @@ -120,12 +120,12 @@ int UtcDaliRenderTaskListDownCast(void) BaseHandle base = application.GetScene().GetRenderTaskList(); - RenderTaskList taskList = RenderTaskList::DownCast( base ); + RenderTaskList taskList = RenderTaskList::DownCast(base); - DALI_TEST_CHECK( taskList ); + DALI_TEST_CHECK(taskList); // Try calling a method - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); END_TEST; } @@ -136,10 +136,10 @@ int UtcDaliRenderTaskListCreateTask(void) tet_infoline("Testing RenderTaskList::CreateTask()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); taskList.CreateTask(); - DALI_TEST_CHECK( 2u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(2u == taskList.GetTaskCount()); END_TEST; } @@ -150,13 +150,13 @@ int UtcDaliRenderTaskListRemoveTask(void) tet_infoline("Testing RenderTaskList::RemoveTask()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( 2u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(2u == taskList.GetTaskCount()); - taskList.RemoveTask( newTask ); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + taskList.RemoveTask(newTask); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); END_TEST; } @@ -167,19 +167,19 @@ int UtcDaliRenderTaskListRemoveTaskWithExclusiveActor(void) tet_infoline("Testing RenderTaskList::RemoveTask() which has an exclusive actor set"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( 2u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(2u == taskList.GetTaskCount()); auto actor = CreateRenderableActor(); - newTask.SetSourceActor( actor ); - newTask.SetExclusive( true ); - DALI_TEST_EQUALS( actor, newTask.GetSourceActor(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, newTask.IsExclusive(), TEST_LOCATION ); - taskList.RemoveTask( newTask ); + newTask.SetSourceActor(actor); + newTask.SetExclusive(true); + DALI_TEST_EQUALS(actor, newTask.GetSourceActor(), TEST_LOCATION); + DALI_TEST_EQUALS(true, newTask.IsExclusive(), TEST_LOCATION); + taskList.RemoveTask(newTask); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); END_TEST; } @@ -190,10 +190,10 @@ int UtcDaliRenderTaskListGetTaskCount(void) tet_infoline("Testing RenderTaskList::GetTaskCount()"); RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); - taskList.RemoveTask( taskList.GetTask(0u) ); - DALI_TEST_CHECK( 0u == taskList.GetTaskCount() ); + taskList.RemoveTask(taskList.GetTask(0u)); + DALI_TEST_CHECK(0u == taskList.GetTaskCount()); END_TEST; } @@ -203,34 +203,34 @@ int UtcDaliRenderTaskListGetTask(void) tet_infoline("Testing RenderTaskList::GetTask()"); - RenderTaskList taskList = application.GetScene().GetRenderTaskList(); - RenderTask defaultTask = taskList.GetTask( 0u ); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); - DALI_TEST_CHECK( defaultTask ); - DALI_TEST_CHECK( defaultTask == taskList.GetTask( 0u ) ); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + RenderTask defaultTask = taskList.GetTask(0u); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); + DALI_TEST_CHECK(defaultTask); + DALI_TEST_CHECK(defaultTask == taskList.GetTask(0u)); RenderTask newTask = taskList.CreateTask(); - DALI_TEST_CHECK( 2u == taskList.GetTaskCount() ); + DALI_TEST_CHECK(2u == taskList.GetTaskCount()); - RenderTask temp = taskList.GetTask( 0u ); - RenderTask temp2 = taskList.GetTask( 1u ); + RenderTask temp = taskList.GetTask(0u); + RenderTask temp2 = taskList.GetTask(1u); - DALI_TEST_CHECK( newTask ); - DALI_TEST_CHECK( defaultTask != newTask ); - DALI_TEST_CHECK( taskList.GetTask( 0u ) == defaultTask ); - DALI_TEST_CHECK( taskList.GetTask( 1u ) == newTask ); - DALI_TEST_CHECK( taskList.GetTask( 1u ) != defaultTask ); + DALI_TEST_CHECK(newTask); + DALI_TEST_CHECK(defaultTask != newTask); + DALI_TEST_CHECK(taskList.GetTask(0u) == defaultTask); + DALI_TEST_CHECK(taskList.GetTask(1u) == newTask); + DALI_TEST_CHECK(taskList.GetTask(1u) != defaultTask); - taskList.RemoveTask( taskList.GetTask(0u) ); - DALI_TEST_CHECK( 1u == taskList.GetTaskCount() ); - DALI_TEST_CHECK( taskList.GetTask( 0u ) != defaultTask ); - DALI_TEST_CHECK( taskList.GetTask( 0u ) == newTask ); + taskList.RemoveTask(taskList.GetTask(0u)); + DALI_TEST_CHECK(1u == taskList.GetTaskCount()); + DALI_TEST_CHECK(taskList.GetTask(0u) != defaultTask); + DALI_TEST_CHECK(taskList.GetTask(0u) == newTask); END_TEST; } int UtcDaliRenderTaskListCreateTaskNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTaskList instance; try { @@ -246,7 +246,7 @@ int UtcDaliRenderTaskListCreateTaskNegative(void) int UtcDaliRenderTaskListRemoveTaskNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTaskList instance; try { @@ -263,7 +263,7 @@ int UtcDaliRenderTaskListRemoveTaskNegative(void) int UtcDaliRenderTaskListGetTaskCountNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTaskList instance; try { @@ -279,7 +279,7 @@ int UtcDaliRenderTaskListGetTaskCountNegative(void) int UtcDaliRenderTaskListGetTaskNegative(void) { - TestApplication application; + TestApplication application; Dali::RenderTaskList instance; try { diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index 7b700ce..d77fabc 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -17,31 +17,30 @@ // EXTERNAL INCLUDES #include -#include #include - -#include +#include #include +#include + #include #include // INTERNAL INCLUDES #include -#include #include +#include using namespace Dali; namespace // unnamed namespace { +const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_RGB(BlendFactor::SRC_ALPHA); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_RGB(BlendFactor::ONE_MINUS_SRC_ALPHA); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_ALPHA(BlendFactor::ONE); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_ALPHA(BlendFactor::ONE_MINUS_SRC_ALPHA); -const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_RGB( BlendFactor::SRC_ALPHA ); -const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_RGB( BlendFactor::ONE_MINUS_SRC_ALPHA ); -const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_ALPHA( BlendFactor::ONE ); -const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_ALPHA( BlendFactor::ONE_MINUS_SRC_ALPHA ); - -const BlendEquation::Type DEFAULT_BLEND_EQUATION_RGB( BlendEquation::ADD ); -const BlendEquation::Type DEFAULT_BLEND_EQUATION_ALPHA( BlendEquation::ADD ); +const BlendEquation::Type DEFAULT_BLEND_EQUATION_RGB(BlendEquation::ADD); +const BlendEquation::Type DEFAULT_BLEND_EQUATION_ALPHA(BlendEquation::ADD); /** * @brief Get GL stencil test enumeration value as a string. @@ -65,7 +64,7 @@ std::string GetDepthTestString(void) return stream.str(); } -void ResetDebugAndFlush( TestApplication& application, TraceCallStack& glEnableDisableStack, TraceCallStack& glStencilFunctionStack ) +void ResetDebugAndFlush(TestApplication& application, TraceCallStack& glEnableDisableStack, TraceCallStack& glStencilFunctionStack) { glEnableDisableStack.Reset(); glStencilFunctionStack.Reset(); @@ -73,7 +72,7 @@ void ResetDebugAndFlush( TestApplication& application, TraceCallStack& glEnableD application.Render(); } -void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs ) +void TestConstraintNoBlue(Vector4& current, const PropertyInputContainer& inputs) { current.b = 0.0f; } @@ -95,18 +94,18 @@ int UtcDaliRendererNew01(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - DALI_TEST_EQUALS( (bool)renderer, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)renderer, true, TEST_LOCATION); END_TEST; } int UtcDaliRendererNew02(void) { TestApplication application; - Renderer renderer; - DALI_TEST_EQUALS( (bool)renderer, false, TEST_LOCATION ); + Renderer renderer; + DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION); END_TEST; } @@ -115,11 +114,11 @@ int UtcDaliRendererCopyConstructor(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Renderer rendererCopy( renderer ); - DALI_TEST_EQUALS( (bool)rendererCopy, true, TEST_LOCATION ); + Renderer rendererCopy(renderer); + DALI_TEST_EQUALS((bool)rendererCopy, true, TEST_LOCATION); END_TEST; } @@ -129,14 +128,14 @@ int UtcDaliRendererAssignmentOperator(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); Renderer renderer2; - DALI_TEST_EQUALS( (bool)renderer2, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)renderer2, false, TEST_LOCATION); renderer2 = renderer; - DALI_TEST_EQUALS( (bool)renderer2, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION); END_TEST; } @@ -145,22 +144,22 @@ int UtcDaliRendererMoveConstructor(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); - DALI_TEST_CHECK( renderer ); - DALI_TEST_EQUALS( 1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); + DALI_TEST_CHECK(renderer); + DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); - Renderer move = std::move( renderer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_CHECK( !renderer ); + Renderer move = std::move(renderer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_CHECK(!renderer); END_TEST; } @@ -170,23 +169,23 @@ int UtcDaliRendererMoveAssignment(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); - DALI_TEST_CHECK( renderer ); - DALI_TEST_EQUALS( 1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); + DALI_TEST_CHECK(renderer); + DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); Renderer move; - move = std::move( renderer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_CHECK( !renderer ); + move = std::move(renderer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_CHECK(!renderer); END_TEST; } @@ -196,12 +195,12 @@ int UtcDaliRendererDownCast01(void) TestApplication application; Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); BaseHandle handle(renderer); - Renderer renderer2 = Renderer::DownCast(handle); - DALI_TEST_EQUALS( (bool)renderer2, true, TEST_LOCATION ); + Renderer renderer2 = Renderer::DownCast(handle); + DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION); END_TEST; } @@ -209,28 +208,28 @@ int UtcDaliRendererDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object Renderer renderer = Renderer::DownCast(handle); - DALI_TEST_EQUALS( (bool)renderer, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION); END_TEST; } // using a template to auto deduce the parameter types -template< typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8> -void TEST_RENDERER_PROPERTY( P1 renderer, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION ) +template +void TEST_RENDERER_PROPERTY(P1 renderer, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION) { - DALI_TEST_EQUALS( renderer.GetPropertyName( enumName ), stringName, LOCATION ); - DALI_TEST_EQUALS( renderer.GetPropertyIndex( stringName ), static_cast(enumName), LOCATION ); - DALI_TEST_EQUALS( renderer.GetPropertyType( enumName ), type, LOCATION ); - DALI_TEST_EQUALS( renderer.IsPropertyWritable( enumName ), isWriteable, LOCATION ); - DALI_TEST_EQUALS( renderer.IsPropertyAnimatable( enumName ), isAnimateable, LOCATION ); - DALI_TEST_EQUALS( renderer.IsPropertyAConstraintInput( enumName ), isConstraintInput, LOCATION ); + DALI_TEST_EQUALS(renderer.GetPropertyName(enumName), stringName, LOCATION); + DALI_TEST_EQUALS(renderer.GetPropertyIndex(stringName), static_cast(enumName), LOCATION); + DALI_TEST_EQUALS(renderer.GetPropertyType(enumName), type, LOCATION); + DALI_TEST_EQUALS(renderer.IsPropertyWritable(enumName), isWriteable, LOCATION); + DALI_TEST_EQUALS(renderer.IsPropertyAnimatable(enumName), isAnimateable, LOCATION); + DALI_TEST_EQUALS(renderer.IsPropertyAConstraintInput(enumName), isConstraintInput, LOCATION); } int UtcDaliRendererDefaultProperties(void) { TestApplication application; -/* from renderer-impl.cpp + /* from renderer-impl.cpp DALI_PROPERTY( "depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX ) DALI_PROPERTY( "faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE ) DALI_PROPERTY( "blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE ) @@ -260,36 +259,36 @@ int UtcDaliRendererDefaultProperties(void) */ Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - DALI_TEST_EQUALS( renderer.GetPropertyCount(), 26, TEST_LOCATION ); - - TEST_RENDERER_PROPERTY( renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendMode", Property::INTEGER, true, false, false, Renderer::Property::BLEND_MODE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendEquationRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_RGB, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendEquationAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_ALPHA, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendFactorSrcRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_RGB, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendFactorDestRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_RGB, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendFactorSrcAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendFactorDestAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendColor", Property::VECTOR4, true, false, false, Renderer::Property::BLEND_COLOR, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "blendPreMultipliedAlpha", Property::BOOLEAN, true, false, false, Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "indexRangeFirst", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_FIRST, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "indexRangeCount", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_COUNT, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "depthWriteMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_WRITE_MODE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "depthFunction", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_FUNCTION, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "depthTestMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_TEST_MODE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "renderMode", Property::INTEGER, true, false, false, Renderer::Property::RENDER_MODE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilFunction", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilFunctionMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_MASK, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilFunctionReference",Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_REFERENCE, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_MASK, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_FAIL, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnZFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION ); - TEST_RENDERER_PROPERTY( renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetPropertyCount(), 26, TEST_LOCATION); + + TEST_RENDERER_PROPERTY(renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendMode", Property::INTEGER, true, false, false, Renderer::Property::BLEND_MODE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendEquationRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_RGB, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendEquationAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_ALPHA, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendFactorSrcRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_RGB, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendFactorDestRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_RGB, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendFactorSrcAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendFactorDestAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendColor", Property::VECTOR4, true, false, false, Renderer::Property::BLEND_COLOR, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "blendPreMultipliedAlpha", Property::BOOLEAN, true, false, false, Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "indexRangeFirst", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_FIRST, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "indexRangeCount", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_COUNT, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "depthWriteMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_WRITE_MODE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "depthFunction", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_FUNCTION, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "depthTestMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_TEST_MODE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "renderMode", Property::INTEGER, true, false, false, Renderer::Property::RENDER_MODE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilFunction", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilFunctionMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_MASK, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilFunctionReference", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_REFERENCE, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_MASK, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_FAIL, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION); + TEST_RENDERER_PROPERTY(renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION); END_TEST; } @@ -297,28 +296,28 @@ int UtcDaliRendererDefaultProperties(void) int UtcDaliRendererSetGetGeometry(void) { TestApplication application; - tet_infoline( "Test SetGeometry, GetGeometry" ); + tet_infoline("Test SetGeometry, GetGeometry"); Geometry geometry1 = CreateQuadGeometry(); Geometry geometry2 = CreateQuadGeometry(); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry1, shader); - Actor actor = Actor::New(); + Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetGeometry(), geometry1, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetGeometry(), geometry1, TEST_LOCATION); // Set geometry2 to the renderer - renderer.SetGeometry( geometry2 ); + renderer.SetGeometry(geometry2); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetGeometry(), geometry2, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetGeometry(), geometry2, TEST_LOCATION); END_TEST; } @@ -326,22 +325,22 @@ int UtcDaliRendererSetGetGeometry(void) int UtcDaliRendererSetGetShader(void) { TestApplication application; - tet_infoline( "Test SetShader, GetShader" ); + tet_infoline("Test SetShader, GetShader"); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableCullFaceCallTrace(true); Shader shader1 = CreateShader(); - shader1.RegisterProperty( "uFadeColor", Color::RED ); + shader1.RegisterProperty("uFadeColor", Color::RED); Shader shader2 = CreateShader(); - shader2.RegisterProperty( "uFadeColor", Color::GREEN ); + shader2.RegisterProperty("uFadeColor", Color::GREEN); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader1); - Actor actor = Actor::New(); + Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -350,22 +349,22 @@ int UtcDaliRendererSetGetShader(void) // Expect that the first shaders's fade color property is accessed Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::RED, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::RED, TEST_LOCATION); - DALI_TEST_EQUALS( renderer.GetShader(), shader1, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetShader(), shader1, TEST_LOCATION); // set the second shader to the renderer - renderer.SetShader( shader2 ); + renderer.SetShader(shader2); application.SendNotification(); application.Render(0); // Expect that the second shader's fade color property is accessed - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); - DALI_TEST_EQUALS( renderer.GetShader(), shader2, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetShader(), shader2, TEST_LOCATION); END_TEST; } @@ -376,35 +375,35 @@ int UtcDaliRendererSetGetDepthIndex(void) tet_infoline("Test SetDepthIndex, GetDepthIndex"); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Geometry geometry = CreateQuadGeometry(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); + Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 1 ); + renderer.SetProperty(Renderer::Property::DEPTH_INDEX, 1); - DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 10 ); + renderer.SetProperty(Renderer::Property::DEPTH_INDEX, 10); - DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION); END_TEST; } @@ -415,79 +414,79 @@ int UtcDaliRendererSetGetFaceCullingMode(void) tet_infoline("Test SetFaceCullingMode(cullingMode)"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); // By default, none of the faces should be culled - unsigned int cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE ); + unsigned int cullFace = renderer.GetProperty(Renderer::Property::FACE_CULLING_MODE); + DALI_TEST_CHECK(static_cast(cullFace) == FaceCullingMode::NONE); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& cullFaceStack = gl.GetCullFaceTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& cullFaceStack = gl.GetCullFaceTrace(); gl.EnableCullFaceCallTrace(true); { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT_AND_BACK ); + renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT_AND_BACK); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION); std::ostringstream cullModeString; cullModeString << GL_FRONT_AND_BACK; - DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); - cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT_AND_BACK ); + DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str())); + cullFace = renderer.GetProperty(Renderer::Property::FACE_CULLING_MODE); + DALI_TEST_CHECK(static_cast(cullFace) == FaceCullingMode::FRONT_AND_BACK); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); + renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION); std::ostringstream cullModeString; cullModeString << GL_BACK; - DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); - cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::BACK ); + DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str())); + cullFace = renderer.GetProperty(Renderer::Property::FACE_CULLING_MODE); + DALI_TEST_CHECK(static_cast(cullFace) == FaceCullingMode::BACK); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT ); + renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION); std::ostringstream cullModeString; cullModeString << GL_FRONT; - DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); - cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT ); + DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str())); + cullFace = renderer.GetProperty(Renderer::Property::FACE_CULLING_MODE); + DALI_TEST_CHECK(static_cast(cullFace) == FaceCullingMode::FRONT); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE ); + renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 0, TEST_LOCATION ); - cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE ); + DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 0, TEST_LOCATION); + cullFace = renderer.GetProperty(Renderer::Property::FACE_CULLING_MODE); + DALI_TEST_CHECK(static_cast(cullFace) == FaceCullingMode::NONE); } END_TEST; @@ -500,41 +499,41 @@ int UtcDaliRendererBlendOptions01(void) tet_infoline("Test BLEND_FACTOR properties "); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); // set a transparent actor color so that blending is enabled - actor.SetProperty( Actor::Property::OPACITY, 0.5f ); + actor.SetProperty(Actor::Property::OPACITY, 0.5f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE_MINUS_SRC_COLOR ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::SRC_ALPHA_SATURATE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_COLOR ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::SRC_ALPHA_SATURATE ); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE_MINUS_SRC_COLOR); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::SRC_ALPHA_SATURATE); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_COLOR); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::SRC_ALPHA_SATURATE); // Test that Set was successful: - int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + int srcFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB); + int destFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB); + int srcFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA); + int destFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION); application.SendNotification(); application.Render(); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION); END_TEST; } @@ -546,41 +545,41 @@ int UtcDaliRendererBlendOptions02(void) tet_infoline("Test BLEND_FACTOR properties "); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.5f ); // enable blending + actor.SetProperty(Actor::Property::OPACITY, 0.5f); // enable blending actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::CONSTANT_COLOR ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_CONSTANT_COLOR ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::CONSTANT_ALPHA ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_CONSTANT_ALPHA ); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::CONSTANT_COLOR); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_CONSTANT_COLOR); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::CONSTANT_ALPHA); + renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_CONSTANT_ALPHA); // Test that Set was successful: { - int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); - - DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION ); + int srcFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB); + int destFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB); + int srcFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA); + int destFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA); + + DALI_TEST_EQUALS((int)BlendFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION); } application.SendNotification(); application.Render(); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS((GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION); END_TEST; } @@ -592,20 +591,20 @@ int UtcDaliRendererBlendOptions03(void) tet_infoline("Test GetBlendEquation() defaults "); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); // Test the defaults as documented in blending.h - int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); - int equationAlpha = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_ALPHA ); + int equationRgb = renderer.GetProperty(Renderer::Property::BLEND_EQUATION_RGB); + int equationAlpha = renderer.GetProperty(Renderer::Property::BLEND_EQUATION_ALPHA); - DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS((int)BlendEquation::ADD, equationRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendEquation::ADD, equationAlpha, TEST_LOCATION); END_TEST; } @@ -617,31 +616,31 @@ int UtcDaliRendererBlendOptions04(void) tet_infoline("Test SetBlendEquation() "); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.1f ); + actor.SetProperty(Actor::Property::OPACITY, 0.1f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); // Test the single blending equation setting { - renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT ); - int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); - DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); + renderer.SetProperty(Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT); + int equationRgb = renderer.GetProperty(Renderer::Property::BLEND_EQUATION_RGB); + DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION); } - renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT ); - renderer.SetProperty( Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::REVERSE_SUBTRACT ); + renderer.SetProperty(Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT); + renderer.SetProperty(Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::REVERSE_SUBTRACT); // Test that Set was successful { - int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); - int equationAlpha = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_ALPHA ); - DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION ); + int equationRgb = renderer.GetProperty(Renderer::Property::BLEND_EQUATION_RGB); + int equationAlpha = renderer.GetProperty(Renderer::Property::BLEND_EQUATION_ALPHA); + DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION); } // Render & check GL commands @@ -649,8 +648,8 @@ int UtcDaliRendererBlendOptions04(void) application.Render(); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS((GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION); + DALI_TEST_EQUALS((GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION); END_TEST; } @@ -662,16 +661,16 @@ int UtcDaliRendererSetBlendMode01(void) tet_infoline("Test setting the blend mode to on with an opaque color renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.98f ); + actor.SetProperty(Actor::Property::OPACITY, 0.98f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -679,10 +678,10 @@ int UtcDaliRendererSetBlendMode01(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -694,30 +693,30 @@ int UtcDaliRendererSetBlendMode01b(void) tet_infoline("Test setting the blend mode to on with an transparent color renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.0f ); + actor.SetProperty(Actor::Property::OPACITY, 0.0f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); - glAbstraction.EnableDrawCallTrace( true ); + glAbstraction.EnableDrawCallTrace(true); application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( !glEnableStack.FindMethod( "Enable" ) ); + DALI_TEST_CHECK(!glEnableStack.FindMethod("Enable")); - DALI_TEST_CHECK( !glAbstraction.GetDrawTrace().FindMethod( "DrawElements" ) ); + DALI_TEST_CHECK(!glAbstraction.GetDrawTrace().FindMethod("DrawElements")); END_TEST; } @@ -729,16 +728,16 @@ int UtcDaliRendererSetBlendMode02(void) tet_infoline("Test setting the blend mode to off with a transparent color renders with blending disabled (and not enabled)"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.15f ); + actor.SetProperty(Actor::Property::OPACITY, 0.15f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::OFF); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -746,10 +745,10 @@ int UtcDaliRendererSetBlendMode02(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -761,16 +760,16 @@ int UtcDaliRendererSetBlendMode03(void) tet_infoline("Test setting the blend mode to auto with a transparent color renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::OPACITY, 0.75f ); + actor.SetProperty(Actor::Property::OPACITY, 0.75f); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -778,10 +777,10 @@ int UtcDaliRendererSetBlendMode03(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -793,15 +792,15 @@ int UtcDaliRendererSetBlendMode04(void) tet_infoline("Test setting the blend mode to auto with an opaque color renders with blending disabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -809,10 +808,10 @@ int UtcDaliRendererSetBlendMode04(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -824,16 +823,16 @@ int UtcDaliRendererSetBlendMode04b(void) tet_infoline("Test setting the blend mode to auto with a transparent actor color renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -841,10 +840,10 @@ int UtcDaliRendererSetBlendMode04b(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -856,16 +855,16 @@ int UtcDaliRendererSetBlendMode04c(void) tet_infoline("Test setting the blend mode to auto with an opaque opaque actor color renders with blending disabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Color::MAGENTA ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Color::MAGENTA); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -873,10 +872,10 @@ int UtcDaliRendererSetBlendMode04c(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -888,19 +887,19 @@ int UtcDaliRendererSetBlendMode05(void) tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40); - Shader shader = CreateShader(); - TextureSet textureSet = CreateTextureSet( image ); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Shader shader = CreateShader(); + TextureSet textureSet = CreateTextureSet(image); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -908,10 +907,10 @@ int UtcDaliRendererSetBlendMode05(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -922,16 +921,16 @@ int UtcDaliRendererSetBlendMode06(void) tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_TRANSPARENT renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::Hint::OUTPUT_IS_TRANSPARENT ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc", Shader::Hint::OUTPUT_IS_TRANSPARENT); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -939,10 +938,10 @@ int UtcDaliRendererSetBlendMode06(void) application.SendNotification(); application.Render(); - TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); std::ostringstream blendStr; blendStr << GL_BLEND; - DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str())); END_TEST; } @@ -953,19 +952,19 @@ int UtcDaliRendererSetBlendMode07(void) tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 50, 50); - TextureSet textureSet = CreateTextureSet( image ); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 50, 50); + TextureSet textureSet = CreateTextureSet(image); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -974,7 +973,7 @@ int UtcDaliRendererSetBlendMode07(void) application.Render(); TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); - DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", "GL_BLEND" ) ); + DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", "GL_BLEND")); END_TEST; } @@ -986,22 +985,22 @@ int UtcDaliRendererGetBlendMode(void) tet_infoline("Test GetBlendMode()"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); // default value - unsigned int mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::AUTO, TEST_LOCATION ); + unsigned int mode = renderer.GetProperty(Renderer::Property::BLEND_MODE); + DALI_TEST_EQUALS(static_cast(mode), BlendMode::AUTO, TEST_LOCATION); // ON - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::ON, TEST_LOCATION ); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); + mode = renderer.GetProperty(Renderer::Property::BLEND_MODE); + DALI_TEST_EQUALS(static_cast(mode), BlendMode::ON, TEST_LOCATION); // OFF - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF ); - mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::OFF, TEST_LOCATION ); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::OFF); + mode = renderer.GetProperty(Renderer::Property::BLEND_MODE); + DALI_TEST_EQUALS(static_cast(mode), BlendMode::OFF, TEST_LOCATION); END_TEST; } @@ -1012,46 +1011,46 @@ int UtcDaliRendererSetBlendColor(void) tet_infoline("Test SetBlendColor(color)"); - Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); + Geometry geometry = CreateQuadGeometry(); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); TextureSet textureSet = TextureSet::New(); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50); textureSet.SetTexture(0u, image); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::TRANSPARENT ); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::TRANSPARENT); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); + DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA); - DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION); - Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f ); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, color ); + Vector4 color(0.1f, 0.2f, 0.3f, 0.4f); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, color); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), color, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), color, TEST_LOCATION); END_TEST; } @@ -1063,21 +1062,21 @@ int UtcDaliRendererGetBlendColor(void) tet_infoline("Test GetBlendColor()"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION); - Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f ); - renderer.SetProperty( Renderer::Property::BLEND_COLOR, color ); + Vector4 color(0.1f, 0.2f, 0.3f, 0.4f); + renderer.SetProperty(Renderer::Property::BLEND_COLOR, color); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), color, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(Renderer::Property::BLEND_COLOR), color, TEST_LOCATION); END_TEST; } @@ -1089,91 +1088,91 @@ int UtcDaliRendererPreMultipledAlpha(void) tet_infoline("Test BLEND_PRE_MULTIPLIED_ALPHA property"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f)); application.GetScene().Add(actor); - Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - bool preMultipliedAlpha; - DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); - DALI_TEST_CHECK( !preMultipliedAlpha ); + Property::Value value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA); + bool preMultipliedAlpha; + DALI_TEST_CHECK(value.Get(preMultipliedAlpha)); + DALI_TEST_CHECK(!preMultipliedAlpha); - int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + int srcFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB); + int destFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB); + int srcFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA); + int destFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA); - DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_RGB, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_RGB, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_ALPHA, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_ALPHA, destFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_SRC_RGB, srcFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_DEST_RGB, destFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_SRC_ALPHA, srcFactorAlpha, TEST_LOCATION); + DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_DEST_ALPHA, destFactorAlpha, TEST_LOCATION); application.SendNotification(); application.Render(); - Vector4 actualValue(Vector4::ZERO); + Vector4 actualValue(Vector4::ZERO); TestGlAbstraction& gl = application.GetGlAbstraction(); - DALI_TEST_CHECK( gl.GetUniformValue( "uColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION); // Enable pre-multiplied alpha - renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true ); + renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true); application.SendNotification(); application.Render(); - value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); - DALI_TEST_CHECK( preMultipliedAlpha ); + value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA); + DALI_TEST_CHECK(value.Get(preMultipliedAlpha)); + DALI_TEST_CHECK(preMultipliedAlpha); - value = renderer.GetCurrentProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); - DALI_TEST_CHECK( preMultipliedAlpha ); + value = renderer.GetCurrentProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA); + DALI_TEST_CHECK(value.Get(preMultipliedAlpha)); + DALI_TEST_CHECK(preMultipliedAlpha); - srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + srcFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB); + destFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB); + srcFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA); + destFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA); - DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION); - DALI_TEST_CHECK( gl.GetUniformValue( "uColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Vector4(0.5f, 0.0f, 0.5f, 0.5f), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Vector4(0.5f, 0.0f, 0.5f, 0.5f), TEST_LOCATION); // Disable pre-multiplied alpha again - renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, false ); + renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, false); application.SendNotification(); application.Render(); - value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); - DALI_TEST_CHECK( !preMultipliedAlpha ); + value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA); + DALI_TEST_CHECK(value.Get(preMultipliedAlpha)); + DALI_TEST_CHECK(!preMultipliedAlpha); - value = renderer.GetCurrentProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA ); - DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); - DALI_TEST_CHECK( !preMultipliedAlpha ); + value = renderer.GetCurrentProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA); + DALI_TEST_CHECK(value.Get(preMultipliedAlpha)); + DALI_TEST_CHECK(!preMultipliedAlpha); - srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); - destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); - srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); - destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + srcFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB); + destFactorRgb = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB); + srcFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA); + destFactorAlpha = renderer.GetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA); - DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA, srcFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION); + DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION); - DALI_TEST_CHECK( gl.GetUniformValue( "uColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Vector4( 1.0f, 0.0f, 1.0f, 0.5f ), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION); END_TEST; } @@ -1184,38 +1183,38 @@ int UtcDaliRendererConstraint01(void) tet_infoline("Test that a non-uniform renderer property can be constrained"); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetProperty(colorIndex), initialColor, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(colorIndex), initialColor, TEST_LOCATION); // Apply constraint - Constraint constraint = Constraint::New( renderer, colorIndex, TestConstraintNoBlue ); + Constraint constraint = Constraint::New(renderer, colorIndex, TestConstraintNoBlue); constraint.Apply(); application.SendNotification(); application.Render(0); // Expect no blue component in either buffer - yellow - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(colorIndex), Color::YELLOW, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(colorIndex), Color::YELLOW, TEST_LOCATION); renderer.RemoveConstraints(); - renderer.SetProperty(colorIndex, Color::WHITE ); + renderer.SetProperty(colorIndex, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(colorIndex), Color::WHITE, TEST_LOCATION); END_TEST; } @@ -1226,19 +1225,19 @@ int UtcDaliRendererConstraint02(void) tet_infoline("Test that a uniform map renderer property can be constrained"); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1246,30 +1245,30 @@ int UtcDaliRendererConstraint02(void) application.Render(0); Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION); // Apply constraint - Constraint constraint = Constraint::New( renderer, colorIndex, TestConstraintNoBlue ); + Constraint constraint = Constraint::New(renderer, colorIndex, TestConstraintNoBlue); constraint.Apply(); application.SendNotification(); application.Render(0); - // Expect no blue component in either buffer - yellow - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION ); + // Expect no blue component in either buffer - yellow + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION); application.Render(0); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION); renderer.RemoveConstraints(); - renderer.SetProperty(colorIndex, Color::WHITE ); + renderer.SetProperty(colorIndex, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::WHITE, TEST_LOCATION); END_TEST; } @@ -1280,37 +1279,37 @@ int UtcDaliRendererAnimatedProperty01(void) tet_infoline("Test that a non-uniform renderer property can be animated"); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( renderer.GetProperty(colorIndex), initialColor, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetProperty(colorIndex), initialColor, TEST_LOCATION); - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, initialColor); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( renderer, colorIndex ), keyFrames ); + animation.AnimateBetween(Property(renderer, colorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION); application.Render(500); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS(renderer.GetCurrentProperty(colorIndex), Color::TRANSPARENT, TEST_LOCATION); END_TEST; } @@ -1321,19 +1320,19 @@ int UtcDaliRendererAnimatedProperty02(void) tet_infoline("Test that a uniform map renderer property can be animated"); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1341,25 +1340,25 @@ int UtcDaliRendererAnimatedProperty02(void) application.Render(0); Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION); - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, initialColor); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( renderer, colorIndex ), keyFrames ); + animation.AnimateBetween(Property(renderer, colorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::WHITE * 0.5f, TEST_LOCATION); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION); END_TEST; } @@ -1372,23 +1371,23 @@ int UtcDaliRendererUniformMapPrecendence01(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = Shader::New("VertexSource", "FragmentSource"); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = Shader::New("VertexSource", "FragmentSource"); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - renderer.RegisterProperty( "uFadeColor", Color::RED ); - actor.RegisterProperty( "uFadeColor", Color::GREEN ); - Property::Index shaderFadeColorIndex = shader.RegisterProperty( "uFadeColor", Color::MAGENTA ); + renderer.RegisterProperty("uFadeColor", Color::RED); + actor.RegisterProperty("uFadeColor", Color::GREEN); + Property::Index shaderFadeColorIndex = shader.RegisterProperty("uFadeColor", Color::MAGENTA); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1397,26 +1396,26 @@ int UtcDaliRendererUniformMapPrecendence01(void) // Expect that the actor's fade color property is accessed Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); // Animate shader's fade color property. Should be no change to uniform - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, Color::WHITE); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( shader, shaderFadeColorIndex ), keyFrames ); + animation.AnimateBetween(Property(shader, shaderFadeColorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); END_TEST; } @@ -1429,23 +1428,23 @@ int UtcDaliRendererUniformMapPrecendence02(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = Shader::New("VertexSource", "FragmentSource"); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = Shader::New("VertexSource", "FragmentSource"); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); // Don't add property / uniform map to renderer - actor.RegisterProperty( "uFadeColor", Color::GREEN ); - Property::Index shaderFadeColorIndex = shader.RegisterProperty( "uFadeColor", Color::BLUE ); + actor.RegisterProperty("uFadeColor", Color::GREEN); + Property::Index shaderFadeColorIndex = shader.RegisterProperty("uFadeColor", Color::BLUE); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1454,31 +1453,30 @@ int UtcDaliRendererUniformMapPrecendence02(void) // Expect that the actor's fade color property is accessed Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); // Animate texture set's fade color property. Should be no change to uniform - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, Color::WHITE); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( shader, shaderFadeColorIndex ), keyFrames ); + animation.AnimateBetween(Property(shader, shaderFadeColorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION); END_TEST; } - int UtcDaliRendererUniformMapPrecendence03(void) { TestApplication application; @@ -1487,22 +1485,22 @@ int UtcDaliRendererUniformMapPrecendence03(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = Shader::New("VertexSource", "FragmentSource"); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = Shader::New("VertexSource", "FragmentSource"); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); // Don't add property / uniform map to renderer or actor - shader.RegisterProperty( "uFadeColor", Color::BLACK ); + shader.RegisterProperty("uFadeColor", Color::BLACK); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1511,8 +1509,8 @@ int UtcDaliRendererUniformMapPrecendence03(void) // Expect that the shader's fade color property is accessed Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::BLACK, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::BLACK, TEST_LOCATION); END_TEST; } @@ -1525,23 +1523,23 @@ int UtcDaliRendererUniformMapMultipleUniforms01(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = Shader::New("VertexSource", "FragmentSource"); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = Shader::New("VertexSource", "FragmentSource"); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - renderer.RegisterProperty( "uUniform1", Color::RED ); - actor.RegisterProperty( "uUniform2", Color::GREEN ); - shader.RegisterProperty( "uUniform3", Color::MAGENTA ); + renderer.RegisterProperty("uUniform1", Color::RED); + actor.RegisterProperty("uUniform2", Color::GREEN); + shader.RegisterProperty("uUniform3", Color::MAGENTA); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1550,16 +1548,16 @@ int UtcDaliRendererUniformMapMultipleUniforms01(void) // Expect that each of the object's uniforms are set Vector4 uniform1Value(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uUniform1", uniform1Value ) ); - DALI_TEST_EQUALS( uniform1Value, Color::RED, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uUniform1", uniform1Value)); + DALI_TEST_EQUALS(uniform1Value, Color::RED, TEST_LOCATION); Vector4 uniform2Value(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uUniform2", uniform2Value ) ); - DALI_TEST_EQUALS( uniform2Value, Color::GREEN, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uUniform2", uniform2Value)); + DALI_TEST_EQUALS(uniform2Value, Color::GREEN, TEST_LOCATION); Vector4 uniform3Value(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uUniform3", uniform3Value ) ); - DALI_TEST_EQUALS( uniform3Value, Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uUniform3", uniform3Value)); + DALI_TEST_EQUALS(uniform3Value, Color::MAGENTA, TEST_LOCATION); END_TEST; } @@ -1572,28 +1570,28 @@ int UtcDaliRendererUniformMapMultipleUniforms02(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = Shader::New("VertexSource", "FragmentSource"); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = Shader::New("VertexSource", "FragmentSource"); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); Property::Value value1(Color::RED); - renderer.RegisterProperty( "uFadeColor", value1 ); + renderer.RegisterProperty("uFadeColor", value1); Property::Value value2(1.0f); - actor.RegisterProperty( "uFadeProgress", value2 ); + actor.RegisterProperty("uFadeProgress", value2); Property::Value value3(Matrix3::IDENTITY); - shader.RegisterProperty( "uANormalMatrix", value3 ); + shader.RegisterProperty("uANormalMatrix", value3); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -1602,43 +1600,41 @@ int UtcDaliRendererUniformMapMultipleUniforms02(void) // Expect that each of the object's uniforms are set Vector4 uniform1Value(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", uniform1Value ) ); - DALI_TEST_EQUALS( uniform1Value, value1.Get(), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", uniform1Value)); + DALI_TEST_EQUALS(uniform1Value, value1.Get(), TEST_LOCATION); float uniform2Value(0.0f); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeProgress", uniform2Value ) ); - DALI_TEST_EQUALS( uniform2Value, value2.Get(), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeProgress", uniform2Value)); + DALI_TEST_EQUALS(uniform2Value, value2.Get(), TEST_LOCATION); Matrix3 uniform3Value; - DALI_TEST_CHECK( gl.GetUniformValue( "uANormalMatrix", uniform3Value ) ); - DALI_TEST_EQUALS( uniform3Value, value3.Get(), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uANormalMatrix", uniform3Value)); + DALI_TEST_EQUALS(uniform3Value, value3.Get(), TEST_LOCATION); END_TEST; } - -Renderer CreateRenderer( Actor actor, Geometry geometry, Shader shader, int depthIndex ) +Renderer CreateRenderer(Actor actor, Geometry geometry, Shader shader, int depthIndex) { - Texture image0 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64); - TextureSet textureSet0 = CreateTextureSet( image0 ); - Renderer renderer0 = Renderer::New( geometry, shader ); - renderer0.SetTextures( textureSet0 ); - renderer0.SetProperty( Renderer::Property::DEPTH_INDEX, depthIndex ); + Texture image0 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64); + TextureSet textureSet0 = CreateTextureSet(image0); + Renderer renderer0 = Renderer::New(geometry, shader); + renderer0.SetTextures(textureSet0); + renderer0.SetProperty(Renderer::Property::DEPTH_INDEX, depthIndex); actor.AddRenderer(renderer0); return renderer0; } - -Actor CreateActor( Actor parent, int siblingOrder, const char* location ) +Actor CreateActor(Actor parent, int siblingOrder, const char* location) { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - actor.SetProperty( Actor::Property::PARENT_ORIGIN,AnchorPoint::CENTER); - actor.SetProperty( Actor::Property::POSITION, Vector2(0.0f,0.0f)); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); parent.Add(actor); - actor.SetProperty( Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder ); - DALI_TEST_EQUALS( actor.GetProperty( Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location) ); + actor.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder); + DALI_TEST_EQUALS(actor.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location)); return actor; } @@ -1648,22 +1644,22 @@ int UtcDaliRendererRenderOrder2DLayer(void) TestApplication application; tet_infoline("Test the rendering order in a 2D layer is correct"); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); Actor root = application.GetScene().GetRootLayer(); - Actor actor0 = CreateActor( root, 0, TEST_LOCATION ); - Renderer renderer0 = CreateRenderer( actor0, geometry, shader, 0 ); + Actor actor0 = CreateActor(root, 0, TEST_LOCATION); + Renderer renderer0 = CreateRenderer(actor0, geometry, shader, 0); - Actor actor1 = CreateActor( root, 0, TEST_LOCATION ); - Renderer renderer1 = CreateRenderer( actor1, geometry, shader, 0 ); + Actor actor1 = CreateActor(root, 0, TEST_LOCATION); + Renderer renderer1 = CreateRenderer(actor1, geometry, shader, 0); - Actor actor2 = CreateActor( root, 0, TEST_LOCATION ); - Renderer renderer2 = CreateRenderer( actor2, geometry, shader, 0 ); + Actor actor2 = CreateActor(root, 0, TEST_LOCATION); + Renderer renderer2 = CreateRenderer(actor2, geometry, shader, 0); - Actor actor3 = CreateActor( root, 0, TEST_LOCATION ); - Renderer renderer3 = CreateRenderer( actor3, geometry, shader, 0 ); + Actor actor3 = CreateActor(root, 0, TEST_LOCATION); + Renderer renderer3 = CreateRenderer(actor3, geometry, shader, 0); application.SendNotification(); application.Render(0); @@ -1696,21 +1692,21 @@ int UtcDaliRendererRenderOrder2DLayer(void) application.Render(0); int textureBindIndex[4]; - for( unsigned int i(0); i<4; ++i ) + for(unsigned int i(0); i < 4; ++i) { std::stringstream params; - params << GL_TEXTURE_2D<<", "< -void CheckEnumerationProperty( TestApplication& application, Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString ) +template +void CheckEnumerationProperty(TestApplication& application, Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString) { application.SendNotification(); application.Render(); - DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( initialValue ) ); - DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast( initialValue ) ); - renderer.SetProperty( propertyIndex, firstCheckEnumeration ); - DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( firstCheckEnumeration ) ); - DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast( firstCheckEnumeration ) ); + DALI_TEST_CHECK(renderer.GetProperty(propertyIndex) == static_cast(initialValue)); + DALI_TEST_CHECK(renderer.GetCurrentProperty(propertyIndex) == static_cast(initialValue)); + renderer.SetProperty(propertyIndex, firstCheckEnumeration); + DALI_TEST_CHECK(renderer.GetProperty(propertyIndex) == static_cast(firstCheckEnumeration)); + DALI_TEST_CHECK(renderer.GetCurrentProperty(propertyIndex) != static_cast(firstCheckEnumeration)); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( firstCheckEnumeration ) ); - DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast( firstCheckEnumeration ) ); + DALI_TEST_CHECK(renderer.GetProperty(propertyIndex) == static_cast(firstCheckEnumeration)); + DALI_TEST_CHECK(renderer.GetCurrentProperty(propertyIndex) == static_cast(firstCheckEnumeration)); - renderer.SetProperty( propertyIndex, secondCheckString ); - DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( secondCheckEnumeration ) ); - DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast( secondCheckEnumeration ) ); + renderer.SetProperty(propertyIndex, secondCheckString); + DALI_TEST_CHECK(renderer.GetProperty(propertyIndex) == static_cast(secondCheckEnumeration)); + DALI_TEST_CHECK(renderer.GetCurrentProperty(propertyIndex) != static_cast(secondCheckEnumeration)); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( secondCheckEnumeration ) ); - DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast( secondCheckEnumeration ) ); + DALI_TEST_CHECK(renderer.GetProperty(propertyIndex) == static_cast(secondCheckEnumeration)); + DALI_TEST_CHECK(renderer.GetCurrentProperty(propertyIndex) == static_cast(secondCheckEnumeration)); } int UtcDaliRendererEnumProperties(void) { TestApplication application; - tet_infoline( "Test Renderer enumeration properties can be set with both integer and string values" ); + tet_infoline("Test Renderer enumeration properties can be set with both integer and string values"); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); /* @@ -2313,38 +2324,38 @@ int UtcDaliRendererEnumProperties(void) * @see CheckEnumerationProperty for details of the checks performed. */ - CheckEnumerationProperty< FaceCullingMode::Type >( application, renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK" ); - CheckEnumerationProperty< BlendMode::Type >( application, renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON" ); - CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" ); - CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" ); - CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); - CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); - CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR" ); - CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); - CheckEnumerationProperty< DepthWriteMode::Type >( application, renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON" ); - CheckEnumerationProperty< DepthFunction::Type >( application, renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER" ); - CheckEnumerationProperty< DepthTestMode::Type >( application, renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON" ); - CheckEnumerationProperty< StencilFunction::Type >( application, renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL" ); - CheckEnumerationProperty< RenderMode::Type >( application, renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL" ); - CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); - CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); - CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); + CheckEnumerationProperty(application, renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR"); + CheckEnumerationProperty(application, renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR"); + CheckEnumerationProperty(application, renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON"); + CheckEnumerationProperty(application, renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER"); + CheckEnumerationProperty(application, renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON"); + CheckEnumerationProperty(application, renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL"); + CheckEnumerationProperty(application, renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL"); + CheckEnumerationProperty(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT"); + CheckEnumerationProperty(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT"); + CheckEnumerationProperty(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT"); END_TEST; } -Renderer RendererTestFixture( TestApplication& application ) +Renderer RendererTestFixture(TestApplication& application) { Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); Integration::Scene scene = application.GetScene(); - scene.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); - scene.Add( actor ); + scene.GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D); + scene.Add(actor); return renderer; } @@ -2354,9 +2365,9 @@ int UtcDaliRendererSetDepthTestMode(void) TestApplication application; tet_infoline("Test setting the DepthTestMode"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); + glAbstraction.EnableEnableDisableCallTrace(true); TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); glEnableDisableStack.Reset(); @@ -2364,52 +2375,52 @@ int UtcDaliRendererSetDepthTestMode(void) application.Render(); // Check depth-test is enabled by default. - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) ); - DALI_TEST_CHECK( !glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString())); + DALI_TEST_CHECK(!glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString())); // Turn off depth-testing. We want to check if the depth buffer has been disabled, so we need to turn off depth-write as well for this case. - renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::OFF ); - renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF ); + renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::OFF); + renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF); glEnableDisableStack.Reset(); application.SendNotification(); application.Render(); // Check the depth buffer was disabled. - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString())); // Turn on automatic mode depth-testing. // Layer behavior is currently set to LAYER_3D so AUTO should enable depth-testing. - renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO ); + renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO); glEnableDisableStack.Reset(); application.SendNotification(); application.Render(); // Check depth-test is now enabled. - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) ); - DALI_TEST_CHECK( !glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString())); + DALI_TEST_CHECK(!glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString())); // Change the layer behavior to LAYER_UI. // Note this will also disable depth testing for the layer by default, we test this first. - application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI ); + application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI); glEnableDisableStack.Reset(); application.SendNotification(); application.Render(); // Check depth-test is disabled. - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString())); // Turn the layer depth-test flag back on, and confirm that depth testing is now on. - application.GetScene().GetRootLayer().SetProperty(Layer::Property::DEPTH_TEST, true ); + application.GetScene().GetRootLayer().SetProperty(Layer::Property::DEPTH_TEST, true); glEnableDisableStack.Reset(); application.SendNotification(); application.Render(); // Check depth-test is *still* disabled. - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString())); END_TEST; } @@ -2419,43 +2430,43 @@ int UtcDaliRendererSetDepthWriteMode(void) TestApplication application; tet_infoline("Test setting the DepthWriteMode"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); application.SendNotification(); application.Render(); // Check the default depth-write status first. - DALI_TEST_CHECK( glAbstraction.GetLastDepthMask() ); + DALI_TEST_CHECK(glAbstraction.GetLastDepthMask()); // Turn off depth-writing. - renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF ); + renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF); application.SendNotification(); application.Render(); // Check depth-write is now disabled. - DALI_TEST_CHECK( !glAbstraction.GetLastDepthMask() ); + DALI_TEST_CHECK(!glAbstraction.GetLastDepthMask()); // Test the AUTO mode for depth-writing. // As our renderer is opaque, depth-testing should be enabled. - renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO ); + renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO); application.SendNotification(); application.Render(); // Check depth-write is now enabled. - DALI_TEST_CHECK( glAbstraction.GetLastDepthMask() ); + DALI_TEST_CHECK(glAbstraction.GetLastDepthMask()); // Now make the renderer be treated as translucent by enabling blending. // The AUTO depth-write mode should turn depth-write off in this scenario. - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); + renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); application.SendNotification(); application.Render(); // Check depth-write is now disabled. - DALI_TEST_CHECK( !glAbstraction.GetLastDepthMask() ); + DALI_TEST_CHECK(!glAbstraction.GetLastDepthMask()); END_TEST; } @@ -2465,23 +2476,23 @@ int UtcDaliRendererCheckStencilDefaults(void) TestApplication application; tet_infoline("Test the stencil defaults"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); - glAbstraction.EnableStencilFunctionCallTrace( true ); - TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); + glAbstraction.EnableEnableDisableCallTrace(true); + glAbstraction.EnableStencilFunctionCallTrace(true); + TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace(); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); // Check the defaults: - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get() ), static_cast( StencilFunction::ALWAYS ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get() ), 0xFF, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get() ), 0x00, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get() ), 0xFF, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL ).Get() ), static_cast( StencilOperation::KEEP ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL ).Get() ), static_cast( StencilOperation::KEEP ), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS ).Get() ), static_cast( StencilOperation::KEEP ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get()), static_cast(StencilFunction::ALWAYS), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get()), 0xFF, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get()), 0x00, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get()), 0xFF, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL).Get()), static_cast(StencilOperation::KEEP), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL).Get()), static_cast(StencilOperation::KEEP), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS).Get()), static_cast(StencilOperation::KEEP), TEST_LOCATION); END_TEST; } @@ -2491,72 +2502,72 @@ int UtcDaliRendererSetRenderModeToUseStencilBuffer(void) TestApplication application; tet_infoline("Test setting the RenderMode to use the stencil buffer"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); - glAbstraction.EnableStencilFunctionCallTrace( true ); - TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); + glAbstraction.EnableEnableDisableCallTrace(true); + glAbstraction.EnableStencilFunctionCallTrace(true); + TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace(); // Set the StencilFunction to something other than the default, to confirm it is set as a property, // but NO GL call has been made while the RenderMode is set to not use the stencil buffer. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::NONE ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::NONE); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::NEVER ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get() ), static_cast( StencilFunction::NEVER ), TEST_LOCATION ); + renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, StencilFunction::NEVER); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get()), static_cast(StencilFunction::NEVER), TEST_LOCATION); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); - std::string methodString( "StencilFunc" ); - DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); + std::string methodString("StencilFunc"); + DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString)); // Test the other RenderModes that will not enable the stencil buffer. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::AUTO ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); - DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::AUTO); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); + DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString)); - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); - DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); + DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString)); // Now set the RenderMode to modes that will use the stencil buffer, and check the StencilFunction has changed. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) ); - DALI_TEST_CHECK( glStencilFunctionStack.FindMethod( methodString ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetStencilTestString())); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethod(methodString)); // Test the COLOR_STENCIL RenderMode as it also enables the stencil buffer. // First set a mode to turn off the stencil buffer, so the enable is required. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL); // Set a different stencil function as the last one is cached. - renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) ); - DALI_TEST_CHECK( glStencilFunctionStack.FindMethod( methodString ) ); + DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetStencilTestString())); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethod(methodString)); END_TEST; } // Helper function for the SetRenderModeToUseColorBuffer test. -void CheckRenderModeColorMask( TestApplication& application, Renderer& renderer, RenderMode::Type renderMode, bool expectedValue ) +void CheckRenderModeColorMask(TestApplication& application, Renderer& renderer, RenderMode::Type renderMode, bool expectedValue) { // Set the RenderMode property to a value that should not allow color buffer writes. - renderer.SetProperty( Renderer::Property::RENDER_MODE, renderMode ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, renderMode); application.SendNotification(); application.Render(); // Check if ColorMask has been called, and that the values are correct. - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - const TestGlAbstraction::ColorMaskParams& colorMaskParams( glAbstraction.GetColorMaskParams() ); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + const TestGlAbstraction::ColorMaskParams& colorMaskParams(glAbstraction.GetColorMaskParams()); - DALI_TEST_EQUALS( colorMaskParams.red, expectedValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.green, expectedValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.blue, expectedValue, TEST_LOCATION ); - DALI_TEST_EQUALS( colorMaskParams.alpha, expectedValue, TEST_LOCATION ); + DALI_TEST_EQUALS(colorMaskParams.red, expectedValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.green, expectedValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.blue, expectedValue, TEST_LOCATION); + DALI_TEST_EQUALS(colorMaskParams.alpha, expectedValue, TEST_LOCATION); } int UtcDaliRendererSetRenderModeToUseColorBuffer(void) @@ -2564,15 +2575,15 @@ int UtcDaliRendererSetRenderModeToUseColorBuffer(void) TestApplication application; tet_infoline("Test setting the RenderMode to use the color buffer"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); // Set the RenderMode property to a value that should not allow color buffer writes. // Then check if ColorMask has been called, and that the values are correct. - CheckRenderModeColorMask( application, renderer, RenderMode::AUTO, true ); - CheckRenderModeColorMask( application, renderer, RenderMode::NONE, false ); - CheckRenderModeColorMask( application, renderer, RenderMode::COLOR, true ); - CheckRenderModeColorMask( application, renderer, RenderMode::STENCIL, false ); - CheckRenderModeColorMask( application, renderer, RenderMode::COLOR_STENCIL, true ); + CheckRenderModeColorMask(application, renderer, RenderMode::AUTO, true); + CheckRenderModeColorMask(application, renderer, RenderMode::NONE, false); + CheckRenderModeColorMask(application, renderer, RenderMode::COLOR, true); + CheckRenderModeColorMask(application, renderer, RenderMode::STENCIL, false); + CheckRenderModeColorMask(application, renderer, RenderMode::COLOR_STENCIL, true); END_TEST; } @@ -2582,31 +2593,31 @@ int UtcDaliRendererSetStencilFunction(void) TestApplication application; tet_infoline("Test setting the StencilFunction"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); - glAbstraction.EnableStencilFunctionCallTrace( true ); - TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); + glAbstraction.EnableEnableDisableCallTrace(true); + glAbstraction.EnableStencilFunctionCallTrace(true); + TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace(); // RenderMode must use the stencil for StencilFunction to operate. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); /* * Lookup table for testing StencilFunction. * Note: This MUST be in the same order as the Dali::StencilFunction enum. */ const int StencilFunctionLookupTable[] = { - GL_NEVER, - GL_LESS, - GL_EQUAL, - GL_LEQUAL, - GL_GREATER, - GL_NOTEQUAL, - GL_GEQUAL, - GL_ALWAYS - }; const int StencilFunctionLookupTableCount = sizeof( StencilFunctionLookupTable ) / sizeof( StencilFunctionLookupTable[0] ); + GL_NEVER, + GL_LESS, + GL_EQUAL, + GL_LEQUAL, + GL_GREATER, + GL_NOTEQUAL, + GL_GEQUAL, + GL_ALWAYS}; + const int StencilFunctionLookupTableCount = sizeof(StencilFunctionLookupTable) / sizeof(StencilFunctionLookupTable[0]); /* * Loop through all types of StencilFunction, checking: @@ -2615,58 +2626,57 @@ int UtcDaliRendererSetStencilFunction(void) * - Checks the correct parameters to "glStencilFunc" were used */ std::string nonChangingParameters = "0, 255"; - std::string methodString( "StencilFunc" ); - for( int i = 0; i < StencilFunctionLookupTableCount; ++i ) + std::string methodString("StencilFunc"); + for(int i = 0; i < StencilFunctionLookupTableCount; ++i) { // Set the property. - renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, static_cast( i ) ); + renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, static_cast(i)); // Check GetProperty returns the same value. - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get() ), i, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get()), i, TEST_LOCATION); // Reset the trace debug. - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); // Check the function is called and the parameters are correct. std::stringstream parameterStream; - parameterStream << StencilFunctionLookupTable[ i ] << ", " << nonChangingParameters; + parameterStream << StencilFunctionLookupTable[i] << ", " << nonChangingParameters; - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) ); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str())); } // Change the Function Reference only and check the behavior is correct: // 170 is 0xaa in hex / 10101010 in binary (every other bit set). int testValueReference = 170; - renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, testValueReference ); + renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE, testValueReference); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get() ), testValueReference, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get()), testValueReference, TEST_LOCATION); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_EQUALS( static_cast( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get() ), testValueReference, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetCurrentProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get()), testValueReference, TEST_LOCATION); std::stringstream parameterStream; - parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", 255"; - - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) ); + parameterStream << StencilFunctionLookupTable[StencilOperation::DECREMENT_WRAP] << ", " << testValueReference << ", 255"; + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str())); // Change the Function Mask only and check the behavior is correct: // 85 is 0x55 in hex / 01010101 in binary (every other bit set). int testValueMask = 85; - renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, testValueMask ); + renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION_MASK, testValueMask); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get() ), testValueMask, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get()), testValueMask, TEST_LOCATION); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_EQUALS( static_cast( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get() ), testValueMask, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetCurrentProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get()), testValueMask, TEST_LOCATION); // Clear the stringstream. - parameterStream.str( std::string() ); - parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", " << testValueMask; + parameterStream.str(std::string()); + parameterStream << StencilFunctionLookupTable[StencilOperation::DECREMENT_WRAP] << ", " << testValueReference << ", " << testValueMask; - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) ); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str())); END_TEST; } @@ -2676,15 +2686,15 @@ int UtcDaliRendererSetStencilOperation(void) TestApplication application; tet_infoline("Test setting the StencilOperation"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); - glAbstraction.EnableStencilFunctionCallTrace( true ); - TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); + glAbstraction.EnableEnableDisableCallTrace(true); + glAbstraction.EnableStencilFunctionCallTrace(true); + TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace(); // RenderMode must use the stencil for StencilOperation to operate. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL); /* * Lookup table for testing StencilOperation. @@ -2698,18 +2708,18 @@ int UtcDaliRendererSetStencilOperation(void) GL_DECR, GL_INVERT, GL_INCR_WRAP, - GL_DECR_WRAP - }; const int StencilOperationLookupTableCount = sizeof( StencilOperationLookupTable ) / sizeof( StencilOperationLookupTable[0] ); + GL_DECR_WRAP}; + const int StencilOperationLookupTableCount = sizeof(StencilOperationLookupTable) / sizeof(StencilOperationLookupTable[0]); // Set all 3 StencilOperation properties to a default. - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP ); - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::ZERO ); - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::ZERO ); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::ZERO); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::ZERO); // Set our expected parameter list to the equivalent result. - int parameters[] = { StencilOperationLookupTable[ StencilOperation::ZERO ], StencilOperationLookupTable[ StencilOperation::ZERO ], StencilOperationLookupTable[ StencilOperation::ZERO ] }; + int parameters[] = {StencilOperationLookupTable[StencilOperation::ZERO], StencilOperationLookupTable[StencilOperation::ZERO], StencilOperationLookupTable[StencilOperation::ZERO]}; - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); /* * Loop through all types of StencilOperation, checking: @@ -2718,47 +2728,47 @@ int UtcDaliRendererSetStencilOperation(void) * - Checks the correct parameters to "glStencilFunc" were used * - Checks the above for all 3 parameter placements of StencilOperation ( OnFail, OnZFail, OnPass ) */ - std::string methodString( "StencilOp" ); + std::string methodString("StencilOp"); - for( int i = 0; i < StencilOperationLookupTableCount; ++i ) + for(int i = 0; i < StencilOperationLookupTableCount; ++i) { - for( int j = 0; j < StencilOperationLookupTableCount; ++j ) + for(int j = 0; j < StencilOperationLookupTableCount; ++j) { - for( int k = 0; k < StencilOperationLookupTableCount; ++k ) + for(int k = 0; k < StencilOperationLookupTableCount; ++k) { // Set the property (outer loop causes all 3 different properties to be set separately). - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, static_cast( i ) ); - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, static_cast( j ) ); - renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, static_cast( k ) ); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL, static_cast(i)); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, static_cast(j)); + renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, static_cast(k)); // Check GetProperty returns the same value. - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL ).Get() ), i, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL ).Get() ), j, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS ).Get() ), k, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL).Get()), i, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL).Get()), j, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS).Get()), k, TEST_LOCATION); // Reset the trace debug. - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); // Check the function is called and the parameters are correct. // Set the expected parameter value at its correct index (only) - parameters[ 0u ] = StencilOperationLookupTable[ i ]; - parameters[ 1u ] = StencilOperationLookupTable[ j ]; - parameters[ 2u ] = StencilOperationLookupTable[ k ]; + parameters[0u] = StencilOperationLookupTable[i]; + parameters[1u] = StencilOperationLookupTable[j]; + parameters[2u] = StencilOperationLookupTable[k]; // Build the parameter list. std::stringstream parameterStream; - for( int parameterBuild = 0; parameterBuild < 3; ++parameterBuild ) + for(int parameterBuild = 0; parameterBuild < 3; ++parameterBuild) { - parameterStream << parameters[ parameterBuild ]; + parameterStream << parameters[parameterBuild]; // Comma-separate the parameters. - if( parameterBuild < 2 ) + if(parameterBuild < 2) { parameterStream << ", "; } } // Check the function was called and the parameters were correct. - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) ); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str())); } } } @@ -2771,46 +2781,46 @@ int UtcDaliRendererSetStencilMask(void) TestApplication application; tet_infoline("Test setting the StencilMask"); - Renderer renderer = RendererTestFixture( application ); + Renderer renderer = RendererTestFixture(application); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - glAbstraction.EnableEnableDisableCallTrace( true ); - glAbstraction.EnableStencilFunctionCallTrace( true ); - TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); + glAbstraction.EnableEnableDisableCallTrace(true); + glAbstraction.EnableStencilFunctionCallTrace(true); + TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace(); TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace(); // RenderMode must use the stencil for StencilMask to operate. - renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); + renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL); // Set the StencilMask property to a value. - renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0x00 ); + renderer.SetProperty(Renderer::Property::STENCIL_MASK, 0x00); // Check GetProperty returns the same value. - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get() ), 0x00, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get()), 0x00, TEST_LOCATION); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_EQUALS( static_cast( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get() ), 0x00, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetCurrentProperty(Renderer::Property::STENCIL_MASK).Get()), 0x00, TEST_LOCATION); - std::string methodString( "StencilMask" ); + std::string methodString("StencilMask"); std::string parameterString = "0"; // Check the function was called and the parameters were correct. - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterString ) ); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterString)); // Set the StencilMask property to another value to ensure it has changed. - renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0xFF ); + renderer.SetProperty(Renderer::Property::STENCIL_MASK, 0xFF); // Check GetProperty returns the same value. - DALI_TEST_EQUALS( static_cast( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get() ), 0xFF, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get()), 0xFF, TEST_LOCATION); - ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack ); + ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack); - DALI_TEST_EQUALS( static_cast( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get() ), 0xFF, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(renderer.GetCurrentProperty(Renderer::Property::STENCIL_MASK).Get()), 0xFF, TEST_LOCATION); parameterString = "255"; // Check the function was called and the parameters were correct. - DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterString ) ); + DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterString)); END_TEST; } @@ -2822,25 +2832,25 @@ int UtcDaliRendererWrongNumberOfTextures(void) //Create a TextureSet with 4 textures (One more texture in the texture set than active samplers) //@note Shaders in the test suit have 3 active samplers. See TestGlAbstraction::GetActiveUniform() - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u); TextureSet textureSet = CreateTextureSet(); - textureSet.SetTexture(0, texture ); - textureSet.SetTexture(1, texture ); - textureSet.SetTexture(2, texture ); - textureSet.SetTexture(3, texture ); - Shader shader = Shader::New("VertexSource", "FragmentSource"); + textureSet.SetTexture(0, texture); + textureSet.SetTexture(1, texture); + textureSet.SetTexture(2, texture); + textureSet.SetTexture(3, texture); + Shader shader = Shader::New("VertexSource", "FragmentSource"); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); - Actor actor= Actor::New(); + Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::POSITION, Vector2(0.0f,0.0f)); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); + actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); application.GetScene().Add(actor); - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& drawTrace = gl.GetDrawTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Reset(); drawTrace.Enable(true); @@ -2848,19 +2858,19 @@ int UtcDaliRendererWrongNumberOfTextures(void) application.Render(0); //Test we do the drawcall when TextureSet has more textures than there are active samplers in the shader - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); //Create a TextureSet with 1 texture (two more active samplers than texture in the texture set) //@note Shaders in the test suit have 3 active samplers. See TestGlAbstraction::GetActiveUniform() textureSet = CreateTextureSet(); - renderer.SetTextures( textureSet ); - textureSet.SetTexture(0, texture ); + renderer.SetTextures(textureSet); + textureSet.SetTexture(0, texture); drawTrace.Reset(); application.SendNotification(); application.Render(0); //Test we do the drawcall when TextureSet has less textures than there are active samplers in the shader. - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); END_TEST; } @@ -2869,46 +2879,46 @@ int UtcDaliRendererOpacity(void) { TestApplication application; - tet_infoline( "Test OPACITY property" ); + tet_infoline("Test OPACITY property"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f)); + application.GetScene().Add(actor); - Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); - float opacity; - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY); + float opacity; + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); application.SendNotification(); application.Render(); - Vector4 actualValue; + Vector4 actualValue; TestGlAbstraction& gl = application.GetGlAbstraction(); - DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uColor", actualValue)); + DALI_TEST_EQUALS(actualValue.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.5f ); + renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.5f); application.SendNotification(); application.Render(); - value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + value = renderer.GetProperty(DevelRenderer::Property::OPACITY); + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - value = renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY ); - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + value = renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY); + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue.a, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uColor", actualValue)); + DALI_TEST_EQUALS(actualValue.a, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); END_TEST; } @@ -2917,51 +2927,51 @@ int UtcDaliRendererOpacityAnimation(void) { TestApplication application; - tet_infoline( "Test OPACITY property animation" ); + tet_infoline("Test OPACITY property animation"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f)); + application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); - float opacity; - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY); + float opacity; + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( renderer, DevelRenderer::Property::OPACITY ), 0.0f ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.0f); animation.Play(); application.SendNotification(); - application.Render( 1000 ); + application.Render(1000); - value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + value = renderer.GetProperty(DevelRenderer::Property::OPACITY); + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); // Need to clear the animation before setting the property as the animation value is baked and will override any previous setters animation.Clear(); - renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.1f ); + renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.1f); - animation.AnimateBy( Property( renderer, DevelRenderer::Property::OPACITY ), 0.5f ); + animation.AnimateBy(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f); animation.Play(); application.SendNotification(); - application.Render( 1000 ); + application.Render(1000); - value = renderer.GetProperty( DevelRenderer::Property::OPACITY ); - DALI_TEST_CHECK( value.Get( opacity ) ); - DALI_TEST_EQUALS( opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); - DALI_TEST_EQUALS( opacity, renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY ).Get< float >(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION ); + value = renderer.GetProperty(DevelRenderer::Property::OPACITY); + DALI_TEST_CHECK(value.Get(opacity)); + DALI_TEST_EQUALS(opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); + DALI_TEST_EQUALS(opacity, renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY).Get(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION); END_TEST; } @@ -2970,25 +2980,25 @@ int UtcDaliRendererInvalidProperty(void) { TestApplication application; - tet_infoline( "Test invalid property" ); + tet_infoline("Test invalid property"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Property::Value value = renderer.GetProperty( Renderer::Property::DEPTH_INDEX + 100 ); - DALI_TEST_CHECK( value.GetType() == Property::Type::NONE ); + Property::Value value = renderer.GetProperty(Renderer::Property::DEPTH_INDEX + 100); + DALI_TEST_CHECK(value.GetType() == Property::Type::NONE); - value = renderer.GetCurrentProperty( Renderer::Property::DEPTH_INDEX + 100 ); - DALI_TEST_CHECK( value.GetType() == Property::Type::NONE ); + value = renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX + 100); + DALI_TEST_CHECK(value.GetType() == Property::Type::NONE); END_TEST; } @@ -2997,35 +3007,35 @@ int UtcDaliRendererRenderingBehavior(void) { TestApplication application; - tet_infoline( "Test RENDERING_BEHAVIOR property" ); + tet_infoline("Test RENDERING_BEHAVIOR property"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f)); + application.GetScene().Add(actor); - Property::Value value = renderer.GetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR ); - int renderingBehavior; - DALI_TEST_CHECK( value.Get( renderingBehavior ) ); - DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::IF_REQUIRED, TEST_LOCATION ); + Property::Value value = renderer.GetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR); + int renderingBehavior; + DALI_TEST_CHECK(value.Get(renderingBehavior)); + DALI_TEST_EQUALS(static_cast(renderingBehavior), DevelRenderer::Rendering::IF_REQUIRED, TEST_LOCATION); application.SendNotification(); application.Render(); uint32_t updateStatus = application.GetUpdateStatus(); - DALI_TEST_CHECK( !( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ) ); + DALI_TEST_CHECK(!(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING)); - renderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY ); + renderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY); - value = renderer.GetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR ); - DALI_TEST_CHECK( value.Get( renderingBehavior ) ); - DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION ); + value = renderer.GetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR); + DALI_TEST_CHECK(value.Get(renderingBehavior)); + DALI_TEST_EQUALS(static_cast(renderingBehavior), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION); // Render and check the update status application.SendNotification(); @@ -3033,11 +3043,11 @@ int UtcDaliRendererRenderingBehavior(void) updateStatus = application.GetUpdateStatus(); - DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ); + DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING); - value = renderer.GetCurrentProperty( DevelRenderer::Property::RENDERING_BEHAVIOR ); - DALI_TEST_CHECK( value.Get( renderingBehavior ) ); - DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION ); + value = renderer.GetCurrentProperty(DevelRenderer::Property::RENDERING_BEHAVIOR); + DALI_TEST_CHECK(value.Get(renderingBehavior)); + DALI_TEST_EQUALS(static_cast(renderingBehavior), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION); // Render again and check the update status application.SendNotification(); @@ -3045,10 +3055,10 @@ int UtcDaliRendererRenderingBehavior(void) updateStatus = application.GetUpdateStatus(); - DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ); + DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING); // Change rendering behavior - renderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED ); + renderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED); // Render and check the update status application.SendNotification(); @@ -3056,7 +3066,7 @@ int UtcDaliRendererRenderingBehavior(void) updateStatus = application.GetUpdateStatus(); - DALI_TEST_CHECK( !( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ) ); + DALI_TEST_CHECK(!(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING)); END_TEST; } @@ -3065,27 +3075,27 @@ int UtcDaliRendererRegenerateUniformMap(void) { TestApplication application; - tet_infoline( "Test regenerating uniform map when attaching renderer to the node" ); + tet_infoline("Test regenerating uniform map when attaching renderer to the node"); Geometry geometry = CreateQuadGeometry(); - Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = Shader::New("vertexSrc", "fragmentSrc"); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f)); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - actor.RemoveRenderer( renderer ); - shader = Shader::New( "vertexSrc", "fragmentSrc" ); - shader.RegisterProperty( "opacity", 0.5f ); - renderer.SetShader( shader ); + actor.RemoveRenderer(renderer); + shader = Shader::New("vertexSrc", "fragmentSrc"); + shader.RegisterProperty("opacity", 0.5f); + renderer.SetShader(shader); - Stage::GetCurrent().KeepRendering( 1.0f ); + Stage::GetCurrent().KeepRendering(1.0f); // Update for several frames application.SendNotification(); @@ -3098,13 +3108,13 @@ int UtcDaliRendererRegenerateUniformMap(void) application.Render(); // Add Renderer - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); application.SendNotification(); application.Render(); // Nothing to test here, the test must not crash auto updateStatus = application.GetUpdateStatus(); - DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ); + DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING); END_TEST; } @@ -3115,14 +3125,14 @@ int UtcDaliRendererAddDrawCommands(void) tet_infoline("Test adding draw commands to the renderer"); - TestGlAbstraction &glAbstraction = application.GetGlAbstraction(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); Geometry geometry = CreateQuadGeometry(); Shader shader = Shader::New("vertexSrc", "fragmentSrc"); Renderer renderer = Renderer::New(geometry, shader); - renderer.SetProperty( Renderer::Property::BLEND_MODE, Dali::BlendMode::ON ); + renderer.SetProperty(Renderer::Property::BLEND_MODE, Dali::BlendMode::ON); Actor actor = Actor::New(); actor.AddRenderer(renderer); actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); @@ -3130,27 +3140,27 @@ int UtcDaliRendererAddDrawCommands(void) application.GetScene().Add(actor); // Expect delivering a single draw call - auto &drawTrace = glAbstraction.GetDrawTrace(); + auto& drawTrace = glAbstraction.GetDrawTrace(); drawTrace.Reset(); drawTrace.Enable(true); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION); - auto drawCommand1 = DevelRenderer::DrawCommand{}; + auto drawCommand1 = DevelRenderer::DrawCommand{}; drawCommand1.drawType = DevelRenderer::DrawType::INDEXED; drawCommand1.firstIndex = 0; drawCommand1.elementCount = 2; drawCommand1.queue = DevelRenderer::RENDER_QUEUE_OPAQUE; - auto drawCommand2 = DevelRenderer::DrawCommand{}; + auto drawCommand2 = DevelRenderer::DrawCommand{}; drawCommand2.drawType = DevelRenderer::DrawType::INDEXED; drawCommand2.firstIndex = 2; drawCommand2.elementCount = 2; drawCommand2.queue = DevelRenderer::RENDER_QUEUE_TRANSPARENT; - auto drawCommand3 = DevelRenderer::DrawCommand{}; + auto drawCommand3 = DevelRenderer::DrawCommand{}; drawCommand3.drawType = DevelRenderer::DrawType::ARRAY; drawCommand3.firstIndex = 2; drawCommand3.elementCount = 2; @@ -3172,7 +3182,7 @@ int UtcDaliRendererAddDrawCommands(void) int UtcDaliRendererSetGeometryNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { Dali::Geometry arg1; @@ -3189,7 +3199,7 @@ int UtcDaliRendererSetGeometryNegative(void) int UtcDaliRendererSetTexturesNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { Dali::TextureSet arg1; @@ -3206,7 +3216,7 @@ int UtcDaliRendererSetTexturesNegative(void) int UtcDaliRendererSetShaderNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { Dali::Shader arg1; @@ -3223,7 +3233,7 @@ int UtcDaliRendererSetShaderNegative(void) int UtcDaliRendererGetGeometryNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { instance.GetGeometry(); @@ -3239,7 +3249,7 @@ int UtcDaliRendererGetGeometryNegative(void) int UtcDaliRendererGetTexturesNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { instance.GetTextures(); @@ -3255,7 +3265,7 @@ int UtcDaliRendererGetTexturesNegative(void) int UtcDaliRendererGetShaderNegative(void) { TestApplication application; - Dali::Renderer instance; + Dali::Renderer instance; try { instance.GetShader(); diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp index 4298366..2f3e3f9 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp @@ -15,15 +15,15 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include #include +#include + using namespace Dali; void utc_dali_rotation_gesture_detector_startup(void) @@ -39,7 +39,6 @@ void utc_dali_rotation_gesture_detector_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { @@ -47,11 +46,12 @@ struct SignalData : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -59,22 +59,25 @@ struct SignalData rotatedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; RotationGesture receivedGesture; - Actor rotatedActor; + Actor rotatedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const RotationGesture& rotation) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = rotation; - signalData.rotatedActor = actor; + signalData.rotatedActor = actor; } void operator()() @@ -88,28 +91,28 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) - : GestureReceivedFunctor( data ), - stateToUnstage( stateToUnstage ), - scene( scene ) + UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene) + : GestureReceivedFunctor(data), + stateToUnstage(stateToUnstage), + scene(scene) { } - void operator()( Actor actor, const RotationGesture& rotation ) + void operator()(Actor actor, const RotationGesture& rotation) { - GestureReceivedFunctor::operator()( actor, rotation ); + GestureReceivedFunctor::operator()(actor, rotation); - if ( rotation.GetState() == stateToUnstage ) + if(rotation.GetState() == stateToUnstage) { - scene.Remove( actor ); + scene.Remove(actor); } } - GestureState& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// @@ -126,10 +129,11 @@ int UtcDaliRotationGestureDetectorCopyConstructorP(void) { TestApplication application; - RotationGestureDetector detector = RotationGestureDetector::New();; + RotationGestureDetector detector = RotationGestureDetector::New(); + ; - RotationGestureDetector copy( detector ); - DALI_TEST_CHECK( detector ); + RotationGestureDetector copy(detector); + DALI_TEST_CHECK(detector); END_TEST; } @@ -137,13 +141,14 @@ int UtcDaliRotationGestureDetectorAssignmentOperatorP(void) { TestApplication application; - RotationGestureDetector detector = RotationGestureDetector::New();; + RotationGestureDetector detector = RotationGestureDetector::New(); + ; RotationGestureDetector assign; assign = detector; - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(detector); - DALI_TEST_CHECK( detector == assign ); + DALI_TEST_CHECK(detector == assign); END_TEST; } @@ -157,8 +162,8 @@ int UtcDaliRotationGestureDetectorNew(void) // Attach an actor and emit a touch event on the actor to ensure complete line coverage Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -168,17 +173,17 @@ int UtcDaliRotationGestureDetectorNew(void) detector.Attach(actor); Integration::TouchEvent touchEvent(1); - Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + Integration::Point point; + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); Integration::Point point2; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point2); application.ProcessEvent(touchEvent); END_TEST; @@ -196,17 +201,17 @@ int UtcDaliRotationGestureDetectorDownCast(void) RotationGestureDetector detector2 = RotationGestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - RotationGestureDetector detector3 = DownCast< RotationGestureDetector >(object); + RotationGestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; RotationGestureDetector detector4 = RotationGestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - RotationGestureDetector detector5 = DownCast< RotationGestureDetector >(unInitializedObject); + RotationGestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); - GestureDetector detector6 = RotationGestureDetector::New(); + GestureDetector detector6 = RotationGestureDetector::New(); RotationGestureDetector detector7 = RotationGestureDetector::DownCast(detector6); DALI_TEST_CHECK(detector7); END_TEST; @@ -218,15 +223,15 @@ int UtcDaliRotationGestureSignalReceptionNegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -234,22 +239,19 @@ int UtcDaliRotationGestureSignalReceptionNegative(void) detector.DetectedSignal().Connect(&application, functor); // Do a rotation outside actor's area - TestStartRotation( application, Vector2( 112.0f, 62.0f ), Vector2( 112.0f, 162.0f ), - Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), 100 ); + TestStartRotation(application, Vector2(112.0f, 62.0f), Vector2(112.0f, 162.0f), Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Continue rotation into actor's area - we should still not receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); + TestContinueRotation(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Stop rotating - we should still not receive the signal data.Reset(); - TestEndRotation( application, Vector2( 6.0f, 6.0f ), Vector2( 18.0f, 18.0f ), - Vector2( 10.0f, 8.0f ), Vector2( 14.0f, 16.0f ), 300 ); + TestEndRotation(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 300); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -260,15 +262,15 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -276,8 +278,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation within the actor's area - TestStartRotation( application, Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 20.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 30.0f ), 100 ); + TestStartRotation(application, Vector2(5.0f, 5.0f), Vector2(20.0f, 20.0f), Vector2(5.0f, 5.0f), Vector2(20.0f, 30.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.244f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -286,8 +287,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) // Continue the rotation within the actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), 400); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -296,8 +296,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) // Rotation Gesture leaves actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 ); + TestContinueRotation(application, Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -306,8 +305,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) // Gesture ends - we would receive a finished state data.Reset(); - TestEndRotation( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), - Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500); + TestEndRotation(application, Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), Vector2(305.0f, 10.0f), Vector2(315.0f, 10.0f), 1500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -321,15 +319,15 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -337,8 +335,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation within the actor's area - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 31.0f, 29.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(31.0f, 29.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.404892f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -347,8 +344,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) // Continue the rotation within the actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(29.0f, 15.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -357,8 +353,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) // Gesture ends within actor's area - we would receive a finished state data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 15.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -372,15 +367,15 @@ int UtcDaliRotationGestureSignalReceptionDetach(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -388,23 +383,19 @@ int UtcDaliRotationGestureSignalReceptionDetach(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation within the actor's area - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); - // Continue the rotation within the actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Gesture ends within actor's area data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -413,7 +404,7 @@ int UtcDaliRotationGestureSignalReceptionDetach(void) // Ensure we are no longer signalled data.Reset(); - TestGenerateRotation( application ); + TestGenerateRotation(application); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -423,15 +414,15 @@ int UtcDaliRotationGestureSignalReceptionDetachWhileRotationing(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -439,15 +430,13 @@ int UtcDaliRotationGestureSignalReceptionDetachWhileRotationing(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation within the actor's area - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); // Continue the rotation within the actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); @@ -456,8 +445,7 @@ int UtcDaliRotationGestureSignalReceptionDetachWhileRotationing(void) // Gesture ends within actor's area data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -466,7 +454,7 @@ int UtcDaliRotationGestureSignalReceptionActorDestroyedWhileRotationing(void) { TestApplication application; - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -475,16 +463,16 @@ int UtcDaliRotationGestureSignalReceptionActorDestroyedWhileRotationing(void) // Attach a temporary actor to stop detector being removed from RotationGestureProcessor when main actor // is destroyed. Actor tempActor = Actor::New(); - tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(tempActor); detector.Attach(tempActor); // Actor lifetime is scoped { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -494,15 +482,13 @@ int UtcDaliRotationGestureSignalReceptionActorDestroyedWhileRotationing(void) detector.Attach(actor); // Start rotation within the actor's area - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); // Continue the rotation within the actor's area - we should still receive the signal data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); @@ -518,8 +504,7 @@ int UtcDaliRotationGestureSignalReceptionActorDestroyedWhileRotationing(void) // Gesture ends within the area where the actor used to be data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -529,15 +514,15 @@ int UtcDaliRotationGestureSignalReceptionRotatedActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); application.GetScene().Add(actor); // Render and notify a couple of times application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -545,43 +530,37 @@ int UtcDaliRotationGestureSignalReceptionRotatedActor(void) detector.DetectedSignal().Connect(&application, functor); // Do an entire rotation, only check finished value - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(67.5f, 27.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); // Rotate actor again and render and notify - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire rotation, only check finished value - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100); data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 3000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 3000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(27.0f, 32.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); // Rotate actor again and render and notify - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do an entire rotation, only check finished value - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 4100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 4100); data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 5000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 5000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -594,25 +573,25 @@ int UtcDaliRotationGestureSignalReceptionChildHit(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); // Set child to completely cover parent. // Change rotation of child to be different from parent so that we can check if our local coordinate // conversion of the parent actor is correct. Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); parent.Add(child); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -620,11 +599,9 @@ int UtcDaliRotationGestureSignalReceptionChildHit(void) detector.DetectedSignal().Connect(&application, functor); // Do an entire pan, only check finished value - hits child area but parent should still receive it - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 25.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 25.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, parent == data.rotatedActor, TEST_LOCATION); DALI_TEST_EQUALS(0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -637,11 +614,9 @@ int UtcDaliRotationGestureSignalReceptionChildHit(void) detector.Detach(parent); // Do an entire pan, only check finished value - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100); data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 35.0f ), 3000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 35.0f), 3000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, child == data.rotatedActor, TEST_LOCATION); DALI_TEST_EQUALS(0.982794f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION); @@ -655,21 +630,21 @@ int UtcDaliRotationGestureSignalReceptionAttachDetachMany(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -678,15 +653,13 @@ int UtcDaliRotationGestureSignalReceptionAttachDetachMany(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation within second actor's area - TestStartRotation( application, Vector2( 102.0f, 20.0f ), Vector2( 138.0f, 20.0f ), - Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(102.0f, 20.0f), Vector2(138.0f, 20.0f), Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.rotatedActor, TEST_LOCATION); // Rotation moves into first actor's area - second actor should receive the rotation data.Reset(); - TestContinueRotation( application, Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.rotatedActor, TEST_LOCATION); @@ -695,8 +668,7 @@ int UtcDaliRotationGestureSignalReceptionAttachDetachMany(void) // Gesture ends within actor's area data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 119.0f, 20.0f ), Vector2( 121.0f, 20.0f ), 3000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(119.0f, 20.0f), Vector2(121.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -706,15 +678,15 @@ int UtcDaliRotationGestureSignalReceptionActorBecomesUntouchable(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -722,18 +694,16 @@ int UtcDaliRotationGestureSignalReceptionActorBecomesUntouchable(void) detector.DetectedSignal().Connect(&application, functor); // Start rotation in actor's area - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Rotation continues within actor's area data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Actor become invisible - actor should not receive the next rotation - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // Render and notify application.SendNotification(); @@ -741,8 +711,7 @@ int UtcDaliRotationGestureSignalReceptionActorBecomesUntouchable(void) // Gesture ends within actor's area data.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -752,13 +721,13 @@ int UtcDaliRotationGestureSignalReceptionMultipleDetectorsOnActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); application.GetScene().Add(actor2); // Render and notify @@ -766,15 +735,15 @@ int UtcDaliRotationGestureSignalReceptionMultipleDetectorsOnActor(void) application.Render(); // Attach actor to one detector - SignalData firstData; - GestureReceivedFunctor firstFunctor(firstData); + SignalData firstData; + GestureReceivedFunctor firstFunctor(firstData); RotationGestureDetector firstDetector = RotationGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector - SignalData secondData; - GestureReceivedFunctor secondFunctor(secondData); + SignalData secondData; + GestureReceivedFunctor secondFunctor(secondData); RotationGestureDetector secondDetector = RotationGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); @@ -785,16 +754,14 @@ int UtcDaliRotationGestureSignalReceptionMultipleDetectorsOnActor(void) secondDetector.Attach(actor2); // Rotation in actor's area - both detector's functors should be called - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); // Rotation continues in actor's area - both detector's functors should be called firstData.Reset(); secondData.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -802,16 +769,14 @@ int UtcDaliRotationGestureSignalReceptionMultipleDetectorsOnActor(void) firstDetector.Detach(actor); firstData.Reset(); secondData.Reset(); - TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); // New rotation on actor, only secondDetector has actor attached firstData.Reset(); secondData.Reset(); - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); @@ -819,8 +784,7 @@ int UtcDaliRotationGestureSignalReceptionMultipleDetectorsOnActor(void) secondDetector.Detach(actor); firstData.Reset(); secondData.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION); END_TEST; @@ -831,22 +795,22 @@ int UtcDaliRotationGestureSignalReceptionEnsureCorrectSignalling(void) TestApplication application; Actor actor1 = Actor::New(); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor1); - SignalData data1; - GestureReceivedFunctor functor1(data1); + SignalData data1; + GestureReceivedFunctor functor1(data1); RotationGestureDetector detector1 = RotationGestureDetector::New(); detector1.Attach(actor1); detector1.DetectedSignal().Connect(&application, functor1); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT); - actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT); + actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT); application.GetScene().Add(actor2); - SignalData data2; - GestureReceivedFunctor functor2(data2); + SignalData data2; + GestureReceivedFunctor functor2(data2); RotationGestureDetector detector2 = RotationGestureDetector::New(); detector2.Attach(actor2); detector2.DetectedSignal().Connect(&application, functor2); @@ -856,8 +820,7 @@ int UtcDaliRotationGestureSignalReceptionEnsureCorrectSignalling(void) application.Render(); // Start pan in actor1's area, only data1 should be set - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); END_TEST; @@ -868,8 +831,8 @@ int UtcDaliRotationGestureActorUnstaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -877,22 +840,20 @@ int UtcDaliRotationGestureActorUnstaged(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); RotationGestureDetector detector = RotationGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit signals - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -911,16 +872,13 @@ int UtcDaliRotationGestureActorUnstaged(void) stateToUnstage = GestureState::CONTINUING; // Emit signals - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -939,18 +897,15 @@ int UtcDaliRotationGestureActorUnstaged(void) stateToUnstage = GestureState::FINISHED; // Emit signals - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully. + tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully. END_TEST; } @@ -959,15 +914,15 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Create and add a second actor so that GestureDetector destruction does not come into play. - Actor dummyActor( Actor::New() ); - dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); - dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + Actor dummyActor(Actor::New()); + dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); + dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(dummyActor); // Render and notify @@ -975,23 +930,22 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - GestureState stateToUnstage( GestureState::STARTED ); + GestureState stateToUnstage(GestureState::STARTED); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() ); + SignalData data; + UnstageActorFunctor functor(data, stateToUnstage, application.GetScene()); RotationGestureDetector detector = RotationGestureDetector::New(); detector.Attach(actor); detector.Attach(dummyActor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back // before we get a continuing state. As we were removed from the stage, even if we're at the same // position, we should still not be signalled. // Emit signals - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1007,20 +961,17 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Here we delete an actor in started, we should not receive any subsequent signalling. // Emit signals - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1036,12 +987,10 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) application.Render(); // Continue signal emission - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1051,22 +1000,22 @@ int UtcDaliRotationGestureLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - SignalData data; - GestureReceivedFunctor functor(data); + SignalData data; + GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -1074,25 +1023,21 @@ int UtcDaliRotationGestureLayerConsumesTouch(void) application.Render(); // Emit signals, should receive - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 ); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 2000); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 2000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1104,19 +1049,19 @@ int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); - bool consume = false; + bool consume = false; TouchEventFunctorConsumeSetter touchFunctor(consume); - actor.TouchedSignal().Connect(&application,touchFunctor); + actor.TouchedSignal().Connect(&application, touchFunctor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); @@ -1124,8 +1069,7 @@ int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void) detector.DetectedSignal().Connect(&application, functor); // Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); @@ -1134,15 +1078,13 @@ int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void) // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture consume = true; - TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 ); + TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); data.Reset(); // Start another rotation, we should not even get the callback this time - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -1155,24 +1097,23 @@ int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - RotationGestureDetector detector = RotationGestureDetector::New(); - bool functorCalled = false; - detector.Attach( actor ); + RotationGestureDetector detector = RotationGestureDetector::New(); + bool functorCalled = false; + detector.Attach(actor); detector.DetectedSignal().Connect( - &application, - [&detector, &functorCalled](Actor actor, const RotationGesture& gesture) + &application, + [&detector, &functorCalled](Actor actor, const RotationGesture& gesture) { + if(gesture.GetState() == GestureState::FINISHED) { - if( gesture.GetState() == GestureState::FINISHED ) - { - detector.Detach(actor); - functorCalled = true; - } - }); + detector.Detach(actor); + functorCalled = true; + } + }); // Render and notify application.SendNotification(); @@ -1181,19 +1122,16 @@ int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) // Try the gesture, should not crash try { - TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), - Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); - TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), - Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); - TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), - Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000); - - DALI_TEST_CHECK( true ); // No crash, test has passed + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); + TestContinueRotation(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200); + TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000); + + DALI_TEST_CHECK(true); // No crash, test has passed DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } catch(...) { - DALI_TEST_CHECK( false ); // If we crash, the test has failed + DALI_TEST_CHECK(false); // If we crash, the test has failed } END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp index 8c25595..c8d07d0 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp @@ -15,13 +15,13 @@ * */ -#include - -#include -#include -#include -#include #include +#include +#include +#include +#include + +#include using namespace Dali; @@ -38,18 +38,18 @@ void utc_dali_rotation_gesture_recognizer_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -57,22 +57,25 @@ struct SignalData rotatedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; RotationGesture receivedGesture; - Actor rotatedActor; + Actor rotatedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const RotationGesture& rotation) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = rotation; - signalData.rotatedActor = actor; + signalData.rotatedActor = actor; } void operator()() @@ -83,37 +86,36 @@ struct GestureReceivedFunctor SignalData& signalData; }; -Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } -Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time ) +Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( stateA ); - point.SetScreenPosition( screenPositionA ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); - point.SetScreenPosition( screenPositionB ); - point.SetState( stateB); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(stateA); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + point.SetState(stateB); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } - -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// int UtcDaliRotationGestureRecognizerRealistic(void) @@ -123,9 +125,9 @@ int UtcDaliRotationGestureRecognizerRealistic(void) RotationGestureDetector detector = RotationGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); // Render and notify application.SendNotification(); @@ -133,21 +135,21 @@ int UtcDaliRotationGestureRecognizerRealistic(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105)); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145)); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155)); application.SendNotification(); @@ -163,9 +165,9 @@ int UtcDaliRotationGestureRecognizerBasicInterrupted(void) RotationGestureDetector detector = RotationGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); // Render and notify application.SendNotification(); @@ -173,13 +175,13 @@ int UtcDaliRotationGestureRecognizerBasicInterrupted(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); // application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); // application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 30.0f), 152)); application.SendNotification(); @@ -193,38 +195,38 @@ int UtcDaliRotationGestureRecognizerMinimumTouchEvents(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); - detector.Attach( actor ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); // Case 1 // 2 touch events make a gesture begin - Integration::SetRotationGestureMinimumTouchEvents( 2 ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + Integration::SetRotationGestureMinimumTouchEvents(2); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); - DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Case 2 // 4 touch events make a gesture begin - Integration::SetRotationGestureMinimumTouchEvents( 4 ); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + Integration::SetRotationGestureMinimumTouchEvents(4); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); // Check the gesture is not detected unlike previous case - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -234,19 +236,19 @@ int UtcDaliRotationGestureRecognizerMinimumTouchEventsAfterStart(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); RotationGestureDetector detector = RotationGestureDetector::New(); - detector.Attach( actor ); - detector.DetectedSignal().Connect( &application, functor ); + detector.Attach(actor); + detector.DetectedSignal().Connect(&application, functor); // Case 1 // > 2 touch events make a gesture begin @@ -254,21 +256,21 @@ int UtcDaliRotationGestureRecognizerMinimumTouchEventsAfterStart(void) Integration::SetRotationGestureMinimumTouchEvents(2); Integration::SetRotationGestureMinimumTouchEventsAfterStart(6); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160)); DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 170)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 180)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 190)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 200)); // > Test : not enough touch events to make the gesture state "CONTINUING" DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) ); - application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 210)); + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 220)); // > Test : 6 touch events after start make the gesture state "CONTINUING" DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); diff --git a/automated-tests/src/dali/utc-Dali-Sampler.cpp b/automated-tests/src/dali/utc-Dali-Sampler.cpp index c869289..f90ed2b 100644 --- a/automated-tests/src/dali/utc-Dali-Sampler.cpp +++ b/automated-tests/src/dali/utc-Dali-Sampler.cpp @@ -17,8 +17,8 @@ // EXTERNAL INCLUDES #include -#include #include +#include // INTERNAL INCLUDES #include @@ -39,17 +39,17 @@ void sampler_test_cleanup(void) int UtcDaliSamplerNew01(void) { TestApplication application; - Sampler sampler = Sampler::New(); + Sampler sampler = Sampler::New(); - DALI_TEST_EQUALS( (bool)sampler, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)sampler, true, TEST_LOCATION); END_TEST; } int UtcDaliSamplerNew02(void) { TestApplication application; - Sampler sampler; - DALI_TEST_EQUALS( (bool)sampler, false, TEST_LOCATION ); + Sampler sampler; + DALI_TEST_EQUALS((bool)sampler, false, TEST_LOCATION); END_TEST; } @@ -66,7 +66,7 @@ int UtcDaliSamplerCopyConstructor(void) // Copy the object, ref count == 2 Sampler copy(sampler); DALI_TEST_CHECK(copy); - if (copy) + if(copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } @@ -79,13 +79,13 @@ int UtcDaliSamplerMoveConstructor(void) TestApplication application; Sampler sampler = Sampler::New(); - DALI_TEST_CHECK( sampler ); - DALI_TEST_EQUALS( 1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(sampler); + DALI_TEST_EQUALS(1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION); - Sampler move = std::move( sampler ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !sampler ); + Sampler move = std::move(sampler); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!sampler); END_TEST; } @@ -95,14 +95,14 @@ int UtcDaliSamplerMoveAssignment(void) TestApplication application; Sampler sampler = Sampler::New(); - DALI_TEST_CHECK( sampler ); - DALI_TEST_EQUALS( 1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(sampler); + DALI_TEST_EQUALS(1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION); Sampler move; - move = std::move( sampler ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( !sampler ); + move = std::move(sampler); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(!sampler); END_TEST; } @@ -110,11 +110,11 @@ int UtcDaliSamplerMoveAssignment(void) int UtcDaliSamplerDownCast01(void) { TestApplication application; - Sampler sampler = Sampler::New(); + Sampler sampler = Sampler::New(); BaseHandle handle(sampler); - Sampler sampler2 = Sampler::DownCast(handle); - DALI_TEST_EQUALS( (bool)sampler2, true, TEST_LOCATION ); + Sampler sampler2 = Sampler::DownCast(handle); + DALI_TEST_EQUALS((bool)sampler2, true, TEST_LOCATION); END_TEST; } @@ -123,15 +123,15 @@ int UtcDaliSamplerDownCast02(void) TestApplication application; BaseHandle handle; - Sampler sampler = Sampler::DownCast(handle); - DALI_TEST_EQUALS( (bool)sampler, false, TEST_LOCATION ); + Sampler sampler = Sampler::DownCast(handle); + DALI_TEST_EQUALS((bool)sampler, false, TEST_LOCATION); END_TEST; } int UtcDaliSamplerAssignmentOperator(void) { TestApplication application; - Sampler sampler1 = Sampler::New(); + Sampler sampler1 = Sampler::New(); Sampler sampler2; @@ -152,23 +152,22 @@ int UtcSamplerSetFilterMode(void) { TestApplication application; - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Sampler sampler = Sampler::New(); TextureSet textureSet = CreateTextureSet(); textureSet.SetTexture(0u, image); - textureSet.SetSampler( 0u, sampler ); + textureSet.SetSampler(0u, sampler); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - application.GetScene().Add( actor ); - + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -176,105 +175,104 @@ int UtcSamplerSetFilterMode(void) // Default/Default TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetFilterMode( FilterMode::DEFAULT, FilterMode::DEFAULT ); + sampler.SetFilterMode(FilterMode::DEFAULT, FilterMode::DEFAULT); application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // There are 4 calls to TexParameteri when the texture is first created - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION); std::stringstream out; out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_LINEAR; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); /**************************************************************/ // Linear/Linear texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR ); + sampler.SetFilterMode(FilterMode::LINEAR, FilterMode::LINEAR); // Flush the queue and render once application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // Should not make any calls when settings are the same (DEFAULT = LINEAR ) - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0, TEST_LOCATION); /**************************************************************/ // Nearest/Nearest texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); // Flush the queue and render once application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify actor gl state - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2, TEST_LOCATION); out.str(""); out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_NEAREST; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); out.str(""); out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MAG_FILTER << ", " << GL_NEAREST; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(1, "TexParameteri", out.str()), true, TEST_LOCATION); - + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(1, "TexParameteri", out.str()), true, TEST_LOCATION); /**************************************************************/ // Nearest/Linear texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::LINEAR ); + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::LINEAR); // Flush the queue and render once application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify actor gl state - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 1, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 1, TEST_LOCATION); out.str(""); out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MAG_FILTER << ", " << GL_LINEAR; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); /**************************************************************/ // NONE/NONE texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetFilterMode( FilterMode::NONE, FilterMode::NONE ); + sampler.SetFilterMode(FilterMode::NONE, FilterMode::NONE); // Flush the queue and render once application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify actor gl state - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 1, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 1, TEST_LOCATION); out.str(""); out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_NEAREST_MIPMAP_LINEAR; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION); END_TEST; } @@ -283,22 +281,22 @@ int UtcSamplerSetWrapMode1(void) { TestApplication application; - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); TextureSet textureSet = CreateTextureSet(); - Sampler sampler = Sampler::New(); + Sampler sampler = Sampler::New(); textureSet.SetTexture(0u, image); - textureSet.SetSampler( 0u, sampler ); + textureSet.SetSampler(0u, sampler); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -306,41 +304,41 @@ int UtcSamplerSetWrapMode1(void) // CLAMP_TO_EDGE / CLAMP_TO_EDGE TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // There are 4 calls to TexParameteri when the texture is first created - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION); std::stringstream out; out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_CLAMP_TO_EDGE; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION); out.str(""); out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_CLAMP_TO_EDGE; - DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(3, "TexParameteri", out.str()), true, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(3, "TexParameteri", out.str()), true, TEST_LOCATION); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); - sampler.SetWrapMode( WrapMode::DEFAULT, WrapMode::DEFAULT ); + sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT); // Flush the queue and render once application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // Should not make any calls when settings are the same - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0, TEST_LOCATION); //Todo: Test the other wrap mode ( REPEAT, MIRRORED_REPEAT ) , currently not support!! @@ -352,42 +350,42 @@ int UtcSamplerSetWrapMode2(void) TestApplication application; // Create a cube-map texture. - unsigned int width = 8u; - unsigned int height = 8u; - Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height ); + unsigned int width = 8u; + unsigned int height = 8u; + Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height); // Create source image data. - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= new unsigned char[ bufferSize ]; - memset( buffer, 0u, bufferSize ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = new unsigned char[bufferSize]; + memset(buffer, 0u, bufferSize); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::DELETE_ARRAY ); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::DELETE_ARRAY); // Upload the source image data to all 6 sides of our cube-map. - texture.Upload( pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height ); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height ); - texture.Upload( pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height ); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height ); - texture.Upload( pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height ); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height); // Finalize the cube-map setup. TextureSet textureSet = TextureSet::New(); - textureSet.SetTexture( 0u, texture ); + textureSet.SetTexture(0u, texture); Sampler sampler = Sampler::New(); - textureSet.SetSampler( 0u, sampler ); + textureSet.SetSampler(0u, sampler); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -396,39 +394,38 @@ int UtcSamplerSetWrapMode2(void) TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); // Call the 3 dimensional wrap mode API. - sampler.SetWrapMode( WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE ); + sampler.SetWrapMode(WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE); application.SendNotification(); application.Render(); // Verify that no TexParameteri calls occurred since wrap mode hasn't changed. - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0u, TEST_LOCATION ); - + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0u, TEST_LOCATION); - sampler.SetWrapMode( WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT ); + sampler.SetWrapMode(WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT); texParameterTrace.Reset(); application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify that 3 TexParameteri calls occurred. - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3u, TEST_LOCATION ); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 3u, TEST_LOCATION); END_TEST; } int UtcDaliSamplerSetWrapModeNegative01(void) { TestApplication application; - Dali::Sampler instance; + Dali::Sampler instance; try { Dali::WrapMode::Type arg1(static_cast(-1)); Dali::WrapMode::Type arg2(static_cast(-1)); - instance.SetWrapMode(arg1,arg2); + instance.SetWrapMode(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -441,13 +438,13 @@ int UtcDaliSamplerSetWrapModeNegative01(void) int UtcDaliSamplerSetWrapModeNegative02(void) { TestApplication application; - Dali::Sampler instance; + Dali::Sampler instance; try { Dali::WrapMode::Type arg1(static_cast(-1)); Dali::WrapMode::Type arg2(static_cast(-1)); Dali::WrapMode::Type arg3(static_cast(-1)); - instance.SetWrapMode(arg1,arg2,arg3); + instance.SetWrapMode(arg1, arg2, arg3); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -460,12 +457,12 @@ int UtcDaliSamplerSetWrapModeNegative02(void) int UtcDaliSamplerSetFilterModeNegative(void) { TestApplication application; - Dali::Sampler instance; + Dali::Sampler instance; try { Dali::FilterMode::Type arg1(static_cast(-1)); Dali::FilterMode::Type arg2(static_cast(-1)); - instance.SetFilterMode(arg1,arg2); + instance.SetFilterMode(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) diff --git a/automated-tests/src/dali/utc-Dali-Scene.cpp b/automated-tests/src/dali/utc-Dali-Scene.cpp index f23df12..2fb7d3c 100644 --- a/automated-tests/src/dali/utc-Dali-Scene.cpp +++ b/automated-tests/src/dali/utc-Dali-Scene.cpp @@ -15,24 +15,22 @@ * */ -#include - -#include -#include -#include -#include +#include #include +#include #include #include - -#include +#include +#include #include +#include + +#include // Internal headers are allowed here namespace { - const std::string DEFAULT_DEVICE_NAME("hwKeyboard"); // Functor for EventProcessingFinished signal @@ -41,9 +39,10 @@ struct EventProcessingFinishedFunctor /** * @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called. */ - EventProcessingFinishedFunctor( bool& eventProcessingFinished ) - : mEventProcessingFinished( eventProcessingFinished ) - {} + EventProcessingFinishedFunctor(bool& eventProcessingFinished) + : mEventProcessingFinished(eventProcessingFinished) + { + } void operator()() { @@ -58,7 +57,8 @@ struct KeyEventSignalData { KeyEventSignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -67,18 +67,21 @@ struct KeyEventSignalData receivedKeyEvent.Reset(); } - bool functorCalled; + bool functorCalled; KeyEvent receivedKeyEvent; }; // Functor that sets the data when called struct KeyEventReceivedFunctor { - KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { } + KeyEventReceivedFunctor(KeyEventSignalData& data) + : signalData(data) + { + } - bool operator()( const KeyEvent& keyEvent ) + bool operator()(const KeyEvent& keyEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedKeyEvent = keyEvent; return true; @@ -94,36 +97,40 @@ struct TouchedSignalData : functorCalled(false), createNewScene(false), newSceneCreated(false) - {} + { + } void Reset() { - functorCalled = false; - createNewScene = false; + functorCalled = false; + createNewScene = false; newSceneCreated = false; receivedTouchEvent.Reset(); } - bool functorCalled; - bool createNewScene; - bool newSceneCreated; + bool functorCalled; + bool createNewScene; + bool newSceneCreated; TouchEvent receivedTouchEvent; }; // Functor that sets the data when touched signal is received struct TouchFunctor { - TouchFunctor( TouchedSignalData& data ) : signalData( data ) { } + TouchFunctor(TouchedSignalData& data) + : signalData(data) + { + } - void operator()( const TouchEvent& touch ) + void operator()(const TouchEvent& touch) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedTouchEvent = touch; - if ( signalData.createNewScene ) + if(signalData.createNewScene) { - Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) ); - DALI_TEST_CHECK( scene ); + Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(scene); signalData.newSceneCreated = true; } @@ -142,25 +149,29 @@ struct WheelEventSignalData { WheelEventSignalData() : functorCalled(false) - {} + { + } void Reset() { functorCalled = false; } - bool functorCalled; + bool functorCalled; WheelEvent receivedWheelEvent; }; // Functor that sets the data when wheel-event signal is received struct WheelEventReceivedFunctor { - WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { } + WheelEventReceivedFunctor(WheelEventSignalData& data) + : signalData(data) + { + } - bool operator()( const WheelEvent& wheelEvent ) + bool operator()(const WheelEvent& wheelEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedWheelEvent = wheelEvent; return true; @@ -174,7 +185,8 @@ struct KeyEventGeneratedSignalData { KeyEventGeneratedSignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -183,20 +195,21 @@ struct KeyEventGeneratedSignalData receivedKeyEvent.Reset(); } - bool functorCalled; + bool functorCalled; KeyEvent receivedKeyEvent; }; // Functor that sets the data when called struct KeyEventGeneratedReceivedFunctor { - KeyEventGeneratedReceivedFunctor( KeyEventGeneratedSignalData& data ) - : signalData( data ) - {} + KeyEventGeneratedReceivedFunctor(KeyEventGeneratedSignalData& data) + : signalData(data) + { + } - bool operator()( const KeyEvent& keyEvent ) + bool operator()(const KeyEvent& keyEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedKeyEvent = keyEvent; return true; @@ -211,22 +224,22 @@ struct KeyEventGeneratedReceivedFunctor KeyEventGeneratedSignalData& signalData; }; -void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition ) +void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); } -bool DummyTouchCallback( Actor actor, const TouchEvent& touch ) +bool DummyTouchCallback(Actor actor, const TouchEvent& touch) { return true; } -void FrameCallback( int frameId ) +void FrameCallback(int frameId) { } @@ -240,10 +253,10 @@ int UtcDaliSceneAdd(void) Dali::Integration::Scene scene = application.GetScene(); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); - scene.Add( actor ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + scene.Add(actor); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); END_TEST; } @@ -256,13 +269,13 @@ int UtcDaliSceneRemove(void) Dali::Integration::Scene scene = application.GetScene(); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); - scene.Add( actor ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + scene.Add(actor); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); scene.Remove(actor); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); END_TEST; } @@ -273,9 +286,9 @@ int UtcDaliSceneGetSize(void) tet_infoline("Testing Dali::Integration::Scene::GetSize"); Dali::Integration::Scene scene = application.GetScene(); - Size size = scene.GetSize(); - DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_WIDTH, size.width, TEST_LOCATION ); - DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_HEIGHT, size.height, TEST_LOCATION ); + Size size = scene.GetSize(); + DALI_TEST_EQUALS(TestApplication::DEFAULT_SURFACE_WIDTH, size.width, TEST_LOCATION); + DALI_TEST_EQUALS(TestApplication::DEFAULT_SURFACE_HEIGHT, size.height, TEST_LOCATION); END_TEST; } @@ -286,10 +299,10 @@ int UtcDaliSceneGetDpi(void) // Test that setting core DPI explicitly also sets up the scene's DPI. Dali::Integration::Scene scene = application.GetScene(); - scene.SetDpi( Vector2(200.0f, 180.0f) ); + scene.SetDpi(Vector2(200.0f, 180.0f)); Vector2 dpi = scene.GetDpi(); - DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION); + DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION); END_TEST; } @@ -304,13 +317,13 @@ int UtcDaliSceneGetRenderTaskList(void) const RenderTaskList& tasks = scene.GetRenderTaskList(); // There should be 1 task by default. - DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION); // RenderTaskList has it's own UTC tests. // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time. RenderTask newTask = scene.GetRenderTaskList().CreateTask(); - DALI_TEST_EQUALS( scene.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION ); + DALI_TEST_EQUALS(scene.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION); END_TEST; } @@ -321,11 +334,11 @@ int UtcDaliSceneGetRootLayer(void) tet_infoline("Testing Dali::Integration::Scene::GetRootLayer"); Dali::Integration::Scene scene = application.GetScene(); - Layer layer = scene.GetLayer( 0 ); - DALI_TEST_CHECK( layer ); + Layer layer = scene.GetLayer(0); + DALI_TEST_CHECK(layer); // Check that GetRootLayer() correctly retreived layer 0. - DALI_TEST_CHECK( scene.GetRootLayer() == layer ); + DALI_TEST_CHECK(scene.GetRootLayer() == layer); END_TEST; } @@ -337,12 +350,12 @@ int UtcDaliSceneGetLayerCount(void) Dali::Integration::Scene scene = application.GetScene(); // Initially we have a default layer - DALI_TEST_EQUALS( scene.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(scene.GetLayerCount(), 1u, TEST_LOCATION); Layer layer = Layer::New(); - scene.Add( layer ); + scene.Add(layer); - DALI_TEST_EQUALS( scene.GetLayerCount(), 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(scene.GetLayerCount(), 2u, TEST_LOCATION); END_TEST; } @@ -353,14 +366,14 @@ int UtcDaliSceneGetLayer(void) Dali::Integration::Scene scene = application.GetScene(); - Layer rootLayer = scene.GetLayer( 0 ); - DALI_TEST_CHECK( rootLayer ); + Layer rootLayer = scene.GetLayer(0); + DALI_TEST_CHECK(rootLayer); Layer layer = Layer::New(); - scene.Add( layer ); + scene.Add(layer); - Layer sameLayer = scene.GetLayer( 1 ); - DALI_TEST_CHECK( layer == sameLayer ); + Layer sameLayer = scene.GetLayer(1); + DALI_TEST_CHECK(layer == sameLayer); END_TEST; } @@ -373,11 +386,11 @@ int UtcDaliSceneGet(void) Dali::Integration::Scene scene = application.GetScene(); Actor actor = Actor::New(); - DALI_TEST_CHECK( Dali::Integration::Scene() == Dali::Integration::Scene::Get( actor ) ); + DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(actor)); - scene.Add( actor ); + scene.Add(actor); - DALI_TEST_CHECK( scene == Dali::Integration::Scene::Get( actor ) ); + DALI_TEST_CHECK(scene == Dali::Integration::Scene::Get(actor)); END_TEST; } @@ -388,11 +401,11 @@ int UtcDaliSceneDiscard(void) tet_infoline("Testing Dali::Scene::Discard"); // Create a new Scene - Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) ); - DALI_TEST_CHECK( scene ); + Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(scene); // One reference of scene kept here and the other one kept in the Core - DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 ); + DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 2); // Render and notify. application.SendNotification(); @@ -400,12 +413,12 @@ int UtcDaliSceneDiscard(void) // Keep the reference of the root layer handle so it will still be alive after the scene is deleted Layer rootLayer = scene.GetRootLayer(); - DALI_TEST_CHECK( rootLayer ); - DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 ); + DALI_TEST_CHECK(rootLayer); + DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 2); // Request to discard the scene from the Core scene.Discard(); - DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 ); + DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 1); // Reset the scene handle scene.Reset(); @@ -416,7 +429,7 @@ int UtcDaliSceneDiscard(void) // At this point, the scene should have been automatically deleted // To prove this, the ref count of the root layer handle should be decremented to 1 - DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 ); + DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1); // Delete the root layer handle rootLayer.Reset(); @@ -436,18 +449,18 @@ int UtcDaliSceneCreateNewSceneDuringCoreEventProcessing(void) TouchedSignalData data; data.createNewScene = true; - TouchFunctor functor( data ); - scene.TouchedSignal().Connect( &application, functor ); + TouchFunctor functor(data); + scene.TouchedSignal().Connect(&application, functor); // Render and notify. application.SendNotification(); application.Render(); - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, data.createNewScene, TEST_LOCATION ); - DALI_TEST_EQUALS( true, data.newSceneCreated, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, data.createNewScene, TEST_LOCATION); + DALI_TEST_EQUALS(true, data.newSceneCreated, TEST_LOCATION); data.Reset(); END_TEST; @@ -458,15 +471,15 @@ int UtcDaliSceneRootLayerAndSceneAlignment(void) TestApplication application; // Create a Scene - Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) ); - DALI_TEST_CHECK( scene ); + Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(scene); // One reference of scene kept here and the other one kept in the Core - DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 ); + DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 2); // Add a renderable actor to the scene auto actor = CreateRenderableActor(); - scene.Add( actor ); + scene.Add(actor); // Render and notify. application.SendNotification(); @@ -474,12 +487,12 @@ int UtcDaliSceneRootLayerAndSceneAlignment(void) // Keep the reference of the root layer handle so it will still be alive after the scene is deleted Layer rootLayer = scene.GetRootLayer(); - DALI_TEST_CHECK( rootLayer ); - DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 ); + DALI_TEST_CHECK(rootLayer); + DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 2); // Request to discard the scene from the Core scene.Discard(); - DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 ); + DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 1); // Reset the scene handle scene.Reset(); @@ -490,11 +503,11 @@ int UtcDaliSceneRootLayerAndSceneAlignment(void) // At this point, the scene should have been automatically deleted // To prove this, the ref count of the root layer handle should be decremented to 1 - DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 ); + DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1); // Create a new Scene while the root layer of the deleted scene is still alive - Dali::Integration::Scene newScene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) ); - DALI_TEST_CHECK( newScene ); + Dali::Integration::Scene newScene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(newScene); // Render and notify. application.SendNotification(); @@ -502,7 +515,7 @@ int UtcDaliSceneRootLayerAndSceneAlignment(void) // At this point, we have only one scene but two root layers // The root layer of the deleted scene is still alive - DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 ); + DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1); // Delete the root layer of the deleted scene rootLayer.Reset(); @@ -516,118 +529,118 @@ int UtcDaliSceneRootLayerAndSceneAlignment(void) int UtcDaliSceneEventProcessingFinishedP(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - bool eventProcessingFinished = false; - EventProcessingFinishedFunctor functor( eventProcessingFinished ); - scene.EventProcessingFinishedSignal().Connect( &application, functor ); + bool eventProcessingFinished = false; + EventProcessingFinishedFunctor functor(eventProcessingFinished); + scene.EventProcessingFinishedSignal().Connect(&application, functor); - Actor actor( Actor::New() ); - scene.Add( actor ); + Actor actor(Actor::New()); + scene.Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( eventProcessingFinished ); + DALI_TEST_CHECK(eventProcessingFinished); END_TEST; } int UtcDaliSceneEventProcessingFinishedN(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - bool eventProcessingFinished = false; - EventProcessingFinishedFunctor functor( eventProcessingFinished ); - scene.EventProcessingFinishedSignal().Connect( &application, functor ); + bool eventProcessingFinished = false; + EventProcessingFinishedFunctor functor(eventProcessingFinished); + scene.EventProcessingFinishedSignal().Connect(&application, functor); - Actor actor( Actor::New() ); - scene.Add( actor ); + Actor actor(Actor::New()); + scene.Add(actor); // Do not complete event processing and confirm the signal has not been emitted. - DALI_TEST_CHECK( !eventProcessingFinished ); + DALI_TEST_CHECK(!eventProcessingFinished); END_TEST; } int UtcDaliSceneSignalKeyEventP(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - KeyEventSignalData data; - KeyEventReceivedFunctor functor( data ); - scene.KeyEventSignal().Connect( &application, functor ); + KeyEventSignalData data; + KeyEventReceivedFunctor functor(data); + scene.KeyEventSignal().Connect(&application, functor); - Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event ); + Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event2 ); + Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event2.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event2.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event3 ); + Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event3); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event3.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event3.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event4 ); + Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event4); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event4.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event4.state == static_cast(data.receivedKeyEvent.GetState())); END_TEST; } int UtcDaliSceneSignalKeyEventN(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - KeyEventSignalData data; - KeyEventReceivedFunctor functor( data ); - scene.KeyEventSignal().Connect( &application, functor ); + KeyEventSignalData data; + KeyEventReceivedFunctor functor(data); + scene.KeyEventSignal().Connect(&application, functor); // Check that a non-pressed key events data is not modified. - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } int UtcDaliSceneTouchedSignalP(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); TouchedSignalData data; - TouchFunctor functor( data ); - scene.TouchedSignal().Connect( &application, functor ); + TouchFunctor functor(data); + scene.TouchedSignal().Connect(&application, functor); // Render and notify. application.SendNotification(); @@ -635,28 +648,28 @@ int UtcDaliSceneTouchedSignalP(void) // Basic test: No actors, single touch (down then up). { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); - GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Add an actor to the scene. Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.TouchedSignal().Connect( &DummyTouchCallback ); - scene.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.TouchedSignal().Connect(&DummyTouchCallback); + scene.Add(actor); // Render and notify. application.SendNotification(); @@ -664,69 +677,69 @@ int UtcDaliSceneTouchedSignalP(void) // Actor on scene, single touch, down in actor, motion, then up outside actor. { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor); data.Reset(); - GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Multiple touch. Should only receive a touch on first down and last up. { Integration::TouchEvent touchEvent; - Integration::Point point; + Integration::Point point; // 1st point - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.0f, 10.0f ) ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.0f, 10.0f)); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); data.Reset(); // 2nd point - touchEvent.points[0].SetState( PointState::STATIONARY ); - point.SetDeviceId( 1 ); - point.SetScreenPosition( Vector2( 50.0f, 50.0f ) ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::STATIONARY); + point.SetDeviceId(1); + point.SetScreenPosition(Vector2(50.0f, 50.0f)); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Primary point is up - touchEvent.points[0].SetState( PointState::UP ); - touchEvent.points[1].SetState( PointState::STATIONARY ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::UP); + touchEvent.points[1].SetState(PointState::STATIONARY); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Remove 1st point now, 2nd point is now in motion - touchEvent.points.erase( touchEvent.points.begin() ); - touchEvent.points[0].SetState( PointState::MOTION ); - touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + touchEvent.points.erase(touchEvent.points.begin()); + touchEvent.points[0].SetState(PointState::MOTION); + touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f)); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Final point Up - touchEvent.points[0].SetState( PointState::UP ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::UP); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); data.Reset(); } END_TEST; @@ -734,52 +747,52 @@ int UtcDaliSceneTouchedSignalP(void) int UtcDaliSceneTouchedSignalN(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); TouchedSignalData data; - TouchFunctor functor( data ); - scene.TouchedSignal().Connect( &application, functor ); + TouchFunctor functor(data); + scene.TouchedSignal().Connect(&application, functor); // Render and notify. application.SendNotification(); application.Render(); // Confirm functor not called before there has been any touch event. - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // No actors, single touch, down, motion then up. { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); // Confirm there is no signal when the touchpoint is only moved. - GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Confirm a following up event generates a signal. - GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) ); + GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Add an actor to the scene. Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.TouchedSignal().Connect( &DummyTouchCallback ); - scene.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.TouchedSignal().Connect(&DummyTouchCallback); + scene.Add(actor); // Render and notify. application.SendNotification(); @@ -787,34 +800,34 @@ int UtcDaliSceneTouchedSignalN(void) // Actor on scene. Interrupted before down and interrupted after down. { - GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED); data.Reset(); - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::DOWN ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN); data.Reset(); - GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); // Check that getting info about a non-existent point returns an empty handle - Actor actor = data.receivedTouchEvent.GetHitActor( 1 ); - DALI_TEST_CHECK( !actor ); + Actor actor = data.receivedTouchEvent.GetHitActor(1); + DALI_TEST_CHECK(!actor); data.Reset(); } @@ -824,80 +837,80 @@ int UtcDaliSceneTouchedSignalN(void) int UtcDaliSceneSignalWheelEventP(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - WheelEventSignalData data; - WheelEventReceivedFunctor functor( data ); - scene.WheelEventSignal().Connect( &application, functor ); + WheelEventSignalData data; + WheelEventReceivedFunctor functor(data); + scene.WheelEventSignal().Connect(&application, functor); - Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u ); - application.ProcessEvent( event ); + Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() ); - DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() ); - DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() ); - DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() ); - DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() ); - DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(static_cast(event.type) == data.receivedWheelEvent.GetType()); + DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection()); + DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers()); + DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint()); + DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta()); + DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime()); data.Reset(); - Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u ); - application.ProcessEvent( event2 ); + Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() ); - DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() ); - DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() ); - DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() ); - DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() ); - DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(static_cast(event2.type) == data.receivedWheelEvent.GetType()); + DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection()); + DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers()); + DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint()); + DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta()); + DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime()); END_TEST; } int UtcDaliSceneSurfaceResizedDefaultScene(void) { - tet_infoline( "Ensure resizing of the surface is handled properly" ); + tet_infoline("Ensure resizing of the surface is handled properly"); TestApplication application; auto defaultScene = application.GetScene(); - DALI_TEST_CHECK( defaultScene ); + DALI_TEST_CHECK(defaultScene); // Ensure stage size matches the scene size auto stage = Stage::GetCurrent(); - DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION); // Resize the scene - Vector2 newSize( 1000.0f, 2000.0f ); - DALI_TEST_CHECK( stage.GetSize() != newSize ); - defaultScene.SurfaceResized( newSize.width, newSize.height ); + Vector2 newSize(1000.0f, 2000.0f); + DALI_TEST_CHECK(stage.GetSize() != newSize); + defaultScene.SurfaceResized(newSize.width, newSize.height); - DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION ); - DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION); + DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION); END_TEST; } int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void) { - tet_infoline( "Ensure resizing of the surface & viewport is handled properly" ); + tet_infoline("Ensure resizing of the surface & viewport is handled properly"); - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& callStack = glAbstraction.GetViewportTrace(); - glAbstraction.EnableViewportCallTrace( true ); + TraceCallStack& callStack = glAbstraction.GetViewportTrace(); + glAbstraction.EnableViewportCallTrace(true); // Initial scene setup Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); // Render before resizing surface @@ -906,65 +919,65 @@ int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void) glAbstraction.ResetViewportCallStack(); auto defaultScene = application.GetScene(); - DALI_TEST_CHECK( defaultScene ); + DALI_TEST_CHECK(defaultScene); // Ensure stage size matches the scene size auto stage = Stage::GetCurrent(); - DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION); // Resize the scene - Vector2 newSize( 1000.0f, 2000.0f ); - std::string viewportParams( "0, 0, 1000, 2000" ); // to match newSize - DALI_TEST_CHECK( stage.GetSize() != newSize ); - defaultScene.SurfaceResized( newSize.width, newSize.height ); + Vector2 newSize(1000.0f, 2000.0f); + std::string viewportParams("0, 0, 1000, 2000"); // to match newSize + DALI_TEST_CHECK(stage.GetSize() != newSize); + defaultScene.SurfaceResized(newSize.width, newSize.height); - DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION ); - DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION); + DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION); // Render after resizing surface application.SendNotification(); application.Render(0); // Check that the viewport is handled properly - DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("Viewport", viewportParams ) ); + DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("Viewport", viewportParams)); END_TEST; } int UtcDaliSceneSurfaceResizedMultipleRenderTasks(void) { - tet_infoline( "Ensure resizing of the surface & viewport is handled properly" ); + tet_infoline("Ensure resizing of the surface & viewport is handled properly"); - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - TraceCallStack& callStack = glAbstraction.GetViewportTrace(); - glAbstraction.EnableViewportCallTrace( true ); + TraceCallStack& callStack = glAbstraction.GetViewportTrace(); + glAbstraction.EnableViewportCallTrace(true); // Initial scene setup auto scene = application.GetScene(); Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - int testWidth = 400; + int testWidth = 400; int testHeight = 400; - actor.SetProperty( Actor::Property::SIZE, Vector2( testWidth, testHeight) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(testWidth, testHeight)); scene.Add(actor); - CameraActor offscreenCameraActor = CameraActor::New( Size( testWidth, testHeight ) ); - application.GetScene().Add( offscreenCameraActor ); + CameraActor offscreenCameraActor = CameraActor::New(Size(testWidth, testHeight)); + application.GetScene().Add(offscreenCameraActor); - FrameBuffer newFrameBuffer = FrameBuffer::New( testWidth, testHeight, FrameBuffer::Attachment::NONE ); + FrameBuffer newFrameBuffer = FrameBuffer::New(testWidth, testHeight, FrameBuffer::Attachment::NONE); RenderTask newTask = scene.GetRenderTaskList().CreateTask(); - newTask.SetCameraActor( offscreenCameraActor ); - newTask.SetSourceActor( actor ); - newTask.SetFrameBuffer( newFrameBuffer ); - newTask.SetViewportPosition( Vector2(0, 0) ); - newTask.SetViewportSize( Vector2(testWidth, testHeight) ); + newTask.SetCameraActor(offscreenCameraActor); + newTask.SetSourceActor(actor); + newTask.SetFrameBuffer(newFrameBuffer); + newTask.SetViewportPosition(Vector2(0, 0)); + newTask.SetViewportSize(Vector2(testWidth, testHeight)); // Render before resizing surface application.SendNotification(); @@ -972,179 +985,179 @@ int UtcDaliSceneSurfaceResizedMultipleRenderTasks(void) glAbstraction.ResetViewportCallStack(); Rect initialViewport = newTask.GetViewport(); - int initialWidth = initialViewport.width; - int initialHeight = initialViewport.height; - DALI_TEST_EQUALS( initialWidth, testWidth, TEST_LOCATION ); - DALI_TEST_EQUALS( initialHeight, testHeight, TEST_LOCATION ); + int initialWidth = initialViewport.width; + int initialHeight = initialViewport.height; + DALI_TEST_EQUALS(initialWidth, testWidth, TEST_LOCATION); + DALI_TEST_EQUALS(initialHeight, testHeight, TEST_LOCATION); auto defaultScene = application.GetScene(); - DALI_TEST_CHECK( defaultScene ); + DALI_TEST_CHECK(defaultScene); // Ensure stage size matches the scene size auto stage = Stage::GetCurrent(); - DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION); // Resize the scene - Vector2 newSize( 1000.0f, 2000.0f ); - std::string viewportParams( "0, 0, 1000, 2000" ); // to match newSize - DALI_TEST_CHECK( stage.GetSize() != newSize ); - defaultScene.SurfaceResized( newSize.width, newSize.height ); + Vector2 newSize(1000.0f, 2000.0f); + std::string viewportParams("0, 0, 1000, 2000"); // to match newSize + DALI_TEST_CHECK(stage.GetSize() != newSize); + defaultScene.SurfaceResized(newSize.width, newSize.height); - DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION ); - DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION); + DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION); // Render after resizing surface application.SendNotification(); application.Render(0); // Check that the viewport is handled properly - DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("Viewport", viewportParams ) ); + DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("Viewport", viewportParams)); // Second render-task should not be affected Rect viewport = newTask.GetViewport(); - int width = viewport.width; - int height = viewport.height; - DALI_TEST_EQUALS( width, testWidth, TEST_LOCATION ); - DALI_TEST_EQUALS( height, testHeight, TEST_LOCATION ); + int width = viewport.width; + int height = viewport.height; + DALI_TEST_EQUALS(width, testWidth, TEST_LOCATION); + DALI_TEST_EQUALS(height, testHeight, TEST_LOCATION); END_TEST; } int UtcDaliSceneSurfaceResizedAdditionalScene(void) { - tet_infoline( "Ensure resizing of the surface is handled properly on additional scenes" ); + tet_infoline("Ensure resizing of the surface is handled properly on additional scenes"); TestApplication application; - Vector2 originalSurfaceSize( 500.0f, 1000.0f ); + Vector2 originalSurfaceSize(500.0f, 1000.0f); - auto scene = Integration::Scene::New( Size( originalSurfaceSize.width, originalSurfaceSize.height ) ); + auto scene = Integration::Scene::New(Size(originalSurfaceSize.width, originalSurfaceSize.height)); // Ensure stage size does NOT match the surface size - auto stage = Stage::GetCurrent(); + auto stage = Stage::GetCurrent(); const auto stageSize = stage.GetSize(); - DALI_TEST_CHECK( stageSize != originalSurfaceSize ); - DALI_TEST_EQUALS( originalSurfaceSize, scene.GetSize(), TEST_LOCATION ); + DALI_TEST_CHECK(stageSize != originalSurfaceSize); + DALI_TEST_EQUALS(originalSurfaceSize, scene.GetSize(), TEST_LOCATION); // Resize the surface and inform the scene accordingly - Vector2 newSize( 1000.0f, 2000.0f ); - DALI_TEST_CHECK( stage.GetSize() != newSize ); - scene.SurfaceResized( newSize.width, newSize.height ); + Vector2 newSize(1000.0f, 2000.0f); + DALI_TEST_CHECK(stage.GetSize() != newSize); + scene.SurfaceResized(newSize.width, newSize.height); // Ensure the stage hasn't been resized - DALI_TEST_EQUALS( stage.GetSize(), stageSize, TEST_LOCATION ); - DALI_TEST_EQUALS( scene.GetSize(), newSize, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetSize(), stageSize, TEST_LOCATION); + DALI_TEST_EQUALS(scene.GetSize(), newSize, TEST_LOCATION); END_TEST; } int UtcDaliSceneKeyEventGeneratedSignalP(void) { - TestApplication application; + TestApplication application; Dali::Integration::Scene scene = application.GetScene(); - KeyEventGeneratedSignalData data; - KeyEventGeneratedReceivedFunctor functor( data ); - scene.KeyEventGeneratedSignal().Connect( &application, functor ); + KeyEventGeneratedSignalData data; + KeyEventGeneratedReceivedFunctor functor(data); + scene.KeyEventGeneratedSignal().Connect(&application, functor); - Integration::KeyEvent event( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event ); + Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event2 ); + Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event2.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event2.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event3 ); + Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event3); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event3.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event3.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event4 ); + Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event4); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event4.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event4.state == static_cast(data.receivedKeyEvent.GetState())); END_TEST; } int UtcDaliSceneEnsureReplacedSurfaceKeepsClearColor(void) { - tet_infoline( "Ensure we keep background color when the scene surface is replaced " ); + tet_infoline("Ensure we keep background color when the scene surface is replaced "); TestApplication application; // Create a new scene and set the background color of the main scene auto defaultScene = application.GetScene(); - defaultScene.SetBackgroundColor( Color::BLUE ); + defaultScene.SetBackgroundColor(Color::BLUE); // Need to create a renderable as we don't start rendering until we have at least one // We don't need to add this to any scene auto actor = CreateRenderableActor(); - auto& glAbstraction = application.GetGlAbstraction(); - auto clearCountBefore = glAbstraction.GetClearCountCalled(); + auto& glAbstraction = application.GetGlAbstraction(); + auto clearCountBefore = glAbstraction.GetClearCountCalled(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION ); - DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION); + DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION); defaultScene.SurfaceReplaced(); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION ); - DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION); + DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION); // Check when the main render task viewport is set the clear color is clipped using scissors - TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); + TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace(); TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace(); - scissorTrace.Enable( true ); - enabledDisableTrace.Enable( true ); + scissorTrace.Enable(true); + enabledDisableTrace.Enable(true); - defaultScene.GetRenderTaskList().GetTask( 0 ).SetViewport( Viewport( 0.0f, 0.0f, 100.0f, 100.0f ) ); + defaultScene.GetRenderTaskList().GetTask(0).SetViewport(Viewport(0.0f, 0.0f, 100.0f, 100.0f)); application.SendNotification(); application.Render(); // Check scissor test was enabled. - DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST) + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) // Check the scissor was set, and the coordinates are correct. - DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", "0, 700, 100, 100" ) ); + DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", "0, 700, 100, 100")); - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION ); - DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION); + DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION); - scissorTrace.Enable( false ); + scissorTrace.Enable(false); scissorTrace.Reset(); - enabledDisableTrace.Enable( false ); + enabledDisableTrace.Enable(false); enabledDisableTrace.Reset(); END_TEST; @@ -1152,9 +1165,9 @@ int UtcDaliSceneEnsureReplacedSurfaceKeepsClearColor(void) int UtcDaliSceneEmptySceneRendering(void) { - tet_infoline( "Ensure not rendering before a Renderer is added" ); + tet_infoline("Ensure not rendering before a Renderer is added"); - TestApplication application; + TestApplication application; TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); // Render without any renderer @@ -1162,30 +1175,30 @@ int UtcDaliSceneEmptySceneRendering(void) application.Render(); // Check the clear count and the render status - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 0, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 0, TEST_LOCATION); + DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), false, TEST_LOCATION); // Add a Renderer Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); + actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400, 400 ) ); - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400)); + application.GetScene().Add(actor); // Render application.SendNotification(); application.Render(); // Check the clear count and the render status - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), true, TEST_LOCATION); // Remove the Renderer - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); actor.Reset(); renderer.Reset(); @@ -1194,49 +1207,49 @@ int UtcDaliSceneEmptySceneRendering(void) application.Render(); // Check the clear count and the render status - DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 2, TEST_LOCATION ); // Should be cleared - DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 2, TEST_LOCATION); // Should be cleared + DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), true, TEST_LOCATION); END_TEST; } int UtcDaliSceneFrameRenderedPresentedCallback(void) { - tet_infoline( "UtcDaliSceneFrameRenderedCallback" ); + tet_infoline("UtcDaliSceneFrameRenderedCallback"); TestApplication application; // Add a Renderer Geometry geometry = CreateQuadGeometry(); - Shader shader = CreateShader(); - Renderer renderer = Renderer::New( geometry, shader ); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - application.GetScene().Add( actor ); + actor.AddRenderer(renderer); + application.GetScene().Add(actor); Dali::Integration::Scene scene = application.GetScene(); int frameId = 1; - scene.AddFrameRenderedCallback( std::unique_ptr< CallbackBase >( MakeCallback( &FrameCallback ) ), frameId ); - scene.AddFramePresentedCallback( std::unique_ptr< CallbackBase >( MakeCallback( &FrameCallback ) ), frameId ); + scene.AddFrameRenderedCallback(std::unique_ptr(MakeCallback(&FrameCallback)), frameId); + scene.AddFramePresentedCallback(std::unique_ptr(MakeCallback(&FrameCallback)), frameId); // Render application.SendNotification(); application.Render(); Dali::Integration::Scene::FrameCallbackContainer callbackContainer; - scene.GetFrameRenderedCallback( callbackContainer ); + scene.GetFrameRenderedCallback(callbackContainer); - DALI_TEST_EQUALS( callbackContainer.size(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( callbackContainer[0].second, frameId, TEST_LOCATION ); + DALI_TEST_EQUALS(callbackContainer.size(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(callbackContainer[0].second, frameId, TEST_LOCATION); callbackContainer.clear(); - scene.GetFramePresentedCallback( callbackContainer ); + scene.GetFramePresentedCallback(callbackContainer); - DALI_TEST_EQUALS( callbackContainer.size(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( callbackContainer[0].second, frameId, TEST_LOCATION ); + DALI_TEST_EQUALS(callbackContainer.size(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(callbackContainer[0].second, frameId, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Scripting.cpp b/automated-tests/src/dali/utc-Dali-Scripting.cpp index 2ae4abf..3d543fa 100644 --- a/automated-tests/src/dali/utc-Dali-Scripting.cpp +++ b/automated-tests/src/dali/utc-Dali-Scripting.cpp @@ -15,35 +15,32 @@ * */ -#include - -#include -#include -#include #include +#include +#include +#include + +#include using namespace Dali; using namespace Dali::Scripting; namespace { - const StringEnum COLOR_MODE_VALUES[] = -{ - { "USE_OWN_COLOR", USE_OWN_COLOR }, - { "USE_PARENT_COLOR", USE_PARENT_COLOR }, - { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR }, - { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA }, + { + {"USE_OWN_COLOR", USE_OWN_COLOR}, + {"USE_PARENT_COLOR", USE_PARENT_COLOR}, + {"USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR}, + {"USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA}, }; -const unsigned int COLOR_MODE_VALUES_COUNT = sizeof( COLOR_MODE_VALUES ) / sizeof( COLOR_MODE_VALUES[0] ); +const unsigned int COLOR_MODE_VALUES_COUNT = sizeof(COLOR_MODE_VALUES) / sizeof(COLOR_MODE_VALUES[0]); const StringEnum DRAW_MODE_VALUES[] = -{ - { "NORMAL", DrawMode::NORMAL }, - { "OVERLAY_2D", DrawMode::OVERLAY_2D } -}; -const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( DRAW_MODE_VALUES[0] ); - + { + {"NORMAL", DrawMode::NORMAL}, + {"OVERLAY_2D", DrawMode::OVERLAY_2D}}; +const unsigned int DRAW_MODE_VALUES_COUNT = sizeof(DRAW_MODE_VALUES) / sizeof(DRAW_MODE_VALUES[0]); //////////////////////////////////////////////////////////////////////////////// // Helpers for string to enum comparisons for Image and Image loading parameters @@ -52,24 +49,24 @@ const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( /** * Template to check enumerations of type T, with a class of type X */ -template< typename T, typename X > +template void TestEnumStrings( - Property::Map& map, // The map used to create instance of type X - const char * const keyName, // the name of the key to iterate through - const StringEnum* values, // An array of string values - unsigned int num, // Number of items in the array - T ( X::*method )() const, // The member method of X to call to get the enum - X ( *creator ) ( const Property::Value& ) // The method which creates an instance of type X + Property::Map& map, // The map used to create instance of type X + const char* const keyName, // the name of the key to iterate through + const StringEnum* values, // An array of string values + unsigned int num, // Number of items in the array + T (X::*method)() const, // The member method of X to call to get the enum + X (*creator)(const Property::Value&) // The method which creates an instance of type X ) { // get the key reference so we can change its value - Property::Value* value = map.Find( keyName ); - for ( unsigned int i = 0; i < num; ++i ) + Property::Value* value = map.Find(keyName); + for(unsigned int i = 0; i < num; ++i) { *value = values[i].string; - tet_printf("Checking: %s: %s\n", keyName, values[i].string ); - X instance = creator( map ); - DALI_TEST_EQUALS( values[i].value, (int)( instance.*method )(), TEST_LOCATION ); + tet_printf("Checking: %s: %s\n", keyName, values[i].string); + X instance = creator(map); + DALI_TEST_EQUALS(values[i].value, (int)(instance.*method)(), TEST_LOCATION); } } @@ -80,56 +77,58 @@ void TestEnumStrings( /** * Template to check enumerations of type T */ -template< typename T > +template void TestEnumStrings( - const char * const keyName, // The name of the key to check - TestApplication& application, // Reference to the application class - const StringEnum* values, // An array of string values - unsigned int num, // Number of items in the array - void ( Actor::*method )( T ) // The Actor member method to set the enumeration + const char* const keyName, // The name of the key to check + TestApplication& application, // Reference to the application class + const StringEnum* values, // An array of string values + unsigned int num, // Number of items in the array + void (Actor::*method)(T) // The Actor member method to set the enumeration ) { - for ( unsigned int i = 0; i < num; ++i ) + for(unsigned int i = 0; i < num; ++i) { - tet_printf("Checking: %s: %s\n", keyName, values[i].string ); + tet_printf("Checking: %s: %s\n", keyName, values[i].string); Actor actor = Actor::New(); - (actor.*method)( ( T ) values[i].value ); + (actor.*method)((T)values[i].value); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); + CreatePropertyMap(actor, map); - DALI_TEST_CHECK( 0 < map.Count() ); - DALI_TEST_CHECK( NULL != map.Find( keyName ) ); - DALI_TEST_EQUALS( map.Find( keyName )->Get< std::string >(), values[i].string, TEST_LOCATION ); + DALI_TEST_CHECK(0 < map.Count()); + DALI_TEST_CHECK(NULL != map.Find(keyName)); + DALI_TEST_EQUALS(map.Find(keyName)->Get(), values[i].string, TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } } ////////////////////////////////////////////////////////////////////////////// - -} // anon namespace +} // namespace int UtcDaliValueFromEnum(void) { - enum class T { - None, V1 = 1, V2 = 2 + enum class T + { + None, + V1 = 1, + V2 = 2 }; Property::Value v1 = T::V1; Property::Value v2 = T::V2; T t = T::None; - DALI_TEST_CHECK( v1.Get() == T::V1 ); - DALI_TEST_CHECK( v2.Get() == T::V2 ); - DALI_TEST_CHECK( v1.Get(t) && t == T::V1 ); - DALI_TEST_CHECK( v2.Get(t) && t == T::V2 ); + DALI_TEST_CHECK(v1.Get() == T::V1); + DALI_TEST_CHECK(v2.Get() == T::V2); + DALI_TEST_CHECK(v1.Get(t) && t == T::V1); + DALI_TEST_CHECK(v2.Get(t) && t == T::V2); END_TEST; } @@ -140,30 +139,30 @@ int UtcDaliScriptingNewActorNegative(void) // Empty map { - Actor handle = NewActor( Property::Map() ); - DALI_TEST_CHECK( !handle ); + Actor handle = NewActor(Property::Map()); + DALI_TEST_CHECK(!handle); } // Map with only properties { Property::Map map; - map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER; - map[ "anchorPoint" ] = AnchorPoint::TOP_CENTER; - Actor handle = NewActor( map ); - DALI_TEST_CHECK( !handle ); + map["parentOrigin"] = ParentOrigin::TOP_CENTER; + map["anchorPoint"] = AnchorPoint::TOP_CENTER; + Actor handle = NewActor(map); + DALI_TEST_CHECK(!handle); } // Add some signals to the map, we should have no signal connections as its not yet supported { Property::Map map; - map[ "type" ] = "Actor"; - map[ "signals" ] = Property::MAP; - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); - DALI_TEST_CHECK( !handle.WheelEventSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.OffSceneSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.OnSceneSignal().GetConnectionCount() ); - DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() ); + map["type"] = "Actor"; + map["signals"] = Property::MAP; + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); + DALI_TEST_CHECK(!handle.WheelEventSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.OffSceneSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.OnSceneSignal().GetConnectionCount()); + DALI_TEST_CHECK(!handle.TouchedSignal().GetConnectionCount()); } END_TEST; } @@ -173,77 +172,77 @@ int UtcDaliScriptingNewActorProperties(void) TestApplication application; Property::Map map; - map[ "type" ] = "Actor"; - map[ "size" ] = Vector3::ONE; - map[ "position" ] = Vector3::XAXIS; - map[ "scale" ] = Vector3::ONE; - map[ "visible" ] = false; - map[ "color" ] = Color::MAGENTA; - map[ "name" ] = "MyActor"; - map[ "colorMode" ] = "USE_PARENT_COLOR"; - map[ "sensitive" ] = false; - map[ "leaveRequired" ] = true; - map[ "drawMode" ] = "OVERLAY_2D"; - map[ "inheritOrientation" ] = false; - map[ "inheritScale" ] = false; + map["type"] = "Actor"; + map["size"] = Vector3::ONE; + map["position"] = Vector3::XAXIS; + map["scale"] = Vector3::ONE; + map["visible"] = false; + map["color"] = Color::MAGENTA; + map["name"] = "MyActor"; + map["colorMode"] = "USE_PARENT_COLOR"; + map["sensitive"] = false; + map["leaveRequired"] = true; + map["drawMode"] = "OVERLAY_2D"; + map["inheritOrientation"] = false; + map["inheritScale"] = false; // Default properties { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< std::string >( Actor::Property::NAME ), "MyActor", TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::SENSITIVE ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION ); - - application.GetScene().Remove( handle ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::SIZE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::VISIBLE), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::NAME), "MyActor", TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SENSITIVE), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::LEAVE_REQUIRED), true, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION); + + application.GetScene().Remove(handle); } // Check Anchor point and parent origin vector3s - map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER; - map[ "anchorPoint" ] = AnchorPoint::TOP_LEFT; + map["parentOrigin"] = ParentOrigin::TOP_CENTER; + map["anchorPoint"] = AnchorPoint::TOP_LEFT; { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::TOP_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::ANCHOR_POINT), AnchorPoint::TOP_LEFT, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); } // Check Anchor point and parent origin STRINGS - map[ "parentOrigin" ] = "TOP_LEFT"; - map[ "anchorPoint" ] = "CENTER_LEFT"; + map["parentOrigin"] = "TOP_LEFT"; + map["anchorPoint"] = "CENTER_LEFT"; { - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER_LEFT, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); } END_TEST; } @@ -253,25 +252,25 @@ int UtcDaliScriptingNewAnimation(void) TestApplication application; Property::Map map; - map["actor"] = "Actor1"; - map["property"] = "color"; - map["value"] = Color::MAGENTA; + map["actor"] = "Actor1"; + map["property"] = "color"; + map["value"] = Color::MAGENTA; map["alphaFunction"] = "EASE_IN_OUT"; Property::Map timePeriod; - timePeriod["delay"] = 0.5f; + timePeriod["delay"] = 0.5f; timePeriod["duration"] = 1.0f; - map["timePeriod"] = timePeriod; + map["timePeriod"] = timePeriod; Dali::AnimationData data; - Scripting::NewAnimation( map, data ); + Scripting::NewAnimation(map, data); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::NAME,"Actor1"); - actor.SetProperty( Actor::Property::COLOR,Color::CYAN); + actor.SetProperty(Actor::Property::NAME, "Actor1"); + actor.SetProperty(Actor::Property::COLOR, Color::CYAN); application.GetScene().Add(actor); - Animation anim = data.CreateAnimation( actor, 0.5f ); + Animation anim = data.CreateAnimation(actor, 0.5f); anim.Play(); application.SendNotification(); @@ -279,11 +278,11 @@ int UtcDaliScriptingNewAnimation(void) application.Render(500); // Start animation application.Render(500); // Halfway thru anim application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), (Color::MAGENTA+Color::CYAN)*0.5f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), (Color::MAGENTA + Color::CYAN) * 0.5f, TEST_LOCATION); application.Render(500); // Halfway thru anim application.SendNotification(); - DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION); END_TEST; } @@ -293,39 +292,38 @@ int UtcDaliScriptingNewActorChildren(void) TestApplication application; Property::Map map; - map[ "type" ] = "Actor"; - map[ "position" ] = Vector3::XAXIS; + map["type"] = "Actor"; + map["position"] = Vector3::XAXIS; Property::Map child1Map; - child1Map[ "type" ] = "Layer"; - child1Map[ "position" ] = Vector3::YAXIS; + child1Map["type"] = "Layer"; + child1Map["position"] = Vector3::YAXIS; Property::Array childArray; - childArray.PushBack( child1Map ); - map[ "actors" ] = childArray; + childArray.PushBack(child1Map); + map["actors"] = childArray; // Create - Actor handle = NewActor( map ); - DALI_TEST_CHECK( handle ); + Actor handle = NewActor(map); + DALI_TEST_CHECK(handle); - application.GetScene().Add( handle ); + application.GetScene().Add(handle); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetChildCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(handle.GetCurrentProperty(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(handle.GetChildCount(), 1u, TEST_LOCATION); Actor child1 = handle.GetChildAt(0); - DALI_TEST_CHECK( child1 ); - DALI_TEST_CHECK( Layer::DownCast( child1 ) ); - DALI_TEST_EQUALS( child1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::YAXIS, TEST_LOCATION ); - DALI_TEST_EQUALS( child1.GetChildCount(), 0u, TEST_LOCATION ); + DALI_TEST_CHECK(child1); + DALI_TEST_CHECK(Layer::DownCast(child1)); + DALI_TEST_EQUALS(child1.GetCurrentProperty(Actor::Property::POSITION), Vector3::YAXIS, TEST_LOCATION); + DALI_TEST_EQUALS(child1.GetChildCount(), 0u, TEST_LOCATION); - application.GetScene().Remove( handle ); + application.GetScene().Remove(handle); END_TEST; } - int UtcDaliScriptingCreatePropertyMapActor(void) { TestApplication application; @@ -335,12 +333,12 @@ int UtcDaliScriptingCreatePropertyMapActor(void) Actor actor = Actor::New(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type")->Get< std::string >(), "Actor", TEST_LOCATION ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Actor", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } // Layer Type @@ -348,95 +346,95 @@ int UtcDaliScriptingCreatePropertyMapActor(void) Actor actor = Layer::New(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Layer", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } // Default properties { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector3::ONE ); - actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS ); - actor.SetProperty( Actor::Property::SCALE, Vector3::ZAXIS ); - actor.SetProperty( Actor::Property::VISIBLE, false ); - actor.SetProperty( Actor::Property::COLOR, Color::MAGENTA ); - actor.SetProperty( Actor::Property::NAME, "MyActor" ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT ); - actor.SetProperty( Actor::Property::SENSITIVE, false ); - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); - actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false ); - actor.SetProperty( Actor::Property::INHERIT_SCALE, false ); - actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE ); - - application.GetScene().Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE); + actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS); + actor.SetProperty(Actor::Property::SCALE, Vector3::ZAXIS); + actor.SetProperty(Actor::Property::VISIBLE, false); + actor.SetProperty(Actor::Property::COLOR, Color::MAGENTA); + actor.SetProperty(Actor::Property::NAME, "MyActor"); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT); + actor.SetProperty(Actor::Property::SENSITIVE, false); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false); + actor.SetProperty(Actor::Property::INHERIT_SCALE, false); + actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE); + + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); - - DALI_TEST_CHECK( !map.Empty() ); - DALI_TEST_CHECK( NULL != map.Find( "size" ) ); - DALI_TEST_EQUALS( map.Find( "size" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "position" ) ); - DALI_TEST_EQUALS( map.Find( "position" )->Get< Vector3 >(), Vector3::XAXIS, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "scale" ) ); - DALI_TEST_EQUALS( map.Find( "scale" )->Get< Vector3 >(), Vector3::ZAXIS, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "visible" ) ); - DALI_TEST_EQUALS( map.Find( "visible" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "color" ) ); - DALI_TEST_EQUALS( map.Find( "color" )->Get< Vector4 >(), Color::MAGENTA, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "name" ) ); - DALI_TEST_EQUALS( map.Find( "name")->Get< std::string >(), "MyActor", TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "anchorPoint" ) ); - DALI_TEST_EQUALS( map.Find( "anchorPoint" )->Get< Vector3 >(), AnchorPoint::CENTER_LEFT, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "parentOrigin" ) ); - DALI_TEST_EQUALS( map.Find( "parentOrigin" )->Get< Vector3 >(), ParentOrigin::TOP_RIGHT, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "sensitive" ) ); - DALI_TEST_EQUALS( map.Find( "sensitive" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "leaveRequired" ) ); - DALI_TEST_EQUALS( map.Find( "leaveRequired" )->Get< bool >(), true, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "inheritOrientation" ) ); - DALI_TEST_EQUALS( map.Find( "inheritOrientation" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "inheritScale" ) ); - DALI_TEST_EQUALS( map.Find( "inheritScale" )->Get< bool >(), false, TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "sizeModeFactor" ) ); - DALI_TEST_EQUALS( map.Find( "sizeModeFactor" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION ); - - application.GetScene().Remove( actor ); + CreatePropertyMap(actor, map); + + DALI_TEST_CHECK(!map.Empty()); + DALI_TEST_CHECK(NULL != map.Find("size")); + DALI_TEST_EQUALS(map.Find("size")->Get(), Vector3::ONE, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("position")); + DALI_TEST_EQUALS(map.Find("position")->Get(), Vector3::XAXIS, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("scale")); + DALI_TEST_EQUALS(map.Find("scale")->Get(), Vector3::ZAXIS, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("visible")); + DALI_TEST_EQUALS(map.Find("visible")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("color")); + DALI_TEST_EQUALS(map.Find("color")->Get(), Color::MAGENTA, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("name")); + DALI_TEST_EQUALS(map.Find("name")->Get(), "MyActor", TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("anchorPoint")); + DALI_TEST_EQUALS(map.Find("anchorPoint")->Get(), AnchorPoint::CENTER_LEFT, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("parentOrigin")); + DALI_TEST_EQUALS(map.Find("parentOrigin")->Get(), ParentOrigin::TOP_RIGHT, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("sensitive")); + DALI_TEST_EQUALS(map.Find("sensitive")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("leaveRequired")); + DALI_TEST_EQUALS(map.Find("leaveRequired")->Get(), true, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("inheritOrientation")); + DALI_TEST_EQUALS(map.Find("inheritOrientation")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("inheritScale")); + DALI_TEST_EQUALS(map.Find("inheritScale")->Get(), false, TEST_LOCATION); + DALI_TEST_CHECK(NULL != map.Find("sizeModeFactor")); + DALI_TEST_EQUALS(map.Find("sizeModeFactor")->Get(), Vector3::ONE, TEST_LOCATION); + + application.GetScene().Remove(actor); } // Children { Actor actor = Actor::New(); Actor child = Layer::New(); - actor.Add( child ); + actor.Add(child); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); application.SendNotification(); application.Render(); Property::Map map; - CreatePropertyMap( actor, map ); - DALI_TEST_CHECK( !map.Empty() ); + CreatePropertyMap(actor, map); + DALI_TEST_CHECK(!map.Empty()); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Actor", TEST_LOCATION ); + DALI_TEST_CHECK(NULL != map.Find("type")); + DALI_TEST_EQUALS(map.Find("type")->Get(), "Actor", TEST_LOCATION); - DALI_TEST_CHECK( NULL != map.Find( "actors" ) ); - Property::Array children( map.Find( "actors")->Get< Property::Array >() ); - DALI_TEST_CHECK( !children.Empty() ); - Property::Map childMap( children[0].Get< Property::Map >() ); - DALI_TEST_CHECK( !childMap.Empty() ); - DALI_TEST_CHECK( childMap.Find( "type" ) ); - DALI_TEST_EQUALS( childMap.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION ); + DALI_TEST_CHECK(NULL != map.Find("actors")); + Property::Array children(map.Find("actors")->Get()); + DALI_TEST_CHECK(!children.Empty()); + Property::Map childMap(children[0].Get()); + DALI_TEST_CHECK(!childMap.Empty()); + DALI_TEST_CHECK(childMap.Find("type")); + DALI_TEST_EQUALS(childMap.Find("type")->Get(), "Layer", TEST_LOCATION); - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); } END_TEST; } @@ -444,27 +442,27 @@ int UtcDaliScriptingCreatePropertyMapActor(void) int UtcDaliScriptingGetEnumerationTemplates(void) { const Scripting::StringEnum myTable[] = - { - { "ONE", 1 }, - { "TWO", 2 }, - { "THREE", 3 }, - { "FOUR", 4 }, - { "FIVE", 5 }, - }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + { + {"ONE", 1}, + {"TWO", 2}, + {"THREE", 3}, + {"FOUR", 4}, + {"FIVE", 5}, + }; + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); - for ( unsigned int i = 0; i < myTableCount; ++i ) + for(unsigned int i = 0; i < myTableCount; ++i) { - tet_printf("Checking: %s\n", myTable[ i ].string ); + tet_printf("Checking: %s\n", myTable[i].string); int value; - DALI_TEST_CHECK( GetEnumeration( myTable[ i ].string, myTable, myTableCount, value ) ); - DALI_TEST_EQUALS( myTable[ i ].value, value, TEST_LOCATION ); + DALI_TEST_CHECK(GetEnumeration(myTable[i].string, myTable, myTableCount, value)); + DALI_TEST_EQUALS(myTable[i].value, value, TEST_LOCATION); } - for ( unsigned int i = 0; i < myTableCount; ++i ) + for(unsigned int i = 0; i < myTableCount; ++i) { - tet_printf("Checking: %d\n", myTable[ i ].value ); - DALI_TEST_EQUALS( myTable[ i ].string, GetEnumerationName( myTable[ i ].value, myTable, myTableCount ), TEST_LOCATION ); + tet_printf("Checking: %d\n", myTable[i].value); + DALI_TEST_EQUALS(myTable[i].string, GetEnumerationName(myTable[i].value, myTable, myTableCount), TEST_LOCATION); } END_TEST; @@ -472,22 +470,22 @@ int UtcDaliScriptingGetEnumerationTemplates(void) int UtcDaliScriptingGetEnumerationNameN(void) { - const char* value = GetEnumerationName( 10, NULL, 0 ); - DALI_TEST_CHECK( NULL == value ); + const char* value = GetEnumerationName(10, NULL, 0); + DALI_TEST_CHECK(NULL == value); - value = GetEnumerationName( 10, NULL, 1 ); - DALI_TEST_CHECK( NULL == value ); + value = GetEnumerationName(10, NULL, 1); + DALI_TEST_CHECK(NULL == value); END_TEST; } int UtcDaliScriptingGetLinearEnumerationNameN(void) { - const char* value = GetLinearEnumerationName( 10, NULL, 0 ); - DALI_TEST_CHECK( NULL == value ); + const char* value = GetLinearEnumerationName(10, NULL, 0); + DALI_TEST_CHECK(NULL == value); - value = GetLinearEnumerationName( 10, NULL, 1 ); - DALI_TEST_CHECK( NULL == value ); + value = GetLinearEnumerationName(10, NULL, 1); + DALI_TEST_CHECK(NULL == value); END_TEST; } @@ -506,67 +504,67 @@ int UtcDaliScriptingGetEnumerationProperty(void) */ // String to Enum property table to test with (equivalent to ones used within DALi). - const Dali::Scripting::StringEnum testTable[] = { - { "NONE", FaceCullingMode::NONE }, - { "FRONT", FaceCullingMode::FRONT }, - { "BACK", FaceCullingMode::BACK }, - { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK } - }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] ); + const Dali::Scripting::StringEnum testTable[] = { + {"NONE", FaceCullingMode::NONE}, + {"FRONT", FaceCullingMode::FRONT}, + {"BACK", FaceCullingMode::BACK}, + {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}}; + const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]); // TEST: An enum can be looked up from a Property::Value of type INTEGER. // Initialise to first element. FaceCullingMode::Type result = FaceCullingMode::NONE; // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueInteger( FaceCullingMode::FRONT ); + Property::Value propertyValueInteger(FaceCullingMode::FRONT); // Perform the lookup. - bool returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + bool returnValue = GetEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "true" if the property can be successfully converted AND it has changed // Check the property could be converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // Now emulate a property-set with the same value. false should be returned. - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "false" if the property can be successfully converted BUT it has NOT changed. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // TEST: An enum can be looked up from a Property::Value of type STRING. // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueString( "BACK" ); + Property::Value propertyValueString("BACK"); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // TEST: An enum can NOT be looked up for other Property::Value types. - Property::Value propertyValueBoolean( true ); + Property::Value propertyValueBoolean(true); - returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueBoolean, testTable, testTableCount, result ); + returnValue = GetEnumerationProperty(propertyValueBoolean, testTable, testTableCount, result); // TEST: The return value is "false" if the property can not be successfully converted. // Return value should be false as Property::Value was of an unsupported type for enum properties. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed). // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); END_TEST; } @@ -593,106 +591,106 @@ int UtcDaliScriptingGetBitmaskEnumerationProperty(void) */ // String to Enum property table to test with (equivalent to ones used within DALi). - const Dali::Scripting::StringEnum testTable[] = { - { "NONE", FaceCullingMode::NONE }, - { "FRONT", FaceCullingMode::FRONT }, - { "BACK", FaceCullingMode::BACK }, - { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK } - }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] ); + const Dali::Scripting::StringEnum testTable[] = { + {"NONE", FaceCullingMode::NONE}, + {"FRONT", FaceCullingMode::FRONT}, + {"BACK", FaceCullingMode::BACK}, + {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}}; + const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]); // TEST: An enum can be looked up from a Property::Value of type INTEGER. // Initialise to first element. FaceCullingMode::Type result = FaceCullingMode::NONE; // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueInteger( FaceCullingMode::FRONT ); + Property::Value propertyValueInteger(FaceCullingMode::FRONT); // Perform the lookup. - bool returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result ); + bool returnValue = GetBitmaskEnumerationProperty(propertyValueInteger, testTable, testTableCount, result); // TEST: The return value is "true" if the property can be successfully converted AND it has changed // Check the property could be converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::FRONT ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::FRONT), TEST_LOCATION); // TEST: An enum can be looked up from a Property::Value of type STRING. // Set the input property value to a different value (to emulate a change). - Property::Value propertyValueString( "BACK" ); + Property::Value propertyValueString("BACK"); - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyValueString, testTable, testTableCount, result); - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // TEST: An enum can NOT be looked up from other Property::Value types. - Property::Value propertyValueVector( Vector3::ZERO ); + Property::Value propertyValueVector(Vector3::ZERO); - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueVector, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyValueVector, testTable, testTableCount, result); // TEST: The return value is "false" if the property can not be successfully converted. // Return value should be false as Property::Value was of an unsupported type for enum properties. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed). // The result should remain the same. - DALI_TEST_EQUALS( static_cast( result ), static_cast( FaceCullingMode::BACK ), TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(result), static_cast(FaceCullingMode::BACK), TEST_LOCATION); // Test PropertyArrays: // Property array of 2 integers. Property::Array propertyArrayIntegers; - propertyArrayIntegers.PushBack( FaceCullingMode::FRONT ); - propertyArrayIntegers.PushBack( FaceCullingMode::BACK ); + propertyArrayIntegers.PushBack(FaceCullingMode::FRONT); + propertyArrayIntegers.PushBack(FaceCullingMode::BACK); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayIntegers, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayIntegers, testTable, testTableCount, result); // TEST: The return value when checking an array with 2 INTEGERS is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with 2 INTEGERS is the ORd value of the 2 integers. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of 2 strings. Property::Array propertyArrayStrings; - propertyArrayStrings.PushBack( "FRONT" ); - propertyArrayStrings.PushBack( "BACK" ); + propertyArrayStrings.PushBack("FRONT"); + propertyArrayStrings.PushBack("BACK"); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayStrings, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayStrings, testTable, testTableCount, result); // TEST: The return value when checking an array with 2 STRINGS is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with 2 STRINGS is the ORd value of the 2 integer equivalents of the strings. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of an int and a string. Property::Array propertyArrayMixed; - propertyArrayMixed.PushBack( FaceCullingMode::FRONT ); - propertyArrayMixed.PushBack( "BACK" ); + propertyArrayMixed.PushBack(FaceCullingMode::FRONT); + propertyArrayMixed.PushBack("BACK"); result = FaceCullingMode::NONE; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayMixed, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayMixed, testTable, testTableCount, result); // TEST: The return value when checking an array with an INTEGER and a STRING is "true" if the properties can be successfully converted. - DALI_TEST_CHECK( returnValue ); + DALI_TEST_CHECK(returnValue); // TEST: The result value when checking an array with an INTEGER and a STRING is the ORd value of the 2 integer equivalents of the strings. - DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) ); + DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK)); // Property array of an int and a string. Property::Array propertyArrayInvalid; - propertyArrayInvalid.PushBack( FaceCullingMode::FRONT ); - propertyArrayInvalid.PushBack( Vector3::ZERO ); + propertyArrayInvalid.PushBack(FaceCullingMode::FRONT); + propertyArrayInvalid.PushBack(Vector3::ZERO); // Set the initial value to non-zero, so we can test it does not change. result = FaceCullingMode::FRONT_AND_BACK; - returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayInvalid, testTable, testTableCount, result ); + returnValue = GetBitmaskEnumerationProperty(propertyArrayInvalid, testTable, testTableCount, result); // TEST: The return value when checking an array with an INTEGER and a Vector3 is "false" as the properties can not be successfully converted. - DALI_TEST_CHECK( !returnValue ); + DALI_TEST_CHECK(!returnValue); // TEST: The result value when checking an array with an INTEGER and a Vector3 is unchanged. - DALI_TEST_CHECK( result == FaceCullingMode::FRONT_AND_BACK ); + DALI_TEST_CHECK(result == FaceCullingMode::FRONT_AND_BACK); END_TEST; } @@ -701,14 +699,14 @@ int UtcDaliScriptingFindEnumIndexN(void) { const Scripting::StringEnum myTable[] = { - { "ONE", (1<<1) }, - { "TWO", (1<<2) }, - { "THREE", (1<<3) }, - { "FOUR", (1<<4) }, - { "FIVE", (1<<5) }, + {"ONE", (1 << 1)}, + {"TWO", (1 << 2)}, + {"THREE", (1 << 3)}, + {"FOUR", (1 << 4)}, + {"FIVE", (1 << 5)}, }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); - DALI_TEST_EQUALS( myTableCount, FindEnumIndex( "Foo", myTable, myTableCount ), TEST_LOCATION ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); + DALI_TEST_EQUALS(myTableCount, FindEnumIndex("Foo", myTable, myTableCount), TEST_LOCATION); END_TEST; } @@ -717,44 +715,43 @@ int UtcDaliScriptingEnumStringToIntegerP(void) { const Scripting::StringEnum myTable[] = { - { "ONE", (1<<1) }, - { "TWO", (1<<2) }, - { "THREE", (1<<3) }, - { "FOUR", (1<<4) }, - { "FIVE", (1<<5) }, + {"ONE", (1 << 1)}, + {"TWO", (1 << 2)}, + {"THREE", (1 << 3)}, + {"FOUR", (1 << 4)}, + {"FIVE", (1 << 5)}, }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "ONE", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(EnumStringToInteger("ONE", myTable, myTableCount, integerEnum)); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,,TWO", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,,TWO", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION); - DALI_TEST_CHECK( EnumStringToInteger( "ONE,SEVEN", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); - - DALI_TEST_CHECK( EnumStringToInteger( "ONE,", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("ONE,SEVEN", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); + DALI_TEST_CHECK(EnumStringToInteger("ONE,", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION); END_TEST; } @@ -762,29 +759,29 @@ int UtcDaliScriptingEnumStringToIntegerP(void) int UtcDaliScriptingEnumStringToIntegerN(void) { const Scripting::StringEnum myTable[] = - { - { "ONE", 1 }, - { "TWO", 2 }, - { "THREE", 3 }, - { "FOUR", 4 }, - { "FIVE", 5 }, - }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + { + {"ONE", 1}, + {"TWO", 2}, + {"THREE", 3}, + {"FOUR", 4}, + {"FIVE", 5}, + }; + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( !EnumStringToInteger( "Foo", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("Foo", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",ONE,SEVEN", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",ONE,SEVEN", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", myTable, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", myTable, 0, integerEnum)); - DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION); END_TEST; } @@ -792,17 +789,17 @@ int UtcDaliScriptingEnumStringToIntegerN(void) int UtcDaliScriptingEnumStringToIntegerInvalidEnumP(void) { const Scripting::StringEnum myTable[] = - { - { "", 1 }, - { "", 2 }, - { "", 3 }, - }; + { + {"", 1}, + {"", 2}, + {"", 3}, + }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( EnumStringToInteger( "", myTable, myTableCount, integerEnum ) ); - DALI_TEST_EQUALS( integerEnum, 1, TEST_LOCATION ); + DALI_TEST_CHECK(EnumStringToInteger("", myTable, myTableCount, integerEnum)); + DALI_TEST_EQUALS(integerEnum, 1, TEST_LOCATION); END_TEST; } @@ -810,26 +807,26 @@ int UtcDaliScriptingEnumStringToIntegerInvalidEnumP(void) int UtcDaliScriptingEnumStringToIntegerInvalidEnumN(void) { const Scripting::StringEnum myTable[] = - { - { "", 1 }, - { "", 1 }, - { "", 1 }, - }; + { + {"", 1}, + {"", 1}, + {"", 1}, + }; - const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] ); + const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]); int integerEnum = 0; - DALI_TEST_CHECK( !EnumStringToInteger( NULL, NULL, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, NULL, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, 0, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, 0, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, myTableCount, integerEnum)); - DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, myTableCount, integerEnum ) ); + DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, myTableCount, integerEnum)); - DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Shader.cpp b/automated-tests/src/dali/utc-Dali-Shader.cpp index 278af12..4633c21 100644 --- a/automated-tests/src/dali/utc-Dali-Shader.cpp +++ b/automated-tests/src/dali/utc-Dali-Shader.cpp @@ -15,12 +15,12 @@ * */ -#include - -#include -#include #include +#include #include +#include + +#include using namespace Dali; @@ -36,30 +36,26 @@ void utc_dali_shader_cleanup(void) namespace { - static const char* VertexSource = -"This is a custom vertex shader\n" -"made on purpose to look nothing like a normal vertex shader inside dali\n"; + "This is a custom vertex shader\n" + "made on purpose to look nothing like a normal vertex shader inside dali\n"; static const char* FragmentSource = -"This is a custom fragment shader\n" -"made on purpose to look nothing like a normal fragment shader inside dali\n"; - + "This is a custom fragment shader\n" + "made on purpose to look nothing like a normal fragment shader inside dali\n"; -void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs ) +void TestConstraintNoBlue(Vector4& current, const PropertyInputContainer& inputs) { current.b = 0.0f; } - -} // anon namespace - +} // namespace int UtcDaliShaderMethodNew01(void) { TestApplication application; - Shader shader = Shader::New( VertexSource, FragmentSource ); + Shader shader = Shader::New(VertexSource, FragmentSource); DALI_TEST_EQUALS((bool)shader, true, TEST_LOCATION); END_TEST; } @@ -87,7 +83,8 @@ int UtcDaliShaderAssignmentOperator(void) DALI_TEST_CHECK(shader1 == shader2); - shader2 = Shader::New(VertexSource, FragmentSource);; + shader2 = Shader::New(VertexSource, FragmentSource); + ; DALI_TEST_CHECK(!(shader1 == shader2)); @@ -99,19 +96,19 @@ int UtcDaliShaderMoveConstructor(void) TestApplication application; Shader shader = Shader::New(VertexSource, FragmentSource); - DALI_TEST_CHECK( shader ); - DALI_TEST_EQUALS( 1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(shader); + DALI_TEST_EQUALS(1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION); // Register a custom property - Vector2 vec( 1.0f, 2.0f ); - Property::Index customIndex = shader.RegisterProperty( "custom", vec ); - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), vec, TEST_LOCATION ); + Vector2 vec(1.0f, 2.0f); + Property::Index customIndex = shader.RegisterProperty("custom", vec); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), vec, TEST_LOCATION); - Shader move = std::move( shader ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetProperty( customIndex ), vec, TEST_LOCATION ); - DALI_TEST_CHECK( !shader ); + Shader move = std::move(shader); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetProperty(customIndex), vec, TEST_LOCATION); + DALI_TEST_CHECK(!shader); END_TEST; } @@ -121,20 +118,20 @@ int UtcDaliShaderMoveAssignment(void) TestApplication application; Shader shader = Shader::New(VertexSource, FragmentSource); - DALI_TEST_CHECK( shader ); - DALI_TEST_EQUALS( 1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(shader); + DALI_TEST_EQUALS(1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION); // Register a custom property - Vector2 vec( 1.0f, 2.0f ); - Property::Index customIndex = shader.RegisterProperty( "custom", vec ); - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), vec, TEST_LOCATION ); + Vector2 vec(1.0f, 2.0f); + Property::Index customIndex = shader.RegisterProperty("custom", vec); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), vec, TEST_LOCATION); Shader move; - move = std::move( shader ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetProperty( customIndex ), vec, TEST_LOCATION ); - DALI_TEST_CHECK( !shader ); + move = std::move(shader); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetProperty(customIndex), vec, TEST_LOCATION); + DALI_TEST_CHECK(!shader); END_TEST; } @@ -146,8 +143,8 @@ int UtcDaliShaderDownCast01(void) Shader shader = Shader::New(VertexSource, FragmentSource); BaseHandle handle(shader); - Shader shader2 = Shader::DownCast(handle); - DALI_TEST_EQUALS( (bool)shader2, true, TEST_LOCATION ); + Shader shader2 = Shader::DownCast(handle); + DALI_TEST_EQUALS((bool)shader2, true, TEST_LOCATION); END_TEST; } @@ -157,25 +154,25 @@ int UtcDaliShaderDownCast02(void) Handle handle = Handle::New(); // Create a custom object Shader shader = Shader::DownCast(handle); - DALI_TEST_EQUALS( (bool)shader, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)shader, false, TEST_LOCATION); END_TEST; } int UtcDaliShaderDefaultProperties(void) { TestApplication application; -// from shader-impl.cpp -// DALI_PROPERTY( "program", MAP, true, false, false, Dali::Shader::Property::PROGRAM ) + // from shader-impl.cpp + // DALI_PROPERTY( "program", MAP, true, false, false, Dali::Shader::Property::PROGRAM ) Shader shader = Shader::New(VertexSource, FragmentSource); - DALI_TEST_EQUALS( shader.GetPropertyCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetPropertyCount(), 1, TEST_LOCATION); - DALI_TEST_EQUALS( shader.GetPropertyName( Shader::Property::PROGRAM ), "program", TEST_LOCATION ); - DALI_TEST_EQUALS( shader.GetPropertyIndex( "program" ), (Property::Index)Shader::Property::PROGRAM, TEST_LOCATION ); - DALI_TEST_EQUALS( shader.GetPropertyType( Shader::Property::PROGRAM ), Property::MAP, TEST_LOCATION ); - DALI_TEST_EQUALS( shader.IsPropertyWritable( Shader::Property::PROGRAM ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( shader.IsPropertyAnimatable( Shader::Property::PROGRAM ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( shader.IsPropertyAConstraintInput( Shader::Property::PROGRAM ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetPropertyName(Shader::Property::PROGRAM), "program", TEST_LOCATION); + DALI_TEST_EQUALS(shader.GetPropertyIndex("program"), (Property::Index)Shader::Property::PROGRAM, TEST_LOCATION); + DALI_TEST_EQUALS(shader.GetPropertyType(Shader::Property::PROGRAM), Property::MAP, TEST_LOCATION); + DALI_TEST_EQUALS(shader.IsPropertyWritable(Shader::Property::PROGRAM), true, TEST_LOCATION); + DALI_TEST_EQUALS(shader.IsPropertyAnimatable(Shader::Property::PROGRAM), false, TEST_LOCATION); + DALI_TEST_EQUALS(shader.IsPropertyAConstraintInput(Shader::Property::PROGRAM), false, TEST_LOCATION); END_TEST; } @@ -186,38 +183,38 @@ int UtcDaliShaderConstraint01(void) tet_infoline("Test that a non-uniform shader property can be constrained"); - Shader shader = Shader::New(VertexSource, FragmentSource); + Shader shader = Shader::New(VertexSource, FragmentSource); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( shader.GetProperty(colorIndex), initialColor, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetProperty(colorIndex), initialColor, TEST_LOCATION); // Apply constraint - Constraint constraint = Constraint::New( shader, colorIndex, TestConstraintNoBlue ); + Constraint constraint = Constraint::New(shader, colorIndex, TestConstraintNoBlue); constraint.Apply(); application.SendNotification(); application.Render(0); // Expect no blue component in either buffer - yellow - DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetCurrentProperty(colorIndex), Color::YELLOW, TEST_LOCATION); application.Render(0); - DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetCurrentProperty(colorIndex), Color::YELLOW, TEST_LOCATION); shader.RemoveConstraints(); - shader.SetProperty(colorIndex, Color::WHITE ); + shader.SetProperty(colorIndex, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetCurrentProperty(colorIndex), Color::WHITE, TEST_LOCATION); END_TEST; } @@ -228,19 +225,19 @@ int UtcDaliShaderConstraint02(void) tet_infoline("Test that a uniform map shader property can be constrained"); - Shader shader = Shader::New(VertexSource, FragmentSource); + Shader shader = Shader::New(VertexSource, FragmentSource); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -248,30 +245,30 @@ int UtcDaliShaderConstraint02(void) application.Render(0); Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION); // Apply constraint - Constraint constraint = Constraint::New( shader, colorIndex, TestConstraintNoBlue ); + Constraint constraint = Constraint::New(shader, colorIndex, TestConstraintNoBlue); constraint.Apply(); application.SendNotification(); application.Render(0); - // Expect no blue component in either buffer - yellow - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION ); + // Expect no blue component in either buffer - yellow + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION); application.Render(0); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION); shader.RemoveConstraints(); - shader.SetProperty(colorIndex, Color::WHITE ); + shader.SetProperty(colorIndex, Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::WHITE, TEST_LOCATION); END_TEST; } @@ -282,37 +279,37 @@ int UtcDaliShaderAnimatedProperty01(void) tet_infoline("Test that a non-uniform shader property can be animated"); - Shader shader = Shader::New(VertexSource, FragmentSource); + Shader shader = Shader::New(VertexSource, FragmentSource); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( shader.GetProperty(colorIndex), initialColor, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetProperty(colorIndex), initialColor, TEST_LOCATION); - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, initialColor); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( shader, colorIndex ), keyFrames ); + animation.AnimateBetween(Property(shader, colorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetCurrentProperty(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION); application.Render(500); - DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetCurrentProperty(colorIndex), Color::TRANSPARENT, TEST_LOCATION); END_TEST; } @@ -323,19 +320,19 @@ int UtcDaliShaderAnimatedProperty02(void) tet_infoline("Test that a uniform map shader property can be animated"); - Shader shader = Shader::New(VertexSource, FragmentSource); + Shader shader = Shader::New(VertexSource, FragmentSource); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); + Renderer renderer = Renderer::New(geometry, shader); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); application.GetScene().Add(actor); application.SendNotification(); application.Render(0); - Vector4 initialColor = Color::WHITE; - Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor ); + Vector4 initialColor = Color::WHITE; + Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor); TestGlAbstraction& gl = application.GetGlAbstraction(); @@ -343,48 +340,48 @@ int UtcDaliShaderAnimatedProperty02(void) application.Render(0); Vector4 actualValue(Vector4::ZERO); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION); - Animation animation = Animation::New(1.0f); + Animation animation = Animation::New(1.0f); KeyFrames keyFrames = KeyFrames::New(); keyFrames.Add(0.0f, initialColor); keyFrames.Add(1.0f, Color::TRANSPARENT); - animation.AnimateBetween( Property( shader, colorIndex ), keyFrames ); + animation.AnimateBetween(Property(shader, colorIndex), keyFrames); animation.Play(); application.SendNotification(); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::WHITE * 0.5f, TEST_LOCATION); application.Render(500); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION); // change shader program Property::Map map; - map["vertex"] = VertexSource; + map["vertex"] = VertexSource; map["fragment"] = FragmentSource; - map["hints"] = "MODIFIES_GEOMETRY"; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); + map["hints"] = "MODIFIES_GEOMETRY"; + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); application.SendNotification(); application.Render(100); // register another custom property as well - Property::Index customIndex = shader.RegisterProperty( "uCustom", Vector3(1,2,3) ); - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), Vector3(1,2,3), TEST_LOCATION ); + Property::Index customIndex = shader.RegisterProperty("uCustom", Vector3(1, 2, 3)); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), Vector3(1, 2, 3), TEST_LOCATION); application.SendNotification(); application.Render(100); - DALI_TEST_CHECK( gl.GetUniformValue( "uFadeColor", actualValue ) ); - DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uFadeColor", actualValue)); + DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION); Vector3 customValue; - DALI_TEST_CHECK( gl.GetUniformValue( "uCustom", customValue ) ); - DALI_TEST_EQUALS( customValue, Vector3(1,2,3), TEST_LOCATION ); + DALI_TEST_CHECK(gl.GetUniformValue("uCustom", customValue)); + DALI_TEST_EQUALS(customValue, Vector3(1, 2, 3), TEST_LOCATION); END_TEST; } @@ -394,81 +391,81 @@ int UtcDaliShaderProgramProperty(void) tet_infoline("Test get/set progam property"); - Shader shader = Shader::New("", ""); + Shader shader = Shader::New("", ""); std::string hintSet = "MODIFIES_GEOMETRY"; Property::Map map; - map["vertex"] = VertexSource; + map["vertex"] = VertexSource; map["fragment"] = FragmentSource; - map["hints"] = hintSet; + map["hints"] = hintSet; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); // register a custom property as well - Property::Index customIndex = shader.RegisterProperty( "custom", Vector3(1,2,3) ); - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), Vector3(1,2,3), TEST_LOCATION ); + Property::Index customIndex = shader.RegisterProperty("custom", Vector3(1, 2, 3)); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), Vector3(1, 2, 3), TEST_LOCATION); Property::Value value = shader.GetProperty(Shader::Property::PROGRAM); - DALI_TEST_CHECK( value.GetType() == Property::MAP); + DALI_TEST_CHECK(value.GetType() == Property::MAP); const Property::Map* outMap = value.GetMap(); std::string v = (*outMap)["vertex"].Get(); std::string f = (*outMap)["fragment"].Get(); std::string h = (*outMap)["hints"].Get(); - DALI_TEST_CHECK( v == VertexSource ); - DALI_TEST_CHECK( f == FragmentSource ); - DALI_TEST_CHECK( h == hintSet ); + DALI_TEST_CHECK(v == VertexSource); + DALI_TEST_CHECK(f == FragmentSource); + DALI_TEST_CHECK(h == hintSet); - value = shader.GetCurrentProperty( Shader::Property::PROGRAM ); - DALI_TEST_CHECK( value.GetType() == Property::MAP); + value = shader.GetCurrentProperty(Shader::Property::PROGRAM); + DALI_TEST_CHECK(value.GetType() == Property::MAP); outMap = value.GetMap(); // check that changing the shader did not cause us to loose custom property - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), Vector3(1,2,3), TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), Vector3(1, 2, 3), TEST_LOCATION); using Dali::Animation; - Animation animation = Animation::New( 0.1f ); - animation.AnimateTo( Property( shader, customIndex ), Vector3(4,5,6) ); + Animation animation = Animation::New(0.1f); + animation.AnimateTo(Property(shader, customIndex), Vector3(4, 5, 6)); animation.Play(); application.SendNotification(); application.Render(100); - DALI_TEST_EQUALS( shader.GetProperty( customIndex ), Vector3(4,5,6), TEST_LOCATION ); + DALI_TEST_EQUALS(shader.GetProperty(customIndex), Vector3(4, 5, 6), TEST_LOCATION); v = (*outMap)["vertex"].Get(); f = (*outMap)["fragment"].Get(); h = (*outMap)["hints"].Get(); - DALI_TEST_CHECK( v == VertexSource ); - DALI_TEST_CHECK( f == FragmentSource ); - DALI_TEST_CHECK( h == hintSet ); + DALI_TEST_CHECK(v == VertexSource); + DALI_TEST_CHECK(f == FragmentSource); + DALI_TEST_CHECK(h == hintSet); std::string hintGot; - hintSet = "OUTPUT_IS_TRANSPARENT,MODIFIES_GEOMETRY"; + hintSet = "OUTPUT_IS_TRANSPARENT,MODIFIES_GEOMETRY"; map["hints"] = hintSet; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); - value = shader.GetProperty(Shader::Property::PROGRAM); + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); + value = shader.GetProperty(Shader::Property::PROGRAM); hintGot = (*value.GetMap())["hints"].Get(); - DALI_TEST_CHECK( hintGot == hintSet ); + DALI_TEST_CHECK(hintGot == hintSet); - hintSet = "OUTPUT_IS_TRANSPARENT"; + hintSet = "OUTPUT_IS_TRANSPARENT"; map["hints"] = hintSet; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); - value = shader.GetProperty(Shader::Property::PROGRAM); + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); + value = shader.GetProperty(Shader::Property::PROGRAM); hintGot = (*value.GetMap())["hints"].Get(); - DALI_TEST_CHECK( hintGot == hintSet ); + DALI_TEST_CHECK(hintGot == hintSet); - hintSet = "NONE"; + hintSet = "NONE"; map["hints"] = hintSet; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); - value = shader.GetProperty(Shader::Property::PROGRAM); + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); + value = shader.GetProperty(Shader::Property::PROGRAM); hintGot = (*value.GetMap())["hints"].Get(); - DALI_TEST_CHECK( hintGot == hintSet ); + DALI_TEST_CHECK(hintGot == hintSet); - hintSet = ""; + hintSet = ""; map["hints"] = hintSet; - shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) ); - value = shader.GetProperty(Shader::Property::PROGRAM); + shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map)); + value = shader.GetProperty(Shader::Property::PROGRAM); hintGot = (*value.GetMap())["hints"].Get(); - DALI_TEST_CHECK( hintGot == "NONE" ); + DALI_TEST_CHECK(hintGot == "NONE"); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp b/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp index 80967dd..8595a27 100644 --- a/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp +++ b/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp @@ -16,17 +16,17 @@ */ // EXTERNAL INCLUDES -#include #include +#include + // INTERNAL INCLUDES -#include -#include #include +#include +#include using namespace Dali; - void utc_dali_signal_delegate_startup(void) { test_return_value = TET_UNDEF; @@ -47,15 +47,14 @@ static bool gSignalReceived = false; class SignalDelegateTestClass : public Dali::ConnectionTracker { public: - - SignalDelegateTestClass( Actor connectActor, std::string connectSignal ) + SignalDelegateTestClass(Actor connectActor, std::string connectSignal) { - mSignalDelegate = new SignalDelegate( connectActor, connectSignal ); + mSignalDelegate = new SignalDelegate(connectActor, connectSignal); } void ConnectToInternalMember() { - mSignalDelegate->Connect( this, &SignalDelegateTestClass::SignalHandlerMemberFunction ); + mSignalDelegate->Connect(this, &SignalDelegateTestClass::SignalHandlerMemberFunction); } bool IsConnected() @@ -64,10 +63,9 @@ public: } private: - void SignalHandlerMemberFunction() { - tet_infoline( "Got signal in member function\n" ); + tet_infoline("Got signal in member function\n"); gSignalReceived = true; } @@ -96,26 +94,25 @@ struct SignalDelegateTestFunctor } }; - // Test cases: int UtcDaliSignalDelegateIsConnectedP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateIsConnectedP" ); + tet_infoline(" UtcDaliSignalDelegateIsConnectedP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. testObject.ConnectToInternalMember(); - DALI_TEST_CHECK( testObject.IsConnected() ); + DALI_TEST_CHECK(testObject.IsConnected()); END_TEST; } @@ -123,16 +120,16 @@ int UtcDaliSignalDelegateIsConnectedP(void) int UtcDaliSignalDelegateIsConnectedN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateIsConnectedN" ); + tet_infoline(" UtcDaliSignalDelegateIsConnectedN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); - DALI_TEST_CHECK( !testObject.IsConnected() ); + DALI_TEST_CHECK(!testObject.IsConnected()); END_TEST; } @@ -140,16 +137,16 @@ int UtcDaliSignalDelegateIsConnectedN(void) int UtcDaliSignalDelegateConnectToMemberP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToMemberP" ); + tet_infoline(" UtcDaliSignalDelegateConnectToMemberP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; gSignalReceived = false; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. @@ -158,10 +155,10 @@ int UtcDaliSignalDelegateConnectToMemberP(void) // Add the actor to the scene to trigger it's "onScene" signal. // If the delegate connected correctly, this will call the member // function in the test object and set a global flag. - application.GetScene().Add( connectActor ); + application.GetScene().Add(connectActor); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( gSignalReceived ); + DALI_TEST_CHECK(gSignalReceived); END_TEST; } @@ -169,23 +166,23 @@ int UtcDaliSignalDelegateConnectToMemberP(void) int UtcDaliSignalDelegateConnectToMemberN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToMemberN" ); + tet_infoline(" UtcDaliSignalDelegateConnectToMemberN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; gSignalReceived = false; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. testObject.ConnectToInternalMember(); // Check the global flag to confirm the signal was not received. - DALI_TEST_CHECK( !gSignalReceived ); + DALI_TEST_CHECK(!gSignalReceived); END_TEST; } @@ -193,14 +190,14 @@ int UtcDaliSignalDelegateConnectToMemberN(void) int UtcDaliSignalDelegateConnectToFunctorP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToFunctorP" ); + tet_infoline(" UtcDaliSignalDelegateConnectToFunctorP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; // Initialise the signal delegate with the actor to connect to and it's signal. - SignalDelegate signalDelegate( connectActor, connectSignal ); + SignalDelegate signalDelegate(connectActor, connectSignal); // We need a connection tracker object to associated with the connection. // This could normally be "this", but since we are not within a class, we pass @@ -208,22 +205,22 @@ int UtcDaliSignalDelegateConnectToFunctorP(void) TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject(); // Check the signal delegate currently has no connection. - DALI_TEST_CHECK( !signalDelegate.IsConnected() ); + DALI_TEST_CHECK(!signalDelegate.IsConnected()); // Tell the signal delegate to connect to the given functor (via a functor delegate). // Note: It is at this point that the delegate internally makes the connection. - signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) ); + signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor())); // Check the signal delegate has made the connection. - DALI_TEST_CHECK( signalDelegate.IsConnected() ); + DALI_TEST_CHECK(signalDelegate.IsConnected()); // Add the actor to the scene to trigger it's "onScene" signal. // If the delegate connected correctly, this will call the () operator of our // passed-in functor, the functor will in turn set a global flag. - application.GetScene().Add( connectActor ); + application.GetScene().Add(connectActor); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( gSignalReceived ); + DALI_TEST_CHECK(gSignalReceived); END_TEST; } @@ -231,14 +228,14 @@ int UtcDaliSignalDelegateConnectToFunctorP(void) int UtcDaliSignalDelegateConnectToFunctorN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToFunctorN" ); + tet_infoline(" UtcDaliSignalDelegateConnectToFunctorN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); + Actor connectActor = Actor::New(); std::string connectSignal = "onScene"; // Initialise the signal delegate with the actor to connect to and it's signal. - SignalDelegate signalDelegate( connectActor, connectSignal ); + SignalDelegate signalDelegate(connectActor, connectSignal); // We need a connection tracker object to associated with the connection. // This could normally be "this", but since we are not within a class, we pass @@ -246,17 +243,17 @@ int UtcDaliSignalDelegateConnectToFunctorN(void) TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject(); // Check the signal delegate currently has no connection. - DALI_TEST_CHECK( !signalDelegate.IsConnected() ); + DALI_TEST_CHECK(!signalDelegate.IsConnected()); // Tell the signal delegate to connect to the given functor (via a functor delegate). // Note: It is at this point that the delegate internally makes the connection. - signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) ); + signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor())); // Check the signal delegate has made the connection. - DALI_TEST_CHECK( signalDelegate.IsConnected() ); + DALI_TEST_CHECK(signalDelegate.IsConnected()); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( !gSignalReceived ); + DALI_TEST_CHECK(!gSignalReceived); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-SignalTemplates.cpp b/automated-tests/src/dali/utc-Dali-SignalTemplates.cpp index 3c21c13..e612ccb 100644 --- a/automated-tests/src/dali/utc-Dali-SignalTemplates.cpp +++ b/automated-tests/src/dali/utc-Dali-SignalTemplates.cpp @@ -16,12 +16,14 @@ */ // EXTERNAL INCLUDES -#include #include +#include + // INTERNAL INCLUDES -#include #include +#include + #include "signal-helper.h" using namespace Dali; @@ -38,16 +40,15 @@ void utc_dali_signal_templates_cleanup(void) test_return_value = TET_PASS; } -namespace { - - -bool wasStaticVoidCallbackVoidCalled = false; -bool wasStaticFloatCallbackVoidCalled = false; -bool wasStaticVoidCallbackIntValueCalled = false; -int staticIntValue = 0; -bool wasStaticFloatCallbackFloatValueFloatValueCalled = false; -float staticFloatValue1 = 0.0f; -float staticFloatValue2 = 0.0f; +namespace +{ +bool wasStaticVoidCallbackVoidCalled = false; +bool wasStaticFloatCallbackVoidCalled = false; +bool wasStaticVoidCallbackIntValueCalled = false; +int staticIntValue = 0; +bool wasStaticFloatCallbackFloatValueFloatValueCalled = false; +float staticFloatValue1 = 0.0f; +float staticFloatValue2 = 0.0f; void StaticVoidCallbackVoid() { @@ -64,23 +65,21 @@ float StaticFloatCallbackVoid() return 7.0f; } -void StaticVoidCallbackIntValue( int value ) +void StaticVoidCallbackIntValue(int value) { wasStaticVoidCallbackIntValueCalled = true; - staticIntValue = value; + staticIntValue = value; } -float StaticFloatCallbackFloatValueFloatValue( float value1, float value2 ) +float StaticFloatCallbackFloatValueFloatValue(float value1, float value2) { wasStaticFloatCallbackFloatValueFloatValueCalled = true; - staticFloatValue1 = value1; - staticFloatValue2 = value2; + staticFloatValue1 = value1; + staticFloatValue2 = value2; return value1 + value2; } -} // anon namespace - - +} // namespace /******************************************* * @@ -98,16 +97,16 @@ int UtcDaliSignalEmptyP(void) { TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); } // Test that Empty() is true, when a slot has connected and disconnected { TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - signal.Disconnect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( signal.Empty() ); + TestSlotHandler handler; + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + signal.Disconnect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(signal.Empty()); } END_TEST; @@ -119,9 +118,9 @@ int UtcDaliSignalEmptyN(void) // Test that Empty() is false after signal connection TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + TestSlotHandler handler; + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); END_TEST; } @@ -131,22 +130,22 @@ int UtcDaliSignalGetConnectionCountP(void) TestApplication application; // Create core for debug logging TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( signal.GetConnectionCount() == 1 ); + TestSlotHandler handler; + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(signal.GetConnectionCount() == 1); TestSlotHandler handler2; - signal.Connect( &handler2, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( signal.GetConnectionCount() == 2 ); + signal.Connect(&handler2, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(signal.GetConnectionCount() == 2); END_TEST; } int UtcDaliSignalGetConnectionCountN(void) { - TestApplication application; // Create core for debug logging + TestApplication application; // Create core for debug logging TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.GetConnectionCount() == 0 ); + DALI_TEST_CHECK(signal.GetConnectionCount() == 0); END_TEST; } @@ -160,9 +159,8 @@ int UtcDaliSignalConnectP01(void) // test static function: void Connect( void (*func)() ) TestSignals::VoidRetNoParamSignal signal; - signal.Connect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - + signal.Connect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(!signal.Empty()); END_TEST; } @@ -175,32 +173,31 @@ int UtcDaliSignalConnectN01(void) TestApplication application; // Create core for debug logging TestSignals::VoidRetNoParamSignal signal; - signal.Connect( NULL ); + signal.Connect(NULL); try { signal.Emit(); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { // Tests that a negative test of an assertion succeeds - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_PASS); } END_TEST; } - int UtcDaliSignalConnectP02(void) { TestApplication application; // Create core for debug logging // test member function: Connect( X* obj, void (X::*func)() )) TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + TestSlotHandler handler; + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_CHECK( handler.mHandled == true ); + DALI_TEST_CHECK(handler.mHandled == true); END_TEST; } @@ -212,29 +209,28 @@ int UtcDaliSignalConnectN02(void) try { // test member function: Connect( X* obj, void (X::*func)() )) with NULL object - signal.Connect( static_cast(NULL), &TestSlotHandler::VoidSlotVoid ); + signal.Connect(static_cast(NULL), &TestSlotHandler::VoidSlotVoid); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { // Tests that a negative test of an assertion succeeds - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); tet_result(TET_PASS); } END_TEST; } - int UtcDaliSignalConnectP03(void) { TestApplication application; // Create core for debug logging // test slot delegate: Connect( SlotDelegate& delegate, void (X::*func)() ) TestSignals::VoidRetNoParamSignal signal; - TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + TestSlotDelegateHandler handler; + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_CHECK( handler.mHandled == true ); + DALI_TEST_CHECK(handler.mHandled == true); END_TEST; } @@ -243,7 +239,7 @@ int UtcDaliSignalConnectN03(void) { TestApplication application; // Create core for debug logging // the delegate is passed by reference, so you can't pass null. - tet_result( TET_PASS ); + tet_result(TET_PASS); END_TEST; } @@ -252,14 +248,14 @@ int UtcDaliSignalConnectP04(void) TestApplication application; // Create core for debug logging // test function object: Connect( ConnectionTrackerInterface* connectionTracker, const X& func ) - TestSlotHandler handler; + TestSlotHandler handler; TestSignals::VoidRetNoParamSignal signal; - bool functorCalled(false); - TestFunctor functor( functorCalled ); - signal.Connect( &handler, functor ); - DALI_TEST_CHECK( ! signal.Empty() ); + bool functorCalled(false); + TestFunctor functor(functorCalled); + signal.Connect(&handler, functor); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_CHECK( functorCalled == true ); + DALI_TEST_CHECK(functorCalled == true); END_TEST; } @@ -268,20 +264,19 @@ int UtcDaliSignalConnectN04(void) { // for negative test we try to connect a null connection tracker to the signal TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler *nullHandler( NULL ); + TestSlotHandler* nullHandler(NULL); try { - signal.Connect( nullHandler , &TestSlotHandler::VoidSlotVoid ); + signal.Connect(nullHandler, &TestSlotHandler::VoidSlotVoid); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { // Tests that a negative test of an assertion succeeds - DALI_TEST_PRINT_ASSERT( e ); - tet_result( TET_PASS ); + DALI_TEST_PRINT_ASSERT(e); + tet_result(TET_PASS); } END_TEST; - } int UtcDaliSignalConnectP05(void) @@ -291,20 +286,20 @@ int UtcDaliSignalConnectP05(void) // test function object using FunctorDelegate. // :Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate ) { - TestSlotHandler handler; + TestSlotHandler handler; TestSignals::VoidRetNoParamSignal signal; - bool functorDelegateCalled(false); - signal.Connect( &handler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) )); - DALI_TEST_CHECK( ! signal.Empty() ); + bool functorDelegateCalled(false); + signal.Connect(&handler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled))); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_CHECK( functorDelegateCalled == true ); + DALI_TEST_CHECK(functorDelegateCalled == true); } { - TestSlotHandler handler; + TestSlotHandler handler; TestSignals::VoidRet1ValueParamSignal signal; - bool functorDelegateCalled(false); - signal.Connect( &handler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) )); - DALI_TEST_CHECK( ! signal.Empty() ); + bool functorDelegateCalled(false); + signal.Connect(&handler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled))); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(1); } END_TEST; @@ -316,22 +311,21 @@ int UtcDaliSignalConnectN05(void) // for negative test we try to connect a null connection tracker to the signal // :Connect( ConnectionTrackerInterface == NULL, FunctorDelegate* delegate ) - TestSlotHandler *nullHandler( NULL ); + TestSlotHandler* nullHandler(NULL); TestSignals::VoidRetNoParamSignal signal; - bool functorDelegateCalled(false); + bool functorDelegateCalled(false); try { - signal.Connect( nullHandler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) )); + signal.Connect(nullHandler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled))); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - tet_result( TET_PASS ); + DALI_TEST_PRINT_ASSERT(e); + tet_result(TET_PASS); } END_TEST; } - /** * there 3 different disconnect functions * we go through them here in order of definition in dali-signal.h @@ -343,26 +337,25 @@ int UtcDaliSignalDisconnectP01(void) // test static function: Disconnect( void (*func)( Arg0 arg0 ) ) TestSignals::VoidRetNoParamSignal signal; - signal.Connect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - signal.Disconnect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( signal.Empty() ); + signal.Connect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(!signal.Empty()); + signal.Disconnect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(signal.Empty()); END_TEST; - - } +} int UtcDaliSignalDisconnectN01(void) { TestApplication application; // Create core for debug logging // 1. Disconnect using the function TestSignals::VoidRetNoParamSignal signal; - signal.Connect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(!signal.Empty()); - signal.Disconnect( AlternativeVoidCallbackVoid ); + signal.Disconnect(AlternativeVoidCallbackVoid); - DALI_TEST_CHECK( ! signal.Empty() ); + DALI_TEST_CHECK(!signal.Empty()); END_TEST; } @@ -373,14 +366,13 @@ int UtcDaliSignalDisconnectP02(void) // test member function: Disconnect( X* obj, void (X::*func)( Arg0 arg0 ) ) TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - signal.Disconnect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( signal.Empty() ); + TestSlotHandler handler; + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); + signal.Disconnect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(signal.Empty()); END_TEST; - } int UtcDaliSignalDisconnectN02(void) { @@ -388,21 +380,21 @@ int UtcDaliSignalDisconnectN02(void) // 1. Disconnect using a null connection tracker TestSignals::VoidRetNoParamSignal signal; - TestSlotHandler handler; + TestSlotHandler handler; - signal.Connect( &handler , &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( !signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); try { - TestSlotHandler* nullHandler( NULL ); - signal.Disconnect( nullHandler , &TestSlotHandler::VoidSlotVoid ); + TestSlotHandler* nullHandler(NULL); + signal.Disconnect(nullHandler, &TestSlotHandler::VoidSlotVoid); } catch(Dali::DaliException& e) { // Tests that a negative test of an assertion succeeds - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_CHECK( !signal.Empty() ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_CHECK(!signal.Empty()); } END_TEST; } @@ -413,11 +405,11 @@ int UtcDaliSignalDisconnectP03(void) // test slot delegate: Disconnect( SlotDelegate& delegate, void (X::*func)( Arg0 arg0 ) ) TestSignals::VoidRetNoParamSignal signal; - TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - signal.Disconnect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); - DALI_TEST_CHECK( signal.Empty() ); + TestSlotDelegateHandler handler; + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); + signal.Disconnect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); + DALI_TEST_CHECK(signal.Empty()); END_TEST; } @@ -426,18 +418,17 @@ int UtcDaliSignalDisconnectN03(void) { TestApplication application; // Create core for debug logging - // try to disconnect from the wrong signal + // try to disconnect from the wrong signal TestSignals::VoidRetNoParamSignal signal; - TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); + TestSlotDelegateHandler handler; + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); // use different signal - signal.Disconnect( handler.mSlotDelegate , &TestSlotDelegateHandler::AlternativeVoidSlotVoid ); + signal.Disconnect(handler.mSlotDelegate, &TestSlotDelegateHandler::AlternativeVoidSlotVoid); - DALI_TEST_CHECK( !signal.Empty() ); + DALI_TEST_CHECK(!signal.Empty()); END_TEST; - } /******************************************* @@ -454,13 +445,13 @@ int UtcDaliSignalEmptyCheckSlotDestruction(void) { TestSignals::VoidRetNoParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP signal.Emit(); @@ -469,127 +460,127 @@ int UtcDaliSignalEmptyCheckSlotDestruction(void) { TestSignals::VoidRet1ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - signal.Emit( 10 ); + signal.Emit(10); } { TestSignals::VoidRet1RefParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotIntRef ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::VoidSlotIntRef); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - int temp( 5 ); - signal.Emit( temp ); + int temp(5); + signal.Emit(temp); } { TestSignals::VoidRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::VoidSlotIntValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::VoidSlotIntValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - signal.Emit( 1, 2 ); + signal.Emit(1, 2); } { TestSignals::BoolRet1ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::BoolSlotFloatValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::BoolSlotFloatValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - bool blah = signal.Emit( 1.0f ); - DALI_TEST_CHECK( ! blah ); + bool blah = signal.Emit(1.0f); + DALI_TEST_CHECK(!blah); } { TestSignals::BoolRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::BoolSlotFloatValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::BoolSlotFloatValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - bool blah = signal.Emit( 1.0f, 2 ); - DALI_TEST_CHECK( ! blah ); + bool blah = signal.Emit(1.0f, 2); + DALI_TEST_CHECK(!blah); } { TestSignals::IntRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::IntSlotFloatValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::IntSlotFloatValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - int blah = signal.Emit( 10.0f, 100 ); - DALI_TEST_CHECK( 0 == blah ); + int blah = signal.Emit(10.0f, 100); + DALI_TEST_CHECK(0 == blah); } { TestSignals::FloatRet0ParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; - signal.Connect( &handler, &TestSlotHandler::FloatSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&handler, &TestSlotHandler::FloatSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP float blah = signal.Emit(); - DALI_TEST_CHECK( 0.0f == blah ); + DALI_TEST_CHECK(0.0f == blah); } { TestSignals::FloatRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotHandler handler; signal.Connect(&handler, &TestSlotHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_CHECK( ! signal.Empty() ); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - float blah = signal.Emit( 3.0f, 4.0f ); - DALI_TEST_CHECK( 0.0f == blah ); + float blah = signal.Emit(3.0f, 4.0f); + DALI_TEST_CHECK(0.0f == blah); } END_TEST; } @@ -604,142 +595,142 @@ int UtcDaliSignalConnectAndEmit01P(void) { TestSlotHandler handlers; signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); // Test double emission handlers.mHandled = false; signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); int x = 7; signals.EmitVoidSignalIntRef(x); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalVoid1Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignal1IntValue(5); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 5, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 5, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalVoid2Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignal2IntValue(6, 7); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 6, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 6, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 7, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalBool1Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); // repeat with opposite return value handlers.mBoolReturn = false; - handlers.mHandled = false; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 6.0f, TEST_LOCATION ); + handlers.mHandled = false; + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 6.0f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalBool2Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 10, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalInt2Value().Connect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mIntReturn = 27; - int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5); - DALI_TEST_EQUALS( x, 27, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 33.5f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 5, TEST_LOCATION ); + int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5); + DALI_TEST_EQUALS(x, 27, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 33.5f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 5, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalFloat0().Connect(&handlers, &TestSlotHandler::FloatSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float f = signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + float f = signals.EmitFloat0Signal(); + DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalFloat2Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float f = signals.EmitFloat2VSignal(5, 33.0f); - DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); + float f = signals.EmitFloat2VSignal(5, 33.0f); + DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.VoidSignalFloatValue3().Connect(&handlers, &TestSlotHandler::VoidSlotFloatValue3); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignalFloatValue3(5, 33.0f, 100.0f); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotHandler handlers; signals.SignalFloat3Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValue3); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f); - DALI_TEST_EQUALS( returnValue, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION ); + float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f); + DALI_TEST_EQUALS(returnValue, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); END_TEST; @@ -748,72 +739,67 @@ int UtcDaliSignalConnectAndEmit01P(void) int UtcDaliSignalConnectAndEmit02P(void) { // testing connection of static functions - TestSignals signals; + TestSignals signals; StaticFunctionHandlers handlers; // void ( void ) - signals.SignalVoidNone().Connect( &StaticFunctionHandlers::VoidSlotVoid ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); + signals.SignalVoidNone().Connect(&StaticFunctionHandlers::VoidSlotVoid); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); - + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // void ( p1 ) handlers.Reset(); - signals.SignalVoid1Value().Connect( &StaticFunctionHandlers::VoidSlot1Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitVoidSignal1IntValue( 1 ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(&StaticFunctionHandlers::VoidSlot1Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitVoidSignal1IntValue(1); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // void ( p1, p2 ) handlers.Reset(); - signals.SignalVoid2Value().Connect( &StaticFunctionHandlers::VoidSlot2Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitVoidSignal2IntValue( 1, 2 ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); - + signals.SignalVoid2Value().Connect(&StaticFunctionHandlers::VoidSlot2Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitVoidSignal2IntValue(1, 2); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // void ( p1, p2, p3 ) handlers.Reset(); - signals.SignalVoid3Value().Connect( &StaticFunctionHandlers::VoidSlot3Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitVoidSignal3IntValue( 1, 2, 3 ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); + signals.SignalVoid3Value().Connect(&StaticFunctionHandlers::VoidSlot3Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitVoidSignal3IntValue(1, 2, 3); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // ret ( ) handlers.Reset(); - signals.SignalFloat0().Connect( &StaticFunctionHandlers::RetSlot0Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); + signals.SignalFloat0().Connect(&StaticFunctionHandlers::RetSlot0Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // ret ( p1 ) handlers.Reset(); - signals.SignalFloat1Value().Connect( &StaticFunctionHandlers::RetSlot1Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitFloat1VSignal( 1.f ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); + signals.SignalFloat1Value().Connect(&StaticFunctionHandlers::RetSlot1Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitFloat1VSignal(1.f); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // ret ( p1, p2 ) handlers.Reset(); - signals.SignalFloat2Value().Connect( &StaticFunctionHandlers::RetSlot2Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitFloat2VSignal( 1.f, 2.f ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); - + signals.SignalFloat2Value().Connect(&StaticFunctionHandlers::RetSlot2Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitFloat2VSignal(1.f, 2.f); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); // ret ( p1, p2, p3 ) handlers.Reset(); - signals.SignalFloat3Value().Connect( &StaticFunctionHandlers::RetSlot3Param ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION ); - signals.EmitFloat3VSignal( 1.f, 2.f, 3.f ); - DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION ); + signals.SignalFloat3Value().Connect(&StaticFunctionHandlers::RetSlot3Param); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION); + signals.EmitFloat3VSignal(1.f, 2.f, 3.f); + DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION); END_TEST; - } - int UtcDaliSignalDisconnect(void) { // Test that callbacks don't occur if a signal is disconnected before emission @@ -823,103 +809,103 @@ int UtcDaliSignalDisconnect(void) { TestSlotHandler handlers; signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - int r = 7; + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + int r = 7; handlers.mIntReturn = 5; signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef); signals.EmitVoidSignalIntRef(r); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( r, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(r, 7, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid1Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoid1Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValue); signals.EmitVoidSignal1IntValue(5); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid2Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoid2Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue); signals.EmitVoidSignal2IntValue(5, 10); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalBool1Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; signals.SignalBool1Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalBool2Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; signals.SignalBool2Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalInt2Value().Connect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mIntReturn = 27; signals.SignalInt2Value().Disconnect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue); signals.EmitIntSignalFloatValueIntValue(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalFloat0().Connect(&handlers, &TestSlotHandler::FloatSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; signals.SignalFloat0().Disconnect(&handlers, &TestSlotHandler::FloatSlotVoid); signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalFloat2Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; signals.SignalFloat2Value().Disconnect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue); signals.EmitFloat2VSignal(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } END_TEST; } @@ -933,53 +919,53 @@ int UtcDaliSignalDisconnect2(void) TestSlotHandler handlers; signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); } { TestSlotHandler handlers; - int r = 7; + int r = 7; signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef); signals.EmitVoidSignalIntRef(r); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( r, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(r, 7, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid1Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValue); signals.EmitVoidSignal1IntValue(5); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid2Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue); signals.EmitVoidSignal2IntValue(5, 10); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { TestSlotHandler handlers; handlers.mBoolReturn = true; signals.SignalBool1Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); } { TestSlotHandler handlers; handlers.mBoolReturn = true; signals.SignalBool2Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { @@ -987,9 +973,9 @@ int UtcDaliSignalDisconnect2(void) handlers.mIntReturn = 27; signals.SignalInt2Value().Disconnect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue); signals.EmitIntSignalFloatValueIntValue(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { @@ -997,9 +983,9 @@ int UtcDaliSignalDisconnect2(void) handlers.mFloatReturn = 27.0f; signals.SignalFloat2Value().Disconnect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue); signals.EmitFloat2VSignal(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { @@ -1007,9 +993,9 @@ int UtcDaliSignalDisconnect2(void) handlers.mFloatReturn = 27.0f; signals.SignalFloat0().Disconnect(&handlers, &TestSlotHandler::FloatSlotVoid); signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } END_TEST; } @@ -1023,38 +1009,38 @@ int UtcDaliSignalDisconnect3(void) { TestSlotHandler handlers; signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); // Emit first signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); // Disconnect and emit again handlers.mHandled = false; signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); } { TestSlotHandler handlers; signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); int r = 7; // Emit first signals.EmitVoidSignalIntRef(r); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION); // Disconnect and emit again - handlers.mHandled = false; + handlers.mHandled = false; handlers.mIntParam1 = 0; signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef); signals.EmitVoidSignalIntRef(r); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( r, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(r, 7, TEST_LOCATION); } END_TEST; } @@ -1065,13 +1051,13 @@ int UtcDaliSignalCustomConnectionTracker(void) { TestSignals::VoidRetNoParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestBasicConnectionTrackerInterface customTracker; - signal.Connect( &customTracker, &TestBasicConnectionTrackerInterface::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(&customTracker, &TestBasicConnectionTrackerInterface::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP signal.Emit(); @@ -1082,41 +1068,41 @@ int UtcDaliSignalCustomConnectionTracker(void) // Test signal emission & destruction { TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); - DALI_TEST_EQUALS( 0u, customTracker2.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_CHECK(signal.Empty()); + DALI_TEST_EQUALS(0u, customTracker2.GetConnectionCount(), TEST_LOCATION); - signal.Connect( &customTracker2, &TestBasicConnectionTrackerInterface::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - DALI_TEST_EQUALS( 1u, customTracker2.GetConnectionCount(), TEST_LOCATION ); + signal.Connect(&customTracker2, &TestBasicConnectionTrackerInterface::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); + DALI_TEST_EQUALS(1u, customTracker2.GetConnectionCount(), TEST_LOCATION); - DALI_TEST_EQUALS( customTracker2.mCallbackHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(customTracker2.mCallbackHandled, false, TEST_LOCATION); signal.Emit(); - DALI_TEST_EQUALS( customTracker2.mCallbackHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(customTracker2.mCallbackHandled, true, TEST_LOCATION); } - DALI_TEST_EQUALS( 0u, customTracker2.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, customTracker2.GetConnectionCount(), TEST_LOCATION); // Test for removing a null callback { - TestBasicConnectionTrackerInterface customTracker3; - - TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); - DALI_TEST_EQUALS( 0u, customTracker3.GetConnectionCount(), TEST_LOCATION ); - - signal.Connect( &customTracker3, &TestBasicConnectionTrackerInterface::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); - DALI_TEST_EQUALS( 1u, customTracker3.GetConnectionCount(), TEST_LOCATION ); - try - { - // should assert - customTracker3.RemoveNullCallback(); - tet_result( TET_FAIL ); - } - catch (Dali::DaliException& e) - { - tet_result( TET_PASS ); - } - } + TestBasicConnectionTrackerInterface customTracker3; + + TestSignals::VoidRetNoParamSignal signal; + DALI_TEST_CHECK(signal.Empty()); + DALI_TEST_EQUALS(0u, customTracker3.GetConnectionCount(), TEST_LOCATION); + + signal.Connect(&customTracker3, &TestBasicConnectionTrackerInterface::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); + DALI_TEST_EQUALS(1u, customTracker3.GetConnectionCount(), TEST_LOCATION); + try + { + // should assert + customTracker3.RemoveNullCallback(); + tet_result(TET_FAIL); + } + catch(Dali::DaliException& e) + { + tet_result(TET_PASS); + } + } END_TEST; } @@ -1129,90 +1115,90 @@ int UtcDaliSignalMultipleConnections(void) { TestSlotHandler handler1; - signals.SignalVoidNone().Connect( &handler1, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); + signals.SignalVoidNone().Connect(&handler1, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); TestSlotHandler handler2; - signals.SignalVoidNone().Connect( &handler2, &TestSlotHandler::VoidSlotVoid ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); + signals.SignalVoidNone().Connect(&handler2, &TestSlotHandler::VoidSlotVoid); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); // Remove first connection and repeat handler1.Reset(); handler2.Reset(); - signals.SignalVoidNone().Disconnect( &handler1, &TestSlotHandler::VoidSlotVoid ); + signals.SignalVoidNone().Disconnect(&handler1, &TestSlotHandler::VoidSlotVoid); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); } { TestSlotHandler handler1; - signals.SignalVoid1Ref().Connect( &handler1, &TestSlotHandler::VoidSlotIntRef ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Ref().Connect(&handler1, &TestSlotHandler::VoidSlotIntRef); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); TestSlotHandler handler2; - signals.SignalVoid1Ref().Connect( &handler2, &TestSlotHandler::VoidSlotIntRef ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Ref().Connect(&handler2, &TestSlotHandler::VoidSlotIntRef); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); int x = 7; signals.EmitVoidSignalIntRef(x); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 7, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mIntParam1, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 7, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mIntParam1, 7, TEST_LOCATION); // Remove second connection and repeat handler1.Reset(); handler2.Reset(); x = 8; - signals.SignalVoid1Ref().Disconnect( &handler2, &TestSlotHandler::VoidSlotIntRef ); + signals.SignalVoid1Ref().Disconnect(&handler2, &TestSlotHandler::VoidSlotIntRef); signals.EmitVoidSignalIntRef(x); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 8, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mIntParam1, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 8, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mIntParam1, 0, TEST_LOCATION); } { TestSlotHandler handler1; - signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); TestSlotHandler handler2; - signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); TestSlotHandler handler3; - signals.SignalVoid1Value().Connect( &handler3, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(&handler3, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION); - signals.EmitVoidSignal1IntValue( 5 ); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 5, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mIntParam1, 5, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mIntParam1, 5, TEST_LOCATION ); + signals.EmitVoidSignal1IntValue(5); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 5, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mIntParam1, 5, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mIntParam1, 5, TEST_LOCATION); // Remove middle connection and repeat handler1.Reset(); handler2.Reset(); handler3.Reset(); - signals.SignalVoid1Value().Disconnect( &handler2, &TestSlotHandler::VoidSlotIntValue ); + signals.SignalVoid1Value().Disconnect(&handler2, &TestSlotHandler::VoidSlotIntValue); - signals.EmitVoidSignal1IntValue( 6 ); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 6, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mIntParam1, 6, TEST_LOCATION ); + signals.EmitVoidSignal1IntValue(6); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 6, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mIntParam1, 6, TEST_LOCATION); } // Test that multiple callbacks are disconnected when a signal is destroyed @@ -1224,23 +1210,23 @@ int UtcDaliSignalMultipleConnections(void) { TestSignals::VoidRet1ValueParamSignal tempSignal; - DALI_TEST_EQUALS( handler4.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler5.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler6.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(handler4.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(handler5.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(handler6.GetConnectionCount(), 0u, TEST_LOCATION); - tempSignal.Connect( &handler4, &TestSlotHandler::VoidSlotIntValue ); - tempSignal.Connect( &handler5, &TestSlotHandler::VoidSlotIntValue ); - tempSignal.Connect( &handler6, &TestSlotHandler::VoidSlotIntValue ); + tempSignal.Connect(&handler4, &TestSlotHandler::VoidSlotIntValue); + tempSignal.Connect(&handler5, &TestSlotHandler::VoidSlotIntValue); + tempSignal.Connect(&handler6, &TestSlotHandler::VoidSlotIntValue); - DALI_TEST_EQUALS( handler4.GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler5.GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler6.GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(handler4.GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(handler5.GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(handler6.GetConnectionCount(), 1u, TEST_LOCATION); } // End of tempSignal lifetime - DALI_TEST_EQUALS( handler4.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler5.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler6.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(handler4.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(handler5.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(handler6.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1253,73 +1239,73 @@ int UtcDaliSignalMultipleConnections2(void) TestSlotHandler handler1; // Note the double connection is intentional - signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue ); - signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue); + signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION); - signals.EmitVoidSignal1IntValue( 6 ); - DALI_TEST_EQUALS( handler1.mHandledCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 6, TEST_LOCATION ); + signals.EmitVoidSignal1IntValue(6); + DALI_TEST_EQUALS(handler1.mHandledCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 6, TEST_LOCATION); // Calling Disconnect once should be enough - signals.SignalVoid1Value().Disconnect( &handler1, &TestSlotHandler::VoidSlotIntValue ); - DALI_TEST_CHECK( signals.SignalVoid1Value().Empty() ); + signals.SignalVoid1Value().Disconnect(&handler1, &TestSlotHandler::VoidSlotIntValue); + DALI_TEST_CHECK(signals.SignalVoid1Value().Empty()); handler1.mIntParam1 = 0; - signals.EmitVoidSignal1IntValue( 7 ); - DALI_TEST_EQUALS( handler1.mHandledCount, 1/*not incremented since last check*/, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 0, TEST_LOCATION ); + signals.EmitVoidSignal1IntValue(7); + DALI_TEST_EQUALS(handler1.mHandledCount, 1 /*not incremented since last check*/, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 0, TEST_LOCATION); } // Test automatic disconnect after multiple Connect() calls { TestSlotHandler handler2; - signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue ); - signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue ); + signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue); + signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue); TestSlotHandler handler3; - signals.SignalBool1Value().Connect( &handler3, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler3, &TestSlotHandler::BoolSlotFloatValue ); + signals.SignalBool1Value().Connect(&handler3, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler3, &TestSlotHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( handler2.mHandledCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandledCount, 0, TEST_LOCATION ); - DALI_TEST_CHECK( ! signals.SignalVoid1Value().Empty() ); - DALI_TEST_CHECK( ! signals.SignalBool1Value().Empty() ); + DALI_TEST_EQUALS(handler2.mHandledCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandledCount, 0, TEST_LOCATION); + DALI_TEST_CHECK(!signals.SignalVoid1Value().Empty()); + DALI_TEST_CHECK(!signals.SignalBool1Value().Empty()); } - DALI_TEST_CHECK( signals.SignalVoid1Value().Empty() ); - DALI_TEST_CHECK( signals.SignalBool1Value().Empty() ); + DALI_TEST_CHECK(signals.SignalVoid1Value().Empty()); + DALI_TEST_CHECK(signals.SignalBool1Value().Empty()); // Should be NOOP - signals.EmitVoidSignal1IntValue( 1 ); - signals.EmitBoolSignalFloatValue( 1.0f ); + signals.EmitVoidSignal1IntValue(1); + signals.EmitBoolSignalFloatValue(1.0f); // Test that connecting the same callback 10 times is a NOOP TestSlotHandler handler4; - DALI_TEST_EQUALS( handler4.mHandledCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handler4.mFloatParam1, 0.0f, TEST_LOCATION ); - - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - - signals.EmitBoolSignalFloatValue( 2.0f ); - DALI_TEST_EQUALS( handler4.mHandledCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( handler4.mFloatParam1, 2.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(handler4.mHandledCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handler4.mFloatParam1, 0.0f, TEST_LOCATION); + + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + + signals.EmitBoolSignalFloatValue(2.0f); + DALI_TEST_EQUALS(handler4.mHandledCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(handler4.mFloatParam1, 2.0f, TEST_LOCATION); // Calling Disconnect once should be enough - signals.SignalBool1Value().Disconnect( &handler4, &TestSlotHandler::BoolSlotFloatValue ); - DALI_TEST_CHECK( signals.SignalBool1Value().Empty() ); + signals.SignalBool1Value().Disconnect(&handler4, &TestSlotHandler::BoolSlotFloatValue); + DALI_TEST_CHECK(signals.SignalBool1Value().Empty()); - signals.EmitBoolSignalFloatValue( 3.0f ); - DALI_TEST_EQUALS( handler4.mHandledCount, 1/*not incremented since last check*/, TEST_LOCATION ); - DALI_TEST_EQUALS( handler4.mFloatParam1, 2.0f, TEST_LOCATION ); + signals.EmitBoolSignalFloatValue(3.0f); + DALI_TEST_EQUALS(handler4.mHandledCount, 1 /*not incremented since last check*/, TEST_LOCATION); + DALI_TEST_EQUALS(handler4.mFloatParam1, 2.0f, TEST_LOCATION); END_TEST; } @@ -1334,130 +1320,129 @@ int UtcDaliSignalMultipleConnections3(void) { TestSignals::VoidRet1ValueParamSignal tempSignal; - DALI_TEST_EQUALS( handler1.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 0, TEST_LOCATION); // Note that the duplicate connection is deliberate - tempSignal.Connect( &handler1, &TestSlotHandler::VoidSlotIntValue ); - tempSignal.Connect( &handler1, &TestSlotHandler::VoidDuplicateSlotIntValue ); + tempSignal.Connect(&handler1, &TestSlotHandler::VoidSlotIntValue); + tempSignal.Connect(&handler1, &TestSlotHandler::VoidDuplicateSlotIntValue); - DALI_TEST_EQUALS( handler1.GetConnectionCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.GetConnectionCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION); - tempSignal.Emit( 10 ); + tempSignal.Emit(10); - DALI_TEST_EQUALS( handler1.mHandledCount, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam1, 10, TEST_LOCATION ); - DALI_TEST_EQUALS( handler1.mIntParam2, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandledCount, 2, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam1, 10, TEST_LOCATION); + DALI_TEST_EQUALS(handler1.mIntParam2, 10, TEST_LOCATION); } // End of tempSignal lifetime - DALI_TEST_EQUALS( handler1.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } - int UtcDaliSignalDisconnectStatic(void) { // void Func() { TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); - signal.Connect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(!signal.Empty()); wasStaticVoidCallbackVoidCalled = false; signal.Emit(); - DALI_TEST_EQUALS( wasStaticVoidCallbackVoidCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(wasStaticVoidCallbackVoidCalled, true, TEST_LOCATION); - signal.Disconnect( StaticVoidCallbackVoid ); - DALI_TEST_CHECK( signal.Empty() ); + signal.Disconnect(StaticVoidCallbackVoid); + DALI_TEST_CHECK(signal.Empty()); wasStaticVoidCallbackVoidCalled = false; signal.Emit(); - DALI_TEST_EQUALS( wasStaticVoidCallbackVoidCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(wasStaticVoidCallbackVoidCalled, false, TEST_LOCATION); } // float Func() { TestSignals::FloatRet0ParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); - signal.Connect( StaticFloatCallbackVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(StaticFloatCallbackVoid); + DALI_TEST_CHECK(!signal.Empty()); wasStaticFloatCallbackVoidCalled = false; - float result = signal.Emit(); - DALI_TEST_EQUALS( wasStaticFloatCallbackVoidCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( result, 7.0f, TEST_LOCATION ); + float result = signal.Emit(); + DALI_TEST_EQUALS(wasStaticFloatCallbackVoidCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(result, 7.0f, TEST_LOCATION); - signal.Disconnect( StaticFloatCallbackVoid ); - DALI_TEST_CHECK( signal.Empty() ); + signal.Disconnect(StaticFloatCallbackVoid); + DALI_TEST_CHECK(signal.Empty()); wasStaticFloatCallbackVoidCalled = false; - result = signal.Emit(); - DALI_TEST_EQUALS( wasStaticFloatCallbackVoidCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( result, 0.0f, TEST_LOCATION ); + result = signal.Emit(); + DALI_TEST_EQUALS(wasStaticFloatCallbackVoidCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(result, 0.0f, TEST_LOCATION); } // void Func( int ) { TestSignals::VoidRet1ValueParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); - signal.Connect( StaticVoidCallbackIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(StaticVoidCallbackIntValue); + DALI_TEST_CHECK(!signal.Empty()); wasStaticVoidCallbackIntValueCalled = false; - staticIntValue = 0; - signal.Emit( 10 ); - DALI_TEST_EQUALS( wasStaticVoidCallbackIntValueCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( staticIntValue, 10, TEST_LOCATION ); + staticIntValue = 0; + signal.Emit(10); + DALI_TEST_EQUALS(wasStaticVoidCallbackIntValueCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(staticIntValue, 10, TEST_LOCATION); - signal.Disconnect( StaticVoidCallbackIntValue ); - DALI_TEST_CHECK( signal.Empty() ); + signal.Disconnect(StaticVoidCallbackIntValue); + DALI_TEST_CHECK(signal.Empty()); wasStaticVoidCallbackIntValueCalled = false; - staticIntValue = 0; - signal.Emit( 11 ); - DALI_TEST_EQUALS( wasStaticVoidCallbackIntValueCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( staticIntValue, 0, TEST_LOCATION ); + staticIntValue = 0; + signal.Emit(11); + DALI_TEST_EQUALS(wasStaticVoidCallbackIntValueCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(staticIntValue, 0, TEST_LOCATION); } // float Func( float, float ) { TestSignals::FloatRet2ValueParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); - signal.Connect( StaticFloatCallbackFloatValueFloatValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(StaticFloatCallbackFloatValueFloatValue); + DALI_TEST_CHECK(!signal.Empty()); wasStaticFloatCallbackFloatValueFloatValueCalled = false; - staticFloatValue1 = 0.0f; - staticFloatValue2 = 0.0f; - float result = signal.Emit( 5.0f, 6.0f ); - DALI_TEST_EQUALS( wasStaticFloatCallbackFloatValueFloatValueCalled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( staticFloatValue1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( staticFloatValue2, 6.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( result, 5.0f+6.0f, TEST_LOCATION ); + staticFloatValue1 = 0.0f; + staticFloatValue2 = 0.0f; + float result = signal.Emit(5.0f, 6.0f); + DALI_TEST_EQUALS(wasStaticFloatCallbackFloatValueFloatValueCalled, true, TEST_LOCATION); + DALI_TEST_EQUALS(staticFloatValue1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(staticFloatValue2, 6.0f, TEST_LOCATION); + DALI_TEST_EQUALS(result, 5.0f + 6.0f, TEST_LOCATION); - signal.Disconnect( StaticFloatCallbackFloatValueFloatValue ); - DALI_TEST_CHECK( signal.Empty() ); + signal.Disconnect(StaticFloatCallbackFloatValueFloatValue); + DALI_TEST_CHECK(signal.Empty()); wasStaticFloatCallbackFloatValueFloatValueCalled = false; - staticFloatValue1 = 0.0f; - staticFloatValue2 = 0.0f; - result = signal.Emit( 7.0f, 8.0f ); - DALI_TEST_EQUALS( wasStaticFloatCallbackFloatValueFloatValueCalled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( staticFloatValue1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( staticFloatValue2, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( result, 0.0f, TEST_LOCATION ); + staticFloatValue1 = 0.0f; + staticFloatValue2 = 0.0f; + result = signal.Emit(7.0f, 8.0f); + DALI_TEST_EQUALS(wasStaticFloatCallbackFloatValueFloatValueCalled, false, TEST_LOCATION); + DALI_TEST_EQUALS(staticFloatValue1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(staticFloatValue2, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(result, 0.0f, TEST_LOCATION); } END_TEST; } @@ -1467,32 +1452,32 @@ int UtcDaliSignalDisconnectDuringCallback(void) // Test disconnection during each callback TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDisconnector handler1; - handler1.VoidConnectVoid( signal ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_CHECK( ! signal.Empty() ); + handler1.VoidConnectVoid(signal); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_CHECK(signal.Empty()); // Repeat with 2 callbacks handler1.mHandled = false; TestSlotDisconnector handler2; - handler1.VoidConnectVoid( signal ); - handler2.VoidConnectVoid( signal ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); - DALI_TEST_CHECK( ! signal.Empty() ); + handler1.VoidConnectVoid(signal); + handler2.VoidConnectVoid(signal); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); + DALI_TEST_CHECK(signal.Empty()); // Repeat with no callbacks @@ -1500,25 +1485,25 @@ int UtcDaliSignalDisconnectDuringCallback(void) handler2.mHandled = false; signal.Emit(); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); // Repeat with 3 callbacks TestSlotDisconnector handler3; - handler1.VoidConnectVoid( signal ); - handler2.VoidConnectVoid( signal ); - handler3.VoidConnectVoid( signal ); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION ); - DALI_TEST_CHECK( ! signal.Empty() ); + handler1.VoidConnectVoid(signal); + handler2.VoidConnectVoid(signal); + handler3.VoidConnectVoid(signal); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); - DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION ); - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION); + DALI_TEST_CHECK(signal.Empty()); // Repeat with no callbacks @@ -1527,9 +1512,9 @@ int UtcDaliSignalDisconnectDuringCallback(void) handler3.mHandled = false; signal.Emit(); - DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION); END_TEST; } @@ -1538,39 +1523,39 @@ int UtcDaliSignalDisconnectDuringCallback2(void) // Test disconnection of some (but not all) callbacks during sigmal emission TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotMultiDisconnector handler; - handler.ConnectAll( signal ); - DALI_TEST_EQUALS( handler.mSlotHandled[0], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[1], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[2], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[3], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[4], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[5], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[6], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[7], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[8], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[9], false, TEST_LOCATION ); - DALI_TEST_CHECK( ! signal.Empty() ); + handler.ConnectAll(signal); + DALI_TEST_EQUALS(handler.mSlotHandled[0], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[1], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[2], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[3], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[4], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[5], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[6], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[7], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[8], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[9], false, TEST_LOCATION); + DALI_TEST_CHECK(!signal.Empty()); signal.Emit(); // Slots 5, 7, & 9 should be disconnected before being called - DALI_TEST_EQUALS( handler.mSlotHandled[0], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[1], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[2], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[3], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[4], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[5], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[6], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[7], false, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[8], true, TEST_LOCATION ); - DALI_TEST_EQUALS( handler.mSlotHandled[9], false, TEST_LOCATION ); - DALI_TEST_CHECK( ! signal.Empty() ); + DALI_TEST_EQUALS(handler.mSlotHandled[0], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[1], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[2], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[3], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[4], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[5], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[6], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[7], false, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[8], true, TEST_LOCATION); + DALI_TEST_EQUALS(handler.mSlotHandled[9], false, TEST_LOCATION); + DALI_TEST_CHECK(!signal.Empty()); // Odd slots are disconnected - DALI_TEST_EQUALS( handler.GetConnectionCount(), 5u, TEST_LOCATION ); + DALI_TEST_EQUALS(handler.GetConnectionCount(), 5u, TEST_LOCATION); END_TEST; } @@ -1581,10 +1566,10 @@ int UtcDaliSignalEmitDuringCallback(void) // for coverage purposes we test the emit guard for each signal type (0,1,2,3 params) void / return value { TestSignals::VoidRetNoParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestEmitDuringCallback handler1; - handler1.VoidConnectVoid( signal ); + handler1.VoidConnectVoid(signal); // Test that this does not result in an infinite loop! signal.Emit(); @@ -1592,10 +1577,10 @@ int UtcDaliSignalEmitDuringCallback(void) { TestSignals::FloatRet0ParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestEmitDuringCallback handler1; - handler1.FloatRet0ParamConnect( signal ); + handler1.FloatRet0ParamConnect(signal); // Test that this does not result in an infinite loop! signal.Emit(); @@ -1603,35 +1588,35 @@ int UtcDaliSignalEmitDuringCallback(void) { TestSignals::FloatRet1ParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestEmitDuringCallback handler1; - handler1.FloatRet1ParamConnect( signal ); + handler1.FloatRet1ParamConnect(signal); // Test that this does not result in an infinite loop! - signal.Emit( 1.f ); + signal.Emit(1.f); } { TestSignals::FloatRet2ValueParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestEmitDuringCallback handler1; - handler1.FloatRet2ParamConnect( signal ); + handler1.FloatRet2ParamConnect(signal); // Test that this does not result in an infinite loop! - signal.Emit( 1.f, 1.f ); + signal.Emit(1.f, 1.f); } { TestSignals::FloatRet3ValueParamSignal signal; - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestEmitDuringCallback handler1; - handler1.FloatRet3ParamConnect( signal ); + handler1.FloatRet3ParamConnect(signal); // Test that this does not result in an infinite loop! - signal.Emit( 1.f,1.f,1.f ); + signal.Emit(1.f, 1.f, 1.f); } END_TEST; } @@ -1646,12 +1631,12 @@ int UtcDaliSignalDeleteDuringEmit(void) TestSignals::VoidRetNoParamSignal* signal = new TestSignals::VoidRetNoParamSignal; TestEmitDuringCallback handler1; - handler1.DeleteDuringEmitConnect( *signal ); + handler1.DeleteDuringEmitConnect(*signal); // should just log an error signal->Emit(); - tet_result( TET_PASS ); + tet_result(TET_PASS); END_TEST; } @@ -1662,17 +1647,17 @@ int UtcDaliSignalTestApp01(void) // Signal dies first. TestButton* button = new TestButton(1); - TestApp app; - button->DownSignal().Connect(&app,&TestApp::OnButtonPress); + TestApp app; + button->DownSignal().Connect(&app, &TestApp::OnButtonPress); // check we have both the button, and the app have 1 connection - DALI_TEST_EQUALS( app.GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( button->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(button->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION); - delete button; // should automatically destroy the connection + delete button; // should automatically destroy the connection // check we have a 0 connections - DALI_TEST_EQUALS( app.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1683,17 +1668,17 @@ int UtcDaliSignalTestApp02(void) // Slot owning object dies first. TestButton button(1); - TestApp *app = new TestApp; - button.DownSignal().Connect( app, &TestApp::OnButtonPress); + TestApp* app = new TestApp; + button.DownSignal().Connect(app, &TestApp::OnButtonPress); // check we have a 1 connection - DALI_TEST_EQUALS( app->GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(app->GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION); - delete app; // should automatically destroy the connection + delete app; // should automatically destroy the connection // check we have a 0 connections - DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1703,28 +1688,28 @@ int UtcDaliSignalTestApp03(void) // 1 of the slot owners dies. Then the second slot owner dies TestButton button(1); - TestApp *app1 = new TestApp; - TestApp *app2 = new TestApp; + TestApp* app1 = new TestApp; + TestApp* app2 = new TestApp; - button.DownSignal().Connect( app1, &TestApp::OnButtonPress); - button.DownSignal().Connect( app2, &TestApp::OnButtonPress); + button.DownSignal().Connect(app1, &TestApp::OnButtonPress); + button.DownSignal().Connect(app2, &TestApp::OnButtonPress); - // check we have a 2 connections to the signal - DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 2u, TEST_LOCATION ); + // check we have a 2 connections to the signal + DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 2u, TEST_LOCATION); // kill the first slot - delete app1; // should automatically destroy the connection + delete app1; // should automatically destroy the connection // check we have 1 connection left - DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION); - button.Press(); // emit the signal (to ensure it doesn't seg fault) + button.Press(); // emit the signal (to ensure it doesn't seg fault) // kill the second slot - delete app2; // should automatically destroy the connection + delete app2; // should automatically destroy the connection // check we have 1 connection left - DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1735,22 +1720,22 @@ int UtcDaliSignalTestApp04(void) // The Signal dies, check the 2 slots disconnect automatically TestButton* button = new TestButton(1); - TestApp app1; - TestApp app2; + TestApp app1; + TestApp app2; - button->DownSignal().Connect(&app1,&TestApp::OnButtonPress); - button->DownSignal().Connect(&app2,&TestApp::OnButtonPress); + button->DownSignal().Connect(&app1, &TestApp::OnButtonPress); + button->DownSignal().Connect(&app2, &TestApp::OnButtonPress); // check the connection counts - DALI_TEST_EQUALS( app1.GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( app2.GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( button->DownSignal().GetConnectionCount(), 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(app1.GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(app2.GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(button->DownSignal().GetConnectionCount(), 2u, TEST_LOCATION); - delete button; // should automatically destroy the connection + delete button; // should automatically destroy the connection // check both slot owners have zero connections - DALI_TEST_EQUALS( app1.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( app2.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(app1.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(app2.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -1764,52 +1749,52 @@ int UtcDaliSignalTestApp05(void) TestApp app; - button1->DownSignal().Connect(&app,&TestApp::OnButtonPress); - button2->DownSignal().Connect(&app,&TestApp::OnButtonPress); + button1->DownSignal().Connect(&app, &TestApp::OnButtonPress); + button2->DownSignal().Connect(&app, &TestApp::OnButtonPress); // check the connection counts - DALI_TEST_EQUALS( app.GetConnectionCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( button1->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( button2->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetConnectionCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(button1->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(button2->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION); // make sure both signals emit ok button2->Press(); - DALI_TEST_EQUALS( app.GetButtonPressedId() , 2 , TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetButtonPressedId(), 2, TEST_LOCATION); button1->Press(); - DALI_TEST_EQUALS( app.GetButtonPressedId() , 1 , TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetButtonPressedId(), 1, TEST_LOCATION); - delete button1; // should automatically destroy 1 connection + delete button1; // should automatically destroy 1 connection // check both slot owners have zero connections - DALI_TEST_EQUALS( app.GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetConnectionCount(), 1u, TEST_LOCATION); // check remaining connection still works button2->Press(); - DALI_TEST_EQUALS( app.GetButtonPressedId() , 2 , TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetButtonPressedId(), 2, TEST_LOCATION); // kill the last signal delete button2; - DALI_TEST_EQUALS( app.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(app.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } int UtcDaliSignalTestApp06(void) { - Signal< bool () > boolSignal; - TestApp app; - bool result(false); + Signal boolSignal; + TestApp app; + bool result(false); // connect a slot which will return false - boolSignal.Connect( &app, &TestApp::BoolReturnTestFalse); + boolSignal.Connect(&app, &TestApp::BoolReturnTestFalse); result = boolSignal.Emit(); - DALI_TEST_EQUALS( result, false, TEST_LOCATION ); + DALI_TEST_EQUALS(result, false, TEST_LOCATION); // disconnect last slot, and connect a slot which returns true - boolSignal.Disconnect( &app, &TestApp::BoolReturnTestFalse); - boolSignal.Connect( &app, &TestApp::BoolReturnTestTrue); + boolSignal.Disconnect(&app, &TestApp::BoolReturnTestFalse); + boolSignal.Connect(&app, &TestApp::BoolReturnTestTrue); result = boolSignal.Emit(); - DALI_TEST_EQUALS( result, true, TEST_LOCATION ); + DALI_TEST_EQUALS(result, true, TEST_LOCATION); END_TEST; } @@ -1819,143 +1804,143 @@ int UtcDaliSlotDelegateConnection(void) { TestSlotDelegateHandler handlers; - signals.SignalVoidNone().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalVoidNone().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); // Test double emission handlers.mHandled = false; signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalVoid1Ref().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Ref().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); int x = 7; signals.EmitVoidSignalIntRef(x); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalVoid1Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalVoid1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignal1IntValue(5); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 5, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 5, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalVoid2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalVoid2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignal2IntValue(6, 7); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 6, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 6, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 7, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalBool1Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); // repeat with opposite return value handlers.mBoolReturn = false; - handlers.mHandled = false; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 6.0f, TEST_LOCATION ); + handlers.mHandled = false; + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 6.0f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalBool2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalBool2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 10, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalInt2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalInt2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mIntReturn = 27; - int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5); - DALI_TEST_EQUALS( x, 27, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 33.5f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 5, TEST_LOCATION ); + int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5); + DALI_TEST_EQUALS(x, 27, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 33.5f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 5, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalFloat0().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalFloat0().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float f = signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + float f = signals.EmitFloat0Signal(); + DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalFloat2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float f = signals.EmitFloat2VSignal(5, 33.0f); - DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); + float f = signals.EmitFloat2VSignal(5, 33.0f); + DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.VoidSignalFloatValue3().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotFloatValue3 ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.VoidSignalFloatValue3().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotFloatValue3); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.EmitVoidSignalFloatValue3(5, 33.0f, 100.0f); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); { TestSlotDelegateHandler handlers; - signals.SignalFloat3Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValue3 ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + signals.SignalFloat3Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValue3); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; - float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f); - DALI_TEST_EQUALS( returnValue, 27.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION ); + float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f); + DALI_TEST_EQUALS(returnValue, 27.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION); } signals.CheckNoConnections(); END_TEST; @@ -1968,13 +1953,13 @@ int UtcDaliSignalSlotDelegateDestruction(void) { TestSignals::VoidRetNoParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP signal.Emit(); @@ -1983,127 +1968,127 @@ int UtcDaliSignalSlotDelegateDestruction(void) { TestSignals::VoidRet1ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - signal.Emit( 10 ); + signal.Emit(10); } { TestSignals::VoidRet1RefParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - int temp( 5 ); - signal.Emit( temp ); + int temp(5); + signal.Emit(temp); } { TestSignals::VoidRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - signal.Emit( 1, 2 ); + signal.Emit(1, 2); } { TestSignals::BoolRet1ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - bool blah = signal.Emit( 1.0f ); - DALI_TEST_CHECK( ! blah ); + bool blah = signal.Emit(1.0f); + DALI_TEST_CHECK(!blah); } { TestSignals::BoolRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - bool blah = signal.Emit( 1.0f, 2 ); - DALI_TEST_CHECK( ! blah ); + bool blah = signal.Emit(1.0f, 2); + DALI_TEST_CHECK(!blah); } { TestSignals::IntRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - int blah = signal.Emit( 10.0f, 100 ); - DALI_TEST_CHECK( 0 == blah ); + int blah = signal.Emit(10.0f, 100); + DALI_TEST_CHECK(0 == blah); } { TestSignals::FloatRet0ParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; - signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid ); - DALI_TEST_CHECK( ! signal.Empty() ); + signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP float blah = signal.Emit(); - DALI_TEST_CHECK( 0.0f == blah ); + DALI_TEST_CHECK(0.0f == blah); } { TestSignals::FloatRet2ValueParamSignal signal; { - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); TestSlotDelegateHandler handler; signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_CHECK( ! signal.Empty() ); + DALI_TEST_CHECK(!signal.Empty()); } // End of slot lifetime - DALI_TEST_CHECK( signal.Empty() ); + DALI_TEST_CHECK(signal.Empty()); // Signal emission should be a NOOP - float blah = signal.Emit( 3.0f, 4.0f ); - DALI_TEST_CHECK( 0.0f == blah ); + float blah = signal.Emit(3.0f, 4.0f); + DALI_TEST_CHECK(0.0f == blah); } END_TEST; } @@ -2117,113 +2102,112 @@ int UtcDaliSlotHandlerDisconnect(void) { TestSlotDelegateHandler handlers; signals.SignalVoidNone().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoidNone().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid); signals.EmitVoidSignalVoid(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalVoid1Ref().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - int r = 7; + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + int r = 7; handlers.mIntReturn = 5; signals.SignalVoid1Ref().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef); signals.EmitVoidSignalIntRef(r); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( r, 7, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(r, 7, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalVoid1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoid1Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue); signals.EmitVoidSignal1IntValue(5); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalVoid2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); signals.SignalVoid2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue); signals.EmitVoidSignal2IntValue(5, 10); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; signals.SignalBool1Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalBool2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mBoolReturn = true; signals.SignalBool2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue); - DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalInt2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mIntReturn = 27; signals.SignalInt2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue); signals.EmitIntSignalFloatValueIntValue(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalFloat0().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; signals.SignalFloat0().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid); signals.EmitFloat0Signal(); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } { TestSlotDelegateHandler handlers; signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); handlers.mFloatReturn = 27.0f; signals.SignalFloat2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue); signals.EmitFloat2VSignal(5, 33.0f); - DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION); } END_TEST; } - int UtcDaliCallbackBase(void) { // simple constructor for coverage CallbackBase base; - tet_result( TET_PASS ); + tet_result(TET_PASS); END_TEST; } @@ -2232,14 +2216,14 @@ int UtcDaliSlotDelegateMethods(void) TestSignals signals; TestSlotDelegateHandler handlers; - DALI_TEST_EQUALS( 0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION); signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue); - DALI_TEST_EQUALS( 1, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(1, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION); signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue); - DALI_TEST_EQUALS( 2, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(2, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION); handlers.mSlotDelegate.DisconnectAll(); - DALI_TEST_EQUALS( 0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-SignalTemplatesFunctors.cpp b/automated-tests/src/dali/utc-Dali-SignalTemplatesFunctors.cpp index 168e9e3..b051ed2 100644 --- a/automated-tests/src/dali/utc-Dali-SignalTemplatesFunctors.cpp +++ b/automated-tests/src/dali/utc-Dali-SignalTemplatesFunctors.cpp @@ -16,12 +16,13 @@ */ // EXTERNAL INCLUDES -#include #include +#include + // INTERNAL INCLUDES -#include #include +#include using namespace Dali; @@ -37,16 +38,14 @@ void utc_dali_signal_templates_functors_cleanup(void) namespace { - class TestSignals { public: + typedef Signal VoidSignalVoid; + typedef Signal VoidSignalFloat; - typedef Signal VoidSignalVoid; - typedef Signal VoidSignalFloat; - - typedef Signal FloatSignalVoid; - typedef Signal FloatSignalFloat; + typedef Signal FloatSignalVoid; + typedef Signal FloatSignalFloat; TestSignals() { @@ -54,24 +53,23 @@ public: void CheckNoConnections() { - DALI_TEST_EQUALS( mVoidSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mVoidSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(mVoidSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mVoidSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION); - DALI_TEST_EQUALS( mFloatSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( mFloatSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(mFloatSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(mFloatSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION); } - VoidSignalVoid mVoidSignalVoid; + VoidSignalVoid mVoidSignalVoid; VoidSignalFloat mVoidSignalFloat; - FloatSignalVoid mFloatSignalVoid; + FloatSignalVoid mFloatSignalVoid; FloatSignalFloat mFloatSignalFloat; }; class TestConnectionTracker : public ConnectionTracker { public: - TestConnectionTracker() { } @@ -85,7 +83,7 @@ struct VoidFunctorVoid ++mCurrentInstanceCount; } - VoidFunctorVoid( const VoidFunctorVoid& copyMe ) + VoidFunctorVoid(const VoidFunctorVoid& copyMe) { ++mTotalInstanceCount; ++mCurrentInstanceCount; @@ -108,15 +106,15 @@ struct VoidFunctorVoid struct VoidFunctorFloat { - VoidFunctorFloat( float* lastReceivedValue ) - : mLastReceivedValue( lastReceivedValue ) + VoidFunctorFloat(float* lastReceivedValue) + : mLastReceivedValue(lastReceivedValue) { ++mTotalInstanceCount; ++mCurrentInstanceCount; } - VoidFunctorFloat( const VoidFunctorFloat& copyMe ) - : mLastReceivedValue( copyMe.mLastReceivedValue ) + VoidFunctorFloat(const VoidFunctorFloat& copyMe) + : mLastReceivedValue(copyMe.mLastReceivedValue) { ++mTotalInstanceCount; ++mCurrentInstanceCount; @@ -131,7 +129,7 @@ struct VoidFunctorFloat { ++mCallbackCount; - if( mLastReceivedValue ) + if(mLastReceivedValue) { *mLastReceivedValue = value; } @@ -154,7 +152,7 @@ struct FloatFunctorVoid ++mCurrentInstanceCount; } - FloatFunctorVoid( const FloatFunctorVoid& copyMe ) + FloatFunctorVoid(const FloatFunctorVoid& copyMe) { ++mTotalInstanceCount; ++mCurrentInstanceCount; @@ -188,8 +186,8 @@ struct FloatFunctorFloat ++mCurrentInstanceCount; } - FloatFunctorFloat( const FloatFunctorFloat& copyMe ) - : mLastReceivedValue (copyMe.mLastReceivedValue ) + FloatFunctorFloat(const FloatFunctorFloat& copyMe) + : mLastReceivedValue(copyMe.mLastReceivedValue) { ++mTotalInstanceCount; ++mCurrentInstanceCount; @@ -249,8 +247,7 @@ int FloatFunctorFloat::mTotalInstanceCount = 0; int FloatFunctorFloat::mCurrentInstanceCount = 0; int FloatFunctorFloat::mCallbackCount = 0; -} // anon namespace - +} // namespace int UtcDaliSignalFunctorsEmptyCheck(void) { @@ -260,33 +257,33 @@ int UtcDaliSignalFunctorsEmptyCheck(void) { TestSignals::VoidSignalVoid signal; - DALI_TEST_CHECK( signal.Empty() ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_CHECK(signal.Empty()); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); TestConnectionTracker tracker; - signal.Connect( &tracker, VoidFunctorVoid() ); - DALI_TEST_CHECK( ! signal.Empty() ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); + signal.Connect(&tracker, VoidFunctorVoid()); + DALI_TEST_CHECK(!signal.Empty()); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); { TestSignals::VoidSignalFloat signal; - DALI_TEST_CHECK( signal.Empty() ); - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_CHECK(signal.Empty()); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); TestConnectionTracker tracker; - signal.Connect( &tracker, VoidFunctorFloat(NULL) ); - DALI_TEST_CHECK( ! signal.Empty() ); - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION ); + signal.Connect(&tracker, VoidFunctorFloat(NULL)); + DALI_TEST_CHECK(!signal.Empty()); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); END_TEST; } @@ -301,52 +298,52 @@ int UtcDaliSignalFunctorsEmit(void) { TestConnectionTracker tracker; - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION ); + signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid()); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION); signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION); // Test double emission signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION); signals.CheckNoConnections(); { TestConnectionTracker tracker; - float lastReceivedValue( 0.0f ); + float lastReceivedValue(0.0f); - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mVoidSignalFloat.Connect( &tracker, VoidFunctorFloat(&lastReceivedValue) ); - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 0, TEST_LOCATION ); + signals.mVoidSignalFloat.Connect(&tracker, VoidFunctorFloat(&lastReceivedValue)); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 0, TEST_LOCATION); - signals.mVoidSignalFloat.Emit( 3.5f ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( lastReceivedValue, 3.5f, TEST_LOCATION ); + signals.mVoidSignalFloat.Emit(3.5f); + DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(lastReceivedValue, 3.5f, TEST_LOCATION); // Test double emission - signals.mVoidSignalFloat.Emit( 7.0f ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( lastReceivedValue, 7.0f, TEST_LOCATION ); + signals.mVoidSignalFloat.Emit(7.0f); + DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION); + DALI_TEST_EQUALS(lastReceivedValue, 7.0f, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION); signals.CheckNoConnections(); END_TEST; } @@ -362,53 +359,53 @@ int UtcDaliSignalFunctorsEmitReturn(void) { TestConnectionTracker tracker; - DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mFloatSignalVoid.Connect( &tracker, FloatFunctorVoid() ); - DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 0, TEST_LOCATION ); + signals.mFloatSignalVoid.Connect(&tracker, FloatFunctorVoid()); + DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 0, TEST_LOCATION); float returnValue = signals.mFloatSignalVoid.Emit(); - DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION); // Test double emission returnValue = signals.mFloatSignalVoid.Emit(); - DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION); + DALI_TEST_EQUALS(returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION); signals.CheckNoConnections(); { TestConnectionTracker tracker; - DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mFloatSignalFloat.Connect( &tracker, FloatFunctorFloat() ); - DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 0, TEST_LOCATION ); + signals.mFloatSignalFloat.Connect(&tracker, FloatFunctorFloat()); + DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 0, TEST_LOCATION); - float returnValue = signals.mFloatSignalFloat.Emit( 0.1f ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( returnValue, 1.0f + 0.1f, TEST_LOCATION ); + float returnValue = signals.mFloatSignalFloat.Emit(0.1f); + DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(returnValue, 1.0f + 0.1f, TEST_LOCATION); // Test double emission - returnValue = signals.mFloatSignalFloat.Emit( 0.2f ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( returnValue, 1.0f + 0.2f, TEST_LOCATION ); + returnValue = signals.mFloatSignalFloat.Emit(0.2f); + DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION); + DALI_TEST_EQUALS(returnValue, 1.0f + 0.2f, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION); signals.CheckNoConnections(); END_TEST; } @@ -424,23 +421,23 @@ int UtcDaliSignalFunctorsDisconnectBeforeEmit(void) { TestConnectionTracker tracker; - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); + signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid()); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); tracker.DisconnectAll(); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION); // Test double emission signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION); } END_TEST; } @@ -456,25 +453,25 @@ int UtcDaliSignalFunctorsDestroySignal(void) { TestSignals signals; - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); + signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid()); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount,1, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION); - DALI_TEST_EQUALS( tracker.GetConnectionCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(tracker.GetConnectionCount(), 1u, TEST_LOCATION); } // Functor should have been deleted with signal - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION); - DALI_TEST_EQUALS( tracker.GetConnectionCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(tracker.GetConnectionCount(), 0u, TEST_LOCATION); END_TEST; } @@ -489,25 +486,25 @@ int UtcDaliSignalConnectVoidFunctor(void) { TestConnectionTracker tracker; - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); - signals.mVoidSignalVoid.Connect( &tracker, FunctorDelegate::New( VoidFunctorVoid() ) ); - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION ); + signals.mVoidSignalVoid.Connect(&tracker, FunctorDelegate::New(VoidFunctorVoid())); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION); signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION); // Test double emission signals.mVoidSignalVoid.Emit(); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION); } // TestConnectionTracker should auto-disconnect - DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION); + DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION); signals.CheckNoConnections(); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-SingletonService.cpp b/automated-tests/src/dali/utc-Dali-SingletonService.cpp index 21087cd..0325a10 100644 --- a/automated-tests/src/dali/utc-Dali-SingletonService.cpp +++ b/automated-tests/src/dali/utc-Dali-SingletonService.cpp @@ -16,22 +16,27 @@ */ // EXTERNAL INCLUDES -#include -#include -#include #include #include +#include +#include + +#include using namespace Dali; namespace { - class TestHandle : public BaseHandle { public: - TestHandle() {} - TestHandle( BaseObject* object ) : BaseHandle( object ) {} + TestHandle() + { + } + TestHandle(BaseObject* object) + : BaseHandle(object) + { + } }; class TestObject : public BaseObject @@ -55,30 +60,30 @@ int UtcDaliSingletonServiceGet(void) // Attempt to retrieve SingletonService before creating application SingletonService singletonService; singletonService = SingletonService::Get(); - DALI_TEST_CHECK( !singletonService ); + DALI_TEST_CHECK(!singletonService); // Create Application class, should be able to retrieve SingletonService now TestApplication application; singletonService = SingletonService::Get(); - DALI_TEST_CHECK( singletonService ); + DALI_TEST_CHECK(singletonService); END_TEST; } int UtcDaliSingletonServiceRegisterAndGetSingleton(void) { - TestApplication application; - SingletonService singletonService( SingletonService::Get() ); + TestApplication application; + SingletonService singletonService(SingletonService::Get()); // Attempt to register an empty handle TestHandle handle; - singletonService.Register( typeid( handle ), handle ); - DALI_TEST_CHECK( !singletonService.GetSingleton( typeid( handle ) ) ); + singletonService.Register(typeid(handle), handle); + DALI_TEST_CHECK(!singletonService.GetSingleton(typeid(handle))); // Create an actor instance and retrieve, should be valid this time - handle = TestHandle( new TestObject ); - singletonService.Register( typeid( handle ), handle ); - DALI_TEST_CHECK( singletonService.GetSingleton( typeid( handle ) ) ); + handle = TestHandle(new TestObject); + singletonService.Register(typeid(handle), handle); + DALI_TEST_CHECK(singletonService.GetSingleton(typeid(handle))); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Stage.cpp b/automated-tests/src/dali/utc-Dali-Stage.cpp index 8ca978e..90fe393 100644 --- a/automated-tests/src/dali/utc-Dali-Stage.cpp +++ b/automated-tests/src/dali/utc-Dali-Stage.cpp @@ -15,19 +15,17 @@ * */ -#include - -#include - -#include +#include #include #include #include -#include #include #include +#include +#include +#include -#include +#include using namespace Dali; @@ -43,7 +41,6 @@ void stage_test_cleanup(void) namespace { - const std::string DEFAULT_DEVICE_NAME("hwKeyboard"); // Functor for EventProcessingFinished signal @@ -52,9 +49,10 @@ struct EventProcessingFinishedFunctor /** * @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called. */ - EventProcessingFinishedFunctor( bool& eventProcessingFinished ) - : mEventProcessingFinished( eventProcessingFinished ) - {} + EventProcessingFinishedFunctor(bool& eventProcessingFinished) + : mEventProcessingFinished(eventProcessingFinished) + { + } void operator()() { @@ -69,7 +67,8 @@ struct KeyEventGeneratedSignalData { KeyEventGeneratedSignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -78,20 +77,21 @@ struct KeyEventGeneratedSignalData receivedKeyEvent.Reset(); } - bool functorCalled; + bool functorCalled; KeyEvent receivedKeyEvent; }; // Functor that sets the data when called struct KeyEventGeneratedReceivedFunctor { - KeyEventGeneratedReceivedFunctor( KeyEventGeneratedSignalData& data ) - : signalData( data ) - {} + KeyEventGeneratedReceivedFunctor(KeyEventGeneratedSignalData& data) + : signalData(data) + { + } - bool operator()( const KeyEvent& keyEvent ) + bool operator()(const KeyEvent& keyEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedKeyEvent = keyEvent; return true; @@ -111,7 +111,8 @@ struct KeyEventSignalData { KeyEventSignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -120,18 +121,21 @@ struct KeyEventSignalData receivedKeyEvent.Reset(); } - bool functorCalled; + bool functorCalled; KeyEvent receivedKeyEvent; }; // Functor that sets the data when called struct KeyEventReceivedFunctor { - KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { } + KeyEventReceivedFunctor(KeyEventSignalData& data) + : signalData(data) + { + } - bool operator()( const KeyEvent& keyEvent ) + bool operator()(const KeyEvent& keyEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedKeyEvent = keyEvent; return true; @@ -145,7 +149,8 @@ struct TouchedSignalData { TouchedSignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -154,16 +159,19 @@ struct TouchedSignalData receivedTouchEvent.Reset(); } - bool functorCalled; + bool functorCalled; TouchEvent receivedTouchEvent; }; // Functor that sets the data when touched signal is received struct TouchFunctor { - TouchFunctor( TouchedSignalData& data ) : signalData( data ) { } + TouchFunctor(TouchedSignalData& data) + : signalData(data) + { + } - void operator()( const TouchEvent& touch ) + void operator()(const TouchEvent& touch) { signalData.functorCalled = true; TouchEvent handle(touch); @@ -183,25 +191,29 @@ struct WheelEventSignalData { WheelEventSignalData() : functorCalled(false) - {} + { + } void Reset() { functorCalled = false; } - bool functorCalled; + bool functorCalled; WheelEvent receivedWheelEvent; }; // Functor that sets the data when wheel-event signal is received struct WheelEventReceivedFunctor { - WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { } + WheelEventReceivedFunctor(WheelEventSignalData& data) + : signalData(data) + { + } - bool operator()( const WheelEvent& wheelEvent ) + bool operator()(const WheelEvent& wheelEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedWheelEvent = wheelEvent; return true; @@ -210,14 +222,15 @@ struct WheelEventReceivedFunctor WheelEventSignalData& signalData; }; -bool DummyTouchCallback( Actor actor, const TouchEvent& touch ) +bool DummyTouchCallback(Actor actor, const TouchEvent& touch) { return true; } struct ContextStatusFunctor { - ContextStatusFunctor(bool& calledFlag) : mCalledFlag( calledFlag ) + ContextStatusFunctor(bool& calledFlag) + : mCalledFlag(calledFlag) { mCalledFlag = false; } @@ -236,7 +249,8 @@ struct ContextStatusFunctor struct SceneCreatedStatusFunctor { - SceneCreatedStatusFunctor(bool& calledFlag) : mCalledFlag( calledFlag ) + SceneCreatedStatusFunctor(bool& calledFlag) + : mCalledFlag(calledFlag) { mCalledFlag = false; } @@ -255,16 +269,16 @@ struct SceneCreatedStatusFunctor struct ActorCreatedFunctor { - ActorCreatedFunctor( bool& signalReceived ) - : mSignalVerified( signalReceived ) + ActorCreatedFunctor(bool& signalReceived) + : mSignalVerified(signalReceived) { } - void operator()( BaseHandle object ) + void operator()(BaseHandle object) { - tet_infoline( "Verifying TestActorCallback()" ); - Actor actor = Actor::DownCast( object ); - if( actor ) + tet_infoline("Verifying TestActorCallback()"); + Actor actor = Actor::DownCast(object); + if(actor) { mSignalVerified = true; } @@ -273,25 +287,24 @@ struct ActorCreatedFunctor bool& mSignalVerified; }; -void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition ) +void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); } } // unnamed namespace - int UtcDaliStageDefaultConstructorP(void) { TestApplication application; - Stage stage; + Stage stage; - DALI_TEST_CHECK( !stage ); + DALI_TEST_CHECK(!stage); END_TEST; } @@ -300,11 +313,11 @@ int UtcDaliStageDefaultConstructorP(void) int UtcDaliStageDestructorP(void) { TestApplication application; - Stage* stage = new Stage(); + Stage* stage = new Stage(); delete stage; stage = NULL; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } @@ -313,9 +326,9 @@ int UtcDaliStageDestructorP(void) int UtcDaliStageGetCurrentP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - DALI_TEST_CHECK( stage ); + DALI_TEST_CHECK(stage); END_TEST; } @@ -326,14 +339,14 @@ int UtcDaliStageGetCurrentN(void) { Stage stage = Stage::GetCurrent(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage doesn't exist\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage doesn't exist\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -343,13 +356,13 @@ int UtcDaliStageIsInstalledP(void) Stage::GetCurrent(); - DALI_TEST_CHECK( Stage::IsInstalled() ); + DALI_TEST_CHECK(Stage::IsInstalled()); END_TEST; } int UtcDaliStageIsInstalledN(void) { - DALI_TEST_CHECK( !Stage::IsInstalled() ); + DALI_TEST_CHECK(!Stage::IsInstalled()); END_TEST; } @@ -357,12 +370,12 @@ int UtcDaliStageIsInstalledN(void) int UtcDaliStageCopyConstructorP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - Stage copyStage( stage ); + Stage copyStage(stage); - DALI_TEST_CHECK( copyStage ); - DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() ); + DALI_TEST_CHECK(copyStage); + DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer()); END_TEST; } @@ -372,12 +385,12 @@ int UtcDaliStageCopyConstructorP(void) int UtcDaliStageAssignmentOperatorP(void) { TestApplication application; - const Stage stage = Stage::GetCurrent(); + const Stage stage = Stage::GetCurrent(); Stage copyStage = stage; - DALI_TEST_CHECK( copyStage ); - DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() ); + DALI_TEST_CHECK(copyStage); + DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer()); END_TEST; } @@ -391,10 +404,10 @@ int UtcDaliStageAddP(void) Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); - stage.Add( actor ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + stage.Add(actor); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); END_TEST; } @@ -408,16 +421,16 @@ int UtcDaliStageAddN(void) bool asserted = false; try { - stage.Add( actor ); + stage.Add(actor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -429,13 +442,13 @@ int UtcDaliStageRemoveP(void) Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); - stage.Add( actor ); - DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + stage.Add(actor); + DALI_TEST_CHECK(actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); stage.Remove(actor); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); END_TEST; } @@ -450,16 +463,16 @@ int UtcDaliStageRemoveN1(void) try { // Actor is not valid, confirm a removal attempt does assert. - stage.Remove( actor ); + stage.Remove(actor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -469,21 +482,21 @@ int UtcDaliStageRemoveN2(void) Stage stage = Stage::GetCurrent(); Actor actor = Actor::New(); - DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ); + DALI_TEST_CHECK(!actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)); bool asserted = false; try { // Actor is not on stage, confirm a removal attempt does not assert / segfault. - stage.Remove( actor ); + stage.Remove(actor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); asserted = true; } - DALI_TEST_CHECK( !asserted ); + DALI_TEST_CHECK(!asserted); END_TEST; } @@ -494,24 +507,24 @@ int UtcDaliStageRemoveN3(void) Stage stage = Stage::GetCurrent(); // Initially we have a default layer - DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION); // Check we cannot remove the root layer from the stage. - Layer layer = stage.GetRootLayer(); - bool asserted = true; + Layer layer = stage.GetRootLayer(); + bool asserted = true; try { - stage.Remove( layer ); + stage.Remove(layer); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); - DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_CHECK(asserted); + DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION); END_TEST; } @@ -523,8 +536,8 @@ int UtcDaliStageGetSizeP(void) Vector2 size = stage.GetSize(); - DALI_TEST_EQUALS( size.width, static_cast( TestApplication::DEFAULT_SURFACE_WIDTH ), TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, static_cast( TestApplication::DEFAULT_SURFACE_HEIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS(size.width, static_cast(TestApplication::DEFAULT_SURFACE_WIDTH), TEST_LOCATION); + DALI_TEST_EQUALS(size.height, static_cast(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION); END_TEST; } @@ -534,20 +547,20 @@ int UtcDaliStageGetSizeN(void) Stage stage; - bool asserted = false; + bool asserted = false; Vector2 size; try { size = stage.GetSize(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -559,8 +572,8 @@ int UtcDaliStageGetDpiP1(void) // Test the default DPI. Vector2 dpi = stage.GetDpi(); - DALI_TEST_EQUALS( dpi.x, static_cast( TestApplication::DEFAULT_HORIZONTAL_DPI ), TEST_LOCATION ); - DALI_TEST_EQUALS( dpi.y, static_cast( TestApplication::DEFAULT_VERTICAL_DPI ), TEST_LOCATION ); + DALI_TEST_EQUALS(dpi.x, static_cast(TestApplication::DEFAULT_HORIZONTAL_DPI), TEST_LOCATION); + DALI_TEST_EQUALS(dpi.y, static_cast(TestApplication::DEFAULT_VERTICAL_DPI), TEST_LOCATION); END_TEST; } @@ -570,25 +583,25 @@ int UtcDaliStageGetDpiP2(void) // Test that setting core DPI explicitly also sets up the Stage's DPI. Dali::Integration::Scene scene = application.GetScene(); - scene.SetDpi( Vector2(200.0f, 180.0f) ); + scene.SetDpi(Vector2(200.0f, 180.0f)); - Stage stage = Stage::GetCurrent(); - Vector2 dpi = stage.GetDpi(); - DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION ); + Stage stage = Stage::GetCurrent(); + Vector2 dpi = stage.GetDpi(); + DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION); + DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION); END_TEST; } int UtcDaliStageGetDpiP3(void) { - TestApplication application( 480, 800, 72, 120 ); // Initializes core DPI with specific values + TestApplication application(480, 800, 72, 120); // Initializes core DPI with specific values Stage stage = Stage::GetCurrent(); // Test that setting core DPI explicitly also sets up the Stage's DPI. Vector2 dpi = stage.GetDpi(); - DALI_TEST_EQUALS( dpi.x, 72.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( dpi.y, 120.0f, TEST_LOCATION) ; + DALI_TEST_EQUALS(dpi.x, 72.0f, TEST_LOCATION); + DALI_TEST_EQUALS(dpi.y, 120.0f, TEST_LOCATION); END_TEST; } @@ -600,11 +613,11 @@ int UtcDaliStageGetDpiN(void) { TestApplication application; // Initializes core DPI to default values - Stage stage = Stage::GetCurrent(); - Vector2 dpi = stage.GetDpi(); + Stage stage = Stage::GetCurrent(); + Vector2 dpi = stage.GetDpi(); - DALI_TEST_EQUALS( dpi.x, 220.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( dpi.y, 217.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(dpi.x, 220.0f, TEST_LOCATION); + DALI_TEST_EQUALS(dpi.y, 217.0f, TEST_LOCATION); END_TEST; } @@ -615,12 +628,12 @@ int UtcDaliStageGetLayerCountP(void) Stage stage = Stage::GetCurrent(); // Initially we have a default layer - DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION); Layer layer = Layer::New(); - stage.Add( layer ); + stage.Add(layer); - DALI_TEST_EQUALS( stage.GetLayerCount(), 2u, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetLayerCount(), 2u, TEST_LOCATION); END_TEST; } @@ -634,13 +647,13 @@ int UtcDaliStageGetLayerCountN(void) Stage stage = Stage::GetCurrent(); // Initially we have a default layer - DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION); Layer layer = Layer::New(); - stage.Remove( layer ); + stage.Remove(layer); // Still have 1 layer. - DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION); END_TEST; } @@ -650,14 +663,14 @@ int UtcDaliStageGetLayerP(void) Stage stage = Stage::GetCurrent(); - Layer rootLayer = stage.GetLayer( 0 ); - DALI_TEST_CHECK( rootLayer ); + Layer rootLayer = stage.GetLayer(0); + DALI_TEST_CHECK(rootLayer); Layer layer = Layer::New(); - stage.Add( layer ); + stage.Add(layer); - Layer sameLayer = stage.GetLayer( 1 ); - DALI_TEST_CHECK( layer == sameLayer ); + Layer sameLayer = stage.GetLayer(1); + DALI_TEST_CHECK(layer == sameLayer); END_TEST; } @@ -671,16 +684,16 @@ int UtcDaliStageGetLayerN(void) try { // Try to get a layer that doesn't exist (note: 0 is the root layer). - Layer layer = stage.GetLayer( 1 ); + Layer layer = stage.GetLayer(1); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "depth < mLayers.size()", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "depth < mLayers.size()", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -690,11 +703,11 @@ int UtcDaliStageGetRootLayerP(void) Stage stage = Stage::GetCurrent(); - Layer layer = stage.GetLayer( 0 ); - DALI_TEST_CHECK( layer ); + Layer layer = stage.GetLayer(0); + DALI_TEST_CHECK(layer); // Check that GetRootLayer() correctly retreived layer 0. - DALI_TEST_CHECK( stage.GetRootLayer() == layer ); + DALI_TEST_CHECK(stage.GetRootLayer() == layer); END_TEST; } @@ -705,21 +718,21 @@ int UtcDaliStageGetRootLayerN(void) Stage stage = Stage::GetCurrent(); - Layer rootLayer = stage.GetLayer( 0 ); - DALI_TEST_CHECK( rootLayer ); - DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer ); + Layer rootLayer = stage.GetLayer(0); + DALI_TEST_CHECK(rootLayer); + DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer); // Create a new layer and attempt to lower it below the root layer. Layer layer = Layer::New(); - stage.Add( layer ); + stage.Add(layer); layer.LowerToBottom(); // Check that GetRootLayer still retrieves the same original layer. - DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer ); + DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer); // Check modifying the root layer is also blocked. rootLayer.RaiseToTop(); - DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer ); + DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer); END_TEST; } @@ -730,10 +743,10 @@ int UtcDaliStageSetBackgroundColorP(void) Stage stage = Stage::GetCurrent(); - Vector4 testColor( 0.1f, 0.2f, 0.3f, 1.0f ); - stage.SetBackgroundColor( testColor ); + Vector4 testColor(0.1f, 0.2f, 0.3f, 1.0f); + stage.SetBackgroundColor(testColor); - DALI_TEST_EQUALS( testColor, stage.GetBackgroundColor(), TEST_LOCATION ); + DALI_TEST_EQUALS(testColor, stage.GetBackgroundColor(), TEST_LOCATION); END_TEST; } @@ -746,7 +759,7 @@ int UtcDaliStageGetBackgroundColorP(void) Stage stage = Stage::GetCurrent(); - DALI_TEST_EQUALS( DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION ); + DALI_TEST_EQUALS(DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION); END_TEST; } @@ -759,29 +772,29 @@ int UtcDaliStageKeepRenderingP(void) Stage stage = Stage::GetCurrent(); // Run core until it wants to sleep - bool keepUpdating( true ); - while ( keepUpdating ) + bool keepUpdating(true); + while(keepUpdating) { application.SendNotification(); - keepUpdating = application.Render( 1000.0f /*1 second*/ ); + keepUpdating = application.Render(1000.0f /*1 second*/); } // Force rendering for the next 5 seconds - stage.KeepRendering( 5.0f ); + stage.KeepRendering(5.0f); application.SendNotification(); // Test that core wants to sleep after 10 seconds - keepUpdating = application.Render( 1000.0f /*1 second*/ ); - DALI_TEST_CHECK( keepUpdating ); - keepUpdating = application.Render( 1000.0f /*2 seconds*/ ); - DALI_TEST_CHECK( keepUpdating ); - keepUpdating = application.Render( 1000.0f /*3 seconds*/ ); - DALI_TEST_CHECK( keepUpdating ); - keepUpdating = application.Render( 1000.0f /*4 seconds*/ ); - DALI_TEST_CHECK( keepUpdating ); - keepUpdating = application.Render( 1000.0f /*5 seconds*/ ); - DALI_TEST_CHECK( !keepUpdating ); + keepUpdating = application.Render(1000.0f /*1 second*/); + DALI_TEST_CHECK(keepUpdating); + keepUpdating = application.Render(1000.0f /*2 seconds*/); + DALI_TEST_CHECK(keepUpdating); + keepUpdating = application.Render(1000.0f /*3 seconds*/); + DALI_TEST_CHECK(keepUpdating); + keepUpdating = application.Render(1000.0f /*4 seconds*/); + DALI_TEST_CHECK(keepUpdating); + keepUpdating = application.Render(1000.0f /*5 seconds*/); + DALI_TEST_CHECK(!keepUpdating); END_TEST; } @@ -792,21 +805,21 @@ int UtcDaliStageKeepRenderingN(void) Stage stage = Stage::GetCurrent(); // Run core until it wants to sleep - bool keepUpdating( true ); - while ( keepUpdating ) + bool keepUpdating(true); + while(keepUpdating) { application.SendNotification(); - keepUpdating = application.Render( 1000.0f /*1 second*/ ); + keepUpdating = application.Render(1000.0f /*1 second*/); } // Force rendering for the next 5 seconds - stage.KeepRendering( -1.0f ); + stage.KeepRendering(-1.0f); application.SendNotification(); // Test that core wants to sleep after 10 seconds - keepUpdating = application.Render( 1000.0f /*1 second*/ ); - DALI_TEST_CHECK( !keepUpdating ); + keepUpdating = application.Render(1000.0f /*1 second*/); + DALI_TEST_CHECK(!keepUpdating); END_TEST; } @@ -814,19 +827,19 @@ int UtcDaliStageKeepRenderingN(void) int UtcDaliStageEventProcessingFinishedP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - bool eventProcessingFinished = false; - EventProcessingFinishedFunctor functor( eventProcessingFinished ); - stage.EventProcessingFinishedSignal().Connect( &application, functor ); + bool eventProcessingFinished = false; + EventProcessingFinishedFunctor functor(eventProcessingFinished); + stage.EventProcessingFinishedSignal().Connect(&application, functor); - Actor actor( Actor::New() ); - stage.Add( actor ); + Actor actor(Actor::New()); + stage.Add(actor); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( eventProcessingFinished ); + DALI_TEST_CHECK(eventProcessingFinished); END_TEST; } @@ -834,17 +847,17 @@ int UtcDaliStageEventProcessingFinishedP(void) int UtcDaliStageEventProcessingFinishedN(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - bool eventProcessingFinished = false; - EventProcessingFinishedFunctor functor( eventProcessingFinished ); - stage.EventProcessingFinishedSignal().Connect( &application, functor ); + bool eventProcessingFinished = false; + EventProcessingFinishedFunctor functor(eventProcessingFinished); + stage.EventProcessingFinishedSignal().Connect(&application, functor); - Actor actor( Actor::New() ); - stage.Add( actor ); + Actor actor(Actor::New()); + stage.Add(actor); // Do not complete event processing and confirm the signal has not been emitted. - DALI_TEST_CHECK( !eventProcessingFinished ); + DALI_TEST_CHECK(!eventProcessingFinished); END_TEST; } @@ -852,124 +865,124 @@ int UtcDaliStageEventProcessingFinishedN(void) int UtcDaliStageKeyEventGeneratedSignalP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - KeyEventGeneratedSignalData data; - KeyEventGeneratedReceivedFunctor functor( data ); - DevelStage::KeyEventGeneratedSignal( stage ).Connect( &application, functor ); + KeyEventGeneratedSignalData data; + KeyEventGeneratedReceivedFunctor functor(data); + DevelStage::KeyEventGeneratedSignal(stage).Connect(&application, functor); - KeyEventGeneratedSignalData data2; - KeyEventGeneratedReceivedFunctor functor2( data2 ); - GetImplementation( stage ).ConnectSignal( &application, "keyEventGenerated", functor2 ); + KeyEventGeneratedSignalData data2; + KeyEventGeneratedReceivedFunctor functor2(data2); + GetImplementation(stage).ConnectSignal(&application, "keyEventGenerated", functor2); - Integration::KeyEvent event( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event ); + Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event2 ); + Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event2.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event2.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event3 ); + Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event3); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event3.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event3.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event4 ); + Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event4); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event4.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event4.state == static_cast(data.receivedKeyEvent.GetState())); END_TEST; } int UtcDaliStageSignalKeyEventP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - KeyEventSignalData data; - KeyEventReceivedFunctor functor( data ); - stage.KeyEventSignal().Connect( &application, functor ); + KeyEventSignalData data; + KeyEventReceivedFunctor functor(data); + stage.KeyEventSignal().Connect(&application, functor); - Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event ); + Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event2 ); + Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event2.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event2.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event3 ); + Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event3); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event3.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event3.state == static_cast(data.receivedKeyEvent.GetState())); data.Reset(); - Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - application.ProcessEvent( event4 ); + Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE); + application.ProcessEvent(event4); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() ); - DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() ); - DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() ); - DALI_TEST_CHECK( event4.state == static_cast( data.receivedKeyEvent.GetState() ) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier()); + DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName()); + DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString()); + DALI_TEST_CHECK(event4.state == static_cast(data.receivedKeyEvent.GetState())); END_TEST; } int UtcDaliStageSignalKeyEventN(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - KeyEventSignalData data; - KeyEventReceivedFunctor functor( data ); - stage.KeyEventSignal().Connect( &application, functor ); + KeyEventSignalData data; + KeyEventReceivedFunctor functor(data); + stage.KeyEventSignal().Connect(&application, functor); // Check that a non-pressed key events data is not modified. - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -977,11 +990,11 @@ int UtcDaliStageSignalKeyEventN(void) int UtcDaliStageTouchedSignalP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); TouchedSignalData data; - TouchFunctor functor( data ); - stage.TouchedSignal().Connect( &application, functor ); + TouchFunctor functor(data); + stage.TouchedSignal().Connect(&application, functor); // Render and notify. application.SendNotification(); @@ -989,29 +1002,29 @@ int UtcDaliStageTouchedSignalP(void) // Basic test: No actors, single touch (down then up). { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); - GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Add an actor to the scene. Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.TouchedSignal().Connect( &DummyTouchCallback ); - stage.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.TouchedSignal().Connect(&DummyTouchCallback); + stage.Add(actor); // Render and notify. application.SendNotification(); @@ -1019,72 +1032,72 @@ int UtcDaliStageTouchedSignalP(void) // Actor on scene, single touch, down in actor, motion, then up outside actor. { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0)); data.Reset(); - GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); - GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Multiple touch. Should only receive a touch on first down and last up. { Integration::TouchEvent touchEvent; - Integration::Point point; + Integration::Point point; // 1st point - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10.0f, 10.0f ) ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10.0f, 10.0f)); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); data.Reset(); // 2nd point - touchEvent.points[0].SetState( PointState::STATIONARY ); - point.SetDeviceId( 1 ); - point.SetScreenPosition( Vector2( 50.0f, 50.0f ) ); - touchEvent.points.push_back( point ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::STATIONARY); + point.SetDeviceId(1); + point.SetScreenPosition(Vector2(50.0f, 50.0f)); + touchEvent.points.push_back(point); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION); data.Reset(); // Primary point is up - touchEvent.points[0].SetState( PointState::UP ); - touchEvent.points[1].SetState( PointState::STATIONARY ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::UP); + touchEvent.points[1].SetState(PointState::STATIONARY); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION); data.Reset(); // Remove 1st point now, 2nd point is now in motion - touchEvent.points.erase( touchEvent.points.begin() ); - touchEvent.points[0].SetState( PointState::MOTION ); - touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION ); + touchEvent.points.erase(touchEvent.points.begin()); + touchEvent.points[0].SetState(PointState::MOTION); + touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f)); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION); data.Reset(); // Final point Up - touchEvent.points[0].SetState( PointState::UP ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + touchEvent.points[0].SetState(PointState::UP); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); data.Reset(); } END_TEST; @@ -1093,50 +1106,50 @@ int UtcDaliStageTouchedSignalP(void) int UtcDaliStageTouchedSignalN(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); TouchedSignalData data; - TouchFunctor functor( data ); - stage.TouchedSignal().Connect( &application, functor ); + TouchFunctor functor(data); + stage.TouchedSignal().Connect(&application, functor); // Render and notify. application.SendNotification(); application.Render(); // Confirm functor not called before there has been any touch event. - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // No actors, single touch, down, motion then up. { - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); // Confirm there is no signal when the touchpoint is only moved. - GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion + GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Confirm a following up event generates a signal. - GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) ); + GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); data.Reset(); } // Add an actor to the scene. Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - actor.TouchedSignal().Connect( &DummyTouchCallback ); - stage.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.TouchedSignal().Connect(&DummyTouchCallback); + stage.Add(actor); // Render and notify. application.SendNotification(); @@ -1144,33 +1157,33 @@ int UtcDaliStageTouchedSignalN(void) // Actor on scene. Interrupted before down and interrupted after down. { - GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED); data.Reset(); - GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::DOWN ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN); data.Reset(); - GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ); + GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u ); - DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) ); - DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u); + DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0)); + DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED); - DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION); // Check that getting info about a non-existent point causes an assert. - DALI_TEST_EQUALS( data.receivedTouchEvent.GetState( 1 ), PointState::FINISHED, TEST_LOCATION ); + DALI_TEST_EQUALS(data.receivedTouchEvent.GetState(1), PointState::FINISHED, TEST_LOCATION); data.Reset(); } @@ -1181,50 +1194,50 @@ int UtcDaliStageTouchedSignalN(void) int UtcDaliStageSignalWheelEventP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - WheelEventSignalData data; - WheelEventReceivedFunctor functor( data ); - stage.WheelEventSignal().Connect( &application, functor ); + WheelEventSignalData data; + WheelEventReceivedFunctor functor(data); + stage.WheelEventSignal().Connect(&application, functor); - Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u ); - application.ProcessEvent( event ); + Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u); + application.ProcessEvent(event); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() ); - DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() ); - DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() ); - DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() ); - DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() ); - DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(static_cast(event.type) == data.receivedWheelEvent.GetType()); + DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection()); + DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers()); + DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint()); + DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta()); + DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime()); data.Reset(); - Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u ); - application.ProcessEvent( event2 ); + Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u); + application.ProcessEvent(event2); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() ); - DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() ); - DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() ); - DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() ); - DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() ); - DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(static_cast(event2.type) == data.receivedWheelEvent.GetType()); + DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection()); + DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers()); + DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint()); + DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta()); + DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime()); END_TEST; } int UtcDaliStageContextLostSignalP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - bool contextLost = false; - ContextStatusFunctor contextLostFunctor( contextLost ); - stage.ContextLostSignal().Connect( &application, contextLostFunctor ); + bool contextLost = false; + ContextStatusFunctor contextLostFunctor(contextLost); + stage.ContextLostSignal().Connect(&application, contextLostFunctor); Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier(); notifier->NotifyContextLost(); - DALI_TEST_EQUALS( contextLost, true, TEST_LOCATION ); + DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION); END_TEST; } @@ -1232,23 +1245,23 @@ int UtcDaliStageContextLostSignalP(void) int UtcDaliStageContextLostSignalN(void) { TestApplication application; - Stage stage; + Stage stage; // Check that connecting to the signal with a bad stage instance causes an assert. - bool asserted = false; - bool contextLost = false; - ContextStatusFunctor contextLostFunctor( contextLost ); + bool asserted = false; + bool contextLost = false; + ContextStatusFunctor contextLostFunctor(contextLost); try { - stage.ContextLostSignal().Connect( &application, contextLostFunctor ); + stage.ContextLostSignal().Connect(&application, contextLostFunctor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -1256,16 +1269,16 @@ int UtcDaliStageContextLostSignalN(void) int UtcDaliStageContextRegainedSignalP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - bool contextRegained = false; - ContextStatusFunctor contextRegainedFunctor( contextRegained ); - stage.ContextRegainedSignal().Connect( &application, contextRegainedFunctor ); + bool contextRegained = false; + ContextStatusFunctor contextRegainedFunctor(contextRegained); + stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor); Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier(); notifier->NotifyContextLost(); notifier->NotifyContextRegained(); - DALI_TEST_EQUALS( contextRegained, true, TEST_LOCATION ); + DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION); END_TEST; } @@ -1273,23 +1286,23 @@ int UtcDaliStageContextRegainedSignalP(void) int UtcDaliStageContextRegainedSignalN(void) { TestApplication application; - Stage stage; + Stage stage; // Check that connecting to the signal with a bad stage instance causes an assert. - bool asserted = false; - bool contextRegained = false; - ContextStatusFunctor contextRegainedFunctor( contextRegained ); + bool asserted = false; + bool contextRegained = false; + ContextStatusFunctor contextRegainedFunctor(contextRegained); try { - stage.ContextRegainedSignal().Connect( &application, contextRegainedFunctor ); + stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -1297,15 +1310,15 @@ int UtcDaliStageContextRegainedSignalN(void) int UtcDaliStageSceneCreatedSignalP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - bool signalCalled = false; - SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled ); - stage.SceneCreatedSignal().Connect( &application, sceneCreatedFunctor ); + bool signalCalled = false; + SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled); + stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor); Integration::Core& core = application.GetCore(); core.SceneCreated(); - DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION); END_TEST; } @@ -1313,23 +1326,23 @@ int UtcDaliStageSceneCreatedSignalP(void) int UtcDaliStageSceneCreatedSignalN(void) { TestApplication application; - Stage stage; + Stage stage; // Check that connecting to the signal with a bad stage instance causes an assert. - bool asserted = false; - bool signalCalled = false; - SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled ); + bool asserted = false; + bool signalCalled = false; + SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled); try { - stage.SceneCreatedSignal().Connect( &application, sceneCreatedFunctor ); + stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -1337,19 +1350,19 @@ int UtcDaliStageSceneCreatedSignalN(void) int UtcDaliStageGetRenderTaskListP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); // Check we get a valid instance. const RenderTaskList& tasks = stage.GetRenderTaskList(); // There should be 1 task by default. - DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION); // RenderTaskList has it's own UTC tests. // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time. RenderTask newTask = stage.GetRenderTaskList().CreateTask(); - DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION ); + DALI_TEST_EQUALS(stage.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION); END_TEST; } @@ -1357,7 +1370,7 @@ int UtcDaliStageGetRenderTaskListP(void) int UtcDaliStageGetRenderTaskListN(void) { TestApplication application; - Stage stage; + Stage stage; // Check that getting the render task list with a bad stage instance causes an assert. bool asserted = false; @@ -1365,13 +1378,13 @@ int UtcDaliStageGetRenderTaskListN(void) { stage.GetRenderTaskList(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION); asserted = true; } - DALI_TEST_CHECK( asserted ); + DALI_TEST_CHECK(asserted); END_TEST; } @@ -1379,18 +1392,18 @@ int UtcDaliStageGetRenderTaskListN(void) int UtcDaliStageGetObjectRegistryP(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); ObjectRegistry objectRegistry = stage.GetObjectRegistry(); // Object registry tests are covered in their own module. // However we want a basic test to confirm the returned registry is valid and works. - bool verified = false; - ActorCreatedFunctor test( verified ); - objectRegistry.ObjectCreatedSignal().Connect( &application, test ); + bool verified = false; + ActorCreatedFunctor test(verified); + objectRegistry.ObjectCreatedSignal().Connect(&application, test); Actor actor = Actor::New(); - DALI_TEST_CHECK( test.mSignalVerified ); + DALI_TEST_CHECK(test.mSignalVerified); END_TEST; } @@ -1398,7 +1411,7 @@ int UtcDaliStageGetObjectRegistryP(void) int UtcDaliStageGetObjectRegistryN(void) { TestApplication application; - Stage stage; + Stage stage; // Check that getting the object registry with a bad stage instance DOES NOT cause an assert. // This is because GetCurrent() is used, always creating a stage if one does not exist. @@ -1407,12 +1420,12 @@ int UtcDaliStageGetObjectRegistryN(void) { stage.GetObjectRegistry(); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); asserted = true; } - DALI_TEST_CHECK( !asserted ); + DALI_TEST_CHECK(!asserted); END_TEST; } @@ -1420,11 +1433,11 @@ int UtcDaliStageGetObjectRegistryN(void) int UtcDaliStageOperatorAssign(void) { TestApplication application; - Stage stage; - DALI_TEST_CHECK( !stage ); + Stage stage; + DALI_TEST_CHECK(!stage); stage = Stage::GetCurrent(); - DALI_TEST_CHECK( stage ); + DALI_TEST_CHECK(stage); END_TEST; } @@ -1432,41 +1445,41 @@ int UtcDaliStageOperatorAssign(void) int UtcDaliStageRenderingBehavior(void) { TestApplication application; - Stage stage = Stage::GetCurrent(); + Stage stage = Stage::GetCurrent(); - tet_infoline( "Check default rendering behavior is only if required" ); - DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED ); + tet_infoline("Check default rendering behavior is only if required"); + DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED); - tet_infoline( "No update required with an empty application" ); + tet_infoline("No update required with an empty application"); application.SendNotification(); - DALI_TEST_CHECK( application.UpdateOnly() == false ); + DALI_TEST_CHECK(application.UpdateOnly() == false); application.RenderOnly(); - tet_infoline( "Change to continuous rendering, further updates should be required" ); - DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::CONTINUOUSLY ); + tet_infoline("Change to continuous rendering, further updates should be required"); + DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::CONTINUOUSLY); - DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::CONTINUOUSLY ); + DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::CONTINUOUSLY); application.SendNotification(); - DALI_TEST_CHECK( application.UpdateOnly() == true ); + DALI_TEST_CHECK(application.UpdateOnly() == true); application.RenderOnly(); application.SendNotification(); - DALI_TEST_CHECK( application.UpdateOnly() == true ); + DALI_TEST_CHECK(application.UpdateOnly() == true); application.RenderOnly(); - tet_infoline( "Change to rendering only if required, further updates should NOT be required" ); - DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::IF_REQUIRED ); + tet_infoline("Change to rendering only if required, further updates should NOT be required"); + DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::IF_REQUIRED); - DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED ); + DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED); application.SendNotification(); - DALI_TEST_CHECK( application.UpdateOnly() == false ); + DALI_TEST_CHECK(application.UpdateOnly() == false); application.RenderOnly(); - tet_infoline( "The next update is not required so TestApplication should print a warning" ); + tet_infoline("The next update is not required so TestApplication should print a warning"); application.SendNotification(); - DALI_TEST_CHECK( application.UpdateOnly() == false ); + DALI_TEST_CHECK(application.UpdateOnly() == false); application.RenderOnly(); END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp index 30a1441..9204c5f 100644 --- a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp @@ -15,15 +15,15 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include #include +#include + using namespace Dali; void utc_dali_tap_gesture_detector_startup(void) @@ -39,18 +39,18 @@ void utc_dali_tap_gesture_detector_cleanup(void) /////////////////////////////////////////////////////////////////////////////// namespace { - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false) - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -58,22 +58,25 @@ struct SignalData tappedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; TapGesture receivedGesture; - Actor tappedActor; + Actor tappedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const TapGesture& tap) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = tap; - signalData.tappedActor = actor; + signalData.tappedActor = actor; } void operator()() @@ -87,16 +90,16 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, Integration::Scene scene ) - : GestureReceivedFunctor( data ), - scene( scene ) + UnstageActorFunctor(SignalData& data, Integration::Scene scene) + : GestureReceivedFunctor(data), + scene(scene) { } void operator()(Actor actor, const TapGesture& tap) { - GestureReceivedFunctor::operator()( actor, tap ); - scene.Remove( actor ); + GestureReceivedFunctor::operator()(actor, tap); + scene.Remove(actor); } Integration::Scene scene; @@ -109,7 +112,7 @@ struct TouchEventFunctor { //For line coverage unsigned int points = touch.GetPointCount(); - if( points > 0) + if(points > 0) { tet_printf("Touch Point state = %d\n", touch.GetState(0)); } @@ -117,11 +120,10 @@ struct TouchEventFunctor } }; -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - // Positive test case for a method int UtcDaliTapGestureDetectorConstructor(void) { @@ -138,8 +140,8 @@ int UtcDaliTapGestureDetectorCopyConstructorP(void) TapGestureDetector detector = TapGestureDetector::New(); - TapGestureDetector copy( detector ); - DALI_TEST_CHECK( detector ); + TapGestureDetector copy(detector); + DALI_TEST_CHECK(detector); END_TEST; } @@ -147,13 +149,14 @@ int UtcDaliTapGestureDetectorAssignmentOperatorP(void) { TestApplication application; - TapGestureDetector detector = TapGestureDetector::New();; + TapGestureDetector detector = TapGestureDetector::New(); + ; TapGestureDetector assign; assign = detector; - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(detector); - DALI_TEST_CHECK( detector == assign ); + DALI_TEST_CHECK(detector == assign); END_TEST; } @@ -166,7 +169,7 @@ int UtcDaliTapGestureDetectorNew(void) DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION); DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION); - TapGestureDetector detector2 = TapGestureDetector::New( 5u ); + TapGestureDetector detector2 = TapGestureDetector::New(5u); DALI_TEST_CHECK(detector2); DALI_TEST_EQUALS(5u, detector2.GetMinimumTapsRequired(), TEST_LOCATION); DALI_TEST_EQUALS(5u, detector2.GetMaximumTapsRequired(), TEST_LOCATION); @@ -179,8 +182,8 @@ int UtcDaliTapGestureDetectorNew(void) // Attach an actor and emit a touch event on the actor to ensure complete line coverage Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -190,13 +193,13 @@ int UtcDaliTapGestureDetectorNew(void) detector.Attach(actor); TouchEventFunctor touchFunctor; - actor.TouchedSignal().Connect( &application, touchFunctor ); + actor.TouchedSignal().Connect(&application, touchFunctor); Integration::TouchEvent touchEvent(1); - Integration::Point point; - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 20.0f, 20.0f ) ); + Integration::Point point; + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(20.0f, 20.0f)); touchEvent.AddPoint(point); application.ProcessEvent(touchEvent); @@ -219,17 +222,17 @@ int UtcDaliTapGestureDetectorDownCast(void) TapGestureDetector detector2 = TapGestureDetector::DownCast(object); DALI_TEST_CHECK(detector2); - TapGestureDetector detector3 = DownCast< TapGestureDetector >(object); + TapGestureDetector detector3 = DownCast(object); DALI_TEST_CHECK(detector3); - BaseHandle unInitializedObject; + BaseHandle unInitializedObject; TapGestureDetector detector4 = TapGestureDetector::DownCast(unInitializedObject); DALI_TEST_CHECK(!detector4); - TapGestureDetector detector5 = DownCast< TapGestureDetector >(unInitializedObject); + TapGestureDetector detector5 = DownCast(unInitializedObject); DALI_TEST_CHECK(!detector5); - GestureDetector detector6 = TapGestureDetector::New(); + GestureDetector detector6 = TapGestureDetector::New(); TapGestureDetector detector7 = TapGestureDetector::DownCast(detector6); DALI_TEST_CHECK(detector7); END_TEST; @@ -242,8 +245,8 @@ int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void) // Attach an actor and change the required touches Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -255,14 +258,14 @@ int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void) try { TapGestureDetector detector = TapGestureDetector::New(); - detector.SetMinimumTapsRequired( 7u ); - detector.SetMaximumTapsRequired( 3u ); + detector.SetMinimumTapsRequired(7u); + detector.SetMaximumTapsRequired(3u); detector.Attach(actor); - DALI_TEST_CHECK( false ); // Should not get here + DALI_TEST_CHECK(false); // Should not get here } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } END_TEST; @@ -283,23 +286,23 @@ int UtcDaliTapGestureSignalReceptionNegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Do a tap outside actor's area - TestGenerateTap( application, 112.0f, 112.0f, 100 ); + TestGenerateTap(application, 112.0f, 112.0f, 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -309,27 +312,27 @@ int UtcDaliTapGestureSignalReceptionPositive(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Do a tap inside actor's area - TestGenerateTap( application, 50.0f, 50.0f, 100 ); + TestGenerateTap(application, 50.0f, 50.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); END_TEST; } @@ -338,15 +341,15 @@ int UtcDaliTapGestureSignalReceptionDetach(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -354,28 +357,28 @@ int UtcDaliTapGestureSignalReceptionDetach(void) detector.DetectedSignal().Connect(&application, functor); // Start tap within the actor's area - TestGenerateTap( application, 20.0f, 20.0f, 100 ); + TestGenerateTap(application, 20.0f, 20.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); // repeat the tap within the actor's area - we should still receive the signal data.Reset(); - TestGenerateTap( application, 50.0f, 50.0f, 700 ); + TestGenerateTap(application, 50.0f, 50.0f, 700); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION); // Detach actor detector.DetachAll(); // Ensure we are no longer signalled data.Reset(); - TestGenerateTap( application, 20.0f, 20.0f, 1300 ); + TestGenerateTap(application, 20.0f, 20.0f, 1300); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - TestGenerateTap( application, 50.0f, 50.0f, 1900 ); + TestGenerateTap(application, 50.0f, 50.0f, 1900); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -384,7 +387,7 @@ int UtcDaliTapGestureSignalReceptionActorDestroyedWhileTapping(void) { TestApplication application; - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -393,8 +396,8 @@ int UtcDaliTapGestureSignalReceptionActorDestroyedWhileTapping(void) // Actor lifetime is scoped { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -404,7 +407,7 @@ int UtcDaliTapGestureSignalReceptionActorDestroyedWhileTapping(void) detector.Attach(actor); // Start tap within the actor's area - TestGenerateTap( application, 20.0f, 20.0f, 100 ); + TestGenerateTap(application, 20.0f, 20.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Remove the actor from stage and reset the data @@ -418,7 +421,7 @@ int UtcDaliTapGestureSignalReceptionActorDestroyedWhileTapping(void) // Actor should now have been destroyed data.Reset(); - TestGenerateTap( application, 20.0f, 20.0f, 700 ); + TestGenerateTap(application, 20.0f, 20.0f, 700); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -428,15 +431,15 @@ int UtcDaliTapGestureSignalReceptionRotatedActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -444,33 +447,33 @@ int UtcDaliTapGestureSignalReceptionRotatedActor(void) detector.DetectedSignal().Connect(&application, functor); // Do tap, only check finished value - TestGenerateTap( application, 5.0f, 5.0f, 100 ); + TestGenerateTap(application, 5.0f, 5.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); // Rotate actor again and render - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS)); application.SendNotification(); application.Render(); // Do tap, should still receive event data.Reset(); - TestGenerateTap( application, 5.0f, 5.0f, 700 ); + TestGenerateTap(application, 5.0f, 5.0f, 700); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION); // Rotate actor again and render - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) ); + actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS)); application.SendNotification(); application.Render(); // Do tap, inside the actor's area (area if it is not rotated), Should not receive the event data.Reset(); - TestGenerateTap( application, 70.0f, 70.0f, 1300 ); + TestGenerateTap(application, 70.0f, 70.0f, 1300); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -480,18 +483,18 @@ int UtcDaliTapGestureSignalReceptionChildHit(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); // Set child to completely cover parent. // Change rotation of child to be different from parent so that we can check if our local coordinate // conversion of the parent actor is correct. Actor child = Actor::New(); - child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) ); + child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS)); parent.Add(child); TouchEventFunctor touchFunctor; @@ -501,7 +504,7 @@ int UtcDaliTapGestureSignalReceptionChildHit(void) application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -509,7 +512,7 @@ int UtcDaliTapGestureSignalReceptionChildHit(void) detector.DetectedSignal().Connect(&application, functor); // Do tap - hits child area but parent should still receive it - TestGenerateTap( application, 50.0f, 50.0f, 100 ); + TestGenerateTap(application, 50.0f, 50.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION); @@ -521,7 +524,7 @@ int UtcDaliTapGestureSignalReceptionChildHit(void) // Do an entire tap, only check finished value data.Reset(); - TestGenerateTap( application, 51.0f, 51.0f, 700 ); + TestGenerateTap(application, 51.0f, 51.0f, 700); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION); @@ -533,21 +536,21 @@ int UtcDaliTapGestureSignalReceptionAttachDetachMany(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -556,13 +559,13 @@ int UtcDaliTapGestureSignalReceptionAttachDetachMany(void) detector.DetectedSignal().Connect(&application, functor); // Tap within second actor's area - TestGenerateTap( application, 120.0f, 10.0f, 100 ); + TestGenerateTap(application, 120.0f, 10.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION); // Tap within first actor's area data.Reset(); - TestGenerateTap( application, 20.0f, 10.0f, 700 ); + TestGenerateTap(application, 20.0f, 10.0f, 700); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION); @@ -571,12 +574,12 @@ int UtcDaliTapGestureSignalReceptionAttachDetachMany(void) // second actor shouldn't receive event data.Reset(); - TestGenerateTap( application, 120.0f, 10.0f, 1300 ); + TestGenerateTap(application, 120.0f, 10.0f, 1300); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // first actor should continue receiving event data.Reset(); - TestGenerateTap( application, 20.0f, 10.0f, 1900 ); + TestGenerateTap(application, 20.0f, 10.0f, 1900); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -586,15 +589,15 @@ int UtcDaliTapGestureSignalReceptionActorBecomesUntouchable(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -602,11 +605,11 @@ int UtcDaliTapGestureSignalReceptionActorBecomesUntouchable(void) detector.DetectedSignal().Connect(&application, functor); // Tap in actor's area - TestGenerateTap( application, 50.0f, 10.0f, 100 ); + TestGenerateTap(application, 50.0f, 10.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); // Actor become invisible - actor should not receive the next pan - actor.SetProperty( Actor::Property::VISIBLE,false); + actor.SetProperty(Actor::Property::VISIBLE, false); // Render and notify application.SendNotification(); @@ -614,7 +617,7 @@ int UtcDaliTapGestureSignalReceptionActorBecomesUntouchable(void) // Tap in the same area, shouldn't receive event data.Reset(); - TestGenerateTap( application, 50.0f, 10.0f, 700 ); + TestGenerateTap(application, 50.0f, 10.0f, 700); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -624,21 +627,21 @@ int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void) TestApplication application; Actor first = Actor::New(); - first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(first); Actor second = Actor::New(); - second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - second.SetProperty( Actor::Property::POSITION_X, 100.0f); + second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + second.SetProperty(Actor::Property::POSITION_X, 100.0f); first.Add(second); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector firstDetector = TapGestureDetector::New(); @@ -647,32 +650,32 @@ int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void) // secondDetector is scoped { - TapGestureDetector secondDetector = TapGestureDetector::New( 2 ); + TapGestureDetector secondDetector = TapGestureDetector::New(2); secondDetector.Attach(second); secondDetector.DetectedSignal().Connect(&application, functor); // Tap within second actor's area - TestGenerateTap( application, 150.0f, 10.0f, 100 ); - TestGenerateTap( application, 150.0f, 10.0f, 200 ); + TestGenerateTap(application, 150.0f, 10.0f, 100); + TestGenerateTap(application, 150.0f, 10.0f, 200); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION); // Tap continues as single touch gesture - we should not receive any gesture data.Reset(); - TestGenerateTap( application, 150.0f, 10.0f, 800 ); + TestGenerateTap(application, 150.0f, 10.0f, 800); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Single touch tap starts - first actor should be panned data.Reset(); - TestGenerateTap( application, 50.0f, 10.0f, 1400 ); + TestGenerateTap(application, 50.0f, 10.0f, 1400); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION); // Tap changes to double-touch - we shouldn't receive event data.Reset(); - TestGenerateTwoPointTap( application, 50.0f, 10.0f, 60.0f, 20.0f, 2000 ); + TestGenerateTwoPointTap(application, 50.0f, 10.0f, 60.0f, 20.0f, 2000); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); } @@ -685,8 +688,8 @@ int UtcDaliTapGestureSignalReceptionMultipleDetectorsOnActor(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -694,21 +697,21 @@ int UtcDaliTapGestureSignalReceptionMultipleDetectorsOnActor(void) application.Render(); // Attach actor to one detector - SignalData firstData; + SignalData firstData; GestureReceivedFunctor firstFunctor(firstData); - TapGestureDetector firstDetector = TapGestureDetector::New(); + TapGestureDetector firstDetector = TapGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector - SignalData secondData; + SignalData secondData; GestureReceivedFunctor secondFunctor(secondData); - TapGestureDetector secondDetector = TapGestureDetector::New(); + TapGestureDetector secondDetector = TapGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); // Tap in actor's area - both detector's functors should be called - TestGenerateTap( application, 50.0f, 10.0f, 100 ); + TestGenerateTap(application, 50.0f, 10.0f, 100); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); END_TEST; @@ -719,8 +722,8 @@ int UtcDaliTapGestureSignalReceptionDifferentPossible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -728,44 +731,44 @@ int UtcDaliTapGestureSignalReceptionDifferentPossible(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); - TapGestureDetector detector = TapGestureDetector::New(); + SignalData data; + GestureReceivedFunctor functor(data); + TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Gesture possible in actor's area. - TestStartLongPress( application, 50.0f, 10.0f, 100 ); + TestStartLongPress(application, 50.0f, 10.0f, 100); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor somewhere else - actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit STARTED event, we should not receive the tap. - TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); + TestEndPan(application, Vector2(50.0f, 10.0f), 120); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Tap possible in empty area. - TestStartLongPress( application, 50.0f, 10.0f, 700 ); + TestStartLongPress(application, 50.0f, 10.0f, 700); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Move actor in to the tap position. - actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); + actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); // Render and notify application.SendNotification(); application.Render(); // Emit STARTED event, we should not receive the tap. - TestEndPan( application, Vector2(50.0f, 10.0f), 720 ); + TestEndPan(application, Vector2(50.0f, 10.0f), 720); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); // Normal tap in actor's area for completeness. - TestGenerateTap( application, 50.0f, 10.0f, 1300 ); + TestGenerateTap(application, 50.0f, 10.0f, 1300); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -775,8 +778,8 @@ int UtcDaliTapGestureActorUnstaged(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -784,15 +787,15 @@ int UtcDaliTapGestureActorUnstaged(void) application.Render(); // Attach actor to detector - SignalData data; - UnstageActorFunctor functor( data, application.GetScene() ); - TapGestureDetector detector = TapGestureDetector::New(); + SignalData data; + UnstageActorFunctor functor(data, application.GetScene()); + TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); - TestGenerateTap( application, 50.0f, 10.0f, 100 ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - tet_result( TET_PASS ); // If we get here, then the actor removal on signal handler was handled gracefully. + TestGenerateTap(application, 50.0f, 10.0f, 100); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + tet_result(TET_PASS); // If we get here, then the actor removal on signal handler was handled gracefully. END_TEST; } @@ -801,8 +804,8 @@ int UtcDaliTapGestureDetectorRemovedWhilePossible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -810,18 +813,18 @@ int UtcDaliTapGestureDetectorRemovedWhilePossible(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); - TapGestureDetector detector = TapGestureDetector::New(); + SignalData data; + GestureReceivedFunctor functor(data); + TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit a possible - Down press, as emitted by long press function - TestStartLongPress( application, 50.0f, 10.0f, 100 ); + TestStartLongPress(application, 50.0f, 10.0f, 100); // Detach actor and send a STARTED state, no signal. detector.DetachAll(); - TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); + TestEndPan(application, Vector2(50.0f, 10.0f), 120); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -831,8 +834,8 @@ int UtcDaliTapGestureActorRemovedWhilePossible(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -840,14 +843,14 @@ int UtcDaliTapGestureActorRemovedWhilePossible(void) application.Render(); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); - TapGestureDetector detector = TapGestureDetector::New(); + SignalData data; + GestureReceivedFunctor functor(data); + TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Emit a possible - Down press, as emitted by long press function - TestStartLongPress( application, 50.0f, 10.0f, 100 ); + TestStartLongPress(application, 50.0f, 10.0f, 100); // Remove, render and delete actor application.GetScene().Remove(actor); @@ -856,7 +859,7 @@ int UtcDaliTapGestureActorRemovedWhilePossible(void) actor.Reset(); // Send a STARTED state, no signal - Up motion as provided by end pan function - TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); + TestEndPan(application, Vector2(50.0f, 10.0f), 120); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -866,22 +869,22 @@ int UtcDaliTapGestureLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); - TapGestureDetector detector = TapGestureDetector::New(); + TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); - detector.DetectedSignal().Connect( &application, functor ); + detector.DetectedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -889,19 +892,19 @@ int UtcDaliTapGestureLayerConsumesTouch(void) application.Render(); // Emit signals, should receive - TestGenerateTap( application, 50.0f, 50.0f, 100 ); + TestGenerateTap(application, 50.0f, 50.0f, 100); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - TestGenerateTap( application, 50.0f, 50.0f, 700 ); + TestGenerateTap(application, 50.0f, 50.0f, 700); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -913,19 +916,19 @@ int UtcDaliTapGestureInterruptedWhenTouchConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); - bool consume = false; + bool consume = false; TouchEventFunctorConsumeSetter touchFunctor(consume); - actor.TouchedSignal().Connect(&application,touchFunctor); + actor.TouchedSignal().Connect(&application, touchFunctor); // Render and notify application.SendNotification(); application.Render(); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); @@ -933,13 +936,13 @@ int UtcDaliTapGestureInterruptedWhenTouchConsumed(void) detector.DetectedSignal().Connect(&application, functor); // Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed - TestGenerateTap( application, 50.0f, 50.0f ); + TestGenerateTap(application, 50.0f, 50.0f); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Another gesture in the same location, this time we will not receive it as touch is being consumed consume = true; - TestGenerateTap( application, 50.0f, 50.0f ); + TestGenerateTap(application, 50.0f, 50.0f); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -953,21 +956,20 @@ int UtcDaliTapGestureDisableDetectionDuringTapN(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Add a detector - TapGestureDetector detector = TapGestureDetector::New(); - bool functorCalled = false; - detector.Attach( actor ); + TapGestureDetector detector = TapGestureDetector::New(); + bool functorCalled = false; + detector.Attach(actor); detector.DetectedSignal().Connect( - &application, - [&detector, &functorCalled](Actor actor, const TapGesture& gesture) - { - detector.Detach(actor); - functorCalled = true; - }); + &application, + [&detector, &functorCalled](Actor actor, const TapGesture& gesture) { + detector.Detach(actor); + functorCalled = true; + }); // Render and notify application.SendNotification(); @@ -976,16 +978,15 @@ int UtcDaliTapGestureDisableDetectionDuringTapN(void) // Try the gesture, should not crash try { - TestGenerateTap( application, 50.0f, 10.0f ); + TestGenerateTap(application, 50.0f, 10.0f); - DALI_TEST_CHECK( true ); // No crash, test has passed + DALI_TEST_CHECK(true); // No crash, test has passed DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION); } catch(...) { - DALI_TEST_CHECK( false ); // If we crash, the test has failed + DALI_TEST_CHECK(false); // If we crash, the test has failed } END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-TapGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-TapGestureRecognizer.cpp index f1669c2..bff9a08 100644 --- a/automated-tests/src/dali/utc-Dali-TapGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-TapGestureRecognizer.cpp @@ -15,32 +15,31 @@ * */ -#include - -#include -#include +#include #include #include -#include +#include +#include +#include using namespace Dali; /////////////////////////////////////////////////////////////////////////////// namespace { - struct SignalData { SignalData() : functorCalled(false), voidFunctorCalled(false), receivedGesture() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -48,22 +47,25 @@ struct SignalData tappedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; TapGesture receivedGesture; - Actor tappedActor; + Actor tappedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, const TapGesture& tap) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = tap; - signalData.tappedActor = actor; + signalData.tappedActor = actor; } void operator()() @@ -74,41 +76,38 @@ struct GestureReceivedFunctor SignalData& signalData; }; - -Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPosition ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPosition); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } -Integration::TouchEvent GenerateDoubleTouch( PointState::Type state, const Vector2& screenPositionA, const Vector2& screenPositionB, uint32_t time ) +Integration::TouchEvent GenerateDoubleTouch(PointState::Type state, const Vector2& screenPositionA, const Vector2& screenPositionB, uint32_t time) { Integration::TouchEvent touchEvent; - Integration::Point point; - point.SetState( state ); - point.SetScreenPosition( screenPositionA ); - point.SetDeviceClass( Device::Class::TOUCH ); - point.SetDeviceSubclass( Device::Subclass::NONE ); - touchEvent.points.push_back( point ); - point.SetScreenPosition( screenPositionB ); - touchEvent.points.push_back( point ); + Integration::Point point; + point.SetState(state); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + touchEvent.points.push_back(point); touchEvent.time = time; return touchEvent; } - -} // anon namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// - int UtcDaliTapGestureRecognizerBasic(void) { TestApplication application; @@ -116,8 +115,8 @@ int UtcDaliTapGestureRecognizerBasic(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -126,13 +125,13 @@ int UtcDaliTapGestureRecognizerBasic(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -141,7 +140,6 @@ int UtcDaliTapGestureRecognizerBasic(void) END_TEST; } - int UtcDaliTapGestureRecognizerGapTooLong(void) { TestApplication application; @@ -149,8 +147,8 @@ int UtcDaliTapGestureRecognizerGapTooLong(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -159,13 +157,13 @@ int UtcDaliTapGestureRecognizerGapTooLong(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 651 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 651)); application.SendNotification(); @@ -174,7 +172,6 @@ int UtcDaliTapGestureRecognizerGapTooLong(void) END_TEST; } - int UtcDaliTapGestureRecognizerInterrupted(void) { TestApplication application; @@ -182,8 +179,8 @@ int UtcDaliTapGestureRecognizerInterrupted(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -192,15 +189,15 @@ int UtcDaliTapGestureRecognizerInterrupted(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 20.0f ), 175 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 20.0f), 175)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -209,7 +206,6 @@ int UtcDaliTapGestureRecognizerInterrupted(void) END_TEST; } - int UtcDaliTapGestureRecognizerMoveTooFar(void) { TestApplication application; @@ -217,8 +213,8 @@ int UtcDaliTapGestureRecognizerMoveTooFar(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -227,13 +223,13 @@ int UtcDaliTapGestureRecognizerMoveTooFar(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 20.0f), 200)); application.SendNotification(); @@ -242,7 +238,6 @@ int UtcDaliTapGestureRecognizerMoveTooFar(void) END_TEST; } - int UtcDaliTapGestureRecognizerStartDouble(void) { TestApplication application; @@ -250,8 +245,8 @@ int UtcDaliTapGestureRecognizerStartDouble(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -260,13 +255,13 @@ int UtcDaliTapGestureRecognizerStartDouble(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 150 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -275,7 +270,6 @@ int UtcDaliTapGestureRecognizerStartDouble(void) END_TEST; } - int UtcDaliTapGestureRecognizerEndDouble(void) { TestApplication application; @@ -283,8 +277,8 @@ int UtcDaliTapGestureRecognizerEndDouble(void) TapGestureDetector detector = TapGestureDetector::New(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -293,15 +287,15 @@ int UtcDaliTapGestureRecognizerEndDouble(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 200 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 200)); - application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 200 ) ); + application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 200)); application.SendNotification(); @@ -310,7 +304,6 @@ int UtcDaliTapGestureRecognizerEndDouble(void) END_TEST; } - int UtcDaliTapGestureRecognizerDoubleTap(void) { TestApplication application; @@ -318,8 +311,8 @@ int UtcDaliTapGestureRecognizerDoubleTap(void) TapGestureDetector detector = TapGestureDetector::New(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -328,21 +321,21 @@ int UtcDaliTapGestureRecognizerDoubleTap(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 250)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 300 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 300)); application.SendNotification(); @@ -351,7 +344,6 @@ int UtcDaliTapGestureRecognizerDoubleTap(void) END_TEST; } - int UtcDaliTapGestureRecognizerDoubleTapMoveTooFar(void) { TestApplication application; @@ -359,8 +351,8 @@ int UtcDaliTapGestureRecognizerDoubleTapMoveTooFar(void) TapGestureDetector detector = TapGestureDetector::New(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -369,33 +361,33 @@ int UtcDaliTapGestureRecognizerDoubleTapMoveTooFar(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), 250 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), 250)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 50.0f ), 300 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 50.0f), 300)); application.SendNotification(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 450 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 450)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 500 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 500)); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 550 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 550)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 600 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 600)); application.SendNotification(); @@ -404,7 +396,6 @@ int UtcDaliTapGestureRecognizerDoubleTapMoveTooFar(void) END_TEST; } - int UtcDaliTapGestureRecognizerDoubleTapWaitTooLong(void) { TestApplication application; @@ -412,8 +403,8 @@ int UtcDaliTapGestureRecognizerDoubleTapWaitTooLong(void) TapGestureDetector detector = TapGestureDetector::New(2); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -422,33 +413,33 @@ int UtcDaliTapGestureRecognizerDoubleTapWaitTooLong(void) detector.Attach(actor); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 650 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 650)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 750 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 750)); application.SendNotification(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 950 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 950)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 1000 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1000)); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 1050 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 1050)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 1000 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1000)); application.SendNotification(); @@ -457,20 +448,19 @@ int UtcDaliTapGestureRecognizerDoubleTapWaitTooLong(void) END_TEST; } - int UtcDaliTapGestureRecognizerMultipleDetectors(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); Actor actor2 = Actor::New(); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor2.SetProperty( Actor::Property::POSITION_X, 100.0f); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor2.SetProperty(Actor::Property::POSITION_X, 100.0f); application.GetScene().Add(actor2); // Render and notify @@ -483,17 +473,17 @@ int UtcDaliTapGestureRecognizerMultipleDetectors(void) TapGestureDetector detector2 = TapGestureDetector::New(2); detector2.Attach(actor2); - SignalData data; + SignalData data; GestureReceivedFunctor functor(data); detector.DetectedSignal().Connect(&application, functor); - SignalData data2; + SignalData data2; GestureReceivedFunctor functor2(data2); detector2.DetectedSignal().Connect(&application, functor2); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200)); application.SendNotification(); @@ -502,17 +492,17 @@ int UtcDaliTapGestureRecognizerMultipleDetectors(void) data.Reset(); DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), 250 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), 250)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 120.0f, 20.0f ), 300 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(120.0f, 20.0f), 300)); application.SendNotification(); DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), 350 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), 350)); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 120.0f, 20.0f ), 400 ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(120.0f, 20.0f), 400)); application.SendNotification(); diff --git a/automated-tests/src/dali/utc-Dali-Texture.cpp b/automated-tests/src/dali/utc-Dali-Texture.cpp index b170b6a..60810d1 100644 --- a/automated-tests/src/dali/utc-Dali-Texture.cpp +++ b/automated-tests/src/dali/utc-Dali-Texture.cpp @@ -15,9 +15,9 @@ * */ -#include -#include #include +#include +#include #include using namespace Dali; @@ -40,17 +40,17 @@ int UtcDaliTextureNew01(void) unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); - DALI_TEST_CHECK( texture ); + DALI_TEST_CHECK(texture); END_TEST; } int UtcDaliTextureNew02(void) { TestApplication application; - Texture texture; - DALI_TEST_CHECK( !texture ); + Texture texture; + DALI_TEST_CHECK(!texture); END_TEST; } @@ -59,13 +59,13 @@ int UtcDaliTextureNew03(void) TestApplication application; // Create a native image source. - TestNativeImagePointer testNativeImage = TestNativeImage::New( 64u, 64u ); + TestNativeImagePointer testNativeImage = TestNativeImage::New(64u, 64u); // Create a texture from the native image source. - Texture nativeTexture = Texture::New( *testNativeImage ); + Texture nativeTexture = Texture::New(*testNativeImage); // Check the texture was created OK. - DALI_TEST_CHECK( nativeTexture ); + DALI_TEST_CHECK(nativeTexture); END_TEST; } @@ -76,11 +76,11 @@ int UtcDaliTextureCopyConstructor(void) unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); Texture textureCopy(texture); - DALI_TEST_CHECK( textureCopy ); + DALI_TEST_CHECK(textureCopy); END_TEST; } @@ -88,15 +88,15 @@ int UtcDaliTextureCopyConstructor(void) int UtcDaliTextureAssignmentOperator(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + unsigned int width(64); + unsigned int height(64); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); Texture texture2; - DALI_TEST_CHECK( !texture2 ); + DALI_TEST_CHECK(!texture2); texture2 = texture; - DALI_TEST_CHECK( texture2 ); + DALI_TEST_CHECK(texture2); END_TEST; } @@ -105,20 +105,20 @@ int UtcDaliTextureMoveConstructor(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_CHECK( texture ); - DALI_TEST_EQUALS( 1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION ); - DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION ); - - Texture move = std::move( texture ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetWidth(), width, TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetHeight(), height, TEST_LOCATION ); - DALI_TEST_CHECK( !texture ); + uint32_t width = 64; + uint32_t height = 64; + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_CHECK(texture); + DALI_TEST_EQUALS(1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION); + DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION); + + Texture move = std::move(texture); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetWidth(), width, TEST_LOCATION); + DALI_TEST_EQUALS(move.GetHeight(), height, TEST_LOCATION); + DALI_TEST_CHECK(!texture); END_TEST; } @@ -127,21 +127,21 @@ int UtcDaliTextureMoveAssignment(void) { TestApplication application; - uint32_t width = 64; - uint32_t height = 64; - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_CHECK( texture ); - DALI_TEST_EQUALS( 1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION ); - DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION ); + uint32_t width = 64; + uint32_t height = 64; + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_CHECK(texture); + DALI_TEST_EQUALS(1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION); + DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION); Texture move; - move = std::move( texture ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetWidth(), width, TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetHeight(), height, TEST_LOCATION ); - DALI_TEST_CHECK( !texture ); + move = std::move(texture); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetWidth(), width, TEST_LOCATION); + DALI_TEST_EQUALS(move.GetHeight(), height, TEST_LOCATION); + DALI_TEST_CHECK(!texture); END_TEST; } @@ -149,13 +149,13 @@ int UtcDaliTextureMoveAssignment(void) int UtcDaliTextureDownCast01(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + unsigned int width(64); + unsigned int height(64); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); BaseHandle handle(texture); - Texture texture2 = Texture::DownCast(handle); - DALI_TEST_CHECK( texture2 ); + Texture texture2 = Texture::DownCast(handle); + DALI_TEST_CHECK(texture2); END_TEST; } @@ -164,9 +164,9 @@ int UtcDaliTextureDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object Texture texture = Texture::DownCast(handle); - DALI_TEST_CHECK( !texture ); + DALI_TEST_CHECK(!texture); END_TEST; } @@ -177,7 +177,7 @@ int UtcDaliTextureUpload01(void) //Create the texture unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -189,44 +189,43 @@ int UtcDaliTextureUpload01(void) //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } //Upload data to the texture callStack.Reset(); - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelData ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelData); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } //Upload part of the texture callStack.Reset(); - bufferSize = width * height * 2; - buffer = reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 ); + bufferSize = width * height * 2; + buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelDataSubImage = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelDataSubImage, 0u, 0u, width / 2, height / 2, width / 2, height / 2); application.SendNotification(); application.Render(); //TexSubImage2D should be called to upload the data { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " << height/2 << ", " << width/2 << ", " << height/2; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width / 2 << ", " << height / 2 << ", " << width / 2 << ", " << height / 2; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str())); } - END_TEST; } @@ -237,7 +236,7 @@ int UtcDaliTextureUpload02(void) //Create the texture unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -247,30 +246,30 @@ int UtcDaliTextureUpload02(void) TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace(); //TexImage2D should be called six times with a null pointer to reserve storage for the six textures of the cube map - for( unsigned int i(0); i<6; ++i ) + for(unsigned int i(0); i < 6; ++i) { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_POSITIVE_X + i <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_POSITIVE_X + i << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); //Upload data to the POSITIVE_X face of the texture { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the POSITIVE_X face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_POSITIVE_X <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_POSITIVE_X << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } @@ -278,75 +277,75 @@ int UtcDaliTextureUpload02(void) { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the NEGATIVE_X face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } //Upload data to the POSITIVE_Y face of the texture { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the POSITIVE_Y face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_POSITIVE_Y <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_POSITIVE_Y << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } //Upload data to the NEGATIVE_Y face of the texture { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the NEGATIVE_Y face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Y <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Y << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } //Upload data to the POSITIVE_Z face of the texture { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the POSITIVE_Z face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_POSITIVE_Z <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_POSITIVE_Z << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } //Upload data to the NEGATIVE_Z face of the texture { callStack.Reset(); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height ); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to the NEGATIVE_Z face { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Z <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Z << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } @@ -363,7 +362,7 @@ int UtcDaliTextureUpload03(void) unsigned int widthMipmap1(32); unsigned int heightMipmap1(32); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -375,35 +374,35 @@ int UtcDaliTextureUpload03(void) //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } //Upload data to the texture mipmap 0 and mipmap 1 callStack.Reset(); - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelData, 0u, 0u, 0u, 0u, width, height ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelData, 0u, 0u, 0u, 0u, width, height); - bufferSize = widthMipmap1 * heightMipmap1 * 4; - buffer = reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelDataMipmap1, 0u, 1u, 0u, 0u, widthMipmap1, heightMipmap1 ); + bufferSize = widthMipmap1 * heightMipmap1 * 4; + buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelDataMipmap1 = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelDataMipmap1, 0u, 1u, 0u, 0u, widthMipmap1, heightMipmap1); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to mipmaps 0 and 1 { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 1u << ", " << widthMipmap1 << ", " << heightMipmap1; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } END_TEST; @@ -419,34 +418,34 @@ int UtcDaliTextureUpload04(void) unsigned int widthMipmap1(32); unsigned int heightMipmap1(32); - Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace(); //Upload data to the NEGATIVE_X face mipmap 0 and mipmap 1 - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height ); - - bufferSize = widthMipmap1 * heightMipmap1 * 4; - buffer = reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelDataMipmap1, CubeMapLayer::NEGATIVE_X, 1u, 0u, 0u, widthMipmap1, heightMipmap1 ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height); + + bufferSize = widthMipmap1 * heightMipmap1 * 4; + buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelDataMipmap1 = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelDataMipmap1, CubeMapLayer::NEGATIVE_X, 1u, 0u, 0u, widthMipmap1, heightMipmap1); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data to mipmaps 0 and 1 { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } { std::stringstream out; - out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 1u << ", " << widthMipmap1 << ", " << heightMipmap1; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } END_TEST; @@ -455,58 +454,58 @@ int UtcDaliTextureUpload04(void) int UtcDaliTextureUpload05(void) { Pixel::Format COMPRESSED_PIXEL_FORMATS[] = - { - Pixel::COMPRESSED_R11_EAC, - Pixel::COMPRESSED_SIGNED_R11_EAC, - Pixel::COMPRESSED_RG11_EAC, - Pixel::COMPRESSED_SIGNED_RG11_EAC, - Pixel::COMPRESSED_RGB8_ETC2, - Pixel::COMPRESSED_SRGB8_ETC2, - Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, - Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, - Pixel::COMPRESSED_RGBA8_ETC2_EAC, - Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, - Pixel::COMPRESSED_RGB8_ETC1, - Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, - Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, - Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, - Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, - Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, - Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, - Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, - Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, - Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, - Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, - Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, - Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, - Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, - Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, - Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, - Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, - }; - const unsigned int NUMBER_OF_COMPRESSED_PIXEL_FORMATS = sizeof( COMPRESSED_PIXEL_FORMATS ) / sizeof( Pixel::Format ); - - for( unsigned int index = 0; index < NUMBER_OF_COMPRESSED_PIXEL_FORMATS; ++index ) + { + Pixel::COMPRESSED_R11_EAC, + Pixel::COMPRESSED_SIGNED_R11_EAC, + Pixel::COMPRESSED_RG11_EAC, + Pixel::COMPRESSED_SIGNED_RG11_EAC, + Pixel::COMPRESSED_RGB8_ETC2, + Pixel::COMPRESSED_SRGB8_ETC2, + Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + Pixel::COMPRESSED_RGBA8_ETC2_EAC, + Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + Pixel::COMPRESSED_RGB8_ETC1, + Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, + Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, + Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, + Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, + Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, + Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, + Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, + Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, + Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, + Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, + Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, + Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, + Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, + Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, + Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + }; + const unsigned int NUMBER_OF_COMPRESSED_PIXEL_FORMATS = sizeof(COMPRESSED_PIXEL_FORMATS) / sizeof(Pixel::Format); + + for(unsigned int index = 0; index < NUMBER_OF_COMPRESSED_PIXEL_FORMATS; ++index) { TestApplication application; //Create a texture with a compressed format unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, COMPRESSED_PIXEL_FORMATS[index], width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, COMPRESSED_PIXEL_FORMATS[index], width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -518,41 +517,41 @@ int UtcDaliTextureUpload05(void) //CompressedTexImage2D should be called with a null pointer to reserve storage for the texture in the gpu { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str())); } //Upload data to the texture callStack.Reset(); - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE ); - texture.Upload( pixelData ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE); + texture.Upload(pixelData); application.SendNotification(); application.Render(); //CompressedTexImage2D should be called to upload the data { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str())); } //Upload part of the texture callStack.Reset(); - bufferSize = width * height * 2; - buffer = reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE ); - texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 ); + bufferSize = width * height * 2; + buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelDataSubImage = PixelData::New(buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE); + texture.Upload(pixelDataSubImage, 0u, 0u, width / 2, height / 2, width / 2, height / 2); application.SendNotification(); application.Render(); //CompressedTexSubImage2D should be called to upload the data { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " << height/2 << ", " << width/2 << ", " << height/2; - DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexSubImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width / 2 << ", " << height / 2 << ", " << width / 2 << ", " << height / 2; + DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexSubImage2D", out.str().c_str())); } application.GetGlAbstraction().ResetTextureCallStack(); @@ -568,8 +567,8 @@ int UtcDaliTextureUpload06(void) //Create the texture unsigned int width(64); unsigned int height(64); - tet_infoline( "Creating a Texure with an alpha channel" ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + tet_infoline("Creating a Texure with an alpha channel"); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -578,29 +577,29 @@ int UtcDaliTextureUpload06(void) TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace(); - tet_infoline( "TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu" ); + tet_infoline("TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu"); { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } - tet_infoline( "Upload data to the texture" ); + tet_infoline("Upload data to the texture"); callStack.Reset(); - tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" ); - unsigned int bufferSize( width * height * 3 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE ); - texture.Upload( pixelData ); + tet_infoline("Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly"); + unsigned int bufferSize(width * height * 3); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE); + texture.Upload(pixelData); application.SendNotification(); application.Render(); - tet_infoline( "TexImage2D should be called to upload the data" ); + tet_infoline("TexImage2D should be called to upload the data"); { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } END_TEST; @@ -609,21 +608,21 @@ int UtcDaliTextureUpload06(void) int UtcDaliTextureUpload07(void) { Pixel::Format FLOATING_POINT_PIXEL_FORMATS[] = - { - Pixel::RGB16F, - Pixel::RGB32F, - }; - const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof( FLOATING_POINT_PIXEL_FORMATS ) / sizeof( Pixel::Format ); + { + Pixel::RGB16F, + Pixel::RGB32F, + }; + const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof(FLOATING_POINT_PIXEL_FORMATS) / sizeof(Pixel::Format); - for( unsigned int index = 0; index < NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS; ++index ) + for(unsigned int index = 0; index < NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS; ++index) { TestApplication application; //Create the texture unsigned int width(64); unsigned int height(64); - tet_infoline( "Creating a floating point texture" ); - Texture texture = Texture::New( TextureType::TEXTURE_2D, FLOATING_POINT_PIXEL_FORMATS[index], width, height ); + tet_infoline("Creating a floating point texture"); + Texture texture = Texture::New(TextureType::TEXTURE_2D, FLOATING_POINT_PIXEL_FORMATS[index], width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -632,29 +631,29 @@ int UtcDaliTextureUpload07(void) TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace(); - tet_infoline( "TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu" ); + tet_infoline("TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu"); { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } - tet_infoline( "Upload data to the texture" ); + tet_infoline("Upload data to the texture"); callStack.Reset(); - tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" ); - unsigned int bufferSize( width * height * 3 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE ); - texture.Upload( pixelData ); + tet_infoline("Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly"); + unsigned int bufferSize(width * height * 3); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE); + texture.Upload(pixelData); application.SendNotification(); application.Render(); - tet_infoline( "TexImage2D should be called to upload the data" ); + tet_infoline("TexImage2D should be called to upload the data"); { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; - DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) ); + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; + DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str())); } } @@ -668,7 +667,7 @@ int UtcDaliTextureUploadSmallerThanSize(void) //Create the texture unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -680,29 +679,29 @@ int UtcDaliTextureUploadSmallerThanSize(void) //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height; + out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height; std::string params; - DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexImage2D", params ) ); - DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION ); + DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("TexImage2D", params)); + DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION); } //Upload data to the texture callStack.Reset(); - unsigned int bufferSize( width * height * 4 ); - unsigned char* buffer= reinterpret_cast( malloc( bufferSize ) ); - PixelData pixelData = PixelData::New( buffer, bufferSize, width/2, height/2, Pixel::RGBA8888, PixelData::FREE ); - texture.Upload( pixelData ); + unsigned int bufferSize(width * height * 4); + unsigned char* buffer = reinterpret_cast(malloc(bufferSize)); + PixelData pixelData = PixelData::New(buffer, bufferSize, width / 2, height / 2, Pixel::RGBA8888, PixelData::FREE); + texture.Upload(pixelData); application.SendNotification(); application.Render(); //TexImage2D should be called to upload the data { std::stringstream out; - out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << width/2 << ", " << height/2; + out << GL_TEXTURE_2D << ", " << 0u << ", " << 0u << ", " << 0u << ", " << width / 2 << ", " << height / 2; std::string params; - DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexSubImage2D", params ) ); - DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION ); + DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("TexSubImage2D", params)); + DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION); } END_TEST; @@ -711,13 +710,13 @@ int UtcDaliTextureUploadSmallerThanSize(void) int UtcDaliTextureGenerateMipmaps(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); + unsigned int width(64); + unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); texture.GenerateMipmaps(); - Texture textureCubemap = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height ); + Texture textureCubemap = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height); textureCubemap.GenerateMipmaps(); application.GetGlAbstraction().EnableTextureCallTrace(true); @@ -728,12 +727,12 @@ int UtcDaliTextureGenerateMipmaps(void) { std::stringstream out; out << GL_TEXTURE_2D; - DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) ); + DALI_TEST_CHECK(callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str())); } { std::stringstream out; out << GL_TEXTURE_CUBE_MAP; - DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) ); + DALI_TEST_CHECK(callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str())); } END_TEST; @@ -742,22 +741,22 @@ int UtcDaliTextureGenerateMipmaps(void) int UtcDaliTextureGetWidth(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); + unsigned int width(64); + unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION); END_TEST; } int UtcDaliTextureGetHeight(void) { TestApplication application; - unsigned int width(64); - unsigned int height(64); + unsigned int width(64); + unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION); END_TEST; } @@ -770,15 +769,15 @@ int UtcDaliTextureContextLoss(void) //Create the texture unsigned int width(64); unsigned int height(64); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); - DALI_TEST_CHECK( texture ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height); + DALI_TEST_CHECK(texture); application.SendNotification(); application.Render(16); // Lose & regain context (in render 'thread') application.ResetContext(); - DALI_TEST_CHECK( texture ); + DALI_TEST_CHECK(texture); END_TEST; } @@ -786,22 +785,22 @@ int UtcDaliTextureContextLoss(void) int UtcDaliNativeImageTexture01(void) { TestApplication application; - tet_infoline( "UtcDaliNativeImageTexture01" ); + tet_infoline("UtcDaliNativeImageTexture01"); - TestNativeImagePointer imageInterface = TestNativeImage::New( 16, 16 ); + TestNativeImagePointer imageInterface = TestNativeImage::New(16, 16); { - Texture texture = Texture::New( *(imageInterface.Get()) ); - Actor actor = CreateRenderableActor(texture, "", ""); + Texture texture = Texture::New(*(imageInterface.Get())); + Actor actor = CreateRenderableActor(texture, "", ""); application.GetScene().Add(actor); - DALI_TEST_CHECK( texture ); + DALI_TEST_CHECK(texture); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 0, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE), Property::Value(Vector3(16,16,0)), TEST_LOCATION); + DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION); + DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 0, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Property::Value(Vector3(16, 16, 0)), TEST_LOCATION); UnparentAndReset(actor); @@ -811,34 +810,33 @@ int UtcDaliNativeImageTexture01(void) application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION); + DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 1, TEST_LOCATION); END_TEST; } - int UtcDaliNativeImageTexture02(void) { TestApplication application; - tet_infoline( "UtcDaliNativeImageTexture02 - test error on TargetTexture" ); + tet_infoline("UtcDaliNativeImageTexture02 - test error on TargetTexture"); - TestNativeImagePointer imageInterface = TestNativeImage::New( 16, 16 ); - imageInterface->mTargetTextureError = 1u; + TestNativeImagePointer imageInterface = TestNativeImage::New(16, 16); + imageInterface->mTargetTextureError = 1u; { - Texture texture = Texture::New( *(imageInterface.Get()) ); - Actor actor = CreateRenderableActor(texture, "", ""); + Texture texture = Texture::New(*(imageInterface.Get())); + Actor actor = CreateRenderableActor(texture, "", ""); application.GetScene().Add(actor); - DALI_TEST_CHECK( texture ); + DALI_TEST_CHECK(texture); application.SendNotification(); application.Render(16); // Expect 2 attempts to create the texture - once when adding the texture // to the scene-graph, and again since that failed, during the Bind. - DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION); + DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION); UnparentAndReset(actor); @@ -849,8 +847,8 @@ int UtcDaliNativeImageTexture02(void) application.Render(16); // Expect that there are no further calls to create/destroy resource - DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION ); - DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION ); + DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION); + DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION); END_TEST; } @@ -858,7 +856,7 @@ int UtcDaliNativeImageTexture02(void) int UtcDaliTextureGenerateMipmapsNegative(void) { TestApplication application; - Dali::Texture instance; + Dali::Texture instance; try { instance.GenerateMipmaps(); @@ -874,7 +872,7 @@ int UtcDaliTextureGenerateMipmapsNegative(void) int UtcDaliTextureUploadNegative01(void) { TestApplication application; - Dali::Texture instance; + Dali::Texture instance; try { Dali::PixelData arg1; @@ -891,17 +889,17 @@ int UtcDaliTextureUploadNegative01(void) int UtcDaliTextureUploadNegative02(void) { TestApplication application; - Dali::Texture instance; + Dali::Texture instance; try { Dali::PixelData arg1; - unsigned int arg2(0u); - unsigned int arg3(0u); - unsigned int arg4(0u); - unsigned int arg5(0u); - unsigned int arg6(0u); - unsigned int arg7(0u); - instance.Upload(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + unsigned int arg2(0u); + unsigned int arg3(0u); + unsigned int arg4(0u); + unsigned int arg5(0u); + unsigned int arg6(0u); + unsigned int arg7(0u); + instance.Upload(arg1, arg2, arg3, arg4, arg5, arg6, arg7); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -914,7 +912,7 @@ int UtcDaliTextureUploadNegative02(void) int UtcDaliTextureGetWidthNegative(void) { TestApplication application; - Dali::Texture instance; + Dali::Texture instance; try { instance.GetWidth(); @@ -930,7 +928,7 @@ int UtcDaliTextureGetWidthNegative(void) int UtcDaliTextureGetHeightNegative(void) { TestApplication application; - Dali::Texture instance; + Dali::Texture instance; try { instance.GetHeight(); diff --git a/automated-tests/src/dali/utc-Dali-TextureSet.cpp b/automated-tests/src/dali/utc-Dali-TextureSet.cpp index cfa40eb..4e30f15 100644 --- a/automated-tests/src/dali/utc-Dali-TextureSet.cpp +++ b/automated-tests/src/dali/utc-Dali-TextureSet.cpp @@ -26,43 +26,41 @@ using namespace Dali; namespace { - enum SetSampler { SET_SAMPLER, DONT_SET_SAMPLER }; -Actor CreateActor( SetSampler setSamplerOption ) +Actor CreateActor(SetSampler setSamplerOption) { - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = CreateShader(); + Shader shader = CreateShader(); TextureSet textureSet = CreateTextureSet(); Sampler sampler = Sampler::New(); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); - textureSet.SetTexture( 0u, texture ); - if( setSamplerOption == SET_SAMPLER ) + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); + textureSet.SetTexture(0u, texture); + if(setSamplerOption == SET_SAMPLER) { - textureSet.SetSampler( 0u, sampler ); + textureSet.SetSampler(0u, sampler); } Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); return actor; } } // namespace - void texture_set_test_startup(void) { test_return_value = TET_UNDEF; @@ -79,15 +77,15 @@ int UtcDaliTextureSetNew01(void) TextureSet textureSet = TextureSet::New(); - DALI_TEST_CHECK( textureSet ); + DALI_TEST_CHECK(textureSet); END_TEST; } int UtcDaliTextureSetNew02(void) { TestApplication application; - TextureSet textureSet; - DALI_TEST_CHECK( !textureSet ); + TextureSet textureSet; + DALI_TEST_CHECK(!textureSet); END_TEST; } @@ -95,13 +93,13 @@ int UtcDaliTextureSetCopyConstructor(void) { TestApplication application; - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32); TextureSet textureSet = TextureSet::New(); - textureSet.SetTexture( 0u, image ); + textureSet.SetTexture(0u, image); TextureSet textureSetCopy(textureSet); - DALI_TEST_CHECK( textureSetCopy ); + DALI_TEST_CHECK(textureSetCopy); END_TEST; } @@ -109,13 +107,13 @@ int UtcDaliTextureSetCopyConstructor(void) int UtcDaliTextureSetAssignmentOperator(void) { TestApplication application; - TextureSet textureSet = TextureSet::New(); + TextureSet textureSet = TextureSet::New(); TextureSet textureSet2; - DALI_TEST_CHECK( !textureSet2 ); + DALI_TEST_CHECK(!textureSet2); textureSet2 = textureSet; - DALI_TEST_CHECK( textureSet2 ); + DALI_TEST_CHECK(textureSet2); END_TEST; } @@ -125,18 +123,18 @@ int UtcDaliTextureSetMoveConstructor(void) TestApplication application; TextureSet textureSet = TextureSet::New(); - DALI_TEST_CHECK( textureSet ); - DALI_TEST_EQUALS( 1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(textureSet); + DALI_TEST_EQUALS(1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32 ); - textureSet.SetTexture( 0u, texture ); - DALI_TEST_EQUALS( textureSet.GetTexture( 0u ), texture, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32); + textureSet.SetTexture(0u, texture); + DALI_TEST_EQUALS(textureSet.GetTexture(0u), texture, TEST_LOCATION); - TextureSet move = std::move( textureSet ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetTexture( 0u ), texture, TEST_LOCATION ); - DALI_TEST_CHECK( !textureSet ); + TextureSet move = std::move(textureSet); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetTexture(0u), texture, TEST_LOCATION); + DALI_TEST_CHECK(!textureSet); END_TEST; } @@ -146,19 +144,19 @@ int UtcDaliTextureSetMoveAssignment(void) TestApplication application; TextureSet textureSet = TextureSet::New(); - DALI_TEST_CHECK( textureSet ); - DALI_TEST_EQUALS( 1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(textureSet); + DALI_TEST_EQUALS(1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32 ); - textureSet.SetTexture( 0u, texture ); - DALI_TEST_EQUALS( textureSet.GetTexture( 0u ), texture, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32); + textureSet.SetTexture(0u, texture); + DALI_TEST_EQUALS(textureSet.GetTexture(0u), texture, TEST_LOCATION); TextureSet move; - move = std::move( textureSet ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( move.GetTexture( 0u ), texture, TEST_LOCATION ); - DALI_TEST_CHECK( !textureSet ); + move = std::move(textureSet); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(move.GetTexture(0u), texture, TEST_LOCATION); + DALI_TEST_CHECK(!textureSet); END_TEST; } @@ -166,11 +164,11 @@ int UtcDaliTextureSetMoveAssignment(void) int UtcDaliTextureSetDownCast01(void) { TestApplication application; - TextureSet textureSet = TextureSet::New(); + TextureSet textureSet = TextureSet::New(); BaseHandle handle(textureSet); TextureSet textureSet2 = TextureSet::DownCast(handle); - DALI_TEST_CHECK( textureSet2 ); + DALI_TEST_CHECK(textureSet2); END_TEST; } @@ -179,39 +177,38 @@ int UtcDaliTextureSetDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object TextureSet textureSet = TextureSet::DownCast(handle); - DALI_TEST_CHECK( !textureSet ); + DALI_TEST_CHECK(!textureSet); END_TEST; } - int UtcDaliTextureSetTexture01(void) { TestApplication application; - Actor actor = CreateActor( DONT_SET_SAMPLER ); + Actor actor = CreateActor(DONT_SET_SAMPLER); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); application.SendNotification(); application.Render(); - int textureUnit=-1; - DALI_TEST_CHECK( gl.GetUniformValue( "sTexture", textureUnit ) ); - DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION ); + int textureUnit = -1; + DALI_TEST_CHECK(gl.GetUniformValue("sTexture", textureUnit)); + DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // There are four calls to TexParameteri when the texture is first created // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION); END_TEST; } @@ -222,27 +219,27 @@ int UtcDaliTextureSetTexture02(void) Actor actor = CreateActor(SET_SAMPLER); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); application.SendNotification(); application.Render(); - int textureUnit=-1; - DALI_TEST_CHECK( gl.GetUniformValue( "sTexture", textureUnit ) ); - DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION ); + int textureUnit = -1; + DALI_TEST_CHECK(gl.GetUniformValue("sTexture", textureUnit)); + DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // There are four calls to TexParameteri when the texture is first created // Texture minification and magnification filters are now different than default so //there should have been two extra TexParameteri calls to set the new filter mode - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 6, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 6, TEST_LOCATION); END_TEST; } @@ -254,28 +251,28 @@ int UtcDaliTextureSetMultiple(void) Actor actor1 = CreateActor(SET_SAMPLER); Actor actor2 = CreateActor(SET_SAMPLER); - application.GetScene().Add( actor1 ); - application.GetScene().Add( actor2 ); + application.GetScene().Add(actor1); + application.GetScene().Add(actor2); TestGlAbstraction& gl = application.GetGlAbstraction(); TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); application.SendNotification(); application.Render(); - int textureUnit=-1; - DALI_TEST_CHECK( gl.GetUniformValue( "sTexture", textureUnit ) ); - DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION ); + int textureUnit = -1; + DALI_TEST_CHECK(gl.GetUniformValue("sTexture", textureUnit)); + DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // For each actor there are four calls to TexParameteri when the texture is first created // Texture minification and magnification filters are now different than default so //there should have been two extra TexParameteri calls to set the new filter mode - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2 * 6, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2 * 6, TEST_LOCATION); END_TEST; } @@ -286,56 +283,54 @@ int UtcDaliTextureSetSetSampler(void) Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - Shader shader = CreateShader(); - TextureSet textureSet = CreateTextureSet( image ); + Shader shader = CreateShader(); + TextureSet textureSet = CreateTextureSet(image); Geometry geometry = CreateQuadGeometry(); - Renderer renderer = Renderer::New( geometry, shader ); - renderer.SetTextures( textureSet ); + Renderer renderer = Renderer::New(geometry, shader); + renderer.SetTextures(textureSet); Actor actor = Actor::New(); actor.AddRenderer(renderer); - actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) ); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f)); - application.GetScene().Add( actor ); + application.GetScene().Add(actor); TestGlAbstraction& gl = application.GetGlAbstraction(); TraceCallStack& texParameterTrace = gl.GetTexParameterTrace(); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); application.SendNotification(); application.Render(); - int textureUnit=-1; - DALI_TEST_CHECK( gl.GetUniformValue( "sTexture", textureUnit ) ); - DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION ); + int textureUnit = -1; + DALI_TEST_CHECK(gl.GetUniformValue("sTexture", textureUnit)); + DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state // There are 4 calls to TexParameteri when the texture is first created // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION); + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION); texParameterTrace.Reset(); - texParameterTrace.Enable( true ); + texParameterTrace.Enable(true); Sampler sampler = Sampler::New(); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); - textureSet.SetSampler( 0u, sampler ); - + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); + textureSet.SetSampler(0u, sampler); application.SendNotification(); application.Render(); - texParameterTrace.Enable( false ); + texParameterTrace.Enable(false); // Verify gl state //There should have been two calls to TexParameteri to set the new filtering mode - DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION); - + DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2, TEST_LOCATION); END_TEST; } @@ -345,26 +340,26 @@ int UtcDaliTextureSetGetTexture(void) TestApplication application; TextureSet textureSet = CreateTextureSet(); - DALI_TEST_EQUALS( textureSet.GetTexture(0), Texture(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetTexture(0), Texture(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 ); - textureSet.SetTexture( 0u, texture ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); + textureSet.SetTexture(0u, texture); - DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION); - textureSet.SetTexture( 2u, texture ); - DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(2), texture, TEST_LOCATION ); + textureSet.SetTexture(2u, texture); + DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(2), texture, TEST_LOCATION); - textureSet.SetTexture( 2u, Texture() ); - DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION ); + textureSet.SetTexture(2u, Texture()); + DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION); END_TEST; } @@ -374,27 +369,27 @@ int UtcDaliTextureSetGetSampler(void) TestApplication application; TextureSet textureSet = CreateTextureSet(); - DALI_TEST_EQUALS( textureSet.GetSampler(0), Sampler(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetSampler(0), Sampler(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION); Sampler sampler = Sampler::New(); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); - textureSet.SetSampler( 0u, sampler ); + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); + textureSet.SetSampler(0u, sampler); - DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION); - textureSet.SetSampler( 2u, sampler ); - DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2), sampler, TEST_LOCATION ); + textureSet.SetSampler(2u, sampler); + DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2), sampler, TEST_LOCATION); - textureSet.SetSampler( 2u, Sampler() ); - DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION ); + textureSet.SetSampler(2u, Sampler()); + DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION); END_TEST; } @@ -404,23 +399,23 @@ int UtcDaliTextureSetGetTextureCount0(void) TestApplication application; TextureSet textureSet = CreateTextureSet(); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 0u, TEST_LOCATION); Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); - textureSet.SetTexture( 0u, image ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION ); + textureSet.SetTexture(0u, image); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 1u, TEST_LOCATION); - textureSet.SetTexture( 1u, image ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); + textureSet.SetTexture(1u, image); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION); Sampler sampler = Sampler::New(); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); - textureSet.SetSampler( 2u, sampler ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); + textureSet.SetSampler(2u, sampler); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION); - textureSet.SetTexture( 2u, image ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2u), sampler, TEST_LOCATION ); + textureSet.SetTexture(2u, image); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2u), sampler, TEST_LOCATION); END_TEST; } @@ -430,37 +425,36 @@ int UtcDaliTextureSetGetTextureCount1(void) TestApplication application; TextureSet textureSet = CreateTextureSet(); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 0u, TEST_LOCATION); - Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 ); - textureSet.SetTexture( 0u, texture ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); + textureSet.SetTexture(0u, texture); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 1u, TEST_LOCATION); - textureSet.SetTexture( 1u, texture ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); + textureSet.SetTexture(1u, texture); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION); Sampler sampler = Sampler::New(); - sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST ); - textureSet.SetSampler( 2u, sampler ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); - - textureSet.SetTexture( 2u, texture ); - DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION ); - DALI_TEST_EQUALS( textureSet.GetSampler(2u), sampler, TEST_LOCATION ); + sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST); + textureSet.SetSampler(2u, sampler); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION); + textureSet.SetTexture(2u, texture); + DALI_TEST_EQUALS(textureSet.GetTextureCount(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(textureSet.GetSampler(2u), sampler, TEST_LOCATION); END_TEST; } int UtcDaliTextureSetSetSamplerNegative(void) { - TestApplication application; + TestApplication application; Dali::TextureSet instance; try { unsigned long arg1(0u); Dali::Sampler arg2; - instance.SetSampler(arg1,arg2); + instance.SetSampler(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -472,13 +466,13 @@ int UtcDaliTextureSetSetSamplerNegative(void) int UtcDaliTextureSetSetTextureNegative(void) { - TestApplication application; + TestApplication application; Dali::TextureSet instance; try { unsigned long arg1(0u); Dali::Texture arg2; - instance.SetTexture(arg1,arg2); + instance.SetTexture(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -490,7 +484,7 @@ int UtcDaliTextureSetSetTextureNegative(void) int UtcDaliTextureSetGetSamplerNegative(void) { - TestApplication application; + TestApplication application; Dali::TextureSet instance; try { @@ -507,7 +501,7 @@ int UtcDaliTextureSetGetSamplerNegative(void) int UtcDaliTextureSetGetTextureNegative(void) { - TestApplication application; + TestApplication application; Dali::TextureSet instance; try { @@ -524,7 +518,7 @@ int UtcDaliTextureSetGetTextureNegative(void) int UtcDaliTextureSetGetTextureCountNegative(void) { - TestApplication application; + TestApplication application; Dali::TextureSet instance; try { diff --git a/automated-tests/src/dali/utc-Dali-Thread.cpp b/automated-tests/src/dali/utc-Dali-Thread.cpp index fafc10b..7a05a3f 100644 --- a/automated-tests/src/dali/utc-Dali-Thread.cpp +++ b/automated-tests/src/dali/utc-Dali-Thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,13 @@ * */ -#include +#include +#include #include #include + +#include #include -#include -#include using Dali::Thread; @@ -35,7 +36,7 @@ class TestThread : public Thread gRunThreadEntryFunc = true; } }; -} +} // namespace int UtcDaliThreadP(void) { @@ -47,11 +48,11 @@ int UtcDaliThreadP(void) thread.Start(); // wait till the thread is terminated - while( !gRunThreadEntryFunc ) + while(!gRunThreadEntryFunc) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } - DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION ); + DALI_TEST_EQUALS(true, gRunThreadEntryFunc, TEST_LOCATION); thread.Join(); @@ -60,11 +61,11 @@ int UtcDaliThreadP(void) thread.Start(); thread.Join(); // wait till the thread is terminated - while( !gRunThreadEntryFunc ) + while(!gRunThreadEntryFunc) { - usleep( 1 ); // 1 microsecond + usleep(1); // 1 microsecond } - DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION ); + DALI_TEST_EQUALS(true, gRunThreadEntryFunc, TEST_LOCATION); END_TEST; } @@ -73,8 +74,8 @@ int UtcDaliThreadNonCopyable(void) { // we want to make sure that mutex is not copyable (its copy constructor is not defined) // this test will stop compiling if Mutex has compiler generated copy constructor - static_assert( !__has_trivial_copy( Thread ), "Thread should NOT be copyable" ); + static_assert(!__has_trivial_copy(Thread), "Thread should NOT be copyable"); - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-ThreadPool.cpp b/automated-tests/src/dali/utc-Dali-ThreadPool.cpp index c7c6335..3cc6f94 100644 --- a/automated-tests/src/dali/utc-Dali-ThreadPool.cpp +++ b/automated-tests/src/dali/utc-Dali-ThreadPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,13 @@ * */ -#include +#include +#include #include #include + +#include #include -#include -#include namespace { @@ -28,49 +29,48 @@ Dali::ThreadPool gThreadPool; // Helper function dividing workload into N batches // the loop lambda contains -Dali::UniqueFutureGroup ForEachMT( Dali::ThreadPool* pThreadPool, - uint32_t first, - uint32_t size, - std::function task ) +Dali::UniqueFutureGroup ForEachMT(Dali::ThreadPool* pThreadPool, + uint32_t first, + uint32_t size, + std::function task) { - uint32_t i = 0; - uint32_t j = 0; + uint32_t i = 0; + uint32_t j = 0; const auto workerCount = uint32_t(pThreadPool->GetWorkerCount()); - const auto step = size / workerCount; - j = workerCount + step; + const auto step = size / workerCount; + j = workerCount + step; std::vector tasks; - tasks.reserve( workerCount ); + tasks.reserve(workerCount); - for( auto threadIndex = 0u; threadIndex < workerCount; ++threadIndex ) + for(auto threadIndex = 0u; threadIndex < workerCount; ++threadIndex) { - Dali::Task lambda = [task, i, j]( int workerIndex ) - { - task( uint32_t(workerIndex), i, j ); + Dali::Task lambda = [task, i, j](int workerIndex) { + task(uint32_t(workerIndex), i, j); }; - tasks.emplace_back( lambda ); + tasks.emplace_back(lambda); i = j; j = i + step; - if( j > size ) + if(j > size) j = size; } - return pThreadPool->SubmitTasks( tasks, workerCount ); + return pThreadPool->SubmitTasks(tasks, workerCount); } -} +} // namespace int UtcDaliThreadPoolMultipleTasks(void) { // initialise global thread pool - if( !gThreadPool.GetWorkerCount() ) + if(!gThreadPool.GetWorkerCount()) { - gThreadPool.Initialize( 0u ); + gThreadPool.Initialize(0u); } // populate inputs std::array inputs; - int checksum = 0; - for( auto i = 0; i < decltype(i)(inputs.size()); ++i ) + int checksum = 0; + for(auto i = 0; i < decltype(i)(inputs.size()); ++i) { inputs[i] = i; checksum += i; @@ -80,13 +80,12 @@ int UtcDaliThreadPoolMultipleTasks(void) auto workerCount = gThreadPool.GetWorkerCount(); std::vector outputs; - outputs.resize( workerCount ); - std::fill( outputs.begin(), outputs.end(), 0 ); + outputs.resize(workerCount); + std::fill(outputs.begin(), outputs.end(), 0); // submit - auto future = ForEachMT( &gThreadPool, 0, inputs.size(), [&inputs, &outputs]( uint32_t workerIndex, uint32_t begin, uint32_t end ) - { - for( auto i = begin; i < end; ++i ) + auto future = ForEachMT(&gThreadPool, 0, inputs.size(), [&inputs, &outputs](uint32_t workerIndex, uint32_t begin, uint32_t end) { + for(auto i = begin; i < end; ++i) { outputs[workerIndex] += inputs[i]; } @@ -96,15 +95,14 @@ int UtcDaliThreadPoolMultipleTasks(void) // check outputs int checksum2 = 0; - for( auto output : outputs ) + for(auto output : outputs) { checksum2 += output; } printf("sum: %d, sum2: %d\n", checksum, checksum2); - - DALI_TEST_EQUALS( checksum, checksum2, TEST_LOCATION ); + DALI_TEST_EQUALS(checksum, checksum2, TEST_LOCATION); END_TEST; } @@ -112,24 +110,24 @@ int UtcDaliThreadPoolMultipleTasks(void) int UtcDaliThreadPoolSingleTask(void) { // initialise global thread pool - if( !gThreadPool.GetWorkerCount() ) + if(!gThreadPool.GetWorkerCount()) { - gThreadPool.Initialize( 0u ); + gThreadPool.Initialize(0u); } // some long lasting task - int counter = 0; - auto task = [&counter]( int workerIndex ){ - for( int i = 0; i < 10; ++i ) + int counter = 0; + auto task = [&counter](int workerIndex) { + for(int i = 0; i < 10; ++i) { counter++; - usleep( 16 * 1000 ); + usleep(16 * 1000); } }; - auto future = gThreadPool.SubmitTask( 0, task ); + auto future = gThreadPool.SubmitTask(0, task); future->Wait(); - DALI_TEST_EQUALS( counter, 10, TEST_LOCATION ); + DALI_TEST_EQUALS(counter, 10, TEST_LOCATION); END_TEST; } @@ -137,45 +135,44 @@ int UtcDaliThreadPoolSingleTask(void) int UtcDaliThreadPoolSubmitTasksCopyArray(void) { // initialise global thread pool - if( !gThreadPool.GetWorkerCount() ) + if(!gThreadPool.GetWorkerCount()) { - gThreadPool.Initialize( 0u ); + gThreadPool.Initialize(0u); } - std::array dataSrc; - for( auto i = 0; i < decltype(i)(dataSrc.size()); ++i) + std::array dataSrc; + for(auto i = 0; i < decltype(i)(dataSrc.size()); ++i) { dataSrc[i] = (std::rand() % 0xff); } - std::array dataDst; + std::array dataDst; // each task copies 1kb od data std::vector tasks; - for( int i = 0; i < 1024; ++i ) + for(int i = 0; i < 1024; ++i) { - auto task = [&dataSrc, &dataDst, i ]( int workerIndex ) - { - for( int k = 0; k < 1024; ++k ) + auto task = [&dataSrc, &dataDst, i](int workerIndex) { + for(int k = 0; k < 1024; ++k) { - dataDst[i*1024+k] = dataSrc[i*1024+k]; + dataDst[i * 1024 + k] = dataSrc[i * 1024 + k]; } }; - tasks.push_back( task ); + tasks.push_back(task); } - DALI_TEST_EQUALS( 1024, tasks.size(), TEST_LOCATION ); + DALI_TEST_EQUALS(1024, tasks.size(), TEST_LOCATION); - gThreadPool.SubmitTasks( tasks ); + gThreadPool.SubmitTasks(tasks); // wait for pool to finish gThreadPool.Wait(); // compare arrays - for( auto i = 0; i < decltype(i)(dataSrc.size()); ++i ) + for(auto i = 0; i < decltype(i)(dataSrc.size()); ++i) { - DALI_TEST_EQUALS( dataSrc[i], dataDst[i], TEST_LOCATION ); - if( dataSrc[i] != dataDst[i] ) + DALI_TEST_EQUALS(dataSrc[i], dataDst[i], TEST_LOCATION); + if(dataSrc[i] != dataDst[i]) { break; } diff --git a/automated-tests/src/dali/utc-Dali-TouchEvent.cpp b/automated-tests/src/dali/utc-Dali-TouchEvent.cpp index 8d5b5a0..bd58584 100644 --- a/automated-tests/src/dali/utc-Dali-TouchEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchEvent.cpp @@ -15,12 +15,12 @@ * */ -#include +#include +#include +#include #include -#include -#include -#include +#include void utc_dali_touch_event_startup(void) { @@ -38,27 +38,27 @@ TouchPoint GenerateTouchPoint() { return TouchPoint(1, PointState::STARTED, 100.0f, 200.0f); } -} +} // namespace int UtcDaliTouchEventConstructorP(void) { TouchEvent touchEvent; - DALI_TEST_CHECK( !touchEvent ); + DALI_TEST_CHECK(!touchEvent); END_TEST; } int UtcDaliTouchEventCopyConstructorP(void) { TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint()); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); - TouchEvent touchEvent2( touchEvent ); - DALI_TEST_CHECK( touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION ); - DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + TouchEvent touchEvent2(touchEvent); + DALI_TEST_CHECK(touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION); + DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } @@ -66,14 +66,14 @@ int UtcDaliTouchEventCopyConstructorP(void) int UtcDaliTouchEventMoveConstructorP(void) { TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint()); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); - TouchEvent touchEvent2( std::move(touchEvent) ); - DALI_TEST_CHECK( !touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + TouchEvent touchEvent2(std::move(touchEvent)); + DALI_TEST_CHECK(!touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } @@ -81,18 +81,18 @@ int UtcDaliTouchEventMoveConstructorP(void) int UtcDaliTouchEventCopyAssignmentP(void) { TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint()); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); TouchEvent touchEvent2; - DALI_TEST_CHECK( !touchEvent2 ); + DALI_TEST_CHECK(!touchEvent2); touchEvent2 = touchEvent; - DALI_TEST_CHECK( touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION ); - DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION); + DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } @@ -100,17 +100,17 @@ int UtcDaliTouchEventCopyAssignmentP(void) int UtcDaliTouchEventMoveAssignmentP(void) { TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint()); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); TouchEvent touchEvent2; - DALI_TEST_CHECK( !touchEvent2 ); + DALI_TEST_CHECK(!touchEvent2); touchEvent2 = std::move(touchEvent); - DALI_TEST_CHECK( !touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_CHECK(!touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } @@ -119,21 +119,21 @@ int UtcDaliTouchEventCopyConstructorWithPointP(void) { Dali::Integration::Point point; - Vector2 touchPoint( 10.0, 20.0 ); - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) ); + Vector2 touchPoint(10.0, 20.0); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y)); TouchEvent touchEvent = Integration::NewTouchEvent(123u, point); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); - TouchEvent touchEvent2( touchEvent ); - DALI_TEST_CHECK( touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION ); - DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + TouchEvent touchEvent2(touchEvent); + DALI_TEST_CHECK(touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION); + DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } @@ -142,20 +142,20 @@ int UtcDaliTouchEventMoveConstructorWithPointP(void) { Dali::Integration::Point point; - Vector2 touchPoint( 10.0, 20.0 ); - point.SetDeviceId( 1 ); - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) ); + Vector2 touchPoint(10.0, 20.0); + point.SetDeviceId(1); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y)); TouchEvent touchEvent = Integration::NewTouchEvent(123u, point); - DALI_TEST_CHECK( touchEvent ); + DALI_TEST_CHECK(touchEvent); const auto refCount = touchEvent.GetBaseObject().ReferenceCount(); - TouchEvent touchEvent2( std::move(touchEvent) ); - DALI_TEST_CHECK( !touchEvent ); - DALI_TEST_CHECK( touchEvent2 ); - DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + TouchEvent touchEvent2(std::move(touchEvent)); + DALI_TEST_CHECK(!touchEvent); + DALI_TEST_CHECK(touchEvent2); + DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TouchEventCombiner.cpp b/automated-tests/src/dali/utc-Dali-TouchEventCombiner.cpp index 09fb6aa..1b6eb75 100644 --- a/automated-tests/src/dali/utc-Dali-TouchEventCombiner.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchEventCombiner.cpp @@ -15,29 +15,29 @@ * */ -#include - -#include -#include +#include +#include #include #include -#include -#include +#include +#include + +#include using namespace Dali; using namespace Dali::Integration; namespace { -Point GeneratePoint( int deviceId, PointState::Type state, float x, float y ) +Point GeneratePoint(int deviceId, PointState::Type state, float x, float y) { Point point; - point.SetDeviceId( deviceId ); - point.SetState( state ); - point.SetScreenPosition( Vector2( x, y ) ); + point.SetDeviceId(deviceId); + point.SetState(state); + point.SetScreenPosition(Vector2(x, y)); return point; } -} +} // namespace void utc_dali_touch_event_combiner_startup(void) { @@ -49,28 +49,27 @@ void utc_dali_touch_event_combiner_cleanup(void) test_return_value = TET_PASS; } - int UtcDaliTouchEventCombinerConstructors(void) { TouchEventCombiner combiner1; - DALI_TEST_EQUALS( combiner1.GetMinimumMotionTimeThreshold(), static_cast(1), TEST_LOCATION ); - DALI_TEST_EQUALS( combiner1.GetMinimumMotionDistanceThreshold(), Vector2( 1.0f, 1.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(combiner1.GetMinimumMotionTimeThreshold(), static_cast(1), TEST_LOCATION); + DALI_TEST_EQUALS(combiner1.GetMinimumMotionDistanceThreshold(), Vector2(1.0f, 1.0f), TEST_LOCATION); - TouchEventCombiner combiner2( 10, 20.0f, 31.0f ); - DALI_TEST_EQUALS( combiner2.GetMinimumMotionTimeThreshold(), static_cast(10), TEST_LOCATION ); - DALI_TEST_EQUALS( combiner2.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION ); + TouchEventCombiner combiner2(10, 20.0f, 31.0f); + DALI_TEST_EQUALS(combiner2.GetMinimumMotionTimeThreshold(), static_cast(10), TEST_LOCATION); + DALI_TEST_EQUALS(combiner2.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION); - TouchEventCombiner combiner3( 10, Vector2( 20.0f, 31.0f ) ); - DALI_TEST_EQUALS( combiner3.GetMinimumMotionTimeThreshold(), static_cast(10), TEST_LOCATION ); - DALI_TEST_EQUALS( combiner3.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION ); + TouchEventCombiner combiner3(10, Vector2(20.0f, 31.0f)); + DALI_TEST_EQUALS(combiner3.GetMinimumMotionTimeThreshold(), static_cast(10), TEST_LOCATION); + DALI_TEST_EQUALS(combiner3.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION); // Boundary Checks - TouchEventCombiner combiner4( 10, 0.0f, 0.0f ); - DALI_TEST_EQUALS( combiner4.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION ); + TouchEventCombiner combiner4(10, 0.0f, 0.0f); + DALI_TEST_EQUALS(combiner4.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION); - TouchEventCombiner combiner5( 10, Vector2( 0.0f, 0.0f ) ); - DALI_TEST_EQUALS( combiner5.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION ); + TouchEventCombiner combiner5(10, Vector2(0.0f, 0.0f)); + DALI_TEST_EQUALS(combiner5.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION); END_TEST; } @@ -78,46 +77,46 @@ int UtcDaliTouchEventCombinerConstructorsNegative(void) { try { - TouchEventCombiner combiner( 10, -20.0f, 31.0f ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + TouchEventCombiner combiner(10, -20.0f, 31.0f); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - TouchEventCombiner combiner( 10, 20.0f, -31.0f ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + TouchEventCombiner combiner(10, 20.0f, -31.0f); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - TouchEventCombiner combiner( 10, Vector2( -20.0f, 31.0f ) ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + TouchEventCombiner combiner(10, Vector2(-20.0f, 31.0f)); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - TouchEventCombiner combiner( 10, Vector2( 20.0f, -31.0f ) ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + TouchEventCombiner combiner(10, Vector2(20.0f, -31.0f)); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } END_TEST; } @@ -125,38 +124,38 @@ int UtcDaliTouchEventCombinerConstructorsNegative(void) int UtcDaliTouchEventCombinerSettersAndGetters(void) { TouchEventCombiner combiner; - unsigned long time( 10u ); - Vector2 distance( 40.0f, 30.0f ); + unsigned long time(10u); + Vector2 distance(40.0f, 30.0f); - DALI_TEST_CHECK( combiner.GetMinimumMotionTimeThreshold() != time ); - DALI_TEST_CHECK( combiner.GetMinimumMotionDistanceThreshold() != distance ); + DALI_TEST_CHECK(combiner.GetMinimumMotionTimeThreshold() != time); + DALI_TEST_CHECK(combiner.GetMinimumMotionDistanceThreshold() != distance); - combiner.SetMinimumMotionTimeThreshold( time ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION ); + combiner.SetMinimumMotionTimeThreshold(time); + DALI_TEST_EQUALS(combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION); - combiner.SetMinimumMotionDistanceThreshold( distance.x ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2( distance.x, distance.x ), TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(distance.x); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2(distance.x, distance.x), TEST_LOCATION); distance.x = 20.0f; distance.y = 50.0f; - combiner.SetMinimumMotionDistanceThreshold( distance.x, distance.y ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(distance.x, distance.y); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION); distance.x = 100.0f; distance.y = 20.0f; - combiner.SetMinimumMotionDistanceThreshold( distance ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(distance); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION); // Boundary Checks - combiner.SetMinimumMotionDistanceThreshold( 0.0f ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(0.0f); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION); - combiner.SetMinimumMotionDistanceThreshold( 0.0f, 0.0f ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(0.0f, 0.0f); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION); - combiner.SetMinimumMotionDistanceThreshold( Vector2::ZERO ); - DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION ); + combiner.SetMinimumMotionDistanceThreshold(Vector2::ZERO); + DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION); END_TEST; } @@ -166,57 +165,57 @@ int UtcDaliTouchEventCombinerSettersNegative(void) try { - combiner.SetMinimumMotionDistanceThreshold( -100.0f ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + combiner.SetMinimumMotionDistanceThreshold(-100.0f); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - combiner.SetMinimumMotionDistanceThreshold( -100.0f, 20.0f ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + combiner.SetMinimumMotionDistanceThreshold(-100.0f, 20.0f); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - combiner.SetMinimumMotionDistanceThreshold( 100.0f, -20.0f ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + combiner.SetMinimumMotionDistanceThreshold(100.0f, -20.0f); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - combiner.SetMinimumMotionDistanceThreshold( Vector2( -100.0f, 20.0f ) ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + combiner.SetMinimumMotionDistanceThreshold(Vector2(-100.0f, 20.0f)); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } try { - combiner.SetMinimumMotionDistanceThreshold( Vector2( 100.0f, -20.0f ) ); - tet_printf( "%s: Should have asserted\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + combiner.SetMinimumMotionDistanceThreshold(Vector2(100.0f, -20.0f)); + tet_printf("%s: Should have asserted\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - tet_result( TET_PASS ); + tet_result(TET_PASS); } END_TEST; } @@ -224,19 +223,19 @@ int UtcDaliTouchEventCombinerSettersNegative(void) int UtcDaliTouchEventCombinerSingleTouchNormal(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -245,13 +244,13 @@ int UtcDaliTouchEventCombinerSingleTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -260,22 +259,22 @@ int UtcDaliTouchEventCombinerSingleTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 101.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 101.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } // Motion event, but same time { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } time++; @@ -284,13 +283,13 @@ int UtcDaliTouchEventCombinerSingleTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -299,22 +298,22 @@ int UtcDaliTouchEventCombinerSingleTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } // Up event, no time diff, no movement { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -322,19 +321,19 @@ int UtcDaliTouchEventCombinerSingleTouchNormal(void) int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Motion event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -343,13 +342,13 @@ int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -357,19 +356,19 @@ int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void) int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Motion event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -378,13 +377,13 @@ int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -393,13 +392,13 @@ int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 103.0f, 103.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 103.0f, 103.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -408,17 +407,17 @@ int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 103.0f, 103.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 103.0f, 103.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -426,19 +425,19 @@ int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void) int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -447,9 +446,9 @@ int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -457,15 +456,15 @@ int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void) int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Up event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } time++; @@ -474,9 +473,9 @@ int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -484,19 +483,19 @@ int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void) int UtcDaliTouchEventCombinerSingleTouchTwoUps(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -505,13 +504,13 @@ int UtcDaliTouchEventCombinerSingleTouchTwoUps(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -520,9 +519,9 @@ int UtcDaliTouchEventCombinerSingleTouchTwoUps(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -530,19 +529,19 @@ int UtcDaliTouchEventCombinerSingleTouchTwoUps(void) int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -551,9 +550,9 @@ int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(2, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } time++; @@ -562,13 +561,13 @@ int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -576,19 +575,19 @@ int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void) int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -597,13 +596,13 @@ int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::MOTION, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(2, PointState::MOTION, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -612,13 +611,13 @@ int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -626,19 +625,19 @@ int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void) int UtcDaliTouchEventCombinerMultiTouchNormal(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // 1st point down { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -647,14 +646,14 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::DOWN, 200.0f, 200.0f ); + Integration::Point point = GeneratePoint(2, PointState::DOWN, 200.0f, 200.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -663,23 +662,23 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } // 2nd point motion, no time diff { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::MOTION, 200.0f, 200.0f ); + Integration::Point point = GeneratePoint(2, PointState::MOTION, 200.0f, 200.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } time++; @@ -688,14 +687,14 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::MOTION, 201.0f, 201.0f ); + Integration::Point point = GeneratePoint(2, PointState::MOTION, 201.0f, 201.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -704,14 +703,14 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 101.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 101.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -720,13 +719,13 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::MOTION, 202.0f, 202.0f ); + Integration::Point point = GeneratePoint(2, PointState::MOTION, 202.0f, 202.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -735,13 +734,13 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 2, PointState::UP, 202.0f, 202.0f ); + Integration::Point point = GeneratePoint(2, PointState::UP, 202.0f, 202.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } END_TEST; } @@ -749,29 +748,29 @@ int UtcDaliTouchEventCombinerMultiTouchNormal(void) int UtcDaliTouchEventCombinerSeveralPoints(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); - unsigned int const maximum( 200u ); + unsigned long time(0u); + unsigned int const maximum(200u); // Several downs - for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount ) + for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION); } // Several Ups - for ( unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount ) + for(unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( pointCount, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(pointCount, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION); } END_TEST; } @@ -779,19 +778,19 @@ int UtcDaliTouchEventCombinerSeveralPoints(void) int UtcDaliTouchEventCombinerReset(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -803,9 +802,9 @@ int UtcDaliTouchEventCombinerReset(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -813,19 +812,19 @@ int UtcDaliTouchEventCombinerReset(void) int UtcDaliTouchEventCombinerSingleTouchInterrupted(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Down event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION); } time++; @@ -834,13 +833,13 @@ int UtcDaliTouchEventCombinerSingleTouchInterrupted(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); } // Send up, should not be able to send as combiner has been reset. @@ -848,9 +847,9 @@ int UtcDaliTouchEventCombinerSingleTouchInterrupted(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -858,31 +857,31 @@ int UtcDaliTouchEventCombinerSingleTouchInterrupted(void) int UtcDaliTouchEventCombinerMultiTouchInterrupted(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); - unsigned int const maximum( 200u ); + unsigned long time(0u); + unsigned int const maximum(200u); // Several downs - for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount ) + for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION); } // Interrupted event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION); } // Send up, should not be able to send as combiner has been reset. @@ -890,9 +889,9 @@ int UtcDaliTouchEventCombinerMultiTouchInterrupted(void) { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } @@ -900,15 +899,15 @@ int UtcDaliTouchEventCombinerMultiTouchInterrupted(void) int UtcDaliTouchEventCombinerInvalidState(void) { TouchEventCombiner combiner; - unsigned long time( 0u ); + unsigned long time(0u); // Stationary event { Integration::TouchEvent touchEvent; Integration::HoverEvent hoverEvent; - Integration::Point point = GeneratePoint( 1, PointState::STATIONARY, 100.0f, 100.0f ); + Integration::Point point = GeneratePoint(1, PointState::STATIONARY, 100.0f, 100.0f); - DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION ); + DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION); } END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp index eeb635e..2aaf3e2 100644 --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp @@ -15,15 +15,15 @@ * */ -#include - -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include + +#include using namespace Dali; @@ -43,16 +43,16 @@ namespace { struct TestPoint { - int32_t deviceId{-1}; - PointState::Type state{PointState::FINISHED}; - Actor hitActor; - Vector2 local; - Vector2 screen; - float radius{0}; - Vector2 ellipseRadius; - float pressure{0}; - Degree angle; - Device::Class::Type deviceClass{Device::Class::NONE}; + int32_t deviceId{-1}; + PointState::Type state{PointState::FINISHED}; + Actor hitActor; + Vector2 local; + Vector2 screen; + float radius{0}; + Vector2 ellipseRadius; + float pressure{0}; + Degree angle; + Device::Class::Type deviceClass{Device::Class::NONE}; Device::Subclass::Type deviceSubclass{Device::Subclass::NONE}; TestPoint() = default; @@ -61,12 +61,11 @@ struct TestPoint const TestPoint TestPoint::ZERO; - // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() - : functorCalled( false ), + : functorCalled(false), receivedTouch(), touchedActor() { @@ -74,12 +73,12 @@ struct SignalData struct TestTouchEvent { - unsigned long time; + unsigned long time; std::vector points; const TestPoint& GetPoint(size_t i) { - if( i < points.size() ) + if(i < points.size()) { return points[i]; } @@ -101,9 +100,9 @@ struct SignalData touchedActor.Reset(); } - bool functorCalled; + bool functorCalled; TestTouchEvent receivedTouch; - Actor touchedActor; + Actor touchedActor; }; // Functor that sets the data when called @@ -114,33 +113,33 @@ struct TouchEventFunctor * @param[in] data Reference to the data to store callback information. * @param[in] returnValue What the functor should return. */ - TouchEventFunctor( SignalData& data, bool returnValue = true ) - : signalData( data ), - returnValue( returnValue ) + TouchEventFunctor(SignalData& data, bool returnValue = true) + : signalData(data), + returnValue(returnValue) { } - bool operator()( Actor actor, const TouchEvent& touch ) + bool operator()(Actor actor, const TouchEvent& touch) { signalData.functorCalled = true; - signalData.touchedActor = actor; + signalData.touchedActor = actor; signalData.receivedTouch.time = touch.GetTime(); signalData.receivedTouch.points.clear(); - for( size_t i=0; istate, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, point1->screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, point1->local, 0.1f, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + const TestPoint* point1 = &data.receivedTouch.GetPoint(0); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, point1->state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, point1->screen, TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, point1->local, 0.1f, TEST_LOCATION); data.Reset(); // Emit a motion signal screenCoordinates.x = screenCoordinates.y = 11.0f; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) ); - const TestPoint *point2 = &data.receivedTouch.GetPoint(0); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, point2->state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, point2->screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, point2->local, 0.1f, TEST_LOCATION ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates)); + const TestPoint* point2 = &data.receivedTouch.GetPoint(0); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, point2->state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, point2->screen, TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, point2->local, 0.1f, TEST_LOCATION); data.Reset(); // Emit an up signal screenCoordinates.x = screenCoordinates.y = 12.0f; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) ); - const TestPoint *point3 = &data.receivedTouch.GetPoint(0); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::UP, point3->state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, point3->screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, point3->local, 0.1f, TEST_LOCATION ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates)); + const TestPoint* point3 = &data.receivedTouch.GetPoint(0); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::UP, point3->state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, point3->screen, TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, point3->local, 0.1f, TEST_LOCATION); data.Reset(); // Emit a down signal where the actor is not present screenCoordinates.x = screenCoordinates.y = 200.0f; - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } - int UtcDaliTouchEventNormalProcessing02(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -351,33 +348,32 @@ int UtcDaliTouchEventNormalProcessing02(void) application.Render(); // Connect to actor's touched signal - HandleData handleData; - TouchEventHandleFunctor functor( handleData ); - actor.TouchedSignal().Connect( &application, functor ); + HandleData handleData; + TouchEventHandleFunctor functor(handleData); + actor.TouchedSignal().Connect(&application, functor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( true, handleData.signalReceived, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, handleData.receivedTouchHandle.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, handleData.receivedTouchHandle.GetState(0), TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, handleData.receivedTouchHandle.GetScreenPosition(0), TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, handleData.receivedTouchHandle.GetLocalPosition(0), 0.1f, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(true, handleData.signalReceived, TEST_LOCATION); + DALI_TEST_EQUALS(1u, handleData.receivedTouchHandle.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, handleData.receivedTouchHandle.GetState(0), TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, handleData.receivedTouchHandle.GetScreenPosition(0), TEST_LOCATION); + DALI_TEST_EQUALS(localCoordinates, handleData.receivedTouchHandle.GetLocalPosition(0), 0.1f, TEST_LOCATION); END_TEST; } - int UtcDaliTouchEventAPINegative(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -385,39 +381,38 @@ int UtcDaliTouchEventAPINegative(void) application.Render(); // Connect to actor's touched signal - OutOfBoundsData data; - OutOfBoundsFunctor functor( data, true ); - actor.TouchedSignal().Connect( &application, functor ); + OutOfBoundsData data; + OutOfBoundsFunctor functor(data, true); + actor.TouchedSignal().Connect(&application, functor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( -1, data.point.deviceId, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::FINISHED, data.point.state, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.point.screen, TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2::ZERO, data.point.local, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( ! data.point.hitActor ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(-1, data.point.deviceId, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::FINISHED, data.point.state, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.point.screen, TEST_LOCATION); + DALI_TEST_EQUALS(Vector2::ZERO, data.point.local, 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(!data.point.hitActor); END_TEST; } - int UtcDaliTouchEventOutsideCameraNearFarPlanes(void) { TestApplication application; - Integration::Scene scene = application.GetScene(); - Vector2 sceneSize = scene.GetSize(); + Integration::Scene scene = application.GetScene(); + Vector2 sceneSize = scene.GetSize(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER); - actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); scene.Add(actor); // Render and notify @@ -425,70 +420,70 @@ int UtcDaliTouchEventOutsideCameraNearFarPlanes(void) application.Render(); // Get the camera's near and far planes - RenderTaskList taskList = scene.GetRenderTaskList(); - Dali::RenderTask task = taskList.GetTask(0); - CameraActor camera = task.GetCameraActor(); - float nearPlane = camera.GetNearClippingPlane(); - float farPlane = camera.GetFarClippingPlane(); + RenderTaskList taskList = scene.GetRenderTaskList(); + Dali::RenderTask task = taskList.GetTask(0); + CameraActor camera = task.GetCameraActor(); + float nearPlane = camera.GetNearClippingPlane(); + float farPlane = camera.GetFarClippingPlane(); // Calculate the current distance of the actor from the camera float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f); - float distance = (sceneSize.y * 0.5f) / tanHalfFov; + float distance = (sceneSize.y * 0.5f) / tanHalfFov; // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); - Vector2 screenCoordinates( sceneSize.x * 0.5f, sceneSize.y * 0.5f ); + Vector2 screenCoordinates(sceneSize.x * 0.5f, sceneSize.y * 0.5f); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal where actor is just at the camera's near plane - actor.SetProperty( Actor::Property::POSITION_Z, distance - nearPlane); + actor.SetProperty(Actor::Property::POSITION_Z, distance - nearPlane); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal where actor is closer than the camera's near plane - actor.SetProperty( Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f); + actor.SetProperty(Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal where actor is just at the camera's far plane - actor.SetProperty( Actor::Property::POSITION_Z, distance - farPlane); + actor.SetProperty(Actor::Property::POSITION_Z, distance - farPlane); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal where actor is further than the camera's far plane - actor.SetProperty( Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f); + actor.SetProperty(Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f); // Render and notify application.SendNotification(); application.Render(); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@ -501,12 +496,12 @@ int UtcDaliTouchEventEmitEmpty(void) { // Emit an empty TouchEvent Integration::TouchEvent event; - application.ProcessEvent( event ); - tet_result( TET_FAIL ); + application.ProcessEvent(event); + tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_ASSERT( e, "!event.points.empty()", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "!event.points.empty()", TEST_LOCATION); } END_TEST; } @@ -516,8 +511,8 @@ int UtcDaliTouchEventInterrupted(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -525,36 +520,36 @@ int UtcDaliTouchEventInterrupted(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not. - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // Emit another interrupted signal, our signal handler should not be called. - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } int UtcDaliTouchEventParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -562,99 +557,99 @@ int UtcDaliTouchEventParentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false); + actor.TouchedSignal().Connect(&application, functor); // Connect to root actor's touched signal - SignalData rootData; - TouchEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.TouchedSignal().Connect( &application, rootFunctor ); + SignalData rootData; + TouchEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.TouchedSignal().Connect(&application, rootFunctor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 actorCoordinates, rootCoordinates; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit a motion signal screenCoordinates.x = screenCoordinates.y = 11.0f; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit an up signal screenCoordinates.x = screenCoordinates.y = 12.0f; - actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::UP, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::UP, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::UP, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::UP, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit a down signal where the actor is not present, will hit the root actor though screenCoordinates.x = screenCoordinates.y = 200.0f; - rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor ); + rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION); + DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor); END_TEST; } int UtcDaliTouchEventInterruptedParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -662,48 +657,48 @@ int UtcDaliTouchEventInterruptedParentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false); + actor.TouchedSignal().Connect(&application, functor); // Connect to root actor's touched signal - SignalData rootData; - TouchEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.TouchedSignal().Connect( &application, rootFunctor ); + SignalData rootData; + TouchEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.TouchedSignal().Connect(&application, rootFunctor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit an interrupted signal - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit another down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); rootData.Reset(); // Remove actor from scene - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); data.Reset(); rootData.Reset(); @@ -712,18 +707,18 @@ int UtcDaliTouchEventInterruptedParentConsumer(void) application.Render(); // Emit an interrupted signal, only root actor's signal should be called. - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit another interrupted state, none of the signal's should be called. - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION); END_TEST; } @@ -732,8 +727,8 @@ int UtcDaliTouchEventLeave(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -741,42 +736,42 @@ int UtcDaliTouchEventLeave(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Set actor to require leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // Emit a motion signal outside of actor, should be signalled with a Leave - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // Another motion outside of actor, no signalling - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(201.0f, 201.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Another motion event inside actor, signalled with motion - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // We do not want to listen to leave events anymore - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false); // Another motion event outside of actor, no signalling - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@ -784,11 +779,11 @@ int UtcDaliTouchEventLeave(void) int UtcDaliTouchEventLeaveParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -796,70 +791,70 @@ int UtcDaliTouchEventLeaveParentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false); + actor.TouchedSignal().Connect(&application, functor); // Connect to root actor's touched signal - SignalData rootData; - TouchEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.TouchedSignal().Connect( &application, rootFunctor ); + SignalData rootData; + TouchEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.TouchedSignal().Connect(&application, rootFunctor); // Set actor to require leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); - rootActor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); + rootActor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Emit a motion signal outside of actor, should be signalled with a Leave - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Another motion outside of actor, only rootActor signalled - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(201.0f, 201.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // Another motion event inside actor, signalled with motion - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); // We do not want to listen to leave events of actor anymore - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false); // Another motion event outside of root actor, only root signalled - Vector2 sceneSize( application.GetScene().GetSize() ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( sceneSize.width + 10.0f, sceneSize.height + 10.0f )) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION ); + Vector2 sceneSize(application.GetScene().GetSize()); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(sceneSize.width + 10.0f, sceneSize.height + 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION); END_TEST; } @@ -868,8 +863,8 @@ int UtcDaliTouchEventActorBecomesInsensitive(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -877,23 +872,23 @@ int UtcDaliTouchEventActorBecomesInsensitive(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); // Change actor to insensitive - actor.SetProperty( Actor::Property::SENSITIVE, false ); + actor.SetProperty(Actor::Property::SENSITIVE, false); // Emit a motion signal, signalled with an interrupted - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); END_TEST; } @@ -901,11 +896,11 @@ int UtcDaliTouchEventActorBecomesInsensitive(void) int UtcDaliTouchEventActorBecomesInsensitiveParentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -913,23 +908,23 @@ int UtcDaliTouchEventActorBecomesInsensitiveParentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false); + actor.TouchedSignal().Connect(&application, functor); // Connect to root actor's touched signal - SignalData rootData; - TouchEventFunctor rootFunctor( rootData ); // Consumes signal - rootActor.TouchedSignal().Connect( &application, rootFunctor ); + SignalData rootData; + TouchEventFunctor rootFunctor(rootData); // Consumes signal + rootActor.TouchedSignal().Connect(&application, rootFunctor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); data.Reset(); rootData.Reset(); @@ -938,295 +933,295 @@ int UtcDaliTouchEventActorBecomesInsensitiveParentConsumer(void) application.Render(); // Make root actor insensitive - rootActor.SetProperty( Actor::Property::SENSITIVE, false ); + rootActor.SetProperty(Actor::Property::SENSITIVE, false); // Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor) - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION); END_TEST; } int UtcDaliTouchEventMultipleLayers(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); + SignalData data; + TouchEventFunctor functor(data); - Layer layer1 ( Layer::New() ); - layer1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer1 ); + Layer layer1(Layer::New()); + layer1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer1); - Actor actor1 ( Actor::New() ); - actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - actor1.SetProperty( Actor::Property::POSITION_Z, 1.0f ); // Should hit actor1 in this layer - layer1.Add( actor1 ); + Actor actor1(Actor::New()); + actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + actor1.SetProperty(Actor::Property::POSITION_Z, 1.0f); // Should hit actor1 in this layer + layer1.Add(actor1); // Render and notify application.SendNotification(); application.Render(); // Connect to layer1 and actor1 - layer1.TouchedSignal().Connect( &application, functor ); - actor1.TouchedSignal().Connect( &application, functor ); + layer1.TouchedSignal().Connect(&application, functor); + actor1.TouchedSignal().Connect(&application, functor); // Hit in hittable area, actor1 should be hit - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.touchedActor == actor1 ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.touchedActor == actor1); data.Reset(); // Make layer1 insensitive, nothing should be hit - layer1.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + layer1.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Make layer1 sensitive again, again actor1 will be hit - layer1.SetProperty( Actor::Property::SENSITIVE, true ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.touchedActor == actor1 ); + layer1.SetProperty(Actor::Property::SENSITIVE, true); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.touchedActor == actor1); data.Reset(); // Make rootActor insensitive, nothing should be hit - rootActor.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + rootActor.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Make rootActor sensitive - rootActor.SetProperty( Actor::Property::SENSITIVE, true ); + rootActor.SetProperty(Actor::Property::SENSITIVE, true); // Add another layer - Layer layer2 ( Layer::New() ); - layer2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - layer2.SetProperty( Actor::Property::POSITION_Z, 10.0f ); // Should hit layer2 in this layer rather than actor2 - application.GetScene().Add( layer2 ); + Layer layer2(Layer::New()); + layer2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer2.SetProperty(Actor::Property::POSITION_Z, 10.0f); // Should hit layer2 in this layer rather than actor2 + application.GetScene().Add(layer2); - Actor actor2 ( Actor::New() ); - actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - layer2.Add( actor2 ); + Actor actor2(Actor::New()); + actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + layer2.Add(actor2); // Render and notify application.SendNotification(); application.Render(); // Connect to layer2 and actor2 - layer2.TouchedSignal().Connect( &application, functor ); - actor2.TouchedSignal().Connect( &application, functor ); + layer2.TouchedSignal().Connect(&application, functor); + actor2.TouchedSignal().Connect(&application, functor); // Emit an event, should hit layer2 - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack! data.Reset(); // Make layer2 insensitive, should hit actor1 - layer2.SetProperty( Actor::Property::SENSITIVE, false ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.touchedActor == actor1 ); + layer2.SetProperty(Actor::Property::SENSITIVE, false); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.touchedActor == actor1); data.Reset(); // Make layer2 sensitive again, should hit layer2 - layer2.SetProperty( Actor::Property::SENSITIVE, true ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + layer2.SetProperty(Actor::Property::SENSITIVE, true); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack! data.Reset(); // Make layer2 invisible, render and notify - layer2.SetProperty( Actor::Property::VISIBLE, false ); + layer2.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); // Should hit actor1 - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( data.touchedActor == actor1 ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(data.touchedActor == actor1); data.Reset(); // Make rootActor invisible, render and notify - rootActor.SetProperty( Actor::Property::VISIBLE, false ); + rootActor.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(); // Should not hit anything - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliTouchEventMultipleRenderTasks(void) { - TestApplication application; - Integration::Scene scene ( application.GetScene() ); - Vector2 sceneSize ( scene.GetSize() ); + TestApplication application; + Integration::Scene scene(application.GetScene()); + Vector2 sceneSize(scene.GetSize()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); scene.Add(actor); // Create render task - Viewport viewport( sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f ); - RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() ); - renderTask.SetViewport( viewport ); - renderTask.SetInputEnabled( true ); + Viewport viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f); + RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask()); + renderTask.SetViewport(viewport); + renderTask.SetInputEnabled(true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Ensure renderTask actor can be hit too. - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Disable input on renderTask, should not be hittable - renderTask.SetInputEnabled( false ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + renderTask.SetInputEnabled(false); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliTouchEventMultipleRenderTasksWithChildLayer(void) { - TestApplication application; - Integration::Scene scene ( application.GetScene() ); - Vector2 sceneSize ( scene.GetSize() ); + TestApplication application; + Integration::Scene scene(application.GetScene()); + Vector2 sceneSize(scene.GetSize()); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); scene.Add(actor); Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); actor.Add(layer); // Create render task - Viewport viewport( sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f ); - RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() ); - renderTask.SetViewport( viewport ); - renderTask.SetInputEnabled( true ); - renderTask.SetSourceActor( actor ); + Viewport viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f); + RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask()); + renderTask.SetViewport(viewport); + renderTask.SetInputEnabled(true); + renderTask.SetSourceActor(actor); // Render and notify application.SendNotification(); application.Render(); // Connect to layer's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); - layer.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); + layer.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Ensure renderTask actor can be hit too. - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Disable input on renderTask, should not be hittable - renderTask.SetInputEnabled( false ); - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + renderTask.SetInputEnabled(false); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliTouchEventOffscreenRenderTasks(void) { - TestApplication application; - Integration::Scene scene ( application.GetScene() ); - Vector2 sceneSize ( scene.GetSize() ); + TestApplication application; + Integration::Scene scene(application.GetScene()); + Vector2 sceneSize(scene.GetSize()); // FrameBufferImage for offscreen RenderTask FrameBuffer frameBuffer = FrameBuffer::New(sceneSize.width, sceneSize.height); // Create a renderable actor to display the FrameBufferImage Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture()); - renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); - renderableActor.SetProperty( Actor::Property::SIZE, Vector2( sceneSize.x, sceneSize.y ) ); - renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME - scene.Add( renderableActor ); + renderableActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + renderableActor.SetProperty(Actor::Property::SIZE, Vector2(sceneSize.x, sceneSize.y)); + renderableActor.ScaleBy(Vector3(1.0f, -1.0f, 1.0f)); // FIXME + scene.Add(renderableActor); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - scene.Add( actor ); - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + scene.Add(actor); + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); // Ensure framebuffer connects - scene.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION ); + scene.GetRenderTaskList().GetTask(0u).SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION); // Create a RenderTask RenderTask renderTask = scene.GetRenderTaskList().CreateTask(); - renderTask.SetSourceActor( actor ); + renderTask.SetSourceActor(actor); renderTask.SetFrameBuffer(frameBuffer); - renderTask.SetInputEnabled( true ); + renderTask.SetInputEnabled(true); // Create another RenderTask - RenderTask renderTask2( scene.GetRenderTaskList().CreateTask() ); - renderTask2.SetInputEnabled( true ); + RenderTask renderTask2(scene.GetRenderTaskList().CreateTask()); + renderTask2.SetInputEnabled(true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } int UtcDaliTouchEventMultipleRenderableActors(void) { - TestApplication application; - Integration::Scene scene ( application.GetScene() ); - Vector2 sceneSize ( scene.GetSize() ); + TestApplication application; + Integration::Scene scene(application.GetScene()); + Vector2 sceneSize(scene.GetSize()); Actor parent = CreateRenderableActor(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); scene.Add(parent); Actor actor = CreateRenderableActor(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify @@ -1234,15 +1229,15 @@ int UtcDaliTouchEventMultipleRenderableActors(void) application.Render(); // Connect to layer's touched signal - SignalData data; - TouchEventFunctor functor( data ); - parent.TouchedSignal().Connect( &application, functor ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + parent.TouchedSignal().Connect(&application, functor); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.touchedActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.touchedActor); END_TEST; } @@ -1251,8 +1246,8 @@ int UtcDaliTouchEventActorRemovedInSignal(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1260,16 +1255,16 @@ int UtcDaliTouchEventActorRemovedInSignal(void) application.Render(); // Connect to actor's touched signal - SignalData data; - RemoveActorFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + RemoveActorFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Register for leave events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Re-add, render and notify @@ -1278,13 +1273,13 @@ int UtcDaliTouchEventActorRemovedInSignal(void) application.Render(); // Emit another signal outside of actor's area, should not get anything as the scene has changed. - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Render and notify @@ -1292,8 +1287,8 @@ int UtcDaliTouchEventActorRemovedInSignal(void) application.Render(); // Emit another signal outside of actor's area, should not get anything as the scene has changed. - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Re-add actor back to scene, render and notify @@ -1302,16 +1297,16 @@ int UtcDaliTouchEventActorRemovedInSignal(void) application.Render(); // Emit another down event - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Completely delete the actor actor.Reset(); // Emit event, should not crash and should not receive an event. - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1320,8 +1315,8 @@ int UtcDaliTouchEventActorSignalNotConsumed(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1329,13 +1324,13 @@ int UtcDaliTouchEventActorSignalNotConsumed(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1344,8 +1339,8 @@ int UtcDaliTouchEventActorRemovedFromScene(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1353,17 +1348,17 @@ int UtcDaliTouchEventActorRemovedFromScene(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Remove actor from scene - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); data.Reset(); // Render and notify @@ -1371,8 +1366,8 @@ int UtcDaliTouchEventActorRemovedFromScene(void) application.Render(); // Emit a move at the same point, we should not be signalled. - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } @@ -1382,8 +1377,8 @@ int UtcDaliTouchEventLayerConsumesTouch(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1391,15 +1386,15 @@ int UtcDaliTouchEventLayerConsumesTouch(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Add a layer to overlap the actor Layer layer = Layer::New(); - layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); - application.GetScene().Add( layer ); + layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(layer); layer.RaiseToTop(); // Render and notify @@ -1407,21 +1402,21 @@ int UtcDaliTouchEventLayerConsumesTouch(void) application.Render(); // Emit a few touch signals - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Set layer to consume all touch - layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); + layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true); // Render and notify application.SendNotification(); application.Render(); // Emit the same signals again, should not receive - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f))); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); @@ -1430,45 +1425,45 @@ int UtcDaliTouchEventLayerConsumesTouch(void) int UtcDaliTouchEventLeaveActorReadded(void) { - TestApplication application; + TestApplication application; Integration::Scene scene = application.GetScene(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); scene.Add(actor); // Set actor to receive touch-events - actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true ); + actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down and motion - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 11.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(11.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Remove actor from scene and add again - scene.Remove( actor ); - scene.Add( actor ); + scene.Remove(actor); + scene.Add(actor); // Emit a motion within the actor's bounds - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 12.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(12.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit a motion outside the actor's bounds - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); END_TEST; @@ -1476,51 +1471,51 @@ int UtcDaliTouchEventLeaveActorReadded(void) int UtcDaliTouchEventClippedActor(void) { - TestApplication application; + TestApplication application; Integration::Scene scene = application.GetScene(); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - scene.Add( actor ); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + scene.Add(actor); Actor clippingActor = Actor::New(); - clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); - scene.Add( clippingActor ); + clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN); + scene.Add(clippingActor); // Add a child to the clipped region. Actor clippingChild = Actor::New(); - clippingChild.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); - clippingChild.SetProperty( Actor::Property::POSITION, Vector2( 25.0f, 25.0f )); - clippingChild.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - clippingActor.Add( clippingChild ); + clippingChild.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f)); + clippingChild.SetProperty(Actor::Property::POSITION, Vector2(25.0f, 25.0f)); + clippingChild.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + clippingActor.Add(clippingChild); // Render and notify. application.SendNotification(); application.Render(); // Connect to actor's touch signal. - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit an event within clipped area - no hit. - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Emit an event outside the clipped area but within the actor area, we should have a hit. - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 60.0f, 60.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(60.0f, 60.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); - clippingChild.TouchedSignal().Connect( &application, functor ); + clippingChild.TouchedSignal().Connect(&application, functor); // Emit an event inside part of the child which is within the clipped area, we should have a hit. - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 30.0f, 30.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(30.0f, 30.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; @@ -1531,8 +1526,8 @@ int UtcDaliTouchEventActorUnparented(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1540,15 +1535,15 @@ int UtcDaliTouchEventActorUnparented(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); data.Reset(); // Render and notify @@ -1559,8 +1554,8 @@ int UtcDaliTouchEventActorUnparented(void) actor.Unparent(); // Should receive an interrupted event - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); END_TEST; } @@ -1569,13 +1564,13 @@ int UtcDaliTouchEventParentRemovedFromScene(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify @@ -1583,15 +1578,15 @@ int UtcDaliTouchEventParentRemovedFromScene(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); data.Reset(); // Render and notify @@ -1602,8 +1597,8 @@ int UtcDaliTouchEventParentRemovedFromScene(void) parent.Unparent(); // Should receive an interrupted event - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); END_TEST; } @@ -1612,13 +1607,13 @@ int UtcDaliTouchEventActorRemovedFromSceneDifferentConsumer(void) TestApplication application; Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify @@ -1626,25 +1621,25 @@ int UtcDaliTouchEventActorRemovedFromSceneDifferentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false /* Do not consume */ ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false /* Do not consume */); + actor.TouchedSignal().Connect(&application, functor); // Connect to parent's touched signal - SignalData parentData; - TouchEventFunctor parentFunctor( parentData ); - parent.TouchedSignal().Connect( &application, parentFunctor ); + SignalData parentData; + TouchEventFunctor parentFunctor(parentData); + parent.TouchedSignal().Connect(&application, parentFunctor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == data.touchedActor ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == parentData.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( parent == parentData.touchedActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == data.touchedActor); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(parent == parentData.touchedActor); data.Reset(); parentData.Reset(); @@ -1656,10 +1651,10 @@ int UtcDaliTouchEventActorRemovedFromSceneDifferentConsumer(void) actor.Unparent(); // Should receive an interrupted event for both actor & parent - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); parentData.Reset(); @@ -1671,27 +1666,27 @@ int UtcDaliTouchEventActorRemovedFromSceneDifferentConsumer(void) application.Render(); // Emit a motion signal - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); data.Reset(); parentData.Reset(); // Parent is now consumer, connect again to the touched signal of the actor so that it becomes the consumer - SignalData secondData; - TouchEventFunctor secondFunctor( secondData /* Consume */ ); - actor.TouchedSignal().Connect( &application, secondFunctor ); + SignalData secondData; + TouchEventFunctor secondFunctor(secondData /* Consume */); + actor.TouchedSignal().Connect(&application, secondFunctor); // Unparent the actor actor.Unparent(); // Should receive an interrupted event for both actor functors & the parent as well as it was last consumer - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, secondData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, secondData.receivedTouch.points[0].state, TEST_LOCATION ); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, secondData.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); parentData.Reset(); secondData.Reset(); @@ -1702,16 +1697,16 @@ int UtcDaliTouchEventActorRemovedFromSceneDifferentConsumer(void) int UtcDaliTouchEventInterruptedDifferentConsumer(void) { TestApplication application; - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); Actor parent = Actor::New(); - parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(parent); Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify @@ -1719,51 +1714,51 @@ int UtcDaliTouchEventInterruptedDifferentConsumer(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data, false /* Do not consume */ ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data, false /* Do not consume */); + actor.TouchedSignal().Connect(&application, functor); // Connect to parent's touched signal - SignalData parentData; - TouchEventFunctor parentFunctor( parentData, false /* Do not consume */ ); - parent.TouchedSignal().Connect( &application, parentFunctor ); + SignalData parentData; + TouchEventFunctor parentFunctor(parentData, false /* Do not consume */); + parent.TouchedSignal().Connect(&application, parentFunctor); // Connect to root's touched signal and consume - SignalData rootData; - TouchEventFunctor rootFunctor( rootData ); - rootActor.TouchedSignal().Connect( &application, rootFunctor ); + SignalData rootData; + TouchEventFunctor rootFunctor(rootData); + rootActor.TouchedSignal().Connect(&application, rootFunctor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( actor == data.touchedActor ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == parentData.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( parent == parentData.touchedActor ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor ); - DALI_TEST_CHECK( rootActor == rootData.touchedActor ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == data.touchedActor); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(parent == parentData.touchedActor); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(rootActor == rootData.touchedActor); data.Reset(); parentData.Reset(); rootData.Reset(); // Root is now consumer, connect to the touched signal of the parent so that it becomes the consumer - SignalData secondData; - TouchEventFunctor secondFunctor( secondData /* Consume */ ); - parent.TouchedSignal().Connect( &application, secondFunctor ); + SignalData secondData; + TouchEventFunctor secondFunctor(secondData /* Consume */); + parent.TouchedSignal().Connect(&application, secondFunctor); // Emit an interrupted signal, all three should STILL be called - application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION); data.Reset(); parentData.Reset(); rootData.Reset(); @@ -1776,8 +1771,8 @@ int UtcDaliTouchEventGetRadius(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1785,19 +1780,19 @@ int UtcDaliTouchEventGetRadius(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with an angle - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetRadius( 100.0f ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION ); - DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION ); - DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetRadius(100.0f); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION); + DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION); + DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION); END_TEST; } @@ -1807,8 +1802,8 @@ int UtcDaliTouchEventGetEllipseRadius(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1816,19 +1811,19 @@ int UtcDaliTouchEventGetEllipseRadius(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with an angle - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetRadius( 100.0f, Vector2( 20.0f, 10.0f ) ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION ); - DALI_TEST_EQUALS( 20.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetRadius(100.0f, Vector2(20.0f, 10.0f)); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION); + DALI_TEST_EQUALS(20.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION); END_TEST; } @@ -1838,8 +1833,8 @@ int UtcDaliTouchEventGetAngle(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1847,17 +1842,17 @@ int UtcDaliTouchEventGetAngle(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with an angle - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetAngle( Degree( 90.0f ) ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( Degree( 90.0f ), data.receivedTouch.points[0].angle, TEST_LOCATION ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetAngle(Degree(90.0f)); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(Degree(90.0f), data.receivedTouch.points[0].angle, TEST_LOCATION); END_TEST; } @@ -1867,8 +1862,8 @@ int UtcDaliTouchEventGetPressure(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1876,17 +1871,17 @@ int UtcDaliTouchEventGetPressure(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with an angle - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetPressure( 10.0f ); - application.ProcessEvent( touchEvent ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( 10.0f, data.receivedTouch.points[0].pressure, TEST_LOCATION ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetPressure(10.0f); + application.ProcessEvent(touchEvent); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].pressure, TEST_LOCATION); END_TEST; } @@ -1896,8 +1891,8 @@ int UtcDaliTouchEventUsage(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1905,15 +1900,13 @@ int UtcDaliTouchEventUsage(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); - + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with an angle - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); END_TEST; } @@ -1923,8 +1916,8 @@ int UtcDaliTouchEventGetDeviceAPINegative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1932,20 +1925,20 @@ int UtcDaliTouchEventGetDeviceAPINegative(void) application.Render(); // Connect to actor's touched signal - HandleData handleData; - TouchEventHandleFunctor functor( handleData ); - actor.TouchedSignal().Connect( &application, functor ); + HandleData handleData; + TouchEventHandleFunctor functor(handleData); + actor.TouchedSignal().Connect(&application, functor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Vector2 localCoordinates; - actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y ); + actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) ); + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates)); TouchEvent data = handleData.receivedTouchHandle; - DALI_TEST_EQUALS( data.GetDeviceClass( -1 ), Device::Class::NONE, TEST_LOCATION ); - DALI_TEST_EQUALS( data.GetDeviceSubclass( -1 ), Device::Subclass::NONE, TEST_LOCATION ); + DALI_TEST_EQUALS(data.GetDeviceClass(-1), Device::Class::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(data.GetDeviceSubclass(-1), Device::Subclass::NONE, TEST_LOCATION); END_TEST; } @@ -1954,8 +1947,8 @@ int UtcDaliTouchEventGetMouseButtonPositive(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1963,17 +1956,17 @@ int UtcDaliTouchEventGetMouseButtonPositive(void) application.Render(); // Connect to actor's touched signal - HandleData handleData; - TouchEventHandleFunctor functor( handleData ); - actor.TouchedSignal().Connect( &application, functor ); + HandleData handleData; + TouchEventHandleFunctor functor(handleData); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with MouseButton - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetMouseButton( static_cast< MouseButton::Type >( 3 ) ); - application.ProcessEvent( touchEvent ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetMouseButton(static_cast(3)); + application.ProcessEvent(touchEvent); TouchEvent data = handleData.receivedTouchHandle; - DALI_TEST_EQUALS( data.GetMouseButton( 0 ), MouseButton::SECONDARY, TEST_LOCATION ); + DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::SECONDARY, TEST_LOCATION); END_TEST; } @@ -1983,8 +1976,8 @@ int UtcDaliTouchEventGetMouseButtonNagative(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -1992,18 +1985,18 @@ int UtcDaliTouchEventGetMouseButtonNagative(void) application.Render(); // Connect to actor's touched signal - HandleData handleData; - TouchEventHandleFunctor functor( handleData ); - actor.TouchedSignal().Connect( &application, functor ); + HandleData handleData; + TouchEventHandleFunctor functor(handleData); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal with MouseButton - Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ); - touchEvent.points[ 0 ].SetMouseButton( static_cast< MouseButton::Type >( 2 ) ); - application.ProcessEvent( touchEvent ); + Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)); + touchEvent.points[0].SetMouseButton(static_cast(2)); + application.ProcessEvent(touchEvent); TouchEvent data = handleData.receivedTouchHandle; - DALI_TEST_EQUALS( data.GetMouseButton( 0 ), MouseButton::TERTIARY, TEST_LOCATION ); - DALI_TEST_EQUALS( data.GetMouseButton( 3 ), MouseButton::INVALID, TEST_LOCATION ); + DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::TERTIARY, TEST_LOCATION); + DALI_TEST_EQUALS(data.GetMouseButton(3), MouseButton::INVALID, TEST_LOCATION); END_TEST; } @@ -2013,8 +2006,8 @@ int UtcDaliTouchEventCapturePropertySet(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -2022,57 +2015,56 @@ int UtcDaliTouchEventCapturePropertySet(void) application.Render(); // Connect to actor's touched signal - SignalData data; - TouchEventFunctor functor( data ); - actor.TouchedSignal().Connect( &application, functor ); + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Now motion outside of actor, we should not receive the event - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 110.0f, 110.0f ) ) ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f))); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); // Up event, should receive an interrupted - application.ProcessEvent( GenerateSingleTouch( PointState::FINISHED, Vector2( 110.0f, 110.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouch.GetPoint(0).state, PointState::INTERRUPTED, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::INTERRUPTED, TEST_LOCATION); // Now set the capture property - actor.SetProperty( DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true); + actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true); // Emit a down signal - application.ProcessEvent( GenerateSingleTouch( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Now motion outside of actor, we now SHOULD receive the event - application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 110.0f, 110.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); data.Reset(); // Up event, we should receive it again, but as ended rather than interrupted - application.ProcessEvent( GenerateSingleTouch( PointState::FINISHED, Vector2( 110.0f, 110.0f ) ) ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION ); + application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f))); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION); END_TEST; } int UtcDaliTouchEventIntegNewTouchEvent(void) { - uint32_t timestamp = 92858u; - TouchPoint tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f); + uint32_t timestamp = 92858u; + TouchPoint tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f); Dali::TouchEvent touchEvent = Integration::NewTouchEvent(timestamp, tp); DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION ); - DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION ); - DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION ); - + DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION); + DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index 5388fe9..c971314 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -15,34 +15,34 @@ * */ -#include -#include -#include -#include #include -#include -#include #include +#include +#include +#include +#include -using namespace Dali; +#include +#include +using namespace Dali; namespace { - // Stores data that is populated in the callback and will be read by the Test cases struct SignalData { SignalData() - : functorCalled( false ), - voidFunctorCalled( false ), - receivedGesture( ), + : functorCalled(false), + voidFunctorCalled(false), + receivedGesture(), pressedActor() - {} + { + } void Reset() { - functorCalled = false; + functorCalled = false; voidFunctorCalled = false; receivedGesture.Reset(); @@ -50,22 +50,25 @@ struct SignalData pressedActor.Reset(); } - bool functorCalled; - bool voidFunctorCalled; + bool functorCalled; + bool voidFunctorCalled; LongPressGesture receivedGesture; - Actor pressedActor; + Actor pressedActor; }; // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + GestureReceivedFunctor(SignalData& data) + : signalData(data) + { + } void operator()(Actor actor, LongPressGesture longPress) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedGesture = longPress; - signalData.pressedActor = actor; + signalData.pressedActor = actor; } void operator()() @@ -80,37 +83,35 @@ struct GestureReceivedFunctor // Create function as Init function called // static bool CreateCustomInitCalled = false; -BaseHandle CreateCustomInit(void) +BaseHandle CreateCustomInit(void) { CreateCustomInitCalled = true; return BaseHandle(); } static bool CreateCustomNamedInitCalled = false; -BaseHandle CreateCustomNamedInit(void) +BaseHandle CreateCustomNamedInit(void) { CreateCustomNamedInitCalled = true; return BaseHandle(); } -const std::string scriptedName("PopupStyle"); -static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit ); +const std::string scriptedName("PopupStyle"); +static TypeRegistration scriptedType(scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit); // Property Registration bool setPropertyCalled = false; bool getPropertyCalled = false; -void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value ) +void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value) { setPropertyCalled = true; } -Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ) +Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex) { getPropertyCalled = true; - return Property::Value( true ); + return Property::Value(true); } - - /******************************************************************************* * * Custom Actor @@ -120,21 +121,24 @@ namespace Impl { struct MyTestCustomActor : public CustomActorImpl { - typedef Signal< void ()> SignalType; - typedef Signal< void (float)> SignalTypeFloat; + typedef Signal SignalType; + typedef Signal SignalTypeFloat; - MyTestCustomActor() : CustomActorImpl( ActorFlags() ) - { } + MyTestCustomActor() + : CustomActorImpl(ActorFlags()) + { + } virtual ~MyTestCustomActor() - { } + { + } void ResetCallStack() { } // From CustomActorImpl - virtual void OnSceneConnection( int depth ) + virtual void OnSceneConnection(int depth) { } virtual void OnSceneDisconnection() @@ -160,47 +164,46 @@ struct MyTestCustomActor : public CustomActorImpl } virtual Vector3 GetNaturalSize() { - return Vector3( 0.0f, 0.0f, 0.0f ); + return Vector3(0.0f, 0.0f, 0.0f); } - virtual float GetHeightForWidth( float width ) + virtual float GetHeightForWidth(float width) { return 0.0f; } - virtual float GetWidthForHeight( float height ) + virtual float GetWidthForHeight(float height) { return 0.0f; } - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) + virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) { } - virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) + virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) { } - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) + virtual void OnCalculateRelayoutSize(Dimension::Type dimension) { } - virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) + virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) { return 0.0f; } - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) + virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) { } - virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) + virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) { return false; } public: - SignalType mSignal; }; @@ -209,9 +212,8 @@ public: class MyTestCustomActor : public CustomActor { public: - - typedef Signal< void ()> SignalType; - typedef Signal< void (float)> SignalTypeFloat; + typedef Signal SignalType; + typedef Signal SignalTypeFloat; MyTestCustomActor() { @@ -220,25 +222,25 @@ public: static MyTestCustomActor New() { Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor; - return MyTestCustomActor( *p ); // takes ownership + return MyTestCustomActor(*p); // takes ownership } virtual ~MyTestCustomActor() { } - static MyTestCustomActor DownCast( BaseHandle handle ) + static MyTestCustomActor DownCast(BaseHandle handle) { MyTestCustomActor result; - CustomActor custom = Dali::CustomActor::DownCast( handle ); - if ( custom ) + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); - if (impl) + if(impl) { result = MyTestCustomActor(customImpl.GetOwner()); } @@ -250,37 +252,33 @@ public: SignalType& GetCustomSignal() { Dali::RefObject& obj = GetImplementation(); - return static_cast( obj ).mSignal; + return static_cast(obj).mSignal; } private: - MyTestCustomActor(Internal::CustomActor* internal) : CustomActor(internal) { } - MyTestCustomActor( Impl::MyTestCustomActor& impl ) - : CustomActor( impl ) + MyTestCustomActor(Impl::MyTestCustomActor& impl) + : CustomActor(impl) { } }; - class MyTestCustomActor2 : public CustomActor { public: - struct Property { enum { - P1=Dali::PROPERTY_REGISTRATION_START_INDEX, + P1 = Dali::PROPERTY_REGISTRATION_START_INDEX, P2 }; }; - MyTestCustomActor2() { } @@ -294,18 +292,18 @@ public: { } - static MyTestCustomActor2 DownCast( BaseHandle handle ) + static MyTestCustomActor2 DownCast(BaseHandle handle) { MyTestCustomActor2 result; - CustomActor custom = Dali::CustomActor::DownCast( handle ); - if ( custom ) + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); - if (impl) + if(impl) { result = MyTestCustomActor2(customImpl.GetOwner()); } @@ -315,23 +313,21 @@ public: } private: - MyTestCustomActor2(Internal::CustomActor* internal) : CustomActor(internal) { } - MyTestCustomActor2( Impl::MyTestCustomActor& impl ) - : CustomActor( impl ) + MyTestCustomActor2(Impl::MyTestCustomActor& impl) + : CustomActor(impl) { } }; -static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true ); - -PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty ); -PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty ); +static TypeRegistration customTypeInit(typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true); +PropertyRegistration P1(customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty); +PropertyRegistration P2(customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty); class MyTestCustomActor3 : public CustomActor { @@ -349,18 +345,18 @@ public: { } - static MyTestCustomActor3 DownCast( BaseHandle handle ) + static MyTestCustomActor3 DownCast(BaseHandle handle) { MyTestCustomActor3 result; - CustomActor custom = Dali::CustomActor::DownCast( handle ); - if ( custom ) + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); - if (impl) + if(impl) { result = MyTestCustomActor3(customImpl.GetOwner()); } @@ -370,19 +366,18 @@ public: } private: - MyTestCustomActor3(Internal::CustomActor* internal) : CustomActor(internal) { } - MyTestCustomActor3( Impl::MyTestCustomActor& impl ) - : CustomActor( impl ) + MyTestCustomActor3(Impl::MyTestCustomActor& impl) + : CustomActor(impl) { } }; -static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false ); +static TypeRegistration customTypeBadInit(typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false); BaseHandle CreateCustom(void) { @@ -391,18 +386,18 @@ BaseHandle CreateCustom(void) static std::string lastSignalConnectionCustom; -bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +bool DoConnectSignalCustom(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor) { lastSignalConnectionCustom = signalName; - bool connected( true ); + bool connected(true); - Dali::BaseHandle handle(object); + Dali::BaseHandle handle(object); MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle); - if( "sig1" == signalName ) + if("sig1" == signalName) { - customActor.GetCustomSignal().Connect( tracker, functor ); + customActor.GetCustomSignal().Connect(tracker, functor); } else { @@ -413,7 +408,7 @@ bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* trac return connected; } -bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +bool DoConnectSignalCustomFailure(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor) { lastSignalConnectionCustom = "failed"; @@ -428,7 +423,7 @@ struct CustomTestFunctor ++mCurrentInstanceCount; } - CustomTestFunctor( const CustomTestFunctor& copyMe ) + CustomTestFunctor(const CustomTestFunctor& copyMe) { ++mTotalInstanceCount; ++mCurrentInstanceCount; @@ -449,9 +444,9 @@ struct CustomTestFunctor static int mCallbackCount; }; -int CustomTestFunctor::mTotalInstanceCount = 0; +int CustomTestFunctor::mTotalInstanceCount = 0; int CustomTestFunctor::mCurrentInstanceCount = 0; -int CustomTestFunctor::mCallbackCount = 0; +int CustomTestFunctor::mCallbackCount = 0; static void ResetFunctorCounts() { @@ -461,28 +456,27 @@ static void ResetFunctorCounts() } static std::string lastActionCustom; -bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/) +bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/) { lastActionCustom = actionName; return true; } // Custom type registration -static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom ); +static TypeRegistration customType1(typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom); // Custom signals -static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom ); -static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure ); -static const int TEST_SIGNAL_COUNT = 2; +static SignalConnectorType customSignalConnector1(customType1, "sig1", DoConnectSignalCustom); +static SignalConnectorType customSignalConnector2(customType1, "sig2", DoConnectSignalCustomFailure); +static const int TEST_SIGNAL_COUNT = 2; // Custom actions -static TypeAction customAction1( customType1, "act1", DoActionCustom); -static const int TEST_ACTION_COUNT = 1; +static TypeAction customAction1(customType1, "act1", DoActionCustom); +static const int TEST_ACTION_COUNT = 1; class TestConnectionTracker : public ConnectionTracker { public: - TestConnectionTracker() { } @@ -491,12 +485,12 @@ public: BaseHandle CreateNamedActorType() { Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::NAME, "NamedActor" ); + actor.SetProperty(Actor::Property::NAME, "NamedActor"); return actor; } -TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType ); -PropertyRegistration namedActorPropertyOne( namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty ); +TypeRegistration namedActorType("MyNamedActor", typeid(Dali::Actor), CreateNamedActorType); +PropertyRegistration namedActorPropertyOne(namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty); } // Anonymous namespace @@ -506,7 +500,7 @@ int UtcDaliTypeRegistryGetP(void) TestApplication application; TypeRegistry registry = TypeRegistry::Get(); - DALI_TEST_CHECK( registry ); + DALI_TEST_CHECK(registry); END_TEST; } @@ -517,7 +511,7 @@ int UtcDaliTypeRegistryConstructorP(void) TestApplication application; TypeRegistry registry; - DALI_TEST_CHECK( !registry ); + DALI_TEST_CHECK(!registry); END_TEST; } @@ -527,12 +521,12 @@ int UtcDaliTypeRegistryCopyConstructorP(void) TestApplication application; TypeRegistry registry = TypeRegistry::Get(); - DALI_TEST_CHECK( registry ); + DALI_TEST_CHECK(registry); - TypeRegistry copy( registry ); - DALI_TEST_CHECK( copy ); + TypeRegistry copy(registry); + DALI_TEST_CHECK(copy); - DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() ); + DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == copy.GetTypeInfo("Actor").GetName()); END_TEST; } @@ -543,13 +537,13 @@ int UtcDaliTypeRegistryAssignmentOperatorP(void) TestApplication application; TypeRegistry registry = TypeRegistry::Get(); - DALI_TEST_CHECK( registry ); + DALI_TEST_CHECK(registry); TypeRegistry copy = registry; - DALI_TEST_CHECK( copy ); - DALI_TEST_CHECK( registry == copy ); + DALI_TEST_CHECK(copy); + DALI_TEST_CHECK(registry == copy); - DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() ); + DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == copy.GetTypeInfo("Actor").GetName()); END_TEST; } @@ -559,26 +553,26 @@ int UtcDaliTypeRegistryMoveConstructor(void) TestApplication application; TypeRegistry registry = TypeRegistry::Get(); - DALI_TEST_CHECK( registry ); - DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" ); + DALI_TEST_CHECK(registry); + DALI_TEST_EQUALS(16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == "Actor"); - TypeRegistry movedRegistry = std::move( registry ); - DALI_TEST_CHECK( movedRegistry ); - DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" ); - DALI_TEST_CHECK( !registry ); + TypeRegistry movedRegistry = std::move(registry); + DALI_TEST_CHECK(movedRegistry); + DALI_TEST_EQUALS(16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(movedRegistry.GetTypeInfo("Actor").GetName() == "Actor"); + DALI_TEST_CHECK(!registry); - Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( info ); - DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( info.GetName() == "Actor" ); + Dali::TypeInfo info = movedRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(info); + DALI_TEST_EQUALS(2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(info.GetName() == "Actor"); - Dali::TypeInfo movedInfo = std::move( info ); - DALI_TEST_CHECK( movedInfo ); - DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( movedInfo.GetName() == "Actor" ); - DALI_TEST_CHECK( !info ); + Dali::TypeInfo movedInfo = std::move(info); + DALI_TEST_CHECK(movedInfo); + DALI_TEST_EQUALS(2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(movedInfo.GetName() == "Actor"); + DALI_TEST_CHECK(!info); END_TEST; } @@ -588,28 +582,28 @@ int UtcDaliTypeRegistryMoveAssignment(void) TestApplication application; TypeRegistry registry = TypeRegistry::Get(); - DALI_TEST_CHECK( registry ); - DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" ); + DALI_TEST_CHECK(registry); + DALI_TEST_EQUALS(16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == "Actor"); TypeRegistry movedRegistry; - movedRegistry = std::move( registry ); - DALI_TEST_CHECK( movedRegistry ); - DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" ); - DALI_TEST_CHECK( !registry ); + movedRegistry = std::move(registry); + DALI_TEST_CHECK(movedRegistry); + DALI_TEST_EQUALS(16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(movedRegistry.GetTypeInfo("Actor").GetName() == "Actor"); + DALI_TEST_CHECK(!registry); - Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( info ); - DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( info.GetName() == "Actor" ); + Dali::TypeInfo info = movedRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(info); + DALI_TEST_EQUALS(2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(info.GetName() == "Actor"); Dali::TypeInfo movedInfo; - movedInfo = std::move( info ); - DALI_TEST_CHECK( movedInfo ); - DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_CHECK( movedInfo.GetName() == "Actor" ); - DALI_TEST_CHECK( !info ); + movedInfo = std::move(info); + DALI_TEST_CHECK(movedInfo); + DALI_TEST_EQUALS(2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_CHECK(movedInfo.GetName() == "Actor"); + DALI_TEST_CHECK(!info); END_TEST; } @@ -621,9 +615,9 @@ int UtcDaliTypeRegistryAssignP(void) TypeRegistry registry = TypeRegistry::Get(); TypeRegistry registry2; registry2 = registry; - DALI_TEST_CHECK( registry2 ); + DALI_TEST_CHECK(registry2); - DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() ); + DALI_TEST_CHECK(registry2.GetTypeInfo("Actor").GetName() == registry2.GetTypeInfo("Actor").GetName()); END_TEST; } @@ -637,18 +631,18 @@ int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void) TypeInfo type; // camera actor - type = registry.GetTypeInfo( "CameraActor" ); - DALI_TEST_CHECK( type ); + type = registry.GetTypeInfo("CameraActor"); + DALI_TEST_CHECK(type); CameraActor ca = CameraActor::DownCast(type.CreateInstance()); - DALI_TEST_CHECK( ca ); - application.GetScene().Add( ca ); + DALI_TEST_CHECK(ca); + application.GetScene().Add(ca); application.Render(); // animations - type = registry.GetTypeInfo( "Animation" ); - DALI_TEST_CHECK( type ); + type = registry.GetTypeInfo("Animation"); + DALI_TEST_CHECK(type); Animation an = Animation::DownCast(type.CreateInstance()); - DALI_TEST_CHECK( an ); + DALI_TEST_CHECK(an); an.Play(); application.Render(); @@ -663,25 +657,25 @@ int UtcDaliTypeRegistryGetTypeInfoFromTypeNameN(void) TypeInfo type; - type = registry.GetTypeInfo( "MyDummyActor" ); - DALI_TEST_CHECK( !type ); + type = registry.GetTypeInfo("MyDummyActor"); + DALI_TEST_CHECK(!type); END_TEST; } int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void) { - TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" ); - TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) ); + TypeInfo named_type = TypeRegistry::Get().GetTypeInfo("CameraActor"); + TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo(typeid(Dali::CameraActor)); - DALI_TEST_CHECK( named_type ); - DALI_TEST_CHECK( typeinfo_type ); + DALI_TEST_CHECK(named_type); + DALI_TEST_CHECK(typeinfo_type); // Check named and typeid are equivalent - DALI_TEST_CHECK( named_type == typeinfo_type ); + DALI_TEST_CHECK(named_type == typeinfo_type); - DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() ); - DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() ); + DALI_TEST_CHECK(named_type.GetName() == typeinfo_type.GetName()); + DALI_TEST_CHECK(named_type.GetBaseName() == typeinfo_type.GetBaseName()); END_TEST; } @@ -689,10 +683,10 @@ int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void) int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) ); - DALI_TEST_CHECK( !typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(Vector2)); + DALI_TEST_CHECK(!typeInfo); END_TEST; } @@ -700,35 +694,33 @@ int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void) int UtcDaliTypeRegistryGetTypeNameCountP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo type; + TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeInfo type; for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++) { - type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) ); - DALI_TEST_CHECK( type ); + type = typeRegistry.GetTypeInfo(typeRegistry.GetTypeName(i)); + DALI_TEST_CHECK(type); } END_TEST; } - int UtcDaliTypeRegistryGetTypeNamesP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo type; + TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeInfo type; for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++) { - type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) ); - DALI_TEST_CHECK( type ); + type = typeRegistry.GetTypeInfo(typeRegistry.GetTypeName(i)); + DALI_TEST_CHECK(type); } END_TEST; } - // Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented. int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void) { @@ -736,51 +728,51 @@ int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void) TestApplication application; - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor"); + DALI_TEST_CHECK(type); - TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" ); - DALI_TEST_CHECK( baseType ); + TypeInfo baseType = TypeRegistry::Get().GetTypeInfo("CustomActor"); + DALI_TEST_CHECK(baseType); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); - MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle ); - DALI_TEST_CHECK( customHandle ); + MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle); + DALI_TEST_CHECK(customHandle); - DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION); - DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION); { TestConnectionTracker tracker; - bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() ); - DALI_TEST_EQUALS( connected, true, TEST_LOCATION ); - DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION ); + bool connected = handle.ConnectSignal(&tracker, "sig1", CustomTestFunctor()); + DALI_TEST_EQUALS(connected, true, TEST_LOCATION); + DALI_TEST_CHECK(lastSignalConnectionCustom == "sig1"); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION); } // tracker should automatically disconnect here - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION); // Test that functor is disconnected - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1 /*not incremented*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION); Property::Map attributes; handle.DoAction("act1", attributes); - DALI_TEST_CHECK( lastActionCustom == "act1" ); + DALI_TEST_CHECK(lastActionCustom == "act1"); END_TEST; } @@ -789,11 +781,11 @@ int UtcDaliTypeRegistryTypeRegistrationCallingCreateOnInitP(void) { TestApplication application; - DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() ); + DALI_TEST_CHECK("MyTestCustomActor2" == customTypeInit.RegisteredName()); - DALI_TEST_CHECK( true == CreateCustomInitCalled ); - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" ); - DALI_TEST_CHECK( type ); + DALI_TEST_CHECK(true == CreateCustomInitCalled); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor2"); + DALI_TEST_CHECK(type); END_TEST; } @@ -803,17 +795,17 @@ int UtcDaliTypeRegistryTypeRegistrationForNamedTypeP(void) TestApplication application; // Create Named Actor Type - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyNamedActor"); + DALI_TEST_CHECK(type); BaseHandle namedHandle = type.CreateInstance(); - DALI_TEST_CHECK( namedHandle ); - Actor namedActor( Actor::DownCast( namedHandle ) ); - DALI_TEST_CHECK( namedActor ); + DALI_TEST_CHECK(namedHandle); + Actor namedActor(Actor::DownCast(namedHandle)); + DALI_TEST_CHECK(namedActor); - DALI_TEST_CHECK( namedActor.GetProperty< std::string >( Actor::Property::NAME ) == "NamedActor" ); - DALI_TEST_CHECK( type.GetName() == "MyNamedActor" ); - DALI_TEST_CHECK( type.GetBaseName() == "Actor" ); + DALI_TEST_CHECK(namedActor.GetProperty(Actor::Property::NAME) == "NamedActor"); + DALI_TEST_CHECK(type.GetName() == "MyNamedActor"); + DALI_TEST_CHECK(type.GetBaseName() == "Actor"); END_TEST; } @@ -822,85 +814,83 @@ int UtcDaliTypeRegistryRegisteredNameP(void) { TestApplication application; - DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() ); + DALI_TEST_CHECK(scriptedName == scriptedType.RegisteredName()); - TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName ); - DALI_TEST_CHECK( baseType ); + TypeInfo baseType = TypeRegistry::Get().GetTypeInfo(scriptedName); + DALI_TEST_CHECK(baseType); BaseHandle handle = baseType.CreateInstance(); - DALI_TEST_CHECK( true == CreateCustomNamedInitCalled ); - TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName ); - DALI_TEST_CHECK( type ); + DALI_TEST_CHECK(true == CreateCustomNamedInitCalled); + TypeInfo type = TypeRegistry::Get().GetTypeInfo(scriptedName); + DALI_TEST_CHECK(type); END_TEST; } - int UtcDaliTypeRegistryRegisteredNameN(void) { TestApplication application; - DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() ); + DALI_TEST_CHECK(scriptedName == scriptedType.RegisteredName()); - TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName ); - DALI_TEST_CHECK( baseType ); + TypeInfo baseType = TypeRegistry::Get().GetTypeInfo(scriptedName); + DALI_TEST_CHECK(baseType); // should cause an assert because we're registering same type twice // once statically at the start of this file, then again now try { - TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit ); - tet_result( TET_FAIL ); + TypeRegistration scriptedType(scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Duplicate type name in Type Registration", TEST_LOCATION); } END_TEST; } - int UtcDaliTypeRegistrySignalConnectorTypeP(void) { ResetFunctorCounts(); TestApplication application; - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); - MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle ); - DALI_TEST_CHECK( customHandle ); + MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle); + DALI_TEST_CHECK(customHandle); { TestConnectionTracker tracker; - bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() ); - DALI_TEST_EQUALS( connected, true, TEST_LOCATION ); - DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION ); + bool connected = handle.ConnectSignal(&tracker, "sig1", CustomTestFunctor()); + DALI_TEST_EQUALS(connected, true, TEST_LOCATION); + DALI_TEST_CHECK(lastSignalConnectionCustom == "sig1"); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION); } // tracker should automatically disconnect here - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION); // Test that functor is disconnected - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1 /*not incremented*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION); END_TEST; } @@ -913,42 +903,42 @@ int UtcDaliTypeRegistrySignalConnectorTypeN(void) TestApplication application; - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor"); + DALI_TEST_CHECK(type); - TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" ); - DALI_TEST_CHECK( baseType ); + TypeInfo baseType = TypeRegistry::Get().GetTypeInfo("CustomActor"); + DALI_TEST_CHECK(baseType); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); - MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle ); - DALI_TEST_CHECK( customHandle ); + MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle); + DALI_TEST_CHECK(customHandle); - DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION); - DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION); { TestConnectionTracker tracker; - bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() ); - DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION ); - DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" ); - DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION ); - DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION ); + bool connected = handle.ConnectSignal(&tracker, "sig2", CustomTestFunctor()); + DALI_TEST_EQUALS(connected, false /*This is supposed to fail*/, TEST_LOCATION); + DALI_TEST_CHECK(lastSignalConnectionCustom == "failed"); + DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION); + DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0 /*deleted along with FunctorDelegate*/, TEST_LOCATION); // Should be a NOOP - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0 /*never called*/, TEST_LOCATION); } // tracker should have nothing to disconnect here // Should be a NOOP - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION); customHandle.GetCustomSignal().Emit(); - DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION ); + DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0 /*never called*/, TEST_LOCATION); END_TEST; } @@ -958,15 +948,15 @@ int UtcDaliTypeRegistryTypeActionP(void) TestApplication application; - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); Property::Map attributes; - DALI_TEST_CHECK( handle.DoAction("act1", attributes) ); - DALI_TEST_CHECK( lastActionCustom == "act1" ); + DALI_TEST_CHECK(handle.DoAction("act1", attributes)); + DALI_TEST_CHECK(lastActionCustom == "act1"); END_TEST; } @@ -977,14 +967,14 @@ int UtcDaliTypeRegistryTypeActionN(void) TestApplication application; - TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" ); - DALI_TEST_CHECK( type ); + TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); Property::Map attributes; - DALI_TEST_CHECK( !handle.DoAction( "unknownAction", attributes ) ); + DALI_TEST_CHECK(!handle.DoAction("unknownAction", attributes)); END_TEST; } @@ -992,100 +982,100 @@ int UtcDaliTypeRegistryTypeActionN(void) int UtcDaliTypeRegistryPropertyRegistrationP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); - unsigned int initialPropertyCount( customActor.GetPropertyCount() ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); + unsigned int initialPropertyCount(customActor.GetPropertyCount()); - std::string propertyName( "prop1" ); - int propertyIndex( PROPERTY_REGISTRATION_START_INDEX ); - Property::Type propertyType( Property::BOOLEAN ); - PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty ); + std::string propertyName("prop1"); + int propertyIndex(PROPERTY_REGISTRATION_START_INDEX); + Property::Type propertyType(Property::BOOLEAN); + PropertyRegistration property1(customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty); // Check property count after registration - unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() ); - DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION ); + unsigned int postRegistrationPropertyCount(customActor.GetPropertyCount()); + DALI_TEST_EQUALS(initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION); // Add custom property and check property count - customActor.RegisterProperty( "customProp1", true ); - unsigned int customPropertyCount( customActor.GetPropertyCount() ); - DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION ); + customActor.RegisterProperty("customProp1", true); + unsigned int customPropertyCount(customActor.GetPropertyCount()); + DALI_TEST_EQUALS(postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION); // Set the property, ensure SetProperty called - DALI_TEST_CHECK( !setPropertyCalled ); - customActor.SetProperty( propertyIndex, false ); - DALI_TEST_CHECK( setPropertyCalled ); + DALI_TEST_CHECK(!setPropertyCalled); + customActor.SetProperty(propertyIndex, false); + DALI_TEST_CHECK(setPropertyCalled); // Get the property, ensure GetProperty called - DALI_TEST_CHECK( !getPropertyCalled ); - (void)customActor.GetProperty< bool >( propertyIndex ); - DALI_TEST_CHECK( getPropertyCalled ); + DALI_TEST_CHECK(!getPropertyCalled); + (void)customActor.GetProperty(propertyIndex); + DALI_TEST_CHECK(getPropertyCalled); // Get the property using GetCurrentProperty and ensure GetProperty is called getPropertyCalled = false; - DALI_TEST_CHECK( !getPropertyCalled ); - customActor.GetCurrentProperty< bool >( propertyIndex ); - DALI_TEST_CHECK( getPropertyCalled ); + DALI_TEST_CHECK(!getPropertyCalled); + customActor.GetCurrentProperty(propertyIndex); + DALI_TEST_CHECK(getPropertyCalled); // Check the property name - DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION ); - DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION); + DALI_TEST_EQUALS(typeInfo.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION); // Check the property index - DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION); // Check the property type - DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION); // Check property count of type-info is 1 Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); + typeInfo.GetPropertyIndices(indices); size_t typePropertyCount = typeInfo.GetPropertyCount(); - DALI_TEST_EQUALS( indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION ); + DALI_TEST_EQUALS(indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION); + DALI_TEST_EQUALS(indices.Size(), typePropertyCount, TEST_LOCATION); // Ensure indices returned from actor and customActor differ by two Actor actor = Actor::New(); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); unsigned int actorIndices = indices.Size(); - customActor.GetPropertyIndices( indices ); + customActor.GetPropertyIndices(indices); unsigned int customActorIndices = indices.Size(); - DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property + DALI_TEST_EQUALS(actorIndices + 2u, customActorIndices, TEST_LOCATION); // Custom property + registered property END_TEST; } int UtcDaliTypeRegistryPropertyRegistrationN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Attempt to register a property type out-of-bounds index (less than) try { - PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty ); - tet_result( TET_FAIL ); + PropertyRegistration property1(customType1, "propName", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Attempt to register a property type out-of-bounds index (greater than) try { - PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty ); - tet_result( TET_FAIL ); + PropertyRegistration property1(customType1, "propName", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } END_TEST; @@ -1094,79 +1084,79 @@ int UtcDaliTypeRegistryPropertyRegistrationN(void) int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - unsigned int customPropertyCount( customActor.GetPropertyCount() ); + unsigned int customPropertyCount(customActor.GetPropertyCount()); // Register animatable property - std::string animatablePropertyName( "animatableProp1" ); - int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - Property::Type animatablePropertyType( Property::FLOAT ); - AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType ); + std::string animatablePropertyName("animatableProp1"); + int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + Property::Type animatablePropertyType(Property::FLOAT); + AnimatablePropertyRegistration animatableProperty(customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType); // Check property count after registration - DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION); // Set the animatable property value - customActor.SetProperty( animatablePropertyIndex, 25.0f ); + customActor.SetProperty(animatablePropertyIndex, 25.0f); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 25.f, TEST_LOCATION); // Check the animatable property name - DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION); // Check the animatable property index - DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION); // Check the animatable property type - DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), animatablePropertyType, TEST_LOCATION); // Check property count of type-info is 1 Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); + typeInfo.GetPropertyIndices(indices); + DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION); // Ensure indices returned from actor and customActor differ by one Actor actor = Actor::New(); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); unsigned int actorIndices = indices.Size(); - customActor.GetPropertyIndices( indices ); + customActor.GetPropertyIndices(indices); unsigned int customActorIndices = indices.Size(); - DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property + DALI_TEST_EQUALS(actorIndices + 1u, customActorIndices, TEST_LOCATION); // Custom property + registered property // check that the property is animatable Animation animation = Animation::New(0.2f); - animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(customActor, animatablePropertyIndex), 15.f, AlphaFunction::LINEAR); animation.Play(); // Target value should change straight away - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 15.0f, TEST_LOCATION); // Render and notify, animation play for 0.05 seconds application.SendNotification(); application.Render(50); - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 22.5f, TEST_LOCATION); // Render and notify, animation play for another 0.1 seconds application.SendNotification(); application.Render(100); - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 17.5f, TEST_LOCATION); END_TEST; } @@ -1174,28 +1164,28 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void) int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Attempt to register an animatable property type out-of-bounds index (less than) try { - AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN ); - tet_result( TET_FAIL ); + AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Attempt to register an animatable property type out-of-bounds index (greater than) try { - AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN ); - tet_result( TET_FAIL ); + AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } END_TEST; @@ -1204,75 +1194,75 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void) int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - unsigned int customPropertyCount( customActor.GetPropertyCount() ); + unsigned int customPropertyCount(customActor.GetPropertyCount()); // Register animatable property - std::string animatablePropertyName( "animatableProp1" ); - int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f ); + std::string animatablePropertyName("animatableProp1"); + int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + AnimatablePropertyRegistration animatableProperty1(customType1, animatablePropertyName, animatablePropertyIndex, 10.f); // Check property count after registration - DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 10.f, TEST_LOCATION); // Check the animatable property name - DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION); // Check the animatable property index - DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION); // Check the animatable property type - DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), Property::FLOAT, TEST_LOCATION); // Check property count of type-info Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); + typeInfo.GetPropertyIndices(indices); + DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION); // Ensure indices returned from actor and customActor differ by one Actor actor = Actor::New(); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); unsigned int actorIndices = indices.Size(); - customActor.GetPropertyIndices( indices ); + customActor.GetPropertyIndices(indices); unsigned int customActorIndices = indices.Size(); - DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property + DALI_TEST_EQUALS(actorIndices + 1u, customActorIndices, TEST_LOCATION); // Custom property + registered property // check that the property is animatable Animation animation = Animation::New(0.2f); - animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR ); + animation.AnimateTo(Property(customActor, animatablePropertyIndex), 20.f, AlphaFunction::LINEAR); animation.Play(); // Target value should change straight away - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 20.0f, TEST_LOCATION); // Render and notify, animation play for 0.05 seconds application.SendNotification(); application.Render(50); - DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 12.5f, TEST_LOCATION); // Render and notify, animation play for another 0.1 seconds application.SendNotification(); application.Render(100); - DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION ); + DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 17.5f, TEST_LOCATION); END_TEST; } @@ -1280,28 +1270,28 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void) int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Attempt to register an animatable property type out-of-bounds index (less than) try { - AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false ); - tet_result( TET_FAIL ); + AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Attempt to register an animatable property type out-of-bounds index (greater than) try { - AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true ); - tet_result( TET_FAIL ); + AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } END_TEST; @@ -1310,108 +1300,108 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void) int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); - unsigned int customPropertyCount( customActor.GetPropertyCount() ); + unsigned int customPropertyCount(customActor.GetPropertyCount()); // Register animatable property - std::string animatablePropertyName( "animatableProp1" ); - int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - Property::Type animatablePropertyType( Property::VECTOR2 ); - AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType ); + std::string animatablePropertyName("animatableProp1"); + int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + Property::Type animatablePropertyType(Property::VECTOR2); + AnimatablePropertyRegistration animatableProperty1(customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType); // Check property count after registration - DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION); // Set the animatable property value - customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) ); + customActor.SetProperty(animatablePropertyIndex, Vector2(25.0f, 50.0f)); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), Vector2(25.0f, 50.0f), TEST_LOCATION); // Check the animatable property name - DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION); // Check the animatable property index - DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION); // Check the animatable property type - DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), animatablePropertyType, TEST_LOCATION); // Check property count of type-info Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); - DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION ); + typeInfo.GetPropertyIndices(indices); + DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION); // Register animatable property components - std::string animatablePropertyComponentName1( "animatableProp1X" ); - int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 ); + std::string animatablePropertyComponentName1("animatableProp1X"); + int animatablePropertyComponentIndex1(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1); + AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0); - std::string animatablePropertyComponentName2( "animatableProp1Y" ); - int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 ); + std::string animatablePropertyComponentName2("animatableProp1Y"); + int animatablePropertyComponentIndex2(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2); + AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1); // Check property count after registration - DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION); // Check the animatable property component value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex1), 25.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex2), 50.0f, TEST_LOCATION); // Set the animatable property component value - customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f ); + customActor.SetProperty(animatablePropertyComponentIndex1, 150.0f); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), Vector2(150.0f, 50.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex1), 150.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex2), 50.0f, TEST_LOCATION); // Set the animatable property component value - customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f ); + customActor.SetProperty(animatablePropertyComponentIndex2, 225.0f); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), Vector2(150.0f, 225.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex1), 150.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyComponentIndex2), 225.0f, TEST_LOCATION); // Ensure indices returned from actor and customActor differ by three Actor actor = Actor::New(); - actor.GetPropertyIndices( indices ); + actor.GetPropertyIndices(indices); unsigned int actorIndices = indices.Size(); - customActor.GetPropertyIndices( indices ); + customActor.GetPropertyIndices(indices); unsigned int customActorIndices = indices.Size(); - DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property + DALI_TEST_EQUALS(actorIndices + 3u, customActorIndices, TEST_LOCATION); // Custom property + registered property // Attempt to animate component property, it should not crash - Animation animation = Animation::New( 1.0f ); - animation.AnimateTo( Property( customActor, animatablePropertyComponentIndex1 ), 200.0f ); + Animation animation = Animation::New(1.0f); + animation.AnimateTo(Property(customActor, animatablePropertyComponentIndex1), 200.0f); animation.Play(); // Check the property value - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(200.0f, 225.0f), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 200.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), Vector2(200.0f, 225.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyComponentIndex1), 200.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyComponentIndex2), 225.0f, TEST_LOCATION); END_TEST; } @@ -1419,52 +1409,52 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void) int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); - const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; + const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; const unsigned int xComponentIndex = index + 1; const unsigned int yComponentIndex = index + 2; - const Vector2 initialValue( 20.0f, 40.0f ); + const Vector2 initialValue(20.0f, 40.0f); // Register animatable property & its components - AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue ); - AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 ); + AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue); + AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0); + AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), initialValue.y, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property current value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(yComponentIndex), initialValue.y, TEST_LOCATION); // Do an AnimateBy - const Vector2 targetValue( 45.0f, 53.0f ); - const Vector2 relativeValue( targetValue - initialValue ); + const Vector2 targetValue(45.0f, 53.0f); + const Vector2 relativeValue(targetValue - initialValue); - Animation animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x ); - animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y ); + Animation animation = Animation::New(1.0f); + animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x); + animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y); animation.Play(); // Target values should change straight away - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), targetValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), targetValue.y, TEST_LOCATION); END_TEST; } @@ -1472,58 +1462,58 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP( int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); - const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; + const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; const unsigned int xComponentIndex = index + 1; const unsigned int yComponentIndex = index + 2; const unsigned int zComponentIndex = index + 3; - const Vector3 initialValue( 20.0f, 40.0f, 50.0f ); + const Vector3 initialValue(20.0f, 40.0f, 50.0f); // Register animatable property & its components - AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue ); - AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 ); + AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue); + AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0); + AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1); + AnimatablePropertyComponentRegistration animatablePropertyComponent3(customType1, "animatableProp1Z", zComponentIndex, index, 2); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), initialValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(zComponentIndex), initialValue.z, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property current value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(yComponentIndex), initialValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(zComponentIndex), initialValue.z, TEST_LOCATION); // Do an AnimateBy - const Vector3 targetValue( 45.0f, 53.0f, 25.0f ); - const Vector3 relativeValue( targetValue - initialValue ); + const Vector3 targetValue(45.0f, 53.0f, 25.0f); + const Vector3 relativeValue(targetValue - initialValue); - Animation animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x ); - animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y ); - animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z ); + Animation animation = Animation::New(1.0f); + animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x); + animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y); + animation.AnimateBy(Property(customActor, zComponentIndex), relativeValue.z); animation.Play(); // Target values should change straight away - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), targetValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), targetValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(zComponentIndex), targetValue.z, TEST_LOCATION); END_TEST; } @@ -1531,64 +1521,64 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP( int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); - const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; + const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX; const unsigned int xComponentIndex = index + 1; const unsigned int yComponentIndex = index + 2; const unsigned int zComponentIndex = index + 3; const unsigned int wComponentIndex = index + 4; - const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f ); + const Vector4 initialValue(20.0f, 40.0f, 50.0f, 60.0f); // Register animatable property & its components - AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue ); - AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 ); - AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 ); + AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue); + AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0); + AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1); + AnimatablePropertyComponentRegistration animatablePropertyComponent3(customType1, "animatableProp1Z", zComponentIndex, index, 2); + AnimatablePropertyComponentRegistration animatablePropertyComponent4(customType1, "animatableProp1W", wComponentIndex, index, 3); // Check the animatable property value - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), initialValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(zComponentIndex), initialValue.z, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(wComponentIndex), initialValue.w, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); // Check the animatable property current value - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(index), initialValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(xComponentIndex), initialValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(yComponentIndex), initialValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(zComponentIndex), initialValue.z, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(wComponentIndex), initialValue.w, TEST_LOCATION); // Do an AnimateBy - const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f ); - const Vector4 relativeValue( targetValue - initialValue ); - - Animation animation = Animation::New( 1.0f ); - animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x ); - animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y ); - animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z ); - animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w ); + const Vector4 targetValue(45.0f, 53.0f, 25.0f, 13.0f); + const Vector4 relativeValue(targetValue - initialValue); + + Animation animation = Animation::New(1.0f); + animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x); + animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y); + animation.AnimateBy(Property(customActor, zComponentIndex), relativeValue.z); + animation.AnimateBy(Property(customActor, wComponentIndex), relativeValue.w); animation.Play(); // Target values should change straight away - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(index), targetValue, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(xComponentIndex), targetValue.x, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(yComponentIndex), targetValue.y, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(zComponentIndex), targetValue.z, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(wComponentIndex), targetValue.w, TEST_LOCATION); END_TEST; } @@ -1596,61 +1586,61 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP( int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Register animatable property with the type of Vector2 - int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", animatablePropertyIndex1, Property::VECTOR2 ); + int animatablePropertyIndex1(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", animatablePropertyIndex1, Property::VECTOR2); // Attempt to register an animatable property component out-of-bounds index (less than) try { - AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 ); - tet_result( TET_FAIL ); + AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Attempt to register an animatable property component out-of-bounds index (greater than) try { - AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 ); - tet_result( TET_FAIL ); + AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Register an animatable property component - AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 ); + AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0); // Attempt to register another animatable property component with the same component index try { - AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 ); - tet_result( TET_FAIL ); + AnimatablePropertyComponentRegistration propertyComponent2(customType1, "animatableProp1Y", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property component already registered", TEST_LOCATION); } // Register animatable property with the type of boolean - int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 ); - AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2", animatablePropertyIndex2, Property::BOOLEAN ); + int animatablePropertyIndex2(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2); + AnimatablePropertyRegistration animatableProperty2(customType1, "animatableProp2", animatablePropertyIndex2, Property::BOOLEAN); // Attempt to register an animatable property component for the above property with boolean type try { - AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X", animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 ); - tet_result( TET_FAIL ); + AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp2X", animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Base property does not support component", TEST_LOCATION); } END_TEST; @@ -1659,208 +1649,207 @@ int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void) int UtcDaliTypeRegistryChildPropertyRegistrationP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); - unsigned int initialPropertyCount( customActor.GetPropertyCount() ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); + unsigned int initialPropertyCount(customActor.GetPropertyCount()); // Register child properties to the parent - std::string propertyName( "childProp1" ); - int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - Property::Type propertyType( Property::BOOLEAN ); - ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType ); - - std::string propertyName2( "childProp2" ); - int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); - Property::Type propertyType2( Property::INTEGER ); - ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 ); - - std::string propertyName3( "childProp3" ); - int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 ); - Property::Type propertyType3( Property::FLOAT ); - ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 ); - - std::string propertyName4( "childProp4" ); - int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 ); - Property::Type propertyType4( Property::INTEGER ); - ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 ); + std::string propertyName("childProp1"); + int propertyIndex(CHILD_PROPERTY_REGISTRATION_START_INDEX); + Property::Type propertyType(Property::BOOLEAN); + ChildPropertyRegistration childProperty1(customType1, propertyName, propertyIndex, propertyType); + + std::string propertyName2("childProp2"); + int propertyIndex2(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + Property::Type propertyType2(Property::INTEGER); + ChildPropertyRegistration childProperty2(customType1, propertyName2, propertyIndex2, propertyType2); + + std::string propertyName3("childProp3"); + int propertyIndex3(CHILD_PROPERTY_REGISTRATION_START_INDEX + 2); + Property::Type propertyType3(Property::FLOAT); + ChildPropertyRegistration childProperty3(customType1, propertyName3, propertyIndex3, propertyType3); + + std::string propertyName4("childProp4"); + int propertyIndex4(CHILD_PROPERTY_REGISTRATION_START_INDEX + 3); + Property::Type propertyType4(Property::INTEGER); + ChildPropertyRegistration childProperty4(customType1, propertyName4, propertyIndex4, propertyType4); // Check property count are not changed because the child properties will not be created for the parent - DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION); // check the child property type - Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); - Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") ); - DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION ); + Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo); + Property::Type type = typeInfoImpl.GetChildPropertyType(typeInfoImpl.GetChildPropertyIndex("childProp4")); + DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION); - std::string unRegisteredChildName( typeInfoImpl.GetChildPropertyName( CHILD_PROPERTY_REGISTRATION_START_INDEX + 4 ) ); - DALI_TEST_EQUALS( unRegisteredChildName, "", TEST_LOCATION ); + std::string unRegisteredChildName(typeInfoImpl.GetChildPropertyName(CHILD_PROPERTY_REGISTRATION_START_INDEX + 4)); + DALI_TEST_EQUALS(unRegisteredChildName, "", TEST_LOCATION); // Create a child actor Actor childActor = Actor::New(); - DALI_TEST_CHECK( childActor ); - unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() ); + DALI_TEST_CHECK(childActor); + unsigned int initialChildActorPropertyCount(childActor.GetPropertyCount()); // The type of child properties should be Property::None as the child hasn't registered any child property yet. - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), Property::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex2), Property::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex3), Property::NONE, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex4), Property::NONE, TEST_LOCATION); // Set the value for the first child property when the child actor doesn't have a parent yet childActor.SetProperty(propertyIndex, true); // Check that the first child property is dynamically created - DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION); // Check the first child property value - DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetProperty(propertyIndex), true, TEST_LOCATION); // Check the first child property type - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION); // Check that the first child property have no name, as it doesn't have a parent yet. - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), "", TEST_LOCATION); // Check that the first property can't be accessed through its name, as it doesn't have a parent yet. - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), Property::INVALID_INDEX, TEST_LOCATION); // Create a custom property for the child with the same name as the second child property registered to the parent Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE); // Check that the custom property is created - DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION); // Check the property value - DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetProperty(customPropertyIndex), 100, TEST_LOCATION); // Check the property index - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName2), customPropertyIndex, TEST_LOCATION); // Check the property type - DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex), propertyType2, TEST_LOCATION); // Check the property name - DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex), propertyName2, TEST_LOCATION); // Now add the child actor to the parent - customActor.Add( childActor ); + customActor.Add(childActor); // Check that the first child property now has the correct name as previously registered to the parent - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION); // Check that the child property index for the first child property can now be retrieved through its child property name - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION); // Check that the second child property now has the correct index as previously registered to the parent - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex2), propertyName2, TEST_LOCATION); // Check that the second child property can be accessed through both its custom property index and its child property index - DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetProperty(customPropertyIndex), 100, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetProperty(propertyIndex2), 100, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex), propertyType2, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex2), propertyType2, TEST_LOCATION); // Check that the child property index for the second child property can now be retrieved through its child property name - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName2), propertyIndex2, TEST_LOCATION); // Set the value for the third child property when the child actor is already added to the parent childActor.SetProperty(propertyIndex3, 0.15f); // Check that the third child property is dynamically created - DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION); // Check the third child property value - DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetProperty(propertyIndex3), 0.15f, TEST_LOCATION); // Check the third child property type - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex3), propertyType3, TEST_LOCATION); // Check the third child property name - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex3), propertyName3, TEST_LOCATION); // Check the third child property index. - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName3), propertyIndex3, TEST_LOCATION); // Create a custom property for the child with the same name as the fourth child property registered to the parent Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE); // Check that the custom property is created - DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION); // Check the fourth child property value - DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetProperty(propertyIndex4), 20, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetProperty(customPropertyIndex2), 20, TEST_LOCATION); // Check the fourth child property type - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex4), propertyType4, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex2), propertyType4, TEST_LOCATION); // Check the fourth child property name - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex4), propertyName4, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex2), propertyName4, TEST_LOCATION); // Check the fourth child property index. - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName4), propertyIndex4, TEST_LOCATION); // Now create another parent actor with different child properties registered - TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" ); - DALI_TEST_CHECK( typeInfo2 ); + TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyNamedActor"); + DALI_TEST_CHECK(typeInfo2); BaseHandle handle2 = typeInfo2.CreateInstance(); - DALI_TEST_CHECK( handle2 ); - Actor customActor2 = Actor::DownCast( handle2 ); - DALI_TEST_CHECK( customActor2 ); + DALI_TEST_CHECK(handle2); + Actor customActor2 = Actor::DownCast(handle2); + DALI_TEST_CHECK(customActor2); // Register child properties to the new parent - std::string newPropertyName( "newChildProp" ); - int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent - Property::Type newPropertyType( Property::VECTOR2 ); - ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType ); + std::string newPropertyName("newChildProp"); + int newPropertyIndex(CHILD_PROPERTY_REGISTRATION_START_INDEX); // The same index as the first child property "childProp1" in the old parent + Property::Type newPropertyType(Property::VECTOR2); + ChildPropertyRegistration newChildProperty(namedActorType, newPropertyName, newPropertyIndex, newPropertyType); - std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent - int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent - Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent - ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 ); + std::string newPropertyName2("childProp3"); // The same name as the third child property in the old parent + int newPropertyIndex2(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); // The same index as the second child property "childProp2" in the old parent + Property::Type newPropertyType2(Property::FLOAT); // The same type as the third child property in the old parent + ChildPropertyRegistration newChildProperty2(namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2); // Now move the child actor to the new parent - customActor2.Add( childActor ); + customActor2.Add(childActor); // "childProp1" is not a valid child property supported by the new parent, so nothing changed - DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION); // "childProp3" is a valid child property supported by the new parent // So it should get its new child property index and should just work - DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(newPropertyIndex2), newPropertyType2, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyName(newPropertyIndex2), newPropertyName2, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyIndex(newPropertyName2), newPropertyIndex2, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetProperty(newPropertyIndex2), 0.15f, TEST_LOCATION); // Now register a custom property called "newChildProp" - Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE); + Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2(10.0f, 10.0f), Property::READ_WRITE); // Check that the custom property is created - DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION ); + DALI_TEST_EQUALS(initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION); // This is a valid child property registered to the new parent // So should be able to access it through both its custom property index and its registered child property index - DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same - DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS(childActor.GetPropertyType(newPropertyIndex), newPropertyType, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex3), newPropertyType, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetPropertyName(newPropertyIndex), newPropertyName, TEST_LOCATION); // This should return the new name, although the child property index remains the same + DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex3), newPropertyName, TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetProperty(newPropertyIndex), Vector2(10.0f, 10.0f), TEST_LOCATION); + DALI_TEST_EQUALS(childActor.GetProperty(customPropertyIndex3), Vector2(10.0f, 10.0f), TEST_LOCATION); // Should return the child property index by given its name - DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION ); - + DALI_TEST_EQUALS(childActor.GetPropertyIndex(newPropertyName), newPropertyIndex, TEST_LOCATION); END_TEST; } @@ -1868,34 +1857,33 @@ int UtcDaliTypeRegistryChildPropertyRegistrationP(void) int UtcDaliTypeRegistryChildPropertyRegistrationN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Attempt to register a child property type out-of-bounds index (less than) try { - ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN ); - tet_result( TET_FAIL ); + ChildPropertyRegistration property1(customType1, "propName", CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } // Attempt to register a child property type out-of-bounds index (greater than) try { - ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN ); - tet_result( TET_FAIL ); + ChildPropertyRegistration property1(customType1, "propName", CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "(index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION); } END_TEST; } - /******************************************************************************* * * Action through the base handle @@ -1907,20 +1895,20 @@ int UtcDaliTypeRegistryActionViaBaseHandle(void) TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("Actor"); + DALI_TEST_CHECK(type); BaseHandle hdl = type.CreateInstance(); - DALI_TEST_CHECK( hdl ); + DALI_TEST_CHECK(hdl); Actor a = Actor::DownCast(hdl); - DALI_TEST_CHECK( a ); + DALI_TEST_CHECK(a); - a.SetProperty( Actor::Property::VISIBLE,false); + a.SetProperty(Actor::Property::VISIBLE, false); application.SendNotification(); application.Render(0); - DALI_TEST_CHECK(!a.GetCurrentProperty< bool >( Actor::Property::VISIBLE )); + DALI_TEST_CHECK(!a.GetCurrentProperty(Actor::Property::VISIBLE)); Property::Map attributes; @@ -1928,37 +1916,37 @@ int UtcDaliTypeRegistryActionViaBaseHandle(void) application.SendNotification(); application.Render(0); - DALI_TEST_CHECK(a.GetCurrentProperty< bool >( Actor::Property::VISIBLE )); + DALI_TEST_CHECK(a.GetCurrentProperty(Actor::Property::VISIBLE)); - DALI_TEST_CHECK(!hdl.DoAction("unknownAction", attributes)); + DALI_TEST_CHECK(!hdl.DoAction("unknownAction", attributes)); END_TEST; } int UtcDaliPropertyRegistrationFunctions(void) { TestApplication application; - int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10; + int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10; // Attempt to register a property without a setter try { - PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, &GetProperty ); - tet_result( TET_PASS ); + PropertyRegistration property1(customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, &GetProperty); + tet_result(TET_PASS); } - catch ( DaliException& e ) + catch(DaliException& e) { - tet_result( TET_FAIL ); + tet_result(TET_FAIL); } // Attempt to register a property without a getter try { - PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, NULL ); - tet_result( TET_FAIL ); + PropertyRegistration property1(customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, NULL); + tet_result(TET_FAIL); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "! \"GetProperty", TEST_LOCATION); } END_TEST; } @@ -1966,34 +1954,34 @@ int UtcDaliPropertyRegistrationFunctions(void) int UtcDaliPropertyRegistrationAddSameIndex(void) { TestApplication application; - int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100; + int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100; // Add one property with a valid property index - PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty ); + PropertyRegistration property1(customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty); // Attempt to add another property with the same index try { - PropertyRegistration property2( customType1, "propName2", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty ); + PropertyRegistration property2(customType1, "propName2", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "! \"Property index already added", TEST_LOCATION); } int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100; // Add one property with a valid property index - AnimatablePropertyRegistration property3( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN ); + AnimatablePropertyRegistration property3(customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN); // Attempt to add another property with the same index try { - AnimatablePropertyRegistration property4( customType1, "animPropName2", animatablePropertyIndex, Property::BOOLEAN ); + AnimatablePropertyRegistration property4(customType1, "animPropName2", animatablePropertyIndex, Property::BOOLEAN); } - catch ( DaliException& e ) + catch(DaliException& e) { - DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "! \"Property index already added", TEST_LOCATION); } END_TEST; } @@ -2001,40 +1989,39 @@ int UtcDaliPropertyRegistrationAddSameIndex(void) int UtcDaliPropertyRegistrationPropertyWritableP(void) { TestApplication application; - int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200; - int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201; + int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200; + int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201; // Add two properties, one with SetProperty, one without - PropertyRegistration property1( customType1, "propNameReadwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty ); - PropertyRegistration property2( customType1, "propNameReadonly", propertyIndex2, Property::BOOLEAN, NULL, &GetProperty ); + PropertyRegistration property1(customType1, "propNameReadwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty); + PropertyRegistration property2(customType1, "propNameReadonly", propertyIndex2, Property::BOOLEAN, NULL, &GetProperty); // Create custom-actor - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); // Check whether properties are writable - DALI_TEST_CHECK( customActor.IsPropertyWritable( propertyIndex1 ) ); - DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) ); - + DALI_TEST_CHECK(customActor.IsPropertyWritable(propertyIndex1)); + DALI_TEST_CHECK(!customActor.IsPropertyWritable(propertyIndex2)); // Check the property is writable in the type registry - Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); + Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo); - DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(typeInfoImpl.IsPropertyWritable(propertyIndex1), true, TEST_LOCATION); END_TEST; } int UtcDaliPropertyRegistrationPropertyWritableN(void) { - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) ); - Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo ); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor)); + Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo); - DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR), true, TEST_LOCATION ); + DALI_TEST_EQUALS(typeInfoImpl.IsPropertyWritable(Actor::Property::COLOR), true, TEST_LOCATION); END_TEST; } @@ -2042,98 +2029,97 @@ int UtcDaliPropertyRegistrationPropertyWritableN(void) int UtcDaliPropertyRegistrationPropertyAnimatable(void) { TestApplication application; - int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400; - int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400; + int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400; + int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400; // These properties are not animatable - PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty ); + PropertyRegistration property1(customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty); // These properties are animatable - AnimatablePropertyRegistration property2( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN ); + AnimatablePropertyRegistration property2(customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN); // Create custom-actor - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); // Check if animatable - DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) ); - DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) ); + DALI_TEST_CHECK(!customActor.IsPropertyAnimatable(propertyIndex)); + DALI_TEST_CHECK(customActor.IsPropertyAnimatable(animatablePropertyIndex)); // Create another instance of custom-actor BaseHandle handle2 = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle2 ); - Actor customActor2 = Actor::DownCast( handle2 ); - DALI_TEST_CHECK( customActor2 ); + DALI_TEST_CHECK(handle2); + Actor customActor2 = Actor::DownCast(handle2); + DALI_TEST_CHECK(customActor2); // Check if animatable - DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) ); - DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) ); + DALI_TEST_CHECK(!customActor2.IsPropertyAnimatable(propertyIndex)); + DALI_TEST_CHECK(customActor2.IsPropertyAnimatable(animatablePropertyIndex)); END_TEST; } int UtcDaliPropertyRegistrationUnregisteredGetAndSet(void) { TestApplication application; - int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000; - int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000; + int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000; + int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000; // Create custom-actor - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); // Try to set an index that hasn't been registered, this is a no-op for now, to be fixed in future - customActor.SetProperty( propertyIndex, true ); -// DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get(), TEST_LOCATION); + customActor.SetProperty(propertyIndex, true); + // DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get(), TEST_LOCATION); // Try to set an index that hasn't been registered - customActor.SetProperty( animatablePropertyIndex, true ); - DALI_TEST_EQUALS( true, customActor.GetProperty( animatablePropertyIndex ).Get(), TEST_LOCATION); + customActor.SetProperty(animatablePropertyIndex, true); + DALI_TEST_EQUALS(true, customActor.GetProperty(animatablePropertyIndex).Get(), TEST_LOCATION); END_TEST; } - int UtcDaliLongPressGestureDetectorTypeRegistry(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("LongPressGestureDetector"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle ); - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(handle); + LongPressGestureDetector detector = LongPressGestureDetector::DownCast(handle); + DALI_TEST_CHECK(detector); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); detector.Attach(actor); // Connect to signal through type - handle.ConnectSignal( &application, "longPressDetected", functor ); + handle.ConnectSignal(&application, "longPressDetected", functor); // Render and notify application.SendNotification(); application.Render(); // Emit gesture - TestGenerateLongPress( application, 50.0f, 10.0f ); - TestEndLongPress( application, 50.0f, 10.0f ); + TestGenerateLongPress(application, 50.0f, 10.0f); + TestEndLongPress(application, 50.0f, 10.0f); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; @@ -2144,33 +2130,33 @@ int UtcDaliPanGestureDetectorTypeRegistry(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("PanGestureDetector"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - PanGestureDetector detector = PanGestureDetector::DownCast( handle ); - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(handle); + PanGestureDetector detector = PanGestureDetector::DownCast(handle); + DALI_TEST_CHECK(detector); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); detector.Attach(actor); // Connect to signal through type - handle.ConnectSignal( &application, "panDetected", functor ); + handle.ConnectSignal(&application, "panDetected", functor); // Render and notify application.SendNotification(); application.Render(); // Emit gesture - TestGenerateMiniPan( application ); + TestGenerateMiniPan(application); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; } @@ -2180,33 +2166,33 @@ int UtcDaliPinchGestureDetectorTypeRegistry(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("PinchGestureDetector"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - PinchGestureDetector detector = PinchGestureDetector::DownCast( handle ); - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(handle); + PinchGestureDetector detector = PinchGestureDetector::DownCast(handle); + DALI_TEST_CHECK(detector); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); detector.Attach(actor); // Connect to signal through type - handle.ConnectSignal( &application, "pinchDetected", functor ); + handle.ConnectSignal(&application, "pinchDetected", functor); // Render and notify application.SendNotification(); application.Render(); // Emit gesture - TestGeneratePinch( application ); + TestGeneratePinch(application); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; @@ -2217,33 +2203,33 @@ int UtcDaliRotationGestureDetectorTypeRegistry(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "RotationGestureDetector" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("RotationGestureDetector"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - RotationGestureDetector detector = RotationGestureDetector::DownCast( handle ); - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(handle); + RotationGestureDetector detector = RotationGestureDetector::DownCast(handle); + DALI_TEST_CHECK(detector); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); detector.Attach(actor); // Connect to signal through type - handle.ConnectSignal( &application, "rotationDetected", functor ); + handle.ConnectSignal(&application, "rotationDetected", functor); // Render and notify application.SendNotification(); application.Render(); // Emit gesture - TestGenerateRotation( application ); + TestGenerateRotation(application); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; @@ -2254,33 +2240,33 @@ int UtcDaliTapGestureDetectorTypeRegistry(void) TestApplication application; Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Register Type TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" ); - DALI_TEST_CHECK( type ); + type = TypeRegistry::Get().GetTypeInfo("TapGestureDetector"); + DALI_TEST_CHECK(type); BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - TapGestureDetector detector = TapGestureDetector::DownCast( handle ); - DALI_TEST_CHECK( detector ); + DALI_TEST_CHECK(handle); + TapGestureDetector detector = TapGestureDetector::DownCast(handle); + DALI_TEST_CHECK(detector); // Attach actor to detector - SignalData data; - GestureReceivedFunctor functor( data ); + SignalData data; + GestureReceivedFunctor functor(data); detector.Attach(actor); // Connect to signal through type - handle.ConnectSignal( &application, "tapDetected", functor ); + handle.ConnectSignal(&application, "tapDetected", functor); // Render and notify application.SendNotification(); application.Render(); // Emit gesture - TestGenerateTap( application, 50.0, 10.0, 100 ); + TestGenerateTap(application, 50.0, 10.0, 100); DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION); END_TEST; @@ -2289,58 +2275,54 @@ int UtcDaliTapGestureDetectorTypeRegistry(void) int UtcDaliTypeRegistryNamedType(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); // Create a normal actor - BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance(); - DALI_TEST_CHECK( actorHandle ); - Actor actor( Actor::DownCast( actorHandle ) ); - DALI_TEST_CHECK( actor ); - unsigned int actorPropertyCount( actor.GetPropertyCount() ); + BaseHandle actorHandle = typeRegistry.GetTypeInfo("Actor").CreateInstance(); + DALI_TEST_CHECK(actorHandle); + Actor actor(Actor::DownCast(actorHandle)); + DALI_TEST_CHECK(actor); + unsigned int actorPropertyCount(actor.GetPropertyCount()); // Create Named Actor Type - BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance(); - DALI_TEST_CHECK( namedHandle ); - Actor namedActor( Actor::DownCast( namedHandle ) ); - DALI_TEST_CHECK( namedActor ); - unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() ); + BaseHandle namedHandle = typeRegistry.GetTypeInfo("MyNamedActor").CreateInstance(); + DALI_TEST_CHECK(namedHandle); + Actor namedActor(Actor::DownCast(namedHandle)); + DALI_TEST_CHECK(namedActor); + unsigned int namedActorPropertyCount(namedActor.GetPropertyCount()); - DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount ); + DALI_TEST_CHECK(namedActorPropertyCount > actorPropertyCount); END_TEST; } int UtcDaliTypeInfoGetActionNameP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); - DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() ); + DALI_TEST_CHECK(0 != typeInfo.GetActionCount()); std::string name = typeInfo.GetActionName(0); - DALI_TEST_EQUALS( name, "show", TEST_LOCATION ); - + DALI_TEST_EQUALS(name, "show", TEST_LOCATION); - TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" ); + TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyTestCustomActor"); // search for show action in base class, given a derived class bool foundChildAction = false; - for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ ) + for(std::size_t i = 0; i < typeInfo2.GetActionCount(); i++) { - - std::string name = typeInfo2.GetActionName( i ); - if( name == "show") - { - foundChildAction = true; - } - + std::string name = typeInfo2.GetActionName(i); + if(name == "show") + { + foundChildAction = true; + } } - DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION ); - + DALI_TEST_EQUALS(foundChildAction, true, TEST_LOCATION); END_TEST; } @@ -2348,16 +2330,16 @@ int UtcDaliTypeInfoGetActionNameP(void) int UtcDaliTypeInfoGetActionNameN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); - DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() ); + DALI_TEST_CHECK(0 != typeInfo.GetActionCount()); std::string name = typeInfo.GetActionName(std::numeric_limits::max()); - DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, name.size(), TEST_LOCATION); END_TEST; } @@ -2365,31 +2347,31 @@ int UtcDaliTypeInfoGetActionNameN(void) int UtcDaliTypeInfoGetSignalNameP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); - DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() ); + DALI_TEST_CHECK(0 != typeInfo.GetSignalCount()); std::string name = typeInfo.GetSignalName(0); - DALI_TEST_EQUALS( name, "hovered", TEST_LOCATION ); + DALI_TEST_EQUALS(name, "hovered", TEST_LOCATION); - TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" ); + TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyTestCustomActor"); // search for signal in base class, given a derived class bool foundSignal = false; - for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ ) + for(std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++) { - std::string name = typeInfo2.GetSignalName( i ); - if( name == "hovered") + std::string name = typeInfo2.GetSignalName(i); + if(name == "hovered") { foundSignal = true; } } - DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION ); + DALI_TEST_EQUALS(foundSignal, true, TEST_LOCATION); END_TEST; } @@ -2397,36 +2379,35 @@ int UtcDaliTypeInfoGetSignalNameP(void) int UtcDaliTypeInfoGetSignalNameN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); - DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() ); + DALI_TEST_CHECK(0 != typeInfo.GetSignalCount()); std::string name = typeInfo.GetSignalName(std::numeric_limits::max()); - DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION ); + DALI_TEST_EQUALS(0u, name.size(), TEST_LOCATION); END_TEST; } - int UtcDaliTypeInfoGetCreatorP(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); TypeInfo::CreateFunction createFn = typeInfo.GetCreator(); - DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION ); - if( createFn ) + DALI_TEST_EQUALS(createFn != NULL, true, TEST_LOCATION); + if(createFn) { // try calling it: BaseHandle handle = createFn(); - DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)handle, true, TEST_LOCATION); } END_TEST; @@ -2435,13 +2416,13 @@ int UtcDaliTypeInfoGetCreatorP(void) int UtcDaliTypeInfoGetCreatorN(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("MyTestCustomActor3"); + DALI_TEST_CHECK(typeInfo); TypeInfo::CreateFunction createFn = typeInfo.GetCreator(); - DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION ); + DALI_TEST_EQUALS(createFn == NULL, true, TEST_LOCATION); END_TEST; } @@ -2449,29 +2430,29 @@ int UtcDaliTypeInfoGetCreatorN(void) int UtcDaliTypeInfoGetPropertyCountP1(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor"); + DALI_TEST_CHECK(typeInfo); size_t actorPropertyCount = typeInfo.GetPropertyCount(); - DALI_TEST_EQUALS( actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION ); // No event only props + DALI_TEST_EQUALS(actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION); // No event only props END_TEST; } int UtcDaliTypeInfoGetPropertyCountP2(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" ); - DALI_TEST_CHECK( typeInfo ); - size_t propertyCount = typeInfo.GetPropertyCount(); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("MyTestCustomActor2"); + DALI_TEST_CHECK(typeInfo); + size_t propertyCount = typeInfo.GetPropertyCount(); Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); + typeInfo.GetPropertyIndices(indices); - DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION ); + DALI_TEST_EQUALS(propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION); + DALI_TEST_EQUALS(propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION); END_TEST; } @@ -2479,39 +2460,39 @@ int UtcDaliTypeInfoGetPropertyCountP2(void) int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Register a type registered animatable property and ensure set/get behaviour works synchronously" ); + tet_infoline("Register a type registered animatable property and ensure set/get behaviour works synchronously"); // Register animatable property - const int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - AnimatablePropertyRegistration animatableProperty( customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT ); + const int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + AnimatablePropertyRegistration animatableProperty(customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - tet_infoline( "Set the value and ensure it changes straight away" ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION ); - customActor.SetProperty( animatablePropertyIndex, 25.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION ); + tet_infoline("Set the value and ensure it changes straight away"); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 0.0f, TEST_LOCATION); + customActor.SetProperty(animatablePropertyIndex, 25.0f); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 25.0f, TEST_LOCATION); - tet_infoline( "Check latest scene-graph value is unchanged" ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION ); + tet_infoline("Check latest scene-graph value is unchanged"); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 0.0f, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); - tet_infoline( "Check values after rendering and both retrieval methods should return the latest" ); + tet_infoline("Check values after rendering and both retrieval methods should return the latest"); - DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetProperty(animatablePropertyIndex), 25.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(animatablePropertyIndex), 25.0f, TEST_LOCATION); END_TEST; } @@ -2519,64 +2500,64 @@ int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void) int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector2(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" ); + tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set"); // Register the animatable propeties - const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - const int componentZeroPropertyIndex( basePropertyIndex + 1 ); - const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 ); - AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector2( 13.0f, 24.0f ) ); - AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 ); - AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 ); + const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + const int componentZeroPropertyIndex(basePropertyIndex + 1); + const int componentOnePropertyIndex(componentZeroPropertyIndex + 1); + AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector2(13.0f, 24.0f)); + AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0); + AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - tet_infoline( "Get the component values, they should be the default value of the base-property" ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION ); + tet_infoline("Get the component values, they should be the default value of the base-property"); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector2(13.0f, 24.0f), TEST_LOCATION); - tet_infoline( "Set a component value and ensure it changes for the base property as well" ); - customActor.SetProperty( componentZeroPropertyIndex, 125.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 24.0f ), TEST_LOCATION ); + tet_infoline("Set a component value and ensure it changes for the base property as well"); + customActor.SetProperty(componentZeroPropertyIndex, 125.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector2(125.0f, 24.0f), TEST_LOCATION); - customActor.SetProperty( componentOnePropertyIndex, 225.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION ); + customActor.SetProperty(componentOnePropertyIndex, 225.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION); - tet_infoline( "Check latest scene-graph value is unchanged" ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); + tet_infoline("Check latest scene-graph value is unchanged"); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector2(13.0f, 24.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); - tet_infoline( "Check values after rendering and both retrieval methods should return the latest" ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); + tet_infoline("Check values after rendering and both retrieval methods should return the latest"); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); - tet_infoline( "Set the base property value and ensure the component values reflect the change" ); - customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 1.0f, 2.0f ), TEST_LOCATION ); + tet_infoline("Set the base property value and ensure the component values reflect the change"); + customActor.SetProperty(basePropertyIndex, Vector2(1.0f, 2.0f)); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector2(1.0f, 2.0f), TEST_LOCATION); END_TEST; } @@ -2584,75 +2565,75 @@ int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponents int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector3(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" ); + tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set"); // Register the animatable propeties - const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - const int componentZeroPropertyIndex( basePropertyIndex + 1 ); - const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 ); - const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 ); - AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector3( 13.0f, 24.0f, 35.0 ) ); - AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 ); - AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 ); - AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 ); + const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + const int componentZeroPropertyIndex(basePropertyIndex + 1); + const int componentOnePropertyIndex(componentZeroPropertyIndex + 1); + const int componentTwoPropertyIndex(componentOnePropertyIndex + 1); + AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector3(13.0f, 24.0f, 35.0)); + AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0); + AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1); + AnimatablePropertyComponentRegistration componentTwoAnimatableProperty(customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - tet_infoline( "Get the component values, they should be the default value of the base-property" ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION ); + tet_infoline("Get the component values, they should be the default value of the base-property"); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 35.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(13.0f, 24.0f, 35.0f), TEST_LOCATION); - tet_infoline( "Set a component value and ensure it changes for the base property as well" ); - customActor.SetProperty( componentZeroPropertyIndex, 125.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 24.0f, 35.0f ), TEST_LOCATION ); + tet_infoline("Set a component value and ensure it changes for the base property as well"); + customActor.SetProperty(componentZeroPropertyIndex, 125.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(125.0f, 24.0f, 35.0f), TEST_LOCATION); - customActor.SetProperty( componentOnePropertyIndex, 225.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 35.0f ), TEST_LOCATION ); + customActor.SetProperty(componentOnePropertyIndex, 225.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(125.0f, 225.0f, 35.0f), TEST_LOCATION); - customActor.SetProperty( componentTwoPropertyIndex, 325.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION ); + customActor.SetProperty(componentTwoPropertyIndex, 325.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION); - tet_infoline( "Check latest scene-graph value is unchanged" ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION ); + tet_infoline("Check latest scene-graph value is unchanged"); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector3(13.0f, 24.0f, 35.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentTwoPropertyIndex), 35.0f, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); - tet_infoline( "Check values after rendering and both retrieval methods should return the latest" ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); + tet_infoline("Check values after rendering and both retrieval methods should return the latest"); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); - tet_infoline( "Set the base property value and ensure the component values reflect the change" ); - customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 1.0f, 2.0f, 3.0f ), TEST_LOCATION ); + tet_infoline("Set the base property value and ensure the component values reflect the change"); + customActor.SetProperty(basePropertyIndex, Vector3(1.0f, 2.0f, 3.0f)); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector3(1.0f, 2.0f, 3.0f), TEST_LOCATION); END_TEST; } @@ -2660,222 +2641,215 @@ int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponents int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector4(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" ); + tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set"); // Register the animatable propeties - const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ); - const int componentZeroPropertyIndex( basePropertyIndex + 1 ); - const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 ); - const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 ); - const int componentThreePropertyIndex( componentTwoPropertyIndex + 1 ); - AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector4( 13.0f, 24.0f, 35.0, 47.0f ) ); - AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 ); - AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 ); - AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 ); - AnimatablePropertyComponentRegistration componentThreeAnimatableProperty( customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3 ); + const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX); + const int componentZeroPropertyIndex(basePropertyIndex + 1); + const int componentOnePropertyIndex(componentZeroPropertyIndex + 1); + const int componentTwoPropertyIndex(componentOnePropertyIndex + 1); + const int componentThreePropertyIndex(componentTwoPropertyIndex + 1); + AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector4(13.0f, 24.0f, 35.0, 47.0f)); + AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0); + AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1); + AnimatablePropertyComponentRegistration componentTwoAnimatableProperty(customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2); + AnimatablePropertyComponentRegistration componentThreeAnimatableProperty(customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3); // Check property count before property registration - TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); - Actor customActor = Actor::DownCast( handle ); - DALI_TEST_CHECK( customActor ); + DALI_TEST_CHECK(handle); + Actor customActor = Actor::DownCast(handle); + DALI_TEST_CHECK(customActor); application.GetScene().Add(customActor); - tet_infoline( "Get the component values, they should be the default value of the base-property" ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION ); - - tet_infoline( "Set a component value and ensure it changes for the base property as well" ); - customActor.SetProperty( componentZeroPropertyIndex, 125.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION ); - - customActor.SetProperty( componentOnePropertyIndex, 225.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 35.0f, 47.0f ), TEST_LOCATION ); - - customActor.SetProperty( componentTwoPropertyIndex, 325.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 47.0f ), TEST_LOCATION ); - - customActor.SetProperty( componentThreePropertyIndex, 435.0f ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION ); - - tet_infoline( "Check latest scene-graph value is unchanged" ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION ); + tet_infoline("Get the component values, they should be the default value of the base-property"); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 35.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentThreePropertyIndex), 47.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(13.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION); + + tet_infoline("Set a component value and ensure it changes for the base property as well"); + customActor.SetProperty(componentZeroPropertyIndex, 125.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(125.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION); + + customActor.SetProperty(componentOnePropertyIndex, 225.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(125.0f, 225.0f, 35.0f, 47.0f), TEST_LOCATION); + + customActor.SetProperty(componentTwoPropertyIndex, 325.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 47.0f), TEST_LOCATION); + + customActor.SetProperty(componentThreePropertyIndex, 435.0f); + DALI_TEST_EQUALS(customActor.GetProperty(componentThreePropertyIndex), 435.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION); + + tet_infoline("Check latest scene-graph value is unchanged"); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector4(13.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 13.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 24.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentTwoPropertyIndex), 35.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentThreePropertyIndex), 47.0f, TEST_LOCATION); // Render and notify application.SendNotification(); application.Render(); - tet_infoline( "Check values after rendering and both retrieval methods should return the latest" ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION ); + tet_infoline("Check values after rendering and both retrieval methods should return the latest"); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentThreePropertyIndex), 435.0f, TEST_LOCATION); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentZeroPropertyIndex), 125.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentOnePropertyIndex), 225.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentTwoPropertyIndex), 325.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetCurrentProperty(componentThreePropertyIndex), 435.0f, TEST_LOCATION); - tet_infoline( "Set the base property value and ensure the component values reflect the change" ); - customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 4.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 1.0f, 2.0f, 3.0f, 4.0f ), TEST_LOCATION ); + tet_infoline("Set the base property value and ensure the component values reflect the change"); + customActor.SetProperty(basePropertyIndex, Vector4(1.0f, 2.0f, 3.0f, 4.0f)); + DALI_TEST_EQUALS(customActor.GetProperty(componentZeroPropertyIndex), 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentOnePropertyIndex), 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentTwoPropertyIndex), 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(componentThreePropertyIndex), 4.0f, TEST_LOCATION); + DALI_TEST_EQUALS(customActor.GetProperty(basePropertyIndex), Vector4(1.0f, 2.0f, 3.0f, 4.0f), TEST_LOCATION); END_TEST; } - int UtcDaliTypeInfoRegisterChildProperties01(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Register child properties on a type via name" ); + tet_infoline("Register child properties on a type via name"); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); - auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( customActorTypeInfo ); - DALI_TEST_CHECK( myCustomTypeInfo ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor)); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(customActorTypeInfo); + DALI_TEST_CHECK(myCustomTypeInfo); - const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); - const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS); auto customActor = MyTestCustomActor::New(); - application.GetScene().Add( customActor ); + application.GetScene().Add(customActor); auto child = Actor::New(); - customActor.Add( child ); + customActor.Add(child); - child.SetProperty( WIDTH_SPECIFICATION, 33 ); + child.SetProperty(WIDTH_SPECIFICATION, 33); - auto value = child.GetProperty( WIDTH_SPECIFICATION ); - DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION ); + auto value = child.GetProperty(WIDTH_SPECIFICATION); + DALI_TEST_EQUALS(value, Property::Value(33), TEST_LOCATION); - child.SetProperty( HEIGHT_SPECIFICATION, 44 ); - value = child.GetProperty( HEIGHT_SPECIFICATION ); - DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION ); + child.SetProperty(HEIGHT_SPECIFICATION, 44); + value = child.GetProperty(HEIGHT_SPECIFICATION); + DALI_TEST_EQUALS(value, Property::Value(44), TEST_LOCATION); - child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) ); - value = child.GetProperty( MARGIN_SPECIFICATION ); - DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION ); + child.SetProperty(MARGIN_SPECIFICATION, Extents(10, 10, 10, 10)); + value = child.GetProperty(MARGIN_SPECIFICATION); + DALI_TEST_EQUALS(value, Property::Value(Extents(10, 10, 10, 10)), TEST_LOCATION); END_TEST; } - int UtcDaliTypeInfoRegisterChildProperties02(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); - - tet_infoline( "Register child properties on a type via name" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); - auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( customActorTypeInfo ); - DALI_TEST_CHECK( myCustomTypeInfo ); + tet_infoline("Register child properties on a type via name"); - const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); - const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor)); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(customActorTypeInfo); + DALI_TEST_CHECK(myCustomTypeInfo); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS); - auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" ); - DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION ); + auto index = customActorTypeInfo.GetChildPropertyIndex("widthSpecification"); + DALI_TEST_EQUALS(index, WIDTH_SPECIFICATION, TEST_LOCATION); - index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" ); - DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION ); + index = customActorTypeInfo.GetChildPropertyIndex("heightSpecification"); + DALI_TEST_EQUALS(index, HEIGHT_SPECIFICATION, TEST_LOCATION); - index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" ); - DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION ); + index = customActorTypeInfo.GetChildPropertyIndex("marginSpecification"); + DALI_TEST_EQUALS(index, Property::INVALID_INDEX, TEST_LOCATION); - index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" ); - DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION ); + index = myCustomTypeInfo.GetChildPropertyIndex("marginSpecification"); + DALI_TEST_EQUALS(index, MARGIN_SPECIFICATION, TEST_LOCATION); + auto name = customActorTypeInfo.GetChildPropertyName(WIDTH_SPECIFICATION); + DALI_TEST_EQUALS(name, "widthSpecification", TEST_LOCATION); - auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION ); - DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION ); + name = customActorTypeInfo.GetChildPropertyName(HEIGHT_SPECIFICATION); + DALI_TEST_EQUALS(name, "heightSpecification", TEST_LOCATION); - name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION ); - DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION ); + name = myCustomTypeInfo.GetChildPropertyName(MARGIN_SPECIFICATION); + DALI_TEST_EQUALS(name, "marginSpecification", TEST_LOCATION); - name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION ); - DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION ); + auto type = customActorTypeInfo.GetChildPropertyType(WIDTH_SPECIFICATION); + DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION); + type = customActorTypeInfo.GetChildPropertyType(HEIGHT_SPECIFICATION); + DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION); - auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION ); - DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION ); - - type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION ); - DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION ); - - type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION ); - DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION ); - + type = myCustomTypeInfo.GetChildPropertyType(MARGIN_SPECIFICATION); + DALI_TEST_EQUALS(type, Property::EXTENTS, TEST_LOCATION); END_TEST; } - int UtcDaliTypeInfoRegisterChildProperties03(void) { TestApplication application; - TypeRegistry typeRegistry = TypeRegistry::Get(); + TypeRegistry typeRegistry = TypeRegistry::Get(); - tet_infoline( "Check registered child properties can be retrieved" ); + tet_infoline("Check registered child properties can be retrieved"); - auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); - auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); - DALI_TEST_CHECK( customActorTypeInfo ); - DALI_TEST_CHECK( myCustomTypeInfo ); + auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor)); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor)); + DALI_TEST_CHECK(customActorTypeInfo); + DALI_TEST_CHECK(myCustomTypeInfo); - const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); - const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); - const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX); + const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); - ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER); + ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS); Property::IndexContainer indices; - myCustomTypeInfo.GetChildPropertyIndices( indices ); + myCustomTypeInfo.GetChildPropertyIndices(indices); - auto result = std::find( indices.Begin(), indices.End(), WIDTH_SPECIFICATION ); - DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + auto result = std::find(indices.Begin(), indices.End(), WIDTH_SPECIFICATION); + DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION); - result = std::find( indices.Begin(), indices.End(), HEIGHT_SPECIFICATION ); - DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + result = std::find(indices.Begin(), indices.End(), HEIGHT_SPECIFICATION); + DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION); - result = std::find( indices.Begin(), indices.End(), MARGIN_SPECIFICATION ); - DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + result = std::find(indices.Begin(), indices.End(), MARGIN_SPECIFICATION); + DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION); END_TEST; } @@ -2883,7 +2857,7 @@ int UtcDaliTypeInfoRegisterChildProperties03(void) int UtcDaliTypeInfoGetActionNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { unsigned long arg1(0u); @@ -2900,7 +2874,7 @@ int UtcDaliTypeInfoGetActionNameNegative(void) int UtcDaliTypeInfoGetSignalNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { unsigned long arg1(0u); @@ -2917,7 +2891,7 @@ int UtcDaliTypeInfoGetSignalNameNegative(void) int UtcDaliTypeInfoGetCreatorNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetCreator(); @@ -2933,7 +2907,7 @@ int UtcDaliTypeInfoGetCreatorNegative(void) int UtcDaliTypeInfoGetBaseNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetBaseName(); @@ -2949,7 +2923,7 @@ int UtcDaliTypeInfoGetBaseNameNegative(void) int UtcDaliTypeInfoCreateInstanceNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.CreateInstance(); @@ -2965,7 +2939,7 @@ int UtcDaliTypeInfoCreateInstanceNegative(void) int UtcDaliTypeInfoGetActionCountNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetActionCount(); @@ -2981,7 +2955,7 @@ int UtcDaliTypeInfoGetActionCountNegative(void) int UtcDaliTypeInfoGetSignalCountNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetSignalCount(); @@ -2997,7 +2971,7 @@ int UtcDaliTypeInfoGetSignalCountNegative(void) int UtcDaliTypeInfoGetPropertyNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { int arg1(0); @@ -3014,7 +2988,7 @@ int UtcDaliTypeInfoGetPropertyNameNegative(void) int UtcDaliTypeInfoGetPropertyCountNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetPropertyCount(); @@ -3030,7 +3004,7 @@ int UtcDaliTypeInfoGetPropertyCountNegative(void) int UtcDaliTypeInfoGetPropertyIndicesNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { Dali::Vector arg1; @@ -3047,7 +3021,7 @@ int UtcDaliTypeInfoGetPropertyIndicesNegative(void) int UtcDaliTypeInfoGetChildPropertyNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { int arg1(0); @@ -3064,7 +3038,7 @@ int UtcDaliTypeInfoGetChildPropertyNameNegative(void) int UtcDaliTypeInfoGetChildPropertyTypeNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { int arg1(0); @@ -3081,7 +3055,7 @@ int UtcDaliTypeInfoGetChildPropertyTypeNegative(void) int UtcDaliTypeInfoGetChildPropertyIndexNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { std::string arg1; @@ -3098,7 +3072,7 @@ int UtcDaliTypeInfoGetChildPropertyIndexNegative(void) int UtcDaliTypeInfoGetChildPropertyIndicesNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { Dali::Vector arg1; @@ -3115,7 +3089,7 @@ int UtcDaliTypeInfoGetChildPropertyIndicesNegative(void) int UtcDaliTypeInfoGetNameNegative(void) { TestApplication application; - Dali::TypeInfo instance; + Dali::TypeInfo instance; try { instance.GetName(); @@ -3130,7 +3104,7 @@ int UtcDaliTypeInfoGetNameNegative(void) int UtcDaliTypeRegistryGetTypeInfoNegative01(void) { - TestApplication application; + TestApplication application; Dali::TypeRegistry instance; try { @@ -3147,7 +3121,7 @@ int UtcDaliTypeRegistryGetTypeInfoNegative01(void) int UtcDaliTypeRegistryGetTypeInfoNegative02(void) { - TestApplication application; + TestApplication application; Dali::TypeRegistry instance; try { @@ -3163,7 +3137,7 @@ int UtcDaliTypeRegistryGetTypeInfoNegative02(void) int UtcDaliTypeRegistryGetTypeNameNegative(void) { - TestApplication application; + TestApplication application; Dali::TypeRegistry instance; try { @@ -3180,7 +3154,7 @@ int UtcDaliTypeRegistryGetTypeNameNegative(void) int UtcDaliTypeRegistryGetTypeNameCountNegative(void) { - TestApplication application; + TestApplication application; Dali::TypeRegistry instance; try { diff --git a/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp b/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp index eb19a5e..38a3f06 100644 --- a/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp +++ b/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp @@ -15,20 +15,20 @@ * */ -#include - -#include -#include #include +#include +#include + +#include using namespace Dali; namespace { /// Compare a uint16_t value with an unsigned int -void DALI_TEST_EQUALS( uint16_t value1, unsigned int value2, const char* location ) +void DALI_TEST_EQUALS(uint16_t value1, unsigned int value2, const char* location) { - ::DALI_TEST_EQUALS< uint16_t >( value1, static_cast< uint16_t >( value2 ), location ); + ::DALI_TEST_EQUALS(value1, static_cast(value2), location); } } // unnamed namespace @@ -36,175 +36,175 @@ int UtcDaliUint16PairConstructor01P(void) { Uint16Pair v; - DALI_TEST_EQUALS( v.GetX(), 0u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS(v.GetX(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 0u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairConstructor02P(void) { - Uint16Pair v( 10u, 10u ); + Uint16Pair v(10u, 10u); - DALI_TEST_EQUALS( v.GetX(), 10u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 10u, TEST_LOCATION ); + DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairCopyConstructor(void) { - Uint16Pair u( 5u, 5u ); - Uint16Pair v( u ); - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); + Uint16Pair u(5u, 5u); + Uint16Pair v(u); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairMoveConstructor(void) { - Uint16Pair u( 5u, 5u ); - Uint16Pair v = std::move( u ); - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); + Uint16Pair u(5u, 5u); + Uint16Pair v = std::move(u); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairCopyAssignment(void) { - Uint16Pair u( 5u, 5u ); + Uint16Pair u(5u, 5u); Uint16Pair v; v = u; - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairMoveAssignment(void) { - Uint16Pair u( 5u, 5u ); + Uint16Pair u(5u, 5u); Uint16Pair v; - v = std::move( u ); - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); + v = std::move(u); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairGetWidthP(void) { - Uint16Pair v( 5u ,5u ); - DALI_TEST_EQUALS( v.GetWidth(), 5u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairGetHeightP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetHeight(), 5u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairGetXP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairGetYP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairSetXP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION ); - v.SetX( 10u ); - DALI_TEST_EQUALS( v.GetX(), 10u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION); + v.SetX(10u); + DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairSetWidthP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetWidth(), 5u, TEST_LOCATION ); - v.SetWidth( 10u ); - DALI_TEST_EQUALS( v.GetWidth(), 10u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION); + v.SetWidth(10u); + DALI_TEST_EQUALS(v.GetWidth(), 10u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairSetYP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION ); - v.SetY( 10u ); - DALI_TEST_EQUALS( v.GetY(), 10u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION); + v.SetY(10u); + DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairSetHeightP(void) { - Uint16Pair v( 5u, 5u ); - DALI_TEST_EQUALS( v.GetHeight(), 5u, TEST_LOCATION ); - v.SetHeight( 10u ); - DALI_TEST_EQUALS( v.GetHeight(), 10u, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION); + v.SetHeight(10u); + DALI_TEST_EQUALS(v.GetHeight(), 10u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairEqualsP(void) { - Uint16Pair v( 5u, 5u ); - Uint16Pair u( 5u, 5u ); - DALI_TEST_EQUALS( v == u, true, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + Uint16Pair u(5u, 5u); + DALI_TEST_EQUALS(v == u, true, TEST_LOCATION); - v = Uint16Pair( 5u, 4u ); - u = Uint16Pair( 5u, 5u ); - DALI_TEST_EQUALS( v == u, false, TEST_LOCATION ); + v = Uint16Pair(5u, 4u); + u = Uint16Pair(5u, 5u); + DALI_TEST_EQUALS(v == u, false, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairNotEqualsP(void) { - Uint16Pair v( 5u, 5u ); - Uint16Pair u( 5u, 5u ); - DALI_TEST_EQUALS( v != u, false, TEST_LOCATION ); + Uint16Pair v(5u, 5u); + Uint16Pair u(5u, 5u); + DALI_TEST_EQUALS(v != u, false, TEST_LOCATION); - v = Uint16Pair( 5u, 4u ); - u = Uint16Pair( 5u, 5u ); - DALI_TEST_EQUALS( v != u, true, TEST_LOCATION ); + v = Uint16Pair(5u, 4u); + u = Uint16Pair(5u, 5u); + DALI_TEST_EQUALS(v != u, true, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairLessThanP(void) { - Uint16Pair u( 5u, 5u ); - Uint16Pair v( 6u, 6u ); - DALI_TEST_EQUALS( u < v, true, TEST_LOCATION ); + Uint16Pair u(5u, 5u); + Uint16Pair v(6u, 6u); + DALI_TEST_EQUALS(u < v, true, TEST_LOCATION); - u = Uint16Pair( 0u, 1u ); - v = Uint16Pair( 1u, 0u ); - DALI_TEST_EQUALS( v < u, true, TEST_LOCATION ); + u = Uint16Pair(0u, 1u); + v = Uint16Pair(1u, 0u); + DALI_TEST_EQUALS(v < u, true, TEST_LOCATION); - u = Uint16Pair( 1u, 0u ); - v = Uint16Pair( 0u, 1u ); - DALI_TEST_EQUALS( v < u, false, TEST_LOCATION ); + u = Uint16Pair(1u, 0u); + v = Uint16Pair(0u, 1u); + DALI_TEST_EQUALS(v < u, false, TEST_LOCATION); END_TEST; } @@ -214,41 +214,41 @@ int UtcDaliUint16PairGreaterThanP(void) Uint16Pair u; Uint16Pair v; - u = Uint16Pair( 0u, 1u ); - v = Uint16Pair( 1u, 0u ); - DALI_TEST_EQUALS( u > v, true, TEST_LOCATION ); + u = Uint16Pair(0u, 1u); + v = Uint16Pair(1u, 0u); + DALI_TEST_EQUALS(u > v, true, TEST_LOCATION); - u = Uint16Pair( 1u, 0u ); - v = Uint16Pair( 0u, 1u ); - DALI_TEST_EQUALS( v > u, true, TEST_LOCATION ); + u = Uint16Pair(1u, 0u); + v = Uint16Pair(0u, 1u); + DALI_TEST_EQUALS(v > u, true, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairFromFloatVecP(void) { - Dali::Vector2 v2( 5.f, 5.f ); + Dali::Vector2 v2(5.f, 5.f); - Uint16Pair u = Uint16Pair::FromFloatVec2( v2 ); - DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION ); + Uint16Pair u = Uint16Pair::FromFloatVec2(v2); + DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION); - Dali::Vector3 v3( 5.f, 5.f, 5.f ); + Dali::Vector3 v3(5.f, 5.f, 5.f); - u = Uint16Pair::FromFloatVec2( v3 ); - DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION ); + u = Uint16Pair::FromFloatVec2(v3); + DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION); END_TEST; } int UtcDaliUint16PairFromFloatArrayP(void) { - float array[] = { 5.f, 5.f }; + float array[] = {5.f, 5.f}; - Uint16Pair u = Uint16Pair::FromFloatArray( array ); - DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION ); - DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION ); + Uint16Pair u = Uint16Pair::FromFloatArray(array); + DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION); + DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Vector.cpp b/automated-tests/src/dali/utc-Dali-Vector.cpp index 330b442..f0dd410 100644 --- a/automated-tests/src/dali/utc-Dali-Vector.cpp +++ b/automated-tests/src/dali/utc-Dali-Vector.cpp @@ -17,10 +17,11 @@ #define ENABLE_VECTOR_ASSERTS -#include -#include -#include #include +#include +#include + +#include using namespace Dali; @@ -29,15 +30,15 @@ namespace const Dali::VectorBase::SizeType ZERO(0); /// Compare a short with an int -void DALI_TEST_EQUALS( short value1, int value2, const char* location ) +void DALI_TEST_EQUALS(short value1, int value2, const char* location) { - ::DALI_TEST_EQUALS< short >( value1, static_cast< short >( value2 ), location ); + ::DALI_TEST_EQUALS(value1, static_cast(value2), location); } /// Compare a char with an int -void DALI_TEST_EQUALS( char value1, int value2, const char* location ) +void DALI_TEST_EQUALS(char value1, int value2, const char* location) { - ::DALI_TEST_EQUALS< char >( value1, static_cast< char >( value2 ), location ); + ::DALI_TEST_EQUALS(value1, static_cast(value2), location); } } // unnamed namespace @@ -46,18 +47,18 @@ int UtcDaliEmptyVectorInt(void) { tet_infoline("Testing Dali::Vector"); - Vector< int > intvector; + Vector intvector; - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); intvector.Clear(); - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); intvector.Release(); - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); END_TEST; } @@ -65,34 +66,34 @@ int UtcDaliVectorInt(void) { tet_infoline("Testing Dali::Vector"); - Vector< int > intvector; + Vector intvector; - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); - intvector.PushBack( 11 ); - DALI_TEST_EQUALS( static_cast(1), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(2), intvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION ); + intvector.PushBack(11); + DALI_TEST_EQUALS(static_cast(1), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(2), intvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION); - intvector.PushBack( 99 ); - DALI_TEST_EQUALS( static_cast(2), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(2), intvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION ); + intvector.PushBack(99); + DALI_TEST_EQUALS(static_cast(2), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(2), intvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(99, intvector[1], TEST_LOCATION); - intvector.PushBack( 34 ); - DALI_TEST_EQUALS( static_cast(3), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(6), intvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 34, intvector[ 2 ], TEST_LOCATION ); + intvector.PushBack(34); + DALI_TEST_EQUALS(static_cast(3), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(6), intvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(99, intvector[1], TEST_LOCATION); + DALI_TEST_EQUALS(34, intvector[2], TEST_LOCATION); intvector.Clear(); - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(6), intvector.Capacity(), TEST_LOCATION ); - intvector.PushBack( 123 ); - DALI_TEST_EQUALS( static_cast(1), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 123, intvector[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(6), intvector.Capacity(), TEST_LOCATION); + intvector.PushBack(123); + DALI_TEST_EQUALS(static_cast(1), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(123, intvector[0], TEST_LOCATION); END_TEST; } @@ -100,44 +101,44 @@ int UtcDaliVectorIntCopy(void) { tet_infoline("Testing Dali::Vector::Copy"); - Vector< int > intvector; - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + Vector intvector; + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); - intvector.PushBack( 99 ); - intvector.PushBack( 11 ); - intvector.PushBack( 34 ); + intvector.PushBack(99); + intvector.PushBack(11); + intvector.PushBack(34); // copy construct - Vector< int > intvector2( intvector ); + Vector intvector2(intvector); - DALI_TEST_EQUALS( intvector2.Count(), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( intvector2.Capacity(), intvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( intvector2[ 0 ], intvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( intvector2[ 1 ], intvector[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( intvector2[ 2 ], intvector[ 2 ], TEST_LOCATION ); + DALI_TEST_EQUALS(intvector2.Count(), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(intvector2.Capacity(), intvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(intvector2[0], intvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(intvector2[1], intvector[1], TEST_LOCATION); + DALI_TEST_EQUALS(intvector2[2], intvector[2], TEST_LOCATION); // assign - Vector< int > intvector3; - DALI_TEST_EQUALS( ZERO, intvector3.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector3.Capacity(), TEST_LOCATION ); + Vector intvector3; + DALI_TEST_EQUALS(ZERO, intvector3.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector3.Capacity(), TEST_LOCATION); intvector2 = intvector3; - DALI_TEST_EQUALS( intvector2.Count(), intvector3.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( intvector2.Capacity(), intvector3.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(intvector2.Count(), intvector3.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(intvector2.Capacity(), intvector3.Capacity(), TEST_LOCATION); // copy empty - Vector< int > intvector4; - intvector4.Reserve( 100 ); - DALI_TEST_EQUALS( ZERO, intvector4.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(100), intvector4.Capacity(), TEST_LOCATION ); + Vector intvector4; + intvector4.Reserve(100); + DALI_TEST_EQUALS(ZERO, intvector4.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(100), intvector4.Capacity(), TEST_LOCATION); intvector3 = intvector4; - DALI_TEST_EQUALS( ZERO, intvector3.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(100), intvector3.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector3.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(100), intvector3.Capacity(), TEST_LOCATION); // self copy intvector4 = intvector4; - DALI_TEST_EQUALS( ZERO, intvector4.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(100), intvector4.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, intvector4.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(100), intvector4.Capacity(), TEST_LOCATION); END_TEST; } @@ -145,60 +146,60 @@ int UtcDaliVectorIntResize(void) { tet_infoline("Testing Dali::Vector::Resize"); - Vector< short > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - - vector.Resize( 10u ); - DALI_TEST_EQUALS( static_cast(10), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(10), vector.Capacity(), TEST_LOCATION ); - - vector.Resize( 4u ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(10), vector.Capacity(), TEST_LOCATION ); - - vector.Resize( 4u ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(10), vector.Capacity(), TEST_LOCATION ); - - vector.Resize( 0u ); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(10), vector.Capacity(), TEST_LOCATION ); - - vector.Resize( 12u, 123 ); - DALI_TEST_EQUALS( static_cast(12), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(12), vector.Capacity(), TEST_LOCATION ); - - DALI_TEST_EQUALS( vector[ 0 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 5 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 6 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 7 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 8 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 9 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 10 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 11 ], 123, TEST_LOCATION ); - - vector.Resize( 13u, 321 ); - DALI_TEST_EQUALS( static_cast(13), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(13), vector.Capacity(), TEST_LOCATION ); - - DALI_TEST_EQUALS( vector[ 0 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 5 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 6 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 7 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 8 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 9 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 10 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 11 ], 123, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 12 ], 321, TEST_LOCATION ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); + + vector.Resize(10u); + DALI_TEST_EQUALS(static_cast(10), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(10), vector.Capacity(), TEST_LOCATION); + + vector.Resize(4u); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(10), vector.Capacity(), TEST_LOCATION); + + vector.Resize(4u); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(10), vector.Capacity(), TEST_LOCATION); + + vector.Resize(0u); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(10), vector.Capacity(), TEST_LOCATION); + + vector.Resize(12u, 123); + DALI_TEST_EQUALS(static_cast(12), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(12), vector.Capacity(), TEST_LOCATION); + + DALI_TEST_EQUALS(vector[0], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[5], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[6], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[7], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[8], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[9], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[10], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[11], 123, TEST_LOCATION); + + vector.Resize(13u, 321); + DALI_TEST_EQUALS(static_cast(13), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(13), vector.Capacity(), TEST_LOCATION); + + DALI_TEST_EQUALS(vector[0], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[5], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[6], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[7], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[8], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[9], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[10], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[11], 123, TEST_LOCATION); + DALI_TEST_EQUALS(vector[12], 321, TEST_LOCATION); END_TEST; } @@ -206,243 +207,241 @@ int UtcDaliVectorIntErase(void) { tet_infoline("Testing Dali::Vector::Erase"); - Vector< char > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - vector.PushBack( 1 ); - vector.PushBack( 2 ); - vector.PushBack( 3 ); - vector.PushBack( 4 ); - vector.PushBack( 5 ); - DALI_TEST_EQUALS( static_cast(5), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION ); - - vector.Erase( vector.Begin() ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 5, TEST_LOCATION ); - - Vector< char >::Iterator ret = vector.Erase( std::find( vector.Begin(), vector.End(), 4 ) ); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( *ret, 5, TEST_LOCATION ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); + vector.PushBack(1); + vector.PushBack(2); + vector.PushBack(3); + vector.PushBack(4); + vector.PushBack(5); + DALI_TEST_EQUALS(static_cast(5), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION); + + vector.Erase(vector.Begin()); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 5, TEST_LOCATION); + + Vector::Iterator ret = vector.Erase(std::find(vector.Begin(), vector.End(), 4)); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 5, TEST_LOCATION); + DALI_TEST_EQUALS(*ret, 5, TEST_LOCATION); // try erasing last - vector.PushBack( 99 ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 99, TEST_LOCATION ); - ret = vector.Erase( vector.End() - 1 ); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION ); + vector.PushBack(99); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 99, TEST_LOCATION); + ret = vector.Erase(vector.End() - 1); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION); try { // illegal erase, one past the end - vector.Erase( vector.End() ); + vector.Erase(vector.End()); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { // illegal erase, one before the begin - vector.Erase( vector.Begin() - 1u ); + vector.Erase(vector.Begin() - 1u); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 5, TEST_LOCATION); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 5, TEST_LOCATION ); - - vector.Erase( vector.Begin() + 1 ); - DALI_TEST_EQUALS( static_cast(2), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 5, TEST_LOCATION ); + vector.Erase(vector.Begin() + 1); + DALI_TEST_EQUALS(static_cast(2), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 5, TEST_LOCATION); - vector.Erase( vector.Begin() + 1 ); - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); + vector.Erase(vector.Begin() + 1); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); try { // illegal erase, one past the end - vector.Erase( vector.Begin() + 1 ); + vector.Erase(vector.Begin() + 1); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION); - vector.Erase( vector.Begin() ); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); + vector.Erase(vector.Begin()); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); try { // illegal erase, one before the beginning - vector.Erase( vector.Begin() - 1 ); + vector.Erase(vector.Begin() - 1); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.Begin(), vector.End(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector.Begin(), vector.End(), TEST_LOCATION); - Vector< char >::Iterator endIter = vector.End(); - for( Vector< char >::Iterator iter = vector.Begin(); iter != endIter; ++iter ) + Vector::Iterator endIter = vector.End(); + for(Vector::Iterator iter = vector.Begin(); iter != endIter; ++iter) { tet_result(TET_FAIL); } - vector.PushBack( 3 ); - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); + vector.PushBack(3); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); vector.Clear(); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector.Begin(), vector.End(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector.Begin(), vector.End(), TEST_LOCATION); endIter = vector.End(); - for( Vector< char >::Iterator iter = vector.Begin(); iter != endIter; ++iter ) + for(Vector::Iterator iter = vector.Begin(); iter != endIter; ++iter) { tet_result(TET_FAIL); } // test a vector of pointers - Vector< int* > ptrVector; - DALI_TEST_EQUALS( ZERO, ptrVector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ptrVector.Begin(), ptrVector.End(), TEST_LOCATION ); + Vector ptrVector; + DALI_TEST_EQUALS(ZERO, ptrVector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ptrVector.Begin(), ptrVector.End(), TEST_LOCATION); int* pointer = NULL; - ptrVector.PushBack( pointer ); - DALI_TEST_EQUALS( static_cast(1), ptrVector.Count(), TEST_LOCATION ); - - Vector< int* >::Iterator ptriter = std::find( ptrVector.Begin(), ptrVector.End(), pointer ); - ptriter = ptrVector.Erase( ptriter ); - DALI_TEST_EQUALS( ZERO, ptrVector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ptrVector.Begin(), ptrVector.End(), TEST_LOCATION ); - DALI_TEST_EQUALS( ptrVector.Begin(), ptriter, TEST_LOCATION ); + ptrVector.PushBack(pointer); + DALI_TEST_EQUALS(static_cast(1), ptrVector.Count(), TEST_LOCATION); + + Vector::Iterator ptriter = std::find(ptrVector.Begin(), ptrVector.End(), pointer); + ptriter = ptrVector.Erase(ptriter); + DALI_TEST_EQUALS(ZERO, ptrVector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ptrVector.Begin(), ptrVector.End(), TEST_LOCATION); + DALI_TEST_EQUALS(ptrVector.Begin(), ptriter, TEST_LOCATION); END_TEST; } - int UtcDaliVectorDoubleRemove(void) { tet_infoline("Testing Dali::Vector::Remove"); - Vector< double > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - - vector.PushBack( 11.1 ); - vector.PushBack( 22.2 ); - vector.PushBack( 33.3 ); - vector.PushBack( 44.4 ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 22.2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 33.3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 44.4, TEST_LOCATION ); - - Vector< double >::Iterator res = std::find( vector.Begin(), vector.End(), 22.2 ); - DALI_TEST_EQUALS( 22.2, *res, TEST_LOCATION ); - vector.Remove( res ); - res = std::find( vector.Begin(), vector.End(), 22.2 ); - DALI_TEST_EQUALS( vector.End(), res, TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 44.4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 33.3, TEST_LOCATION ); - - vector.Remove( vector.End() - 1 ); - DALI_TEST_EQUALS( static_cast(2), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 44.4, TEST_LOCATION ); - - vector.Remove( vector.Begin() ); - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 44.4, TEST_LOCATION ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + + vector.PushBack(11.1); + vector.PushBack(22.2); + vector.PushBack(33.3); + vector.PushBack(44.4); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 22.2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 33.3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 44.4, TEST_LOCATION); + + Vector::Iterator res = std::find(vector.Begin(), vector.End(), 22.2); + DALI_TEST_EQUALS(22.2, *res, TEST_LOCATION); + vector.Remove(res); + res = std::find(vector.Begin(), vector.End(), 22.2); + DALI_TEST_EQUALS(vector.End(), res, TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 44.4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 33.3, TEST_LOCATION); + + vector.Remove(vector.End() - 1); + DALI_TEST_EQUALS(static_cast(2), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 44.4, TEST_LOCATION); + + vector.Remove(vector.Begin()); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 44.4, TEST_LOCATION); try { // illegal erase, one past the end - vector.Remove( vector.Begin() + 1 ); + vector.Remove(vector.Begin() + 1); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 44.4, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 44.4, TEST_LOCATION); - vector.Remove( vector.Begin() ); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); + vector.Remove(vector.Begin()); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); try { // illegal erase, one before the beginning - vector.Remove( vector.Begin() - 1 ); + vector.Remove(vector.Begin() - 1); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -453,44 +452,44 @@ int UtcDaliVectorIntSwap(void) { tet_infoline("Testing Dali::Vector::Swap"); - Vector< int > intvector; - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); - - intvector.PushBack( 11 ); - intvector.PushBack( 22 ); - intvector.PushBack( 33 ); - DALI_TEST_EQUALS( static_cast(3), intvector.Count(), TEST_LOCATION ); - - Vector< int > intvector2; - DALI_TEST_EQUALS( ZERO, intvector2.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector2.Capacity(), TEST_LOCATION ); - - intvector2.Swap( intvector ); - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(3), intvector2.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 11, intvector2[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 22, intvector2[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 33, intvector2[ 2 ], TEST_LOCATION ); - - intvector.PushBack( 99 ); - intvector.PushBack( 88 ); - DALI_TEST_EQUALS( static_cast(2), intvector.Count(), TEST_LOCATION ); - - intvector.Swap( intvector2 ); - DALI_TEST_EQUALS( static_cast(2), intvector2.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 99, intvector2[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 88, intvector2[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( static_cast(3), intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 22, intvector[ 1 ], TEST_LOCATION ); - DALI_TEST_EQUALS( 33, intvector[ 2 ], TEST_LOCATION ); - - Vector< int > empty; - intvector.Swap( empty ); - DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION ); + Vector intvector; + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); + + intvector.PushBack(11); + intvector.PushBack(22); + intvector.PushBack(33); + DALI_TEST_EQUALS(static_cast(3), intvector.Count(), TEST_LOCATION); + + Vector intvector2; + DALI_TEST_EQUALS(ZERO, intvector2.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector2.Capacity(), TEST_LOCATION); + + intvector2.Swap(intvector); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(3), intvector2.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(11, intvector2[0], TEST_LOCATION); + DALI_TEST_EQUALS(22, intvector2[1], TEST_LOCATION); + DALI_TEST_EQUALS(33, intvector2[2], TEST_LOCATION); + + intvector.PushBack(99); + intvector.PushBack(88); + DALI_TEST_EQUALS(static_cast(2), intvector.Count(), TEST_LOCATION); + + intvector.Swap(intvector2); + DALI_TEST_EQUALS(static_cast(2), intvector2.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(99, intvector2[0], TEST_LOCATION); + DALI_TEST_EQUALS(88, intvector2[1], TEST_LOCATION); + DALI_TEST_EQUALS(static_cast(3), intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(22, intvector[1], TEST_LOCATION); + DALI_TEST_EQUALS(33, intvector[2], TEST_LOCATION); + + Vector empty; + intvector.Swap(empty); + DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION); END_TEST; } @@ -498,30 +497,30 @@ int UtcDaliVectorIterate(void) { tet_infoline("Testing Dali::Vector::Begin"); - Vector< float > floatvector; - DALI_TEST_EQUALS( ZERO, floatvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, floatvector.Capacity(), TEST_LOCATION ); + Vector floatvector; + DALI_TEST_EQUALS(ZERO, floatvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, floatvector.Capacity(), TEST_LOCATION); - floatvector.PushBack( 0.9f ); - floatvector.PushBack( 1.1f ); - floatvector.PushBack( 1.2f ); - DALI_TEST_EQUALS( static_cast(3), floatvector.Count(), TEST_LOCATION ); + floatvector.PushBack(0.9f); + floatvector.PushBack(1.1f); + floatvector.PushBack(1.2f); + DALI_TEST_EQUALS(static_cast(3), floatvector.Count(), TEST_LOCATION); - Vector< float >::Iterator iter = floatvector.Begin(); - int index = 0; - for( ; iter != floatvector.End(); ++iter, ++index ) + Vector::Iterator iter = floatvector.Begin(); + int index = 0; + for(; iter != floatvector.End(); ++iter, ++index) { std::cout << "value " << *iter << std::endl; - DALI_TEST_EQUALS( *iter, floatvector[ index ], TEST_LOCATION ); + DALI_TEST_EQUALS(*iter, floatvector[index], TEST_LOCATION); } - DALI_TEST_EQUALS( 3, index, TEST_LOCATION ); + DALI_TEST_EQUALS(3, index, TEST_LOCATION); - iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f ); - DALI_TEST_EQUALS( 1.1f, *iter, TEST_LOCATION ); + iter = std::find(floatvector.Begin(), floatvector.End(), 1.1f); + DALI_TEST_EQUALS(1.1f, *iter, TEST_LOCATION); floatvector.Clear(); - iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f ); - DALI_TEST_EQUALS( floatvector.End(), iter, TEST_LOCATION ); + iter = std::find(floatvector.Begin(), floatvector.End(), 1.1f); + DALI_TEST_EQUALS(floatvector.End(), iter, TEST_LOCATION); END_TEST; } @@ -529,24 +528,24 @@ int UtcDaliVectorPair(void) { tet_infoline("Testing Dali::Vector< std::pair< int, float > >"); - Vector< std::pair< int, float > > pairvector; - DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, pairvector.Capacity(), TEST_LOCATION ); + Vector > pairvector; + DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, pairvector.Capacity(), TEST_LOCATION); - pairvector.PushBack( std::make_pair( 5, 0.1f ) ); - pairvector.PushBack( std::make_pair( 3, 0.2f ) ); - pairvector.PushBack( std::make_pair( 4, 0.3f ) ); - pairvector.PushBack( std::make_pair( 1, 0.4f ) ); - pairvector.PushBack( std::make_pair( 2, 0.5f ) ); - DALI_TEST_EQUALS( static_cast(5), pairvector.Count(), TEST_LOCATION ); + pairvector.PushBack(std::make_pair(5, 0.1f)); + pairvector.PushBack(std::make_pair(3, 0.2f)); + pairvector.PushBack(std::make_pair(4, 0.3f)); + pairvector.PushBack(std::make_pair(1, 0.4f)); + pairvector.PushBack(std::make_pair(2, 0.5f)); + DALI_TEST_EQUALS(static_cast(5), pairvector.Count(), TEST_LOCATION); - Vector< std::pair< int, float > >::Iterator iter = pairvector.Begin(); - int index = 0; - for( ; iter != pairvector.End(); ++iter, ++index ) + Vector >::Iterator iter = pairvector.Begin(); + int index = 0; + for(; iter != pairvector.End(); ++iter, ++index) { std::cout << "pair " << (*iter).first << ":" << (*iter).second << std::endl; - DALI_TEST_EQUALS( (*iter).first, pairvector[ index ].first, TEST_LOCATION ); - DALI_TEST_EQUALS( (*iter).second, pairvector[ index ].second, TEST_LOCATION ); + DALI_TEST_EQUALS((*iter).first, pairvector[index].first, TEST_LOCATION); + DALI_TEST_EQUALS((*iter).second, pairvector[index].second, TEST_LOCATION); } END_TEST; } @@ -556,145 +555,145 @@ int UtcDaliVectorAsserts(void) tet_infoline("Testing Dali::Vector< int* > exception handling"); // empty vector - Vector< int* > pointervector; + Vector pointervector; try { - int* value = NULL; - pointervector[ 1 ] = value; - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + int* value = NULL; + pointervector[1] = value; + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "VectorBase::mData", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "VectorBase::mData", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { int* value = NULL; - value = pointervector[ 0 ]; + value = pointervector[0]; (void)value; // to "use" the value - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "VectorBase::mData", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "VectorBase::mData", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } - Vector< int* >::Iterator iter = pointervector.Begin(); - if( iter != pointervector.End() ) + Vector::Iterator iter = pointervector.Begin(); + if(iter != pointervector.End()) { tet_result(TET_FAIL); } try { - pointervector.Erase( pointervector.Begin() ); - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + pointervector.Erase(pointervector.Begin()); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } iter = pointervector.Begin(); - if( iter != pointervector.End() ) + if(iter != pointervector.End()) { tet_result(TET_FAIL); } try { - pointervector.Remove( pointervector.Begin() ); - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + pointervector.Remove(pointervector.Begin()); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } iter = pointervector.Begin(); - if( iter != pointervector.End() ) + if(iter != pointervector.End()) { tet_result(TET_FAIL); } // reserve 0 space - pointervector.Reserve( 0 ); + pointervector.Reserve(0); iter = pointervector.Begin(); - if( iter != pointervector.End() ) + if(iter != pointervector.End()) { tet_result(TET_FAIL); } // reserve 1 space - pointervector.Reserve( 1 ); + pointervector.Reserve(1); iter = pointervector.Begin(); - if( iter != pointervector.End() ) + if(iter != pointervector.End()) { tet_result(TET_FAIL); } try { - int* value = NULL; - pointervector[ 1 ] = value; - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + int* value = NULL; + pointervector[1] = value; + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "index < VectorBase::Count()", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "index < VectorBase::Count()", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { - int* value = pointervector[ 1 ]; + int* value = pointervector[1]; (void)value; // to "use" the value - tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "index < VectorBase::Count()", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "index < VectorBase::Count()", TEST_LOCATION); } catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -706,239 +705,239 @@ int UtcDaliVectorAcidTest(void) tet_infoline("Testing multiple Dali::Vector's"); // create multiple vectors - Vector< std::pair< float, float > > pairvector; - DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, pairvector.Capacity(), TEST_LOCATION ); - Vector< double > doublevector; - DALI_TEST_EQUALS( ZERO, doublevector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, doublevector.Capacity(), TEST_LOCATION ); - Vector< int* > intptrvector; - DALI_TEST_EQUALS( ZERO, intptrvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intptrvector.Capacity(), TEST_LOCATION ); - Vector< Dali::Actor* > actorptrvector; - DALI_TEST_EQUALS( ZERO, actorptrvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, actorptrvector.Capacity(), TEST_LOCATION ); - Vector< long > longvector; - DALI_TEST_EQUALS( ZERO, longvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, longvector.Capacity(), TEST_LOCATION ); - Vector< char > charvector; - DALI_TEST_EQUALS( ZERO, charvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, charvector.Capacity(), TEST_LOCATION ); + Vector > pairvector; + DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, pairvector.Capacity(), TEST_LOCATION); + Vector doublevector; + DALI_TEST_EQUALS(ZERO, doublevector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, doublevector.Capacity(), TEST_LOCATION); + Vector intptrvector; + DALI_TEST_EQUALS(ZERO, intptrvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intptrvector.Capacity(), TEST_LOCATION); + Vector actorptrvector; + DALI_TEST_EQUALS(ZERO, actorptrvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, actorptrvector.Capacity(), TEST_LOCATION); + Vector longvector; + DALI_TEST_EQUALS(ZERO, longvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, longvector.Capacity(), TEST_LOCATION); + Vector charvector; + DALI_TEST_EQUALS(ZERO, charvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, charvector.Capacity(), TEST_LOCATION); // add items static unsigned int acidCount = 10000; - int* ptr = NULL; - for( unsigned int i = 0; i < acidCount; ++i ) + int* ptr = NULL; + for(unsigned int i = 0; i < acidCount; ++i) { - pairvector.PushBack( std::make_pair( i, i ) ); - doublevector.PushBack( (double)i ); - intptrvector.PushBack( (int*)ptr ); - actorptrvector.PushBack( (Dali::Actor*)ptr ); - longvector.PushBack( (long)i ); - charvector.PushBack( (char)i ); + pairvector.PushBack(std::make_pair(i, i)); + doublevector.PushBack((double)i); + intptrvector.PushBack((int*)ptr); + actorptrvector.PushBack((Dali::Actor*)ptr); + longvector.PushBack((long)i); + charvector.PushBack((char)i); } - DALI_TEST_EQUALS( acidCount, pairvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, pairvector.Count(), TEST_LOCATION); std::size_t pairCapacity = pairvector.Capacity(); - DALI_TEST_EQUALS( acidCount, doublevector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, doublevector.Count(), TEST_LOCATION); std::size_t doubleCapacity = doublevector.Capacity(); - DALI_TEST_EQUALS( acidCount, intptrvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, intptrvector.Count(), TEST_LOCATION); std::size_t intptrCapacity = intptrvector.Capacity(); - DALI_TEST_EQUALS( acidCount, actorptrvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, actorptrvector.Count(), TEST_LOCATION); std::size_t actorptrCapacity = actorptrvector.Capacity(); - DALI_TEST_EQUALS( acidCount, longvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, longvector.Count(), TEST_LOCATION); std::size_t longCapacity = longvector.Capacity(); - DALI_TEST_EQUALS( acidCount, charvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(acidCount, charvector.Count(), TEST_LOCATION); std::size_t charCapacity = charvector.Capacity(); - tet_printf("Dali::Vector< pair > capacity after %d pushbacks is %d", acidCount, pairCapacity ); - tet_printf("Dali::Vector< double > capacity after %d pushbacks is %d", acidCount, doubleCapacity ); - tet_printf("Dali::Vector< int* > capacity after %d pushbacks is %d", acidCount, intptrCapacity ); - tet_printf("Dali::Vector< Actor* > capacity after %d pushbacks is %d", acidCount, actorptrCapacity ); - tet_printf("Dali::Vector< long > capacity after %d pushbacks is %d", acidCount, longCapacity ); - tet_printf("Dali::Vector< char > capacity after %d pushbacks is %d", acidCount, charCapacity ); + tet_printf("Dali::Vector< pair > capacity after %d pushbacks is %d", acidCount, pairCapacity); + tet_printf("Dali::Vector< double > capacity after %d pushbacks is %d", acidCount, doubleCapacity); + tet_printf("Dali::Vector< int* > capacity after %d pushbacks is %d", acidCount, intptrCapacity); + tet_printf("Dali::Vector< Actor* > capacity after %d pushbacks is %d", acidCount, actorptrCapacity); + tet_printf("Dali::Vector< long > capacity after %d pushbacks is %d", acidCount, longCapacity); + tet_printf("Dali::Vector< char > capacity after %d pushbacks is %d", acidCount, charCapacity); // erase items - for( unsigned int i = 0; i < acidCount; ++i ) - { - pairvector.Erase( pairvector.Begin() + ( i % pairvector.Count() ) ); - doublevector.Erase( doublevector.Begin() + ( i % doublevector.Count() ) ); - intptrvector.Erase( intptrvector.Begin() + ( i % intptrvector.Count() ) ); - actorptrvector.Erase( actorptrvector.Begin() + ( i % actorptrvector.Count() ) ); - longvector.Erase( longvector.Begin() + ( i % longvector.Count() ) ); - charvector.Erase( charvector.Begin() + ( i % charvector.Count() ) ); - } - DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( pairCapacity, pairvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, doublevector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( doubleCapacity, doublevector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, intptrvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( intptrCapacity, intptrvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, actorptrvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( actorptrCapacity, actorptrvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, longvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( longCapacity, longvector.Capacity(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, charvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( charCapacity, charvector.Capacity(), TEST_LOCATION ); + for(unsigned int i = 0; i < acidCount; ++i) + { + pairvector.Erase(pairvector.Begin() + (i % pairvector.Count())); + doublevector.Erase(doublevector.Begin() + (i % doublevector.Count())); + intptrvector.Erase(intptrvector.Begin() + (i % intptrvector.Count())); + actorptrvector.Erase(actorptrvector.Begin() + (i % actorptrvector.Count())); + longvector.Erase(longvector.Begin() + (i % longvector.Count())); + charvector.Erase(charvector.Begin() + (i % charvector.Count())); + } + DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(pairCapacity, pairvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, doublevector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(doubleCapacity, doublevector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, intptrvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(intptrCapacity, intptrvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, actorptrvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(actorptrCapacity, actorptrvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, longvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(longCapacity, longvector.Capacity(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, charvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(charCapacity, charvector.Capacity(), TEST_LOCATION); END_TEST; } int UtcDaliVectorPushBack(void) { - tet_infoline( "Testing Dali::Vector< int* >PushBack(Element)" ); + tet_infoline("Testing Dali::Vector< int* >PushBack(Element)"); Vector vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); - vector.Reserve( 2u ); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, vector.Capacity(), TEST_LOCATION ); + vector.Reserve(2u); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(2u, vector.Capacity(), TEST_LOCATION); - vector.PushBack( 0u ); - vector.PushBack( 1u ); - vector.PushBack( 2u ); + vector.PushBack(0u); + vector.PushBack(1u); + vector.PushBack(2u); - DALI_TEST_EQUALS( 3u, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 6u, vector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(3u, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(6u, vector.Capacity(), TEST_LOCATION); - vector.PushBack( 3u ); + vector.PushBack(3u); - DALI_TEST_EQUALS( 4u, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 6u, vector.Capacity(), TEST_LOCATION ); + DALI_TEST_EQUALS(4u, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(6u, vector.Capacity(), TEST_LOCATION); - DALI_TEST_EQUALS( 0u, vector[0u], TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, vector[1u], TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, vector[2u], TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, vector[3u], TEST_LOCATION ); + DALI_TEST_EQUALS(0u, vector[0u], TEST_LOCATION); + DALI_TEST_EQUALS(1u, vector[1u], TEST_LOCATION); + DALI_TEST_EQUALS(2u, vector[2u], TEST_LOCATION); + DALI_TEST_EQUALS(3u, vector[3u], TEST_LOCATION); END_TEST; } int UtcDaliVectorInsert01(void) { - tet_infoline( "Testing Dali::Vector< int* >Insert(Iterator, Element)" ); + tet_infoline("Testing Dali::Vector< int* >Insert(Iterator, Element)"); // Test order of array inserted-into: - Vector< unsigned int > orderedVector; - orderedVector.PushBack( 9u ); - for( unsigned int i = 8u; i <= 8u; --i ) + Vector orderedVector; + orderedVector.PushBack(9u); + for(unsigned int i = 8u; i <= 8u; --i) { - orderedVector.Insert( orderedVector.Begin(), i ); - DALI_TEST_EQUALS( 10u - i, orderedVector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( i, orderedVector[0u], TEST_LOCATION ); + orderedVector.Insert(orderedVector.Begin(), i); + DALI_TEST_EQUALS(10u - i, orderedVector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(i, orderedVector[0u], TEST_LOCATION); } - for( unsigned int i = 0u; i < 10u; ++i ) + for(unsigned int i = 0u; i < 10u; ++i) { - DALI_TEST_EQUALS( i, orderedVector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, orderedVector[i], TEST_LOCATION); } // Test insertion out of range in non-empty array throws: try { - orderedVector.Insert( orderedVector.Begin() + 99u, 99u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + orderedVector.Insert(orderedVector.Begin() + 99u, 99u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf( "Assertion test failed - wrong Exception\n" ); - tet_result( TET_FAIL ); + tet_printf("Assertion test failed - wrong Exception\n"); + tet_result(TET_FAIL); } try { - orderedVector.Insert( orderedVector.Begin() - 1u, 99u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); - tet_result( TET_FAIL ); + orderedVector.Insert(orderedVector.Begin() - 1u, 99u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); + tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf( "Assertion test failed - wrong Exception\n" ); - tet_result( TET_FAIL ); + tet_printf("Assertion test failed - wrong Exception\n"); + tet_result(TET_FAIL); } // Test insertion part-way through a largish array retains ordering: // Build vector with hole in sequence: - Vector< unsigned int > longerVector; - const unsigned int insertionPoint = 131571u; - const unsigned int finalLength = 262143u; - for( unsigned int i = 0u; i < insertionPoint; ++i ) + Vector longerVector; + const unsigned int insertionPoint = 131571u; + const unsigned int finalLength = 262143u; + for(unsigned int i = 0u; i < insertionPoint; ++i) { - longerVector.PushBack( i ); + longerVector.PushBack(i); } - for( unsigned int i = insertionPoint; i < finalLength; ++i ) + for(unsigned int i = insertionPoint; i < finalLength; ++i) { - longerVector.PushBack( i + 1 ); + longerVector.PushBack(i + 1); } // Fill the hole in the sequence: - longerVector.Insert( longerVector.Begin() + insertionPoint, insertionPoint ); + longerVector.Insert(longerVector.Begin() + insertionPoint, insertionPoint); // Check the sequence is monotonically increasing by one every time: - for( unsigned int i = 0u; i <= finalLength; ++i ) + for(unsigned int i = 0u; i <= finalLength; ++i) { - DALI_TEST_EQUALS( i, longerVector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, longerVector[i], TEST_LOCATION); } // Insert into an empty vector - Vector< unsigned int > vector; + Vector vector; - vector.Insert( vector.End(), orderedVector.Begin(), orderedVector.End() ); - for( unsigned int i = 0u; i < 10u; ++i ) + vector.Insert(vector.End(), orderedVector.Begin(), orderedVector.End()); + for(unsigned int i = 0u; i < 10u; ++i) { - DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION); } vector.Clear(); - vector.Insert( vector.Begin(), orderedVector.Begin(), orderedVector.End() ); - for( unsigned int i = 0u; i < 10u; ++i ) + vector.Insert(vector.Begin(), orderedVector.Begin(), orderedVector.End()); + for(unsigned int i = 0u; i < 10u; ++i) { - DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION); } // Insert nothing. - vector.Insert( vector.Begin(), orderedVector.Begin(), orderedVector.Begin() ); - for( unsigned int i = 0u; i < 10u; ++i ) + vector.Insert(vector.Begin(), orderedVector.Begin(), orderedVector.Begin()); + for(unsigned int i = 0u; i < 10u; ++i) { - DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION); } - vector.Insert( vector.Begin() + 5, vector.Begin() + 5, vector.Begin() + 5 ); - for( unsigned int i = 0u; i < 10u; ++i ) + vector.Insert(vector.Begin() + 5, vector.Begin() + 5, vector.Begin() + 5); + for(unsigned int i = 0u; i < 10u; ++i) { - DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION ); + DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION); } // AutoInsert vector.Clear(); - vector.PushBack( 0u ); - vector.PushBack( 1u ); - vector.PushBack( 2u ); - vector.PushBack( 3u ); - - vector.Insert( vector.Begin() + 2, vector.Begin(), vector.End() ); - DALI_TEST_EQUALS( 8u, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vector[0u], TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, vector[1u], TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vector[2u], TEST_LOCATION ); - DALI_TEST_EQUALS( 1u, vector[3u], TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, vector[4u], TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, vector[5u], TEST_LOCATION ); - DALI_TEST_EQUALS( 2u, vector[6u], TEST_LOCATION ); - DALI_TEST_EQUALS( 3u, vector[7u], TEST_LOCATION ); + vector.PushBack(0u); + vector.PushBack(1u); + vector.PushBack(2u); + vector.PushBack(3u); + + vector.Insert(vector.Begin() + 2, vector.Begin(), vector.End()); + DALI_TEST_EQUALS(8u, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, vector[0u], TEST_LOCATION); + DALI_TEST_EQUALS(1u, vector[1u], TEST_LOCATION); + DALI_TEST_EQUALS(0u, vector[2u], TEST_LOCATION); + DALI_TEST_EQUALS(1u, vector[3u], TEST_LOCATION); + DALI_TEST_EQUALS(2u, vector[4u], TEST_LOCATION); + DALI_TEST_EQUALS(3u, vector[5u], TEST_LOCATION); + DALI_TEST_EQUALS(2u, vector[6u], TEST_LOCATION); + DALI_TEST_EQUALS(3u, vector[7u], TEST_LOCATION); END_TEST; } @@ -947,57 +946,57 @@ int UtcDaliVectorInsert02(void) { tet_infoline("Testing Dali::Vector::Insert(Iterator,Iterator,Iterator)"); - Vector< char > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - vector.PushBack( 1 ); - vector.PushBack( 2 ); - vector.PushBack( 3 ); - vector.PushBack( 4 ); - vector.PushBack( 5 ); - - Vector< char > vector2; - DALI_TEST_EQUALS( ZERO, vector2.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector2.Capacity(), TEST_LOCATION ); - vector2.PushBack( 6 ); - vector2.PushBack( 7 ); - vector2.PushBack( 8 ); - vector2.PushBack( 9 ); - vector2.PushBack( 10 ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); + vector.PushBack(1); + vector.PushBack(2); + vector.PushBack(3); + vector.PushBack(4); + vector.PushBack(5); + + Vector vector2; + DALI_TEST_EQUALS(ZERO, vector2.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector2.Capacity(), TEST_LOCATION); + vector2.PushBack(6); + vector2.PushBack(7); + vector2.PushBack(8); + vector2.PushBack(9); + vector2.PushBack(10); // Test insert at end - vector.Insert( vector.End(), vector2.Begin(), vector2.Begin() + 1u ); - DALI_TEST_EQUALS( static_cast(6), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 5 ], 6, TEST_LOCATION ); + vector.Insert(vector.End(), vector2.Begin(), vector2.Begin() + 1u); + DALI_TEST_EQUALS(static_cast(6), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION); + DALI_TEST_EQUALS(vector[5], 6, TEST_LOCATION); // Test insert at begin - vector.Insert( vector.Begin(), vector2.Begin()+1, vector2.Begin() + 2u ); - DALI_TEST_EQUALS( static_cast(7), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 7, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 5 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 6 ], 6, TEST_LOCATION ); + vector.Insert(vector.Begin(), vector2.Begin() + 1, vector2.Begin() + 2u); + DALI_TEST_EQUALS(static_cast(7), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 7, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[5], 5, TEST_LOCATION); + DALI_TEST_EQUALS(vector[6], 6, TEST_LOCATION); // Test insert in the middle - vector.Insert( vector.Begin() + 3, vector2.Begin()+3, vector2.End() ); - DALI_TEST_EQUALS( static_cast(9), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 7, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 9, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 10, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 5 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 6 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 7 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 8 ], 6, TEST_LOCATION ); + vector.Insert(vector.Begin() + 3, vector2.Begin() + 3, vector2.End()); + DALI_TEST_EQUALS(static_cast(9), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 7, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 9, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 10, TEST_LOCATION); + DALI_TEST_EQUALS(vector[5], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[6], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[7], 5, TEST_LOCATION); + DALI_TEST_EQUALS(vector[8], 6, TEST_LOCATION); END_TEST; } @@ -1005,157 +1004,156 @@ int UtcDaliVectorIntInsertAssert(void) { tet_infoline("Testing Dali::Vector::Insert(Iterator,Iterator,Iterator) asserts"); - Vector< char > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - vector.PushBack( 1 ); - vector.PushBack( 2 ); - - Vector< char > vector2; - DALI_TEST_EQUALS( ZERO, vector2.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector2.Capacity(), TEST_LOCATION ); - vector2.PushBack( 6 ); - vector2.PushBack( 7 ); - vector2.PushBack( 8 ); - vector2.PushBack( 9 ); - vector2.PushBack( 10 ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); + vector.PushBack(1); + vector.PushBack(2); + + Vector vector2; + DALI_TEST_EQUALS(ZERO, vector2.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector2.Capacity(), TEST_LOCATION); + vector2.PushBack(6); + vector2.PushBack(7); + vector2.PushBack(8); + vector2.PushBack(9); + vector2.PushBack(10); try { - vector.Insert( vector.Begin() + 3u, vector2.Begin(), vector2.End() ); + vector.Insert(vector.Begin() + 3u, vector2.Begin(), vector2.End()); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { - vector.Insert( vector.Begin() - 1u, vector2.Begin(), vector2.End() ); + vector.Insert(vector.Begin() - 1u, vector2.Begin(), vector2.End()); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { - vector.Insert( vector.End(), vector2.End(), vector2.Begin() ); + vector.Insert(vector.End(), vector2.End(), vector2.Begin()); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( from <= to )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(from <= to)", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } END_TEST; - } - +} int UtcDaliVectorIntEraseRange(void) { tet_infoline("Testing Dali::Vector::Erase(Iterator,Iterator)"); - Vector< char > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); // Try to delete from empty vector. - vector.Erase( vector.Begin(), vector.End() ); - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - - vector.PushBack( 1 ); - vector.PushBack( 2 ); - vector.PushBack( 3 ); - vector.PushBack( 4 ); - vector.PushBack( 5 ); - DALI_TEST_EQUALS( static_cast(5), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION ); - - Vector< char >::Iterator ret; - - ret = vector.Erase( vector.Begin() + 1u, vector.Begin() + 2u ); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( *ret, 3, TEST_LOCATION ); - - ret = vector.Erase( vector.Begin(), vector.Begin() + 2 ); - DALI_TEST_EQUALS( static_cast(2), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 5, TEST_LOCATION ); - DALI_TEST_EQUALS( *ret, 4, TEST_LOCATION ); + vector.Erase(vector.Begin(), vector.End()); + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); + + vector.PushBack(1); + vector.PushBack(2); + vector.PushBack(3); + vector.PushBack(4); + vector.PushBack(5); + DALI_TEST_EQUALS(static_cast(5), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION); + + Vector::Iterator ret; + + ret = vector.Erase(vector.Begin() + 1u, vector.Begin() + 2u); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 5, TEST_LOCATION); + DALI_TEST_EQUALS(*ret, 3, TEST_LOCATION); + + ret = vector.Erase(vector.Begin(), vector.Begin() + 2); + DALI_TEST_EQUALS(static_cast(2), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 5, TEST_LOCATION); + DALI_TEST_EQUALS(*ret, 4, TEST_LOCATION); // try erasing last - vector.PushBack( 99 ); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 99, TEST_LOCATION ); - ret = vector.Erase( vector.Begin() + 1u, vector.End() ); - DALI_TEST_EQUALS( static_cast(1), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION ); + vector.PushBack(99); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 99, TEST_LOCATION); + ret = vector.Erase(vector.Begin() + 1u, vector.End()); + DALI_TEST_EQUALS(static_cast(1), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION); + DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION); // try erasing all - vector.PushBack( 100 ); - vector.PushBack( 101 ); - vector.PushBack( 102 ); + vector.PushBack(100); + vector.PushBack(101); + vector.PushBack(102); - DALI_TEST_EQUALS( static_cast(4), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 100, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 101, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 3 ], 102, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(4), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 100, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 101, TEST_LOCATION); + DALI_TEST_EQUALS(vector[3], 102, TEST_LOCATION); - ret = vector.Erase( vector.Begin(), vector.End() ); - DALI_TEST_EQUALS( static_cast(0), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION ); + ret = vector.Erase(vector.Begin(), vector.End()); + DALI_TEST_EQUALS(static_cast(0), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION); // try erase from Iterator to the same Iterator. - vector.PushBack( 100 ); - vector.PushBack( 101 ); - vector.PushBack( 102 ); + vector.PushBack(100); + vector.PushBack(101); + vector.PushBack(102); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 100, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 101, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 102, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 100, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 101, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 102, TEST_LOCATION); - ret = vector.Erase( vector.Begin() + 1, vector.Begin() + 1 ); + ret = vector.Erase(vector.Begin() + 1, vector.Begin() + 1); - DALI_TEST_EQUALS( static_cast(3), vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 0 ], 100, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 1 ], 101, TEST_LOCATION ); - DALI_TEST_EQUALS( vector[ 2 ], 102, TEST_LOCATION ); + DALI_TEST_EQUALS(static_cast(3), vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(vector[0], 100, TEST_LOCATION); + DALI_TEST_EQUALS(vector[1], 101, TEST_LOCATION); + DALI_TEST_EQUALS(vector[2], 102, TEST_LOCATION); - DALI_TEST_EQUALS( *ret, 101, TEST_LOCATION ); + DALI_TEST_EQUALS(*ret, 101, TEST_LOCATION); END_TEST; } @@ -1164,47 +1162,46 @@ int UtcDaliVectorIntEraseRangeAssert(void) { tet_infoline("Testing Dali::Vector::Erase(Iterator,Iterator) asserts"); - Vector< char > vector; - DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION ); - + Vector vector; + DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION); // Add some elements. - vector.PushBack( 1 ); - vector.PushBack( 2 ); + vector.PushBack(1); + vector.PushBack(2); // first out of bounds try { - vector.Erase( vector.Begin() + 3u, vector.Begin() + 4u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + vector.Erase(vector.Begin() + 3u, vector.Begin() + 4u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( first <= End() ) && ( first >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(first <= End()) && (first >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { - vector.Erase( vector.Begin() - 1u, vector.End() ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + vector.Erase(vector.Begin() - 1u, vector.End()); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( first <= End() ) && ( first >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(first <= End()) && (first >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -1212,55 +1209,55 @@ int UtcDaliVectorIntEraseRangeAssert(void) try { - vector.Erase( vector.Begin(), vector.Begin() + 3u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + vector.Erase(vector.Begin(), vector.Begin() + 3u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( last <= End() ) && ( last >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(last <= End()) && (last >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } try { - vector.Erase( vector.Begin(), vector.Begin() - 1u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + vector.Erase(vector.Begin(), vector.Begin() - 1u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( last <= End() ) && ( last >= Begin() )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(last <= End()) && (last >= Begin())", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } - vector.PushBack( 3 ); + vector.PushBack(3); // first > last try { - vector.Erase( vector.Begin() + 2u, vector.Begin() + 1u ); - tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION ); + vector.Erase(vector.Begin() + 2u, vector.Begin() + 1u); + tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION); tet_result(TET_FAIL); } - catch( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "( first <= last )", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "(first <= last)", TEST_LOCATION); } - catch( ... ) + catch(...) { - tet_printf("Assertion test failed - wrong Exception\n" ); + tet_printf("Assertion test failed - wrong Exception\n"); tet_result(TET_FAIL); } @@ -1271,21 +1268,21 @@ int UtcDaliVectorVector2P(void) { tet_infoline("Testing Dali::Vector< Vector2 >"); - Vector< Vector2 > classvector; - DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION ); + Vector classvector; + DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION); - classvector.PushBack( Vector2() ); + classvector.PushBack(Vector2()); - DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION ); - DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION); + DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION); - classvector.PushBack( Vector2( 0.1f, 0.2f ) ); + classvector.PushBack(Vector2(0.1f, 0.2f)); - DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector2(), classvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( Vector2( 0.1f, 0.2f ), classvector[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(Vector2(), classvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(0.1f, 0.2f), classvector[1], TEST_LOCATION); tet_result(TET_PASS); // for now END_TEST; @@ -1295,21 +1292,21 @@ int UtcDaliVectorVector3P(void) { tet_infoline("Testing Dali::Vector< Vector3 >"); - Vector< Vector3 > classvector; - DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION ); + Vector classvector; + DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION); - classvector.PushBack( Vector3() ); + classvector.PushBack(Vector3()); - DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION ); - DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION); + DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION); - classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) ); + classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f)); - DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION); - DALI_TEST_EQUALS( Vector3(), classvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), classvector[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(), classvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), classvector[1], TEST_LOCATION); tet_result(TET_PASS); // for now END_TEST; @@ -1319,21 +1316,21 @@ int UtcDaliVectorMatrixP(void) { tet_infoline("Testing Dali::Vector< Matrix >"); - Vector< Matrix > classvector; - DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION ); + Vector classvector; + DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION); + DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION); - classvector.PushBack( Matrix() ); + classvector.PushBack(Matrix()); - DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION ); - DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION); + DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION); - classvector.PushBack( Matrix::IDENTITY ); + classvector.PushBack(Matrix::IDENTITY); - DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION); - DALI_TEST_EQUALS( Matrix(), classvector[ 0 ], TEST_LOCATION ); - DALI_TEST_EQUALS( Matrix::IDENTITY, classvector[ 1 ], TEST_LOCATION ); + DALI_TEST_EQUALS(Matrix(), classvector[0], TEST_LOCATION); + DALI_TEST_EQUALS(Matrix::IDENTITY, classvector[1], TEST_LOCATION); tet_result(TET_PASS); // for now END_TEST; @@ -1341,20 +1338,20 @@ int UtcDaliVectorMatrixP(void) int UtcDaliVectorCpp11ForP(void) { - Vector< Vector3 > classvector; - for ( auto i : classvector ) + Vector classvector; + for(auto i : classvector) { std::ignore = i; - tet_result( TET_FAIL ); + tet_result(TET_FAIL); } - classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) ); - classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) ); - classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) ); + classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f)); + classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f)); + classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f)); - for ( auto i : classvector ) + for(auto i : classvector) { - DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), i, TEST_LOCATION ); + DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), i, TEST_LOCATION); } END_TEST; @@ -1368,8 +1365,8 @@ int UtcDaliVectorMoveConstructor(void) movedFrom.PushBack(Vector3::NEGATIVE_ZAXIS); Vector movedTo(std::move(movedFrom)); - DALI_TEST_EQUALS( movedTo.Size(), 3u, TEST_LOCATION); - DALI_TEST_EQUALS( movedFrom.Size(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(movedTo.Size(), 3u, TEST_LOCATION); + DALI_TEST_EQUALS(movedFrom.Size(), 0u, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Vector2.cpp b/automated-tests/src/dali/utc-Dali-Vector2.cpp index 64f63ea..dbbf9a0 100644 --- a/automated-tests/src/dali/utc-Dali-Vector2.cpp +++ b/automated-tests/src/dali/utc-Dali-Vector2.cpp @@ -15,13 +15,13 @@ * */ +#include +#include +#include + +#include // isfinite #include #include -#include // isfinite - -#include -#include -#include using namespace Dali; @@ -38,7 +38,7 @@ void utc_dali_vector2_cleanup(void) int UtcDaliVector2Constructor01P(void) { TestApplication application; - Vector2 vec2; + Vector2 vec2; DALI_TEST_EQUALS(vec2.x, 0.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 0.0f, 0.001, TEST_LOCATION); END_TEST; @@ -47,7 +47,7 @@ int UtcDaliVector2Constructor01P(void) int UtcDaliVector2Constructor02P(void) { TestApplication application; - Vector2 vec2(1.f,1.f); + Vector2 vec2(1.f, 1.f); DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); END_TEST; @@ -56,8 +56,8 @@ int UtcDaliVector2Constructor02P(void) int UtcDaliVector2Constructor03P(void) { TestApplication application; - float array[] = {1.f,1.f}; - Vector2 vec2(array); + float array[] = {1.f, 1.f}; + Vector2 vec2(array); DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); END_TEST; @@ -66,8 +66,8 @@ int UtcDaliVector2Constructor03P(void) int UtcDaliVector2Constructor04P(void) { TestApplication application; - Vector3 vec3(1.f,1.f,1.f); - Vector3 vec2(vec3); + Vector3 vec3(1.f, 1.f, 1.f); + Vector3 vec2(vec3); DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); END_TEST; @@ -76,8 +76,8 @@ int UtcDaliVector2Constructor04P(void) int UtcDaliVector2Constructor05P(void) { TestApplication application; - Vector4 vec4(1.f,1.f,1.f,1.f); - Vector2 vec2(vec4); + Vector4 vec4(1.f, 1.f, 1.f, 1.f); + Vector2 vec2(vec4); DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); END_TEST; @@ -86,8 +86,8 @@ int UtcDaliVector2Constructor05P(void) int UtcDaliVector2ConstructorUint16PairP(void) { TestApplication application; - Uint16Pair pair( 20, 30 ); - Vector2 vec2(pair); + Uint16Pair pair(20, 30); + Vector2 vec2(pair); DALI_TEST_EQUALS(vec2.x, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 30.0f, 0.001, TEST_LOCATION); END_TEST; @@ -96,8 +96,8 @@ int UtcDaliVector2ConstructorUint16PairP(void) int UtcDaliVector2CopyConstructor01P(void) { TestApplication application; - float array[] = {1.f,1.f}; - Vector2 vec2; + float array[] = {1.f, 1.f}; + Vector2 vec2; vec2 = array; DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); @@ -107,8 +107,8 @@ int UtcDaliVector2CopyConstructor01P(void) int UtcDaliVector2CopyConstructor02P(void) { TestApplication application; - Vector3 vec3(1.f,1.f,1.f); - Vector3 vec2; + Vector3 vec3(1.f, 1.f, 1.f); + Vector3 vec2; vec2 = vec3; DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); @@ -118,8 +118,8 @@ int UtcDaliVector2CopyConstructor02P(void) int UtcDaliVector2CopyConstructor03P(void) { TestApplication application; - Vector4 vec4(1.f,1.f,1.f,1.f); - Vector3 vec2; + Vector4 vec4(1.f, 1.f, 1.f, 1.f); + Vector3 vec2; vec2 = vec4; DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION); @@ -129,8 +129,8 @@ int UtcDaliVector2CopyConstructor03P(void) int UtcDaliVector2CopyConstructor04P(void) { TestApplication application; - Vector2 vec0( 10.f, 20.f ); - Vector2 vec1( vec0 ); + Vector2 vec0(10.f, 20.f); + Vector2 vec1(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); END_TEST; @@ -139,8 +139,8 @@ int UtcDaliVector2CopyConstructor04P(void) int UtcDaliVector2MoveConstructor(void) { TestApplication application; - Vector2 vec0( 10.f, 20.f ); - Vector2 vec1 = std::move( vec0 ); + Vector2 vec0(10.f, 20.f); + Vector2 vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); @@ -150,8 +150,8 @@ int UtcDaliVector2MoveConstructor(void) int UtcDaliVector2CopyAssignment(void) { TestApplication application; - Vector2 vec0( 10.f, 20.f ); - Vector2 vec1; + Vector2 vec0(10.f, 20.f); + Vector2 vec1; vec1 = vec0; DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); @@ -162,9 +162,9 @@ int UtcDaliVector2CopyAssignment(void) int UtcDaliVector2MoveAssignment(void) { TestApplication application; - Vector2 vec0( 10.f, 20.f ); - Vector2 vec1; - vec1 = std::move( vec0 ); + Vector2 vec0(10.f, 20.f); + Vector2 vec1; + vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); @@ -174,8 +174,8 @@ int UtcDaliVector2MoveAssignment(void) int UtcDaliVector2AssignP(void) { TestApplication application; - Vector2 v1(10.0f, 20.0f); - Vector2 r0(11.0f, 22.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(11.0f, 22.0f); v1 = r0; DALI_TEST_EQUALS(v1, r0, TEST_LOCATION); @@ -185,8 +185,8 @@ int UtcDaliVector2AssignP(void) int UtcDaliVector2AssignP02(void) { TestApplication application; - Vector2 v1(10.0f, 20.0f); - Vector4 r0(11.0f, 22.0f, 33.f, 44.f); + Vector2 v1(10.0f, 20.0f); + Vector4 r0(11.0f, 22.0f, 33.f, 44.f); v1 = r0; DALI_TEST_EQUALS(v1, Vector2(r0.x, r0.y), TEST_LOCATION); @@ -196,8 +196,8 @@ int UtcDaliVector2AssignP02(void) int UtcDaliVector2AssignP03(void) { TestApplication application; - Vector2 v1(10.0f, 20.0f); - Vector3 r0(11.0f, 22.0f, 33.f); + Vector2 v1(10.0f, 20.0f); + Vector3 r0(11.0f, 22.0f, 33.f); v1 = r0; DALI_TEST_EQUALS(v1, Vector2(r0.x, r0.y), TEST_LOCATION); @@ -207,11 +207,11 @@ int UtcDaliVector2AssignP03(void) int UtcDaliVector2AddP(void) { TestApplication application; - Vector2 v0(1.0f, 2.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(11.0f, 22.0f); + Vector2 v0(1.0f, 2.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(11.0f, 22.0f); - Vector2 v2 = v0+v1; + Vector2 v2 = v0 + v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; } @@ -219,9 +219,9 @@ int UtcDaliVector2AddP(void) int UtcDaliVector2AddAssignP(void) { TestApplication application; - Vector2 v0(1.0f, 2.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(11.0f, 22.0f); + Vector2 v0(1.0f, 2.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(11.0f, 22.0f); v0 += v1; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -231,11 +231,11 @@ int UtcDaliVector2AddAssignP(void) int UtcDaliVector2SubtractP(void) { TestApplication application; - Vector2 v0(11.0f, 22.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(1.0f, 2.0f); + Vector2 v0(11.0f, 22.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(1.0f, 2.0f); - Vector2 v2 = v0-v1; + Vector2 v2 = v0 - v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; @@ -244,9 +244,9 @@ int UtcDaliVector2SubtractP(void) int UtcDaliVector2SubtractAssignP(void) { TestApplication application; - Vector2 v0(11.0f, 22.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(1.0f, 2.0f); + Vector2 v0(11.0f, 22.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(1.0f, 2.0f); v0 -= v1; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -256,8 +256,8 @@ int UtcDaliVector2SubtractAssignP(void) int UtcDaliVector2NegateP(void) { TestApplication application; - Vector2 v1(10.0f, 20.0f); - Vector2 r0(-10.0f, -20.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(-10.0f, -20.0f); Vector2 v2 = -v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -267,9 +267,9 @@ int UtcDaliVector2NegateP(void) int UtcDaliVector2Multiply01P(void) { TestApplication application; - Vector2 v0(2.0f, 3.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(20.0f, 60.0f); + Vector2 v0(2.0f, 3.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(20.0f, 60.0f); Vector2 v2 = v0 * v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -280,8 +280,8 @@ int UtcDaliVector2Multiply01P(void) int UtcDaliVector2Multiply02P(void) { TestApplication application; - Vector2 v0(2.0f, 3.0f); - Vector2 r0(20.0f, 30.0f); + Vector2 v0(2.0f, 3.0f); + Vector2 r0(20.0f, 30.0f); Vector2 v2 = v0 * 10.f; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -292,9 +292,9 @@ int UtcDaliVector2Multiply02P(void) int UtcDaliVector2MultiplyAssign01P(void) { TestApplication application; - Vector2 v0(2.0f, 3.0f); - Vector2 v1(10.0f, 20.0f); - Vector2 r0(20.0f, 60.0f); + Vector2 v0(2.0f, 3.0f); + Vector2 v1(10.0f, 20.0f); + Vector2 r0(20.0f, 60.0f); v0 *= v1; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -304,8 +304,8 @@ int UtcDaliVector2MultiplyAssign01P(void) int UtcDaliVector2MultiplyAssign02P(void) { TestApplication application; - Vector2 v0(2.0f, 3.0f); - Vector2 r0(20.0f, 30.0f); + Vector2 v0(2.0f, 3.0f); + Vector2 r0(20.0f, 30.0f); v0 *= 10.f; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -315,14 +315,14 @@ int UtcDaliVector2MultiplyAssign02P(void) int UtcDaliVector2Divide01P(void) { TestApplication application; - Vector2 v0(1.0f, 1.0f); - Vector2 v1(2.0f, 3.0f); - Vector2 v2(4.0f, 9.0f); + Vector2 v0(1.0f, 1.0f); + Vector2 v1(2.0f, 3.0f); + Vector2 v2(4.0f, 9.0f); - DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v0 / v0, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v0, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v1, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v2 / v1, v1, TEST_LOCATION); END_TEST; } @@ -330,13 +330,13 @@ int UtcDaliVector2Divide01P(void) int UtcDaliVector2Divide02P(void) { TestApplication application; - Vector2 v0(1.0f, 1.0f); - Vector2 v1(3.0f, 3.0f); - Vector2 v2(9.0f, 9.0f); + Vector2 v0(1.0f, 1.0f); + Vector2 v1(3.0f, 3.0f); + Vector2 v2(9.0f, 9.0f); - DALI_TEST_EQUALS( v0/1.f, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v1/1.f, v1, TEST_LOCATION); - DALI_TEST_EQUALS( v1/3.f, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v0 / 1.f, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / 1.f, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / 3.f, v0, TEST_LOCATION); END_TEST; } @@ -344,9 +344,9 @@ int UtcDaliVector2Divide02P(void) int UtcDaliVector2DivideAssign01P(void) { TestApplication application; - Vector2 v0(1.0f, 1.0f); - Vector2 v1(2.0f, 3.0f); - Vector2 v2(4.0f, 9.0f); + Vector2 v0(1.0f, 1.0f); + Vector2 v1(2.0f, 3.0f); + Vector2 v2(4.0f, 9.0f); Vector2 v4(v0); v4 /= v0; @@ -369,8 +369,8 @@ int UtcDaliVector2DivideAssign01P(void) int UtcDaliVector2DivideAssign02P(void) { TestApplication application; - Vector2 v0(1.0f, 1.0f); - Vector2 v1(3.0f, 3.0f); + Vector2 v0(1.0f, 1.0f); + Vector2 v1(3.0f, 3.0f); Vector2 v4(v0); v4 /= 1.f; @@ -390,8 +390,8 @@ int UtcDaliVector2DivideAssign02P(void) int UtcDaliVector2EqualsP(void) { TestApplication application; - Vector2 v0(1.0f, 2.0f); - Vector2 v1(1.0f, 2.0f); + Vector2 v0(1.0f, 2.0f); + Vector2 v1(1.0f, 2.0f); DALI_TEST_CHECK(v0 == v1); @@ -401,8 +401,8 @@ int UtcDaliVector2EqualsP(void) int UtcDaliVector2NotEqualsP(void) { TestApplication application; - Vector2 v0(1.0f, 2.0f); - Vector2 v1(1.0f, 2.0f); + Vector2 v0(1.0f, 2.0f); + Vector2 v1(1.0f, 2.0f); Vector2 v2 = Vector2(0.0f, 2.0f); DALI_TEST_CHECK(v0 != v2); @@ -421,18 +421,18 @@ int UtcDaliVector2NotEqualsP(void) int UtcDaliVector2OperatorSubscriptP(void) { TestApplication application; - Vector2 testVector(1.0f, 2.0f); + Vector2 testVector(1.0f, 2.0f); // read array subscripts - DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector[0], 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[1], 2.0f, TEST_LOCATION); // write array subscripts/read struct memebers testVector[0] = 3.0f; testVector[1] = 4.0f; - DALI_TEST_EQUALS( testVector.x, 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.y, 4.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector.x, 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.y, 4.0f, TEST_LOCATION); END_TEST; } @@ -440,7 +440,7 @@ int UtcDaliVector2OperatorSubscriptP(void) int UtcDaliVector2OperatorSubscriptN(void) { TestApplication application; - Vector2 testVector(1.0f, 2.0f); + Vector2 testVector(1.0f, 2.0f); try { @@ -448,10 +448,10 @@ int UtcDaliVector2OperatorSubscriptN(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "Vector element index out of bounds", TEST_LOCATION); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "Vector element index out of bounds", TEST_LOCATION); } END_TEST; @@ -460,18 +460,18 @@ int UtcDaliVector2OperatorSubscriptN(void) int UtcDaliVector2OperatorConstSubscriptP(void) { TestApplication application; - const Vector2 testVector2(3.0f, 4.0f); - const float& x = testVector2[0]; - const float& y = testVector2[1]; - DALI_TEST_EQUALS( x, 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( y, 4.0f, TEST_LOCATION ); + const Vector2 testVector2(3.0f, 4.0f); + const float& x = testVector2[0]; + const float& y = testVector2[1]; + DALI_TEST_EQUALS(x, 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(y, 4.0f, TEST_LOCATION); END_TEST; } int UtcDaliVector2OperatorConstSubscriptN(void) { TestApplication application; - const Vector2 testVector2(3.0f, 4.0f); + const Vector2 testVector2(3.0f, 4.0f); try { @@ -479,22 +479,20 @@ int UtcDaliVector2OperatorConstSubscriptN(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "Vector element index out of bounds" , TEST_LOCATION); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "Vector element index out of bounds", TEST_LOCATION); } - END_TEST; } - int UtcDaliVector2LengthP(void) { TestApplication application; - Vector2 v(1.0f, 2.0f); - DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y), 0.001f, TEST_LOCATION); + Vector2 v(1.0f, 2.0f); + DALI_TEST_EQUALS(v.Length(), sqrtf(v.x * v.x + v.y * v.y), 0.001f, TEST_LOCATION); Vector2 v1(0.0f, 0.0f); DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION); @@ -504,8 +502,8 @@ int UtcDaliVector2LengthP(void) int UtcDaliVector2LengthSquaredP(void) { TestApplication application; - Vector2 v(1.0f, 2.0f); - DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y, 0.001f, TEST_LOCATION); + Vector2 v(1.0f, 2.0f); + DALI_TEST_EQUALS(v.LengthSquared(), v.x * v.x + v.y * v.y, 0.001f, TEST_LOCATION); Vector2 v1(0.0f, 0.0f); DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION); @@ -515,9 +513,9 @@ int UtcDaliVector2LengthSquaredP(void) int UtcDaliVector2NormalizeP(void) { TestApplication application; - for (float f=0.0f; f<6.0f; f+=1.0f) + for(float f = 0.0f; f < 6.0f; f += 1.0f) { - Vector2 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f); + Vector2 v(cosf(f) * 10.0f, cosf(f + 1.0f) * 10.0f); v.Normalize(); DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION); } @@ -527,7 +525,7 @@ int UtcDaliVector2NormalizeP(void) int UtcDaliVector2NormalizeN(void) { TestApplication application; - Vector2 v(0.0f, 0.0f); + Vector2 v(0.0f, 0.0f); v.Normalize(); DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION); END_TEST; @@ -546,34 +544,34 @@ int UtcDaliVector2ClampVector2P(void) Vector2 min(1.0f, 4.0f); Vector2 max(9.0f, 6.0f); - v0.Clamp( min, max ); - v1.Clamp( min, max ); - v2.Clamp( min, max ); - v3.Clamp( min, max ); - v4.Clamp( min, max ); + v0.Clamp(min, max); + v1.Clamp(min, max); + v2.Clamp(min, max); + v3.Clamp(min, max); + v4.Clamp(min, max); - DALI_TEST_EQUALS( v0, Vector2(2.0f, 4.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v1, Vector2(1.0f, 4.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v2, Vector2(9.0f, 5.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v3, Vector2(8.0f, 6.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v4, Vector2(4.9f, 5.1f), 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(v0, Vector2(2.0f, 4.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v1, Vector2(1.0f, 4.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v2, Vector2(9.0f, 5.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v3, Vector2(8.0f, 6.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v4, Vector2(4.9f, 5.1f), 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliVector2AsFloatP(void) { TestApplication application; - Vector2 vec2(1.f,1.f); - float* p = vec2.AsFloat(); + Vector2 vec2(1.f, 1.f); + float* p = vec2.AsFloat(); - DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(p[0], 1.f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(p[1], 1.f, 0.01f, TEST_LOCATION); p[0] = 2.f; p[1] = 2.f; - DALI_TEST_EQUALS( p[0], 2.f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( p[1], 2.f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(p[0], 2.f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(p[1], 2.f, 0.01f, TEST_LOCATION); END_TEST; } @@ -581,11 +579,11 @@ int UtcDaliVector2AsFloatP(void) int UtcDaliVector2ConstAsFloatP(void) { TestApplication application; - Vector2 vec2(1.f,1.f); - const float* p = vec2.AsFloat(); + Vector2 vec2(1.f, 1.f); + const float* p = vec2.AsFloat(); - DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(p[0], 1.f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(p[1], 1.f, 0.01f, TEST_LOCATION); END_TEST; } @@ -593,10 +591,10 @@ int UtcDaliVector2ConstAsFloatP(void) int UtcDaliVector2XWidthP(void) { TestApplication application; - Vector2 vec2(1.f,1.f); + Vector2 vec2(1.f, 1.f); - DALI_TEST_EQUALS( vec2.x, 1.f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( vec2.width, 1.f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(vec2.x, 1.f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(vec2.width, 1.f, 0.01f, TEST_LOCATION); END_TEST; } @@ -604,17 +602,17 @@ int UtcDaliVector2XWidthP(void) int UtcDaliVector2YHeightP(void) { TestApplication application; - Vector2 vec2(1.f,1.f); + Vector2 vec2(1.f, 1.f); - DALI_TEST_EQUALS( vec2.y, 1.f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( vec2.height, 1.f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(vec2.y, 1.f, 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(vec2.height, 1.f, 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliVector2OStreamOperatorP(void) { - TestApplication application; + TestApplication application; std::ostringstream oss; Vector2 vector(1, 2); @@ -623,16 +621,15 @@ int UtcDaliVector2OStreamOperatorP(void) std::string expectedOutput = "[1, 2]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } - int UtcDaliVector2MaxP(void) { TestApplication application; - Vector2 v0(2.0f, 1.0f); - Vector2 v1(1.0f, 2.0f); + Vector2 v0(2.0f, 1.0f); + Vector2 v1(1.0f, 2.0f); DALI_TEST_EQUALS(Max(v0, v1), Vector2(2.0f, 2.0f), 0.01f, TEST_LOCATION); END_TEST; @@ -641,8 +638,8 @@ int UtcDaliVector2MaxP(void) int UtcDaliVector2MinP(void) { TestApplication application; - Vector2 v0(2.0f, 1.0f); - Vector2 v1(1.0f, 2.0f); + Vector2 v0(2.0f, 1.0f); + Vector2 v1(1.0f, 2.0f); DALI_TEST_EQUALS(Min(v0, v1), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION); END_TEST; @@ -656,9 +653,8 @@ int UtcDaliVector2ClampP(void) Vector2 v0(2.0f, 0.8f); Vector2 v1(-1.0f, 2.0f); - DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector2(1.1f, 0.9f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( Clamp( v1, 0.0f, 3.0f ), Vector2(0.0f, 2.0f), 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(Clamp(v0, 0.9f, 1.1f), Vector2(1.1f, 0.9f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(Clamp(v1, 1.0f, 1.0f), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(Clamp(v1, 0.0f, 3.0f), Vector2(0.0f, 2.0f), 0.01f, TEST_LOCATION); END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-Vector3.cpp b/automated-tests/src/dali/utc-Dali-Vector3.cpp index 44dd36b..b07e3a3 100644 --- a/automated-tests/src/dali/utc-Dali-Vector3.cpp +++ b/automated-tests/src/dali/utc-Dali-Vector3.cpp @@ -15,13 +15,13 @@ * */ +#include +#include +#include + +#include // isfinite #include #include -#include // isfinite - -#include -#include -#include using namespace Dali; @@ -38,7 +38,7 @@ void utc_dali_vector3_cleanup(void) int UtcDaliVector3Constructor01P(void) { TestApplication application; - Vector3 va; + Vector3 va; DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION); @@ -48,7 +48,7 @@ int UtcDaliVector3Constructor01P(void) int UtcDaliVector3Constructor02P(void) { TestApplication application; - Vector3 va(1.f, 1.f, 1.f); + Vector3 va(1.f, 1.f, 1.f); DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION); @@ -58,8 +58,8 @@ int UtcDaliVector3Constructor02P(void) int UtcDaliVector3Constructor03P(void) { TestApplication application; - float array [] = {1.f, 1.f, 1.f}; - Vector3 va(array); + float array[] = {1.f, 1.f, 1.f}; + Vector3 va(array); DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION); @@ -69,8 +69,8 @@ int UtcDaliVector3Constructor03P(void) int UtcDaliVector3Constructor04P(void) { TestApplication application; - Vector2 vec2(1.f,1.f); - Vector3 va(vec2); + Vector2 vec2(1.f, 1.f); + Vector3 va(vec2); DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION); @@ -80,8 +80,8 @@ int UtcDaliVector3Constructor04P(void) int UtcDaliVector3Constructor05P(void) { TestApplication application; - Vector4 vec4(1.f, 1.f, 1.f, 1.f); - Vector3 va(vec4); + Vector4 vec4(1.f, 1.f, 1.f, 1.f); + Vector3 va(vec4); DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION); @@ -91,8 +91,8 @@ int UtcDaliVector3Constructor05P(void) int UtcDaliVector3CopyConstructor(void) { TestApplication application; - Vector3 vec0( 10.f, 20.f, 30.0f ); - Vector3 vec1( vec0 ); + Vector3 vec0(10.f, 20.f, 30.0f); + Vector3 vec1(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -102,8 +102,8 @@ int UtcDaliVector3CopyConstructor(void) int UtcDaliVector3MoveConstructor(void) { TestApplication application; - Vector3 vec0( 10.f, 20.f, 30.0f ); - Vector3 vec1 = std::move( vec0 ); + Vector3 vec0(10.f, 20.f, 30.0f); + Vector3 vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -114,8 +114,8 @@ int UtcDaliVector3MoveConstructor(void) int UtcDaliVector3CopyAssignment(void) { TestApplication application; - Vector3 vec0( 10.f, 20.f, 30.0f ); - Vector3 vec1; + Vector3 vec0(10.f, 20.f, 30.0f); + Vector3 vec1; vec1 = vec0; DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); @@ -127,9 +127,9 @@ int UtcDaliVector3CopyAssignment(void) int UtcDaliVector3MoveAssignment(void) { TestApplication application; - Vector3 vec0( 10.f, 20.f, 30.0f ); - Vector3 vec1; - vec1 = std::move( vec0 ); + Vector3 vec0(10.f, 20.f, 30.0f); + Vector3 vec1; + vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -140,9 +140,9 @@ int UtcDaliVector3MoveAssignment(void) int UtcDaliVector3Assign01P(void) { TestApplication application; - Vector3 v0; - const float array[] = { 1.0f, 2.0f, 3.0f }; - v0 = (const float*)array; + Vector3 v0; + const float array[] = {1.0f, 2.0f, 3.0f}; + v0 = (const float*)array; DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION); @@ -153,8 +153,8 @@ int UtcDaliVector3Assign01P(void) int UtcDaliVector3Assign02P(void) { TestApplication application; - Vector2 vec2_q(1.0f, 2.0f); - Vector3 vec3a; + Vector2 vec2_q(1.0f, 2.0f); + Vector3 vec3a; vec3a = vec2_q; DALI_TEST_EQUALS(vec3a.x, 1.0f, 0.001f, TEST_LOCATION); @@ -166,8 +166,8 @@ int UtcDaliVector3Assign02P(void) int UtcDaliVector3Assign03P(void) { TestApplication application; - Vector4 vec4_q(4.0f, 3.0f, 2.0f, 1.0f); - Vector3 vec3b; + Vector4 vec4_q(4.0f, 3.0f, 2.0f, 1.0f); + Vector3 vec3b; vec3b = vec4_q; DALI_TEST_EQUALS(vec3b.x, 4.0f, 0.001f, TEST_LOCATION); @@ -179,11 +179,11 @@ int UtcDaliVector3Assign03P(void) int UtcDaliVector3Add01P(void) { TestApplication application; - Vector3 v0(1.0f, 2.0f, 3.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(11.0f, 22.0f, 33.0f); + Vector3 v0(1.0f, 2.0f, 3.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(11.0f, 22.0f, 33.0f); - Vector3 v2 = v0+v1; + Vector3 v2 = v0 + v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; @@ -192,9 +192,9 @@ int UtcDaliVector3Add01P(void) int UtcDaliVector3Add02P(void) { TestApplication application; - Vector3 v0(1.0f, 2.0f, 3.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(11.0f, 22.0f, 33.0f); + Vector3 v0(1.0f, 2.0f, 3.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(11.0f, 22.0f, 33.0f); v0 += v1; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -205,11 +205,11 @@ int UtcDaliVector3Add02P(void) int UtcDaliVector3Subtract01P(void) { TestApplication application; - Vector3 v0(11.0f, 22.0f, 33.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(1.0f, 2.0f, 3.0f); + Vector3 v0(11.0f, 22.0f, 33.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(1.0f, 2.0f, 3.0f); - Vector3 v2 = v0-v1; + Vector3 v2 = v0 - v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; @@ -218,9 +218,9 @@ int UtcDaliVector3Subtract01P(void) int UtcDaliVector3Subtract02P(void) { TestApplication application; - Vector3 v0(11.0f, 22.0f, 33.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(1.0f, 2.0f, 3.0f); + Vector3 v0(11.0f, 22.0f, 33.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(1.0f, 2.0f, 3.0f); v0 -= v1; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); @@ -230,9 +230,9 @@ int UtcDaliVector3Subtract02P(void) int UtcDaliVector3Multiply01P(void) { TestApplication application; - Vector3 v0(2.0f, 3.0f, 4.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(20.0f, 60.0f, 120.0f); + Vector3 v0(2.0f, 3.0f, 4.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(20.0f, 60.0f, 120.0f); Vector3 v2 = v0 * v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -242,9 +242,9 @@ int UtcDaliVector3Multiply01P(void) int UtcDaliVector3Multiply02P(void) { TestApplication application; - Vector3 v0(2.0f, 3.0f, 4.0f); - Vector3 r0(20.0f, 30.0f, 40.0f); - Vector3 v2 = v0 * 10.f; + Vector3 v0(2.0f, 3.0f, 4.0f); + Vector3 r0(20.0f, 30.0f, 40.0f); + Vector3 v2 = v0 * 10.f; DALI_TEST_EQUALS(v2, r0, 0.001, TEST_LOCATION); END_TEST; } @@ -252,9 +252,9 @@ int UtcDaliVector3Multiply02P(void) int UtcDaliVector3Multiply03P(void) { TestApplication application; - Vector3 v0(2.0f, 3.0f, 4.0f); - Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 r0(20.0f, 60.0f, 120.0f); + Vector3 v0(2.0f, 3.0f, 4.0f); + Vector3 v1(10.0f, 20.0f, 30.0f); + Vector3 r0(20.0f, 60.0f, 120.0f); v0 *= v1; DALI_TEST_EQUALS(v0, r0, 0.001, TEST_LOCATION); END_TEST; @@ -263,8 +263,8 @@ int UtcDaliVector3Multiply03P(void) int UtcDaliVector3Multiply04P(void) { TestApplication application; - Vector3 v0(2.0f, 3.0f, 4.0f); - Vector3 r0(20.0f, 30.0f, 40.0f); + Vector3 v0(2.0f, 3.0f, 4.0f); + Vector3 r0(20.0f, 30.0f, 40.0f); v0 *= 10.f; DALI_TEST_EQUALS(v0, r0, TEST_LOCATION); END_TEST; @@ -273,25 +273,25 @@ int UtcDaliVector3Multiply04P(void) int UtcDaliVector3Multiply05P(void) { TestApplication application; - Vector3 vec3(Vector3::YAXIS); - Quaternion rotation(Radian(Math::PI_2), Vector3::ZAXIS); - Vector3 result(-Vector3::XAXIS); + Vector3 vec3(Vector3::YAXIS); + Quaternion rotation(Radian(Math::PI_2), Vector3::ZAXIS); + Vector3 result(-Vector3::XAXIS); vec3 *= rotation; - DALI_TEST_EQUALS( vec3, result, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS(vec3, result, 0.001, TEST_LOCATION); END_TEST; } int UtcDaliVector3Divide01P(void) { TestApplication application; - Vector3 v0(1.0f, 1.0f, 1.0f); - Vector3 v1(2.0f, 3.0f, 5.0f); - Vector3 v2(4.0f, 9.0f, 25.0f); + Vector3 v0(1.0f, 1.0f, 1.0f); + Vector3 v1(2.0f, 3.0f, 5.0f); + Vector3 v2(4.0f, 9.0f, 25.0f); - DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v0 / v0, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v0, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v1, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v2 / v1, v1, TEST_LOCATION); END_TEST; } @@ -299,10 +299,10 @@ int UtcDaliVector3Divide01P(void) int UtcDaliVector3Divide02P(void) { TestApplication application; - Vector3 v0(3.0f, 6.0f, 9.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); - Vector3 r(3.0f, 3.0f, 3.0f); - Vector3 v2 = v0 / v1; + Vector3 v0(3.0f, 6.0f, 9.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 r(3.0f, 3.0f, 3.0f); + Vector3 v2 = v0 / v1; DALI_TEST_EQUALS(v2, r, TEST_LOCATION); END_TEST; } @@ -310,9 +310,9 @@ int UtcDaliVector3Divide02P(void) int UtcDaliVector3Divide03P(void) { TestApplication application; - Vector3 v0(3.0f, 6.0f, 9.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); - Vector3 v2 = v0 / 3.f; + Vector3 v0(3.0f, 6.0f, 9.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 v2 = v0 / 3.f; DALI_TEST_EQUALS(v2, v1, TEST_LOCATION); END_TEST; } @@ -320,9 +320,9 @@ int UtcDaliVector3Divide03P(void) int UtcDaliVector3Divide04P(void) { TestApplication application; - Vector3 v0(3.0f, 6.0f, 9.0f); - Vector3 v1(1.0f, 1.0f, 1.0f); - Vector3 v4(v0); + Vector3 v0(3.0f, 6.0f, 9.0f); + Vector3 v1(1.0f, 1.0f, 1.0f); + Vector3 v4(v0); v4 /= v0; DALI_TEST_EQUALS(v4, v1, TEST_LOCATION); END_TEST; @@ -331,20 +331,19 @@ int UtcDaliVector3Divide04P(void) int UtcDaliVector3Divide05P(void) { TestApplication application; - Vector3 v0(3.0f, 6.0f, 9.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); - Vector3 v4(v0); + Vector3 v0(3.0f, 6.0f, 9.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 v4(v0); v4 /= 3.f; DALI_TEST_EQUALS(v4, v1, TEST_LOCATION); END_TEST; } - int UtcDaliVector3NegateP(void) { TestApplication application; - Vector3 v1(10.0f, 20.0f, 30.f); - Vector3 r0(-10.0f, -20.0f, -30.f); + Vector3 v1(10.0f, 20.0f, 30.f); + Vector3 r0(-10.0f, -20.0f, -30.f); Vector3 v2 = -v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -354,8 +353,8 @@ int UtcDaliVector3NegateP(void) int UtcDaliVector3EqualsP(void) { TestApplication application; - Vector3 v0(1.0f, 2.0f, 3.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 v0(1.0f, 2.0f, 3.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); DALI_TEST_CHECK(v0 == v1); END_TEST; @@ -364,9 +363,9 @@ int UtcDaliVector3EqualsP(void) int UtcDaliVector3NotEqualsP(void) { TestApplication application; - Vector3 v0(1.0f, 2.0f, 3.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); - Vector3 v2 = Vector3(0.0f, 2.0f, 3.0f); + Vector3 v0(1.0f, 2.0f, 3.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 v2 = Vector3(0.0f, 2.0f, 3.0f); DALI_TEST_CHECK(v0 != v2); v2 = Vector3(1.0f, 0.0f, 3.0f); @@ -383,47 +382,47 @@ int UtcDaliVector3NotEqualsP(void) int UtcDaliVector3OperatorSubscriptP(void) { TestApplication application; - Vector3 testVector(1.0f, 2.0f, 3.0f); + Vector3 testVector(1.0f, 2.0f, 3.0f); // read array subscripts - DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[2], 3.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector[0], 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[1], 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[2], 3.0f, TEST_LOCATION); // write array subscripts/read struct memebers testVector[0] = 4.0f; testVector[1] = 5.0f; testVector[2] = 6.0f; - DALI_TEST_EQUALS( testVector.x, 4.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.y, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.z, 6.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector.x, 4.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.y, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.z, 6.0f, TEST_LOCATION); // write struct members/read array subscripts testVector.x = 7.0f; testVector.y = 8.0f; testVector.z = 9.0f; - DALI_TEST_EQUALS( testVector[0], 7.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[1], 8.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[2], 9.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector[0], 7.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[1], 8.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[2], 9.0f, TEST_LOCATION); END_TEST; } int UtcDaliVector3ConstOperatorSubscriptP(void) { TestApplication application; - Vector3 testVector(1.0f, 2.0f, 3.0f); + Vector3 testVector(1.0f, 2.0f, 3.0f); // write struct members/read array subscripts const Vector3 testVector2(1.0f, 2.0f, 3.0f); - const float& x = testVector2[0]; - const float& y = testVector2[1]; - const float& z ( testVector2[2] ); + const float& x = testVector2[0]; + const float& y = testVector2[1]; + const float& z(testVector2[2]); - DALI_TEST_EQUALS( x, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( y, 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( z, 3.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(x, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(y, 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(z, 3.0f, TEST_LOCATION); try { @@ -431,10 +430,10 @@ int UtcDaliVector3ConstOperatorSubscriptP(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "index < 3", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "index < 3", TEST_LOCATION); } try @@ -443,9 +442,9 @@ int UtcDaliVector3ConstOperatorSubscriptP(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_PRINT_ASSERT(e); DALI_TEST_ASSERT(e, "index < 3", TEST_LOCATION); } @@ -463,7 +462,7 @@ int UtcDaliVector3DotP(void) DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f).Dot(Vector3(1.0f, 0.0f, 0.0f)), 1.0f, TEST_LOCATION); - for (float x = 0; x<6.0f; x+=1.0f) + for(float x = 0; x < 6.0f; x += 1.0f) { Vector3 v0(cosf(x), sinf(x), 0.0f); Vector3 v1(sinf(x), -cosf(x), 0.0f); @@ -496,10 +495,9 @@ int UtcDaliVector3CrossP(void) Vector3 v0(2.0f, 3.0f, 4.0f); Vector3 v1(10.0f, 20.0f, 30.0f); - Vector3 result( (v0.y * v1.z) - (v0.z * v1.y), - (v0.z * v1.x) - (v0.x * v1.z), - (v0.x * v1.y) - (v0.y * v1.x) ); - + Vector3 result((v0.y * v1.z) - (v0.z * v1.y), + (v0.z * v1.x) - (v0.x * v1.z), + (v0.x * v1.y) - (v0.y * v1.x)); DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION); END_TEST; @@ -508,8 +506,8 @@ int UtcDaliVector3CrossP(void) int UtcDaliVector3LengthP(void) { TestApplication application; - Vector3 v(1.0f, 2.0f, 3.0f); - DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y + v.z*v.z), 0.001f, TEST_LOCATION); + Vector3 v(1.0f, 2.0f, 3.0f); + DALI_TEST_EQUALS(v.Length(), sqrtf(v.x * v.x + v.y * v.y + v.z * v.z), 0.001f, TEST_LOCATION); Vector3 v1(0.0f, 0.0f, 0.0f); DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION); @@ -519,8 +517,8 @@ int UtcDaliVector3LengthP(void) int UtcDaliVector3LengthSquaredP(void) { TestApplication application; - Vector3 v(1.0f, 2.0f, 3.0f); - DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y + v.z*v.z, 0.001f, TEST_LOCATION); + Vector3 v(1.0f, 2.0f, 3.0f); + DALI_TEST_EQUALS(v.LengthSquared(), v.x * v.x + v.y * v.y + v.z * v.z, 0.001f, TEST_LOCATION); Vector3 v1(0.0f, 0.0f, 0.0f); DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION); @@ -530,9 +528,9 @@ int UtcDaliVector3LengthSquaredP(void) int UtcDaliVector3NormalizeP(void) { TestApplication application; - for (float f=0.0f; f<6.0f; f+=1.0f) + for(float f = 0.0f; f < 6.0f; f += 1.0f) { - Vector3 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f); + Vector3 v(cosf(f) * 10.0f, cosf(f + 1.0f) * 10.0f, cosf(f + 2.0f) * 10.0f); v.Normalize(); DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION); } @@ -555,27 +553,27 @@ int UtcDaliVector3ClampVector3P(void) Vector3 min(1.0f, 4.0f, 1.5f); Vector3 max(9.0f, 6.0f, 8.0f); - v0.Clamp( min, max ); - v1.Clamp( min, max ); - v2.Clamp( min, max ); - v3.Clamp( min, max ); - v4.Clamp( min, max ); + v0.Clamp(min, max); + v1.Clamp(min, max); + v2.Clamp(min, max); + v3.Clamp(min, max); + v4.Clamp(min, max); - DALI_TEST_EQUALS( v0, Vector3(2.0f, 4.0f, 1.5f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v1, Vector3(1.0f, 4.0f, 8.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v2, Vector3(9.0f, 5.0f, 1.5f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v3, Vector3(8.0f, 6.0f, 5.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v4, Vector3(4.9f, 5.1f, 8.0f), 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(v0, Vector3(2.0f, 4.0f, 1.5f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v1, Vector3(1.0f, 4.0f, 8.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v2, Vector3(9.0f, 5.0f, 1.5f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v3, Vector3(8.0f, 6.0f, 5.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v4, Vector3(4.9f, 5.1f, 8.0f), 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliVector3AsFloatP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + Vector3 v0(values); - for (int i=0;i<3;++i) + for(int i = 0; i < 3; ++i) { DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION); } @@ -586,11 +584,11 @@ int UtcDaliVector3AsFloatP(void) int UtcDaliVector3ConstAsFloatP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + Vector3 v0(values); const Vector3 v1(values); - for (int i=0;i<3;++i) + for(int i = 0; i < 3; ++i) { DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION); } @@ -600,8 +598,8 @@ int UtcDaliVector3ConstAsFloatP(void) int UtcDaliVector3ConstAsVectorXYP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - const Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + const Vector3 v0(values); DALI_TEST_EQUALS(v0.GetVectorXY().x, values[0], TEST_LOCATION); DALI_TEST_EQUALS(v0.GetVectorXY().y, values[1], TEST_LOCATION); END_TEST; @@ -610,8 +608,8 @@ int UtcDaliVector3ConstAsVectorXYP(void) int UtcDaliVector3AsVectorXYP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + Vector3 v0(values); DALI_TEST_EQUALS(v0.GetVectorXY().x, values[0], TEST_LOCATION); DALI_TEST_EQUALS(v0.GetVectorXY().y, values[1], TEST_LOCATION); @@ -621,8 +619,8 @@ int UtcDaliVector3AsVectorXYP(void) int UtcDaliVector3ConstAsVectorXZP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - const Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + const Vector3 v0(values); DALI_TEST_EQUALS(v0.GetVectorYZ().x, values[1], TEST_LOCATION); DALI_TEST_EQUALS(v0.GetVectorYZ().y, values[2], TEST_LOCATION); @@ -632,8 +630,8 @@ int UtcDaliVector3ConstAsVectorXZP(void) int UtcDaliVector3AsVectorXZP(void) { TestApplication application; - float values[] = {0.0f, 1.0f, 2.0f}; - Vector3 v0(values); + float values[] = {0.0f, 1.0f, 2.0f}; + Vector3 v0(values); DALI_TEST_EQUALS(v0.GetVectorYZ().x, values[1], TEST_LOCATION); DALI_TEST_EQUALS(v0.GetVectorYZ().y, values[2], TEST_LOCATION); @@ -642,7 +640,7 @@ int UtcDaliVector3AsVectorXZP(void) int UtcDaliVector3OStreamOperatorP(void) { - TestApplication application; + TestApplication application; std::ostringstream oss; Vector3 vector(1, 2, 3); @@ -651,15 +649,15 @@ int UtcDaliVector3OStreamOperatorP(void) std::string expectedOutput = "[1, 2, 3]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } int UtcDaliVector3MinP(void) { TestApplication application; - Vector3 v0(2.0f, 2.0f, 1.0f); - Vector3 v1(1.0f, 1.0f, 2.0f); + Vector3 v0(2.0f, 2.0f, 1.0f); + Vector3 v1(1.0f, 1.0f, 2.0f); DALI_TEST_EQUALS(Min(v0, v1), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION); END_TEST; @@ -668,8 +666,8 @@ int UtcDaliVector3MinP(void) int UtcDaliVector3MaxP(void) { TestApplication application; - Vector3 v0(2.0f, 1.0f, 3.0f); - Vector3 v1(1.0f, 2.0f, 3.0f); + Vector3 v0(2.0f, 1.0f, 3.0f); + Vector3 v1(1.0f, 2.0f, 3.0f); DALI_TEST_EQUALS(Max(v0, v1), Vector3(2.0f, 2.0f, 3.0f), 0.01f, TEST_LOCATION); END_TEST; @@ -678,20 +676,20 @@ int UtcDaliVector3MaxP(void) int UtcDaliVector3ClampP(void) { TestApplication application; - Vector3 v0( 2.0f, 1.0f, 0.0f ); - Vector3 v1( -1.0f, 2.0f, 1.0f ); + Vector3 v0(2.0f, 1.0f, 0.0f); + Vector3 v1(-1.0f, 2.0f, 1.0f); - DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector3(1.1f, 1.0f, 0.9f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(Clamp(v0, 0.9f, 1.1f), Vector3(1.1f, 1.0f, 0.9f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(Clamp(v1, 1.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliVector3ConstantsP(void) { TestApplication application; - Vector3 va = Vector3::ZERO; - Vector3 vb = Vector3::ONE; - Vector3 vc = Vector3::XAXIS; + Vector3 va = Vector3::ZERO; + Vector3 vb = Vector3::ONE; + Vector3 vc = Vector3::XAXIS; DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION); @@ -706,4 +704,3 @@ int UtcDaliVector3ConstantsP(void) DALI_TEST_EQUALS(vc.z, 0.0f, 0.001f, TEST_LOCATION); END_TEST; } - diff --git a/automated-tests/src/dali/utc-Dali-Vector4.cpp b/automated-tests/src/dali/utc-Dali-Vector4.cpp index dcb593d..cd96bea 100644 --- a/automated-tests/src/dali/utc-Dali-Vector4.cpp +++ b/automated-tests/src/dali/utc-Dali-Vector4.cpp @@ -15,13 +15,13 @@ * */ +#include +#include +#include + #include #include -#include -#include -#include - using namespace Dali; void utc_dali_vector4_startup(void) @@ -56,7 +56,7 @@ int UtcDaliVector4Constructor02P(void) int UtcDaliVector4Constructor03P(void) { - float f [] = {1.0f, 2.0f, 3.0f, 4.f}; + float f[] = {1.0f, 2.0f, 3.0f, 4.f}; Vector4 v(f); DALI_TEST_EQUALS(v.x, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(v.y, 2.0f, TEST_LOCATION); @@ -90,8 +90,8 @@ int UtcDaliVector4Constructor05P(void) int UtcDaliVector4CopyConstructor(void) { TestApplication application; - Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f ); - Vector4 vec1( vec0 ); + Vector4 vec0(10.f, 20.f, 30.0f, 40.0f); + Vector4 vec1(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -102,8 +102,8 @@ int UtcDaliVector4CopyConstructor(void) int UtcDaliVector4MoveConstructor(void) { TestApplication application; - Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f ); - Vector4 vec1 = std::move( vec0 ); + Vector4 vec0(10.f, 20.f, 30.0f, 40.0f); + Vector4 vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -115,8 +115,8 @@ int UtcDaliVector4MoveConstructor(void) int UtcDaliVector4CopyAssignment(void) { TestApplication application; - Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f ); - Vector4 vec1; + Vector4 vec0(10.f, 20.f, 30.0f, 40.0f); + Vector4 vec1; vec1 = vec0; DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); @@ -129,9 +129,9 @@ int UtcDaliVector4CopyAssignment(void) int UtcDaliVector4MoveAssignment(void) { TestApplication application; - Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f ); - Vector4 vec1; - vec1 = std::move( vec0 ); + Vector4 vec0(10.f, 20.f, 30.0f, 40.0f); + Vector4 vec1; + vec1 = std::move(vec0); DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION); DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION); @@ -142,9 +142,9 @@ int UtcDaliVector4MoveAssignment(void) int UtcDaliVector4Assign01P(void) { - Vector4 v0; - const float array[] = { 1.0f, 2.0f, 3.0f, 4.f }; - v0 = (const float*)array; + Vector4 v0; + const float array[] = {1.0f, 2.0f, 3.0f, 4.f}; + v0 = (const float*)array; DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION); @@ -163,7 +163,7 @@ int UtcDaliVector4Assign02P(void) DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION); v0.w = v0.z = 99.f; - v0 = vec2; + v0 = vec2; DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION); @@ -190,7 +190,7 @@ int UtcDaliVector4Add01P(void) Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); Vector4 r0(11.0f, 22.0f, 33.0f, 44.0f); - Vector4 v2 = v0+v1; + Vector4 v2 = v0 + v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; @@ -213,7 +213,7 @@ int UtcDaliVector4Subtract01P(void) Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); Vector4 r0(1.0f, 2.0f, 3.0f, 4.0f); - Vector4 v2 = v0-v1; + Vector4 v2 = v0 - v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; } @@ -232,7 +232,7 @@ int UtcDaliVector4Subtract02P(void) int UtcDaliVector4Multiply01P(void) { Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f); - Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); + Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f); Vector4 v2 = v0 * v1; @@ -243,9 +243,9 @@ int UtcDaliVector4Multiply01P(void) int UtcDaliVector4Multiply02P(void) { - Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); + Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f); - Vector4 v2 = v0 * 10.0f; + Vector4 v2 = v0 * 10.0f; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; } @@ -253,7 +253,7 @@ int UtcDaliVector4Multiply02P(void) int UtcDaliVector4Multiply03P(void) { Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f); - Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); + Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f); v0 *= v1; @@ -263,9 +263,9 @@ int UtcDaliVector4Multiply03P(void) int UtcDaliVector4Multiply04P(void) { - Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); + Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f); - Vector4 v2(r0); + Vector4 v2(r0); v0 *= 10.0f; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); END_TEST; @@ -277,22 +277,21 @@ int UtcDaliVector4Divide01P(void) Vector4 v1(2.0f, 3.0f, 5.0f, 7.0f); Vector4 v2(4.0f, 9.0f, 25.0f, 49.0f); - DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION); - DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION); - DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION); - + DALI_TEST_EQUALS(v0 / v0, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v0, v1, TEST_LOCATION); + DALI_TEST_EQUALS(v1 / v1, v0, TEST_LOCATION); + DALI_TEST_EQUALS(v2 / v1, v1, TEST_LOCATION); END_TEST; } int UtcDaliVector4Divide02P(void) { - Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); + Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f); - const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f); - const Vector4 r2( 1.0f, 2.0f, 4.0f, 8.0f); - const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f); + const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f); + const Vector4 r2(1.0f, 2.0f, 4.0f, 8.0f); + const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f); Vector4 v2 = r0 / 10.0f; DALI_TEST_EQUALS(v2, r3, TEST_LOCATION); @@ -326,11 +325,11 @@ int UtcDaliVector4Divide03P(void) int UtcDaliVector4Divide04P(void) { - Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); + Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f); const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f); - const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f); - const Vector4 r2( 1.0f, 2.0f, 4.0f, 8.0f); - const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f); + const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f); + const Vector4 r2(1.0f, 2.0f, 4.0f, 8.0f); + const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f); Vector4 v2(r0); v2 /= 10.0f; @@ -342,8 +341,8 @@ int UtcDaliVector4Divide04P(void) int UtcDaliVector4NegateP(void) { TestApplication application; - Vector4 v1(10.0f, 20.0f, 30.f, 40.f); - Vector4 r0(-10.0f, -20.0f, -30.f, -40.f); + Vector4 v1(10.0f, 20.0f, 30.f, 40.f); + Vector4 r0(-10.0f, -20.0f, -30.f, -40.f); Vector4 v2 = -v1; DALI_TEST_EQUALS(v2, r0, TEST_LOCATION); @@ -352,8 +351,8 @@ int UtcDaliVector4NegateP(void) int UtcDaliVector4EqualsP(void) { - Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f); - Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f); + Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f); + Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f); DALI_TEST_CHECK(v0 == v1); END_TEST; @@ -361,8 +360,8 @@ int UtcDaliVector4EqualsP(void) int UtcDaliVector4NotEqualsP(void) { - Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f); - Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f); + Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f); + Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f); Vector4 v2 = Vector4(0.0f, 2.0f, 3.0f, 4.0f); DALI_TEST_CHECK(v0 != v2); @@ -383,10 +382,10 @@ int UtcDaliVector4OperatorSubscriptP(void) Vector4 testVector(1.0f, 2.0f, 3.0f, 4.0f); // read array subscripts - DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[2], 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[3], 4.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector[0], 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[1], 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[2], 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[3], 4.0f, TEST_LOCATION); // write array subscripts/read struct memebers testVector[0] = 5.0f; @@ -394,10 +393,10 @@ int UtcDaliVector4OperatorSubscriptP(void) testVector[2] = 7.0f; testVector[3] = 8.0f; - DALI_TEST_EQUALS( testVector.x, 5.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.y, 6.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.z, 7.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector.w, 8.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector.x, 5.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.y, 6.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.z, 7.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector.w, 8.0f, TEST_LOCATION); // write struct members/read array subscripts testVector.x = 9.0f; @@ -405,30 +404,29 @@ int UtcDaliVector4OperatorSubscriptP(void) testVector.z = 11.0f; testVector.w = 12.0f; - DALI_TEST_EQUALS( testVector[0], 9.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[1], 10.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[2], 11.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( testVector[3], 12.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(testVector[0], 9.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[1], 10.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[2], 11.0f, TEST_LOCATION); + DALI_TEST_EQUALS(testVector[3], 12.0f, TEST_LOCATION); END_TEST; } - int UtcDaliVector4ConstOperatorSubscriptP(void) { Vector4 testVector(1.0f, 2.0f, 3.0f, 4.0f); // write struct members/read array subscripts const Vector4 testVector2(1.0f, 2.0f, 3.0f, 4.0f); - const float& x = testVector2[0]; - const float& y = testVector2[1]; - const float& z ( testVector2[2] ); - const float& w ( testVector2[3] ); + const float& x = testVector2[0]; + const float& y = testVector2[1]; + const float& z(testVector2[2]); + const float& w(testVector2[3]); - DALI_TEST_EQUALS( x, 1.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( y, 2.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( z, 3.0f, TEST_LOCATION ); - DALI_TEST_EQUALS( w, 4.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(x, 1.0f, TEST_LOCATION); + DALI_TEST_EQUALS(y, 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(z, 3.0f, TEST_LOCATION); + DALI_TEST_EQUALS(w, 4.0f, TEST_LOCATION); try { @@ -436,10 +434,10 @@ int UtcDaliVector4ConstOperatorSubscriptP(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "index < 4", TEST_LOCATION); } try @@ -448,10 +446,10 @@ int UtcDaliVector4ConstOperatorSubscriptP(void) (void)w; // Suppress unused variable warning tet_result(TET_FAIL); } - catch (Dali::DaliException& e) + catch(Dali::DaliException& e) { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION ); + DALI_TEST_PRINT_ASSERT(e); + DALI_TEST_ASSERT(e, "index < 4", TEST_LOCATION); } END_TEST; } @@ -467,7 +465,7 @@ int UtcDaliVector4Dot01P(void) DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot(Vector4(1.0f, 0.0f, 0.0f, 1.0f)), 1.0f, TEST_LOCATION); // Test v0 . v0 and v0 . v1 (v1 is always 90 degrees out of phase with v0) - for (float x = 0; x<6.0f; x+=1.0f) + for(float x = 0; x < 6.0f; x += 1.0f) { // vectors rotating in the XY plane. Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f); @@ -501,7 +499,7 @@ int UtcDaliVector4DotVector302P(void) DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot(Vector3(1.0f, 0.0f, 0.0f)), 1.0f, TEST_LOCATION); // Test v0 . v0b and v0 . v1 (v1 is always 90 degrees out of phase with v0) - for (float x = 0; x<6.0f; x+=1.0f) + for(float x = 0; x < 6.0f; x += 1.0f) { // vectors rotating in the XY plane. Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f); @@ -511,9 +509,9 @@ int UtcDaliVector4DotVector302P(void) DALI_TEST_EQUALS(v0.Dot(v0b), 1.0f, 0.0001f, TEST_LOCATION); // vectors rotating in the XZ plane. - v0 = Vector4(cosf(x), 0.0f, sinf(x), 0.0f); + v0 = Vector4(cosf(x), 0.0f, sinf(x), 0.0f); v0b = Vector3(cosf(x), 0.0f, sinf(x)); - v1 = Vector3(sinf(x), 0.0f, -cosf(x)); + v1 = Vector3(sinf(x), 0.0f, -cosf(x)); DALI_TEST_EQUALS(v0.Dot(v1), 0.0f, 0.0001f, TEST_LOCATION); DALI_TEST_EQUALS(v0.Dot(v0b), 1.0f, 0.0001f, TEST_LOCATION); } @@ -538,7 +536,7 @@ int UtcDaliVector4Dot4P(void) DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot4(Vector4(1.0f, 0.0f, 0.0f, 1.0f)), 2.0f, TEST_LOCATION); - for (float x = 0; x<6.0f; x+=1.0f) + for(float x = 0; x < 6.0f; x += 1.0f) { Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f); Vector4 v1(sinf(x), -cosf(x), 0.0f, 1.0f); @@ -555,7 +553,7 @@ int UtcDaliVector4Dot4P(void) v0.Normalize(); Vector4 v1 = v0 * 2.0f; - DALI_TEST_EQUALS(v0.Dot4(v1), 2.0f + 3.0f*6.0f, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(v0.Dot4(v1), 2.0f + 3.0f * 6.0f, 0.001f, TEST_LOCATION); END_TEST; } @@ -571,10 +569,10 @@ int UtcDaliVector4CrossP(void) Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f); Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f); - Vector4 result( (v0.y * v1.z) - (v0.z * v1.y), - (v0.z * v1.x) - (v0.x * v1.z), - (v0.x * v1.y) - (v0.y * v1.x), - 0.0f); + Vector4 result((v0.y * v1.z) - (v0.z * v1.y), + (v0.z * v1.x) - (v0.x * v1.z), + (v0.x * v1.y) - (v0.y * v1.x), + 0.0f); DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION); END_TEST; @@ -583,7 +581,7 @@ int UtcDaliVector4CrossP(void) int UtcDaliVector4LengthP(void) { Vector4 v(1.0f, 2.0f, 3.0f, 4.0f); - DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y + v.z*v.z), 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(v.Length(), sqrtf(v.x * v.x + v.y * v.y + v.z * v.z), 0.001f, TEST_LOCATION); Vector4 v1(0.0f, 0.0f, 0.0f, 0.0f); DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION); @@ -593,7 +591,7 @@ int UtcDaliVector4LengthP(void) int UtcDaliVector4LengthSquaredP(void) { Vector4 v(1.0f, 2.0f, 3.0f, 4.0f); - DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y + v.z*v.z, 0.001f, TEST_LOCATION); + DALI_TEST_EQUALS(v.LengthSquared(), v.x * v.x + v.y * v.y + v.z * v.z, 0.001f, TEST_LOCATION); Vector4 v1(0.0f, 0.0f, 0.0f, 0.0f); DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION); @@ -602,9 +600,9 @@ int UtcDaliVector4LengthSquaredP(void) int UtcDaliVector4NormalizeP(void) { - for (float f=0.0f; f<6.0f; f+=1.0f) + for(float f = 0.0f; f < 6.0f; f += 1.0f) { - Vector4 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f, 1.0f); + Vector4 v(cosf(f) * 10.0f, cosf(f + 1.0f) * 10.0f, cosf(f + 2.0f) * 10.0f, 1.0f); v.Normalize(); DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION); } @@ -628,26 +626,26 @@ int UtcDaliVector4ClampVector4P(void) Vector4 min(1.0f, -2.0f, -8.0f, -16.0f); Vector4 max(2.0f, 4.0f, 4.0f, -8.0f); - v0.Clamp( min, max ); - v1.Clamp( min, max ); - v2.Clamp( min, max ); - v3.Clamp( min, max ); - v4.Clamp( min, max ); + v0.Clamp(min, max); + v1.Clamp(min, max); + v2.Clamp(min, max); + v3.Clamp(min, max); + v4.Clamp(min, max); - DALI_TEST_EQUALS( v0, Vector4( 2.0f, 0.8f, 0.0f, -8.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v1, Vector4( 1.0f, 2.0f, 4.0f, -10.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v2, Vector4( 2.0f, 4.0f, 0.0f, -8.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v3, Vector4( 2.0f, 4.0f, 4.0f, -16.0f), 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( v4, Vector4( 2.0f, 4.0f, 4.0f, -8.0f), 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS(v0, Vector4(2.0f, 0.8f, 0.0f, -8.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v1, Vector4(1.0f, 2.0f, 4.0f, -10.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v2, Vector4(2.0f, 4.0f, 0.0f, -8.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v3, Vector4(2.0f, 4.0f, 4.0f, -16.0f), 0.01f, TEST_LOCATION); + DALI_TEST_EQUALS(v4, Vector4(2.0f, 4.0f, 4.0f, -8.0f), 0.01f, TEST_LOCATION); END_TEST; } int UtcDaliVector4AsFloatP(void) { - float values[] = {0.0f, 1.0f, 2.0f, 3.0f}; + float values[] = {0.0f, 1.0f, 2.0f, 3.0f}; Vector4 v0(values); - for (int i=0;i<4;++i) + for(int i = 0; i < 4; ++i) { DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION); } @@ -657,11 +655,11 @@ int UtcDaliVector4AsFloatP(void) int UtcDaliVector4ConstAsFloatP(void) { - float values[] = {0.0f, 1.0f, 2.0f, 3.0f}; + float values[] = {0.0f, 1.0f, 2.0f, 3.0f}; Vector4 v0(values); const Vector4 v1(values); - for (int i=0;i<4;++i) + for(int i = 0; i < 4; ++i) { DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION); } @@ -678,7 +676,7 @@ int UtcDaliVector4OStreamOperatorP(void) std::string expectedOutput = "[1, 2, 3, 4]"; - DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION); + DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION); END_TEST; } @@ -715,7 +713,7 @@ int UtcDaliVector4ClampP(void) int UtcDaliVector4ConstantsP(void) { - float f[] = {2.0f, 3.0f, 4.0f, 5.0f}; + float f[] = {2.0f, 3.0f, 4.0f, 5.0f}; Vector4 v0(f); Vector4 v1(f[0], f[1], f[2], f[3]); Vector4 v2(v0); diff --git a/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp b/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp index b19278c..96ac321 100644 --- a/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp +++ b/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp @@ -15,8 +15,8 @@ * */ -#include #include +#include using namespace Dali; @@ -37,20 +37,20 @@ int UtcDaliVertexBufferNew01(void) TestApplication application; Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; + texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION); END_TEST; } int UtcDaliVertexBufferNew02(void) { TestApplication application; - VertexBuffer vertexBuffer; - DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION ); + VertexBuffer vertexBuffer; + DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION); END_TEST; } @@ -59,14 +59,14 @@ int UtcDaliVertexBufferDownCast01(void) TestApplication application; Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; + texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat); - BaseHandle handle(vertexBuffer); + BaseHandle handle(vertexBuffer); VertexBuffer vertexBuffer2 = VertexBuffer::DownCast(handle); - DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION); END_TEST; } @@ -74,9 +74,9 @@ int UtcDaliVertexBufferDownCast02(void) { TestApplication application; - Handle handle = Handle::New(); // Create a custom object + Handle handle = Handle::New(); // Create a custom object VertexBuffer vertexBuffer = VertexBuffer::DownCast(handle); - DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION); END_TEST; } @@ -88,8 +88,8 @@ int UtcDaliVertexBufferCopyConstructor(void) VertexBuffer vertexBufferCopy(vertexBuffer); - DALI_TEST_EQUALS( (bool)vertexBufferCopy, true, TEST_LOCATION ); - DALI_TEST_EQUALS( vertexBufferCopy.GetSize(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBufferCopy, true, TEST_LOCATION); + DALI_TEST_EQUALS(vertexBufferCopy.GetSize(), 0u, TEST_LOCATION); END_TEST; } @@ -101,11 +101,11 @@ int UtcDaliVertexBufferAssignmentOperator(void) VertexBuffer vertexBuffer = CreateVertexBuffer(); VertexBuffer vertexBuffer2; - DALI_TEST_EQUALS( (bool)vertexBuffer2, false, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBuffer2, false, TEST_LOCATION); vertexBuffer2 = vertexBuffer; - DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( vertexBuffer2.GetSize(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION); + DALI_TEST_EQUALS(vertexBuffer2.GetSize(), 0u, TEST_LOCATION); END_TEST; } @@ -115,15 +115,15 @@ int UtcDaliVertexBufferMoveConstructor(void) TestApplication application; VertexBuffer vertexBuffer = CreateVertexBuffer(); - DALI_TEST_CHECK( vertexBuffer ); - DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION ); + DALI_TEST_CHECK(vertexBuffer); + DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION); - VertexBuffer move = std::move( vertexBuffer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION ); - DALI_TEST_CHECK( !vertexBuffer ); + VertexBuffer move = std::move(vertexBuffer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION); + DALI_TEST_CHECK(!vertexBuffer); END_TEST; } @@ -133,16 +133,16 @@ int UtcDaliVertexBufferMoveAssignment(void) TestApplication application; VertexBuffer vertexBuffer = CreateVertexBuffer(); - DALI_TEST_CHECK( vertexBuffer ); - DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION ); + DALI_TEST_CHECK(vertexBuffer); + DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION); VertexBuffer move; - move = std::move( vertexBuffer ); - DALI_TEST_CHECK( move ); - DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION ); - DALI_TEST_CHECK( !vertexBuffer ); + move = std::move(vertexBuffer); + DALI_TEST_CHECK(move); + DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION); + DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION); + DALI_TEST_CHECK(!vertexBuffer); END_TEST; } @@ -152,30 +152,34 @@ int UtcDaliVertexBufferSetData01(void) TestApplication application; Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; + texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; { - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat); + DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION); const float halfQuadSize = .5f; - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; + struct TexturedQuadVertex + { + Vector2 position; + Vector2 textureCoordinates; + }; TexturedQuadVertex texturedQuadVertexData[4] = { - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) }, - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) }, - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; + {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)}, + {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)}, + {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)}, + {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}}; - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + vertexBuffer.SetData(texturedQuadVertexData, 4); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer(vertexBuffer); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); @@ -185,12 +189,11 @@ int UtcDaliVertexBufferSetData01(void) application.SendNotification(); const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); - - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + application.GetGlAbstraction().GetBufferDataCalls(); - DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION); } // end of scope to let the buffer and geometry die; do another notification and render to get the deletion processed application.SendNotification(); @@ -204,29 +207,33 @@ int UtcDaliVertexBufferSetData02(void) TestApplication application; Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; + texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat); + DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION); const float halfQuadSize = .5f; - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; + struct TexturedQuadVertex + { + Vector2 position; + Vector2 textureCoordinates; + }; TexturedQuadVertex texturedQuadVertexData[4] = { - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) }, - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) }, - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; + {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)}, + {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)}, + {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)}, + {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}}; - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + vertexBuffer.SetData(texturedQuadVertexData, 4); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer(vertexBuffer); - Shader shader = CreateShader(); + Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); - Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f); + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f); actor.AddRenderer(renderer); application.GetScene().Add(actor); @@ -239,13 +246,13 @@ int UtcDaliVertexBufferSetData02(void) const TestGlAbstraction::BufferDataCalls& bufferDataCalls = application.GetGlAbstraction().GetBufferDataCalls(); - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); - DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION); } // Re-upload the data on the vertexBuffer - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + vertexBuffer.SetData(texturedQuadVertexData, 4); application.SendNotification(); application.Render(0); @@ -257,14 +264,14 @@ int UtcDaliVertexBufferSetData02(void) application.GetGlAbstraction().GetBufferSubDataCalls(); const TestGlAbstraction::BufferDataCalls& bufferDataCalls = - application.GetGlAbstraction().GetBufferDataCalls(); + application.GetGlAbstraction().GetBufferDataCalls(); - DALI_TEST_EQUALS( bufferSubDataCalls.size(), 1u, TEST_LOCATION ); - DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS(bufferSubDataCalls.size(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION); - if ( bufferSubDataCalls.size() ) + if(bufferSubDataCalls.size()) { - DALI_TEST_EQUALS( bufferSubDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION ); + DALI_TEST_EQUALS(bufferSubDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION); } } @@ -276,31 +283,30 @@ int UtcDaliVertexBufferInvalidTypeN(void) TestApplication application; Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::MAP; + texturedQuadVertexFormat["aPosition"] = Property::MAP; texturedQuadVertexFormat["aVertexCoord"] = Property::STRING; try { - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat); tet_result(TET_FAIL); } - catch ( Dali::DaliException& e ) + catch(Dali::DaliException& e) { - DALI_TEST_ASSERT( e, "Property::Type not supported in VertexBuffer", TEST_LOCATION ); + DALI_TEST_ASSERT(e, "Property::Type not supported in VertexBuffer", TEST_LOCATION); } END_TEST; } - int UtcDaliVertexBufferSetDataNegative(void) { - TestApplication application; + TestApplication application; Dali::VertexBuffer instance; try { - void* arg1(nullptr); + void* arg1(nullptr); unsigned long arg2(0u); - instance.SetData(arg1,arg2); + instance.SetData(arg1, arg2); DALI_TEST_CHECK(false); // Should not get here } catch(...) @@ -312,7 +318,7 @@ int UtcDaliVertexBufferSetDataNegative(void) int UtcDaliVertexBufferGetSizeNegative(void) { - TestApplication application; + TestApplication application; Dali::VertexBuffer instance; try { diff --git a/automated-tests/src/dali/utc-Dali-WeakHandle.cpp b/automated-tests/src/dali/utc-Dali-WeakHandle.cpp index 5bfd5c3..4b8fe8b 100644 --- a/automated-tests/src/dali/utc-Dali-WeakHandle.cpp +++ b/automated-tests/src/dali/utc-Dali-WeakHandle.cpp @@ -15,14 +15,13 @@ * */ -#include #include +#include using namespace Dali; namespace { - /******************************************************************************* * * Custom Actor @@ -32,21 +31,24 @@ namespace Impl { struct MyTestCustomActor : public CustomActorImpl { - typedef Signal< void ()> SignalType; - typedef Signal< void (float)> SignalTypeFloat; + typedef Signal SignalType; + typedef Signal SignalTypeFloat; - MyTestCustomActor() : CustomActorImpl( ActorFlags() ) - { } + MyTestCustomActor() + : CustomActorImpl(ActorFlags()) + { + } virtual ~MyTestCustomActor() - { } + { + } void ResetCallStack() { } // From CustomActorImpl - virtual void OnSceneConnection( int depth ) + virtual void OnSceneConnection(int depth) { } virtual void OnSceneDisconnection() @@ -72,47 +74,46 @@ struct MyTestCustomActor : public CustomActorImpl } virtual Vector3 GetNaturalSize() { - return Vector3( 0.0f, 0.0f, 0.0f ); + return Vector3(0.0f, 0.0f, 0.0f); } - virtual float GetHeightForWidth( float width ) + virtual float GetHeightForWidth(float width) { return 0.0f; } - virtual float GetWidthForHeight( float height ) + virtual float GetWidthForHeight(float height) { return 0.0f; } - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) + virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) { } - virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) + virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) { } - virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) + virtual void OnCalculateRelayoutSize(Dimension::Type dimension) { } - virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) + virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) { return 0.0f; } - virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) + virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) { } - virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) + virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) { return false; } public: - SignalType mSignal; }; @@ -121,9 +122,8 @@ public: class MyTestCustomActor : public CustomActor { public: - - typedef Signal< void ()> SignalType; - typedef Signal< void (float)> SignalTypeFloat; + typedef Signal SignalType; + typedef Signal SignalTypeFloat; MyTestCustomActor() { @@ -132,25 +132,25 @@ public: static MyTestCustomActor New() { Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor; - return MyTestCustomActor( *p ); // takes ownership + return MyTestCustomActor(*p); // takes ownership } virtual ~MyTestCustomActor() { } - static MyTestCustomActor DownCast( BaseHandle handle ) + static MyTestCustomActor DownCast(BaseHandle handle) { MyTestCustomActor result; - CustomActor custom = Dali::CustomActor::DownCast( handle ); - if ( custom ) + CustomActor custom = Dali::CustomActor::DownCast(handle); + if(custom) { CustomActorImpl& customImpl = custom.GetImplementation(); Impl::MyTestCustomActor* impl = dynamic_cast(&customImpl); - if (impl) + if(impl) { result = MyTestCustomActor(customImpl.GetOwner()); } @@ -162,7 +162,7 @@ public: SignalType& GetCustomSignal() { Dali::RefObject& obj = GetImplementation(); - return static_cast( obj ).mSignal; + return static_cast(obj).mSignal; } MyTestCustomActor(Internal::CustomActor* internal) @@ -170,13 +170,13 @@ public: { } - MyTestCustomActor( Impl::MyTestCustomActor& impl ) - : CustomActor( impl ) + MyTestCustomActor(Impl::MyTestCustomActor& impl) + : CustomActor(impl) { } }; -} +} // namespace int UtcDaliWeakHandleBaseConstructorVoid(void) { @@ -195,17 +195,17 @@ int UtcDaliWeakHandleBaseConstructorWithBaseHandle(void) TestApplication application; tet_infoline("Testing Dali::WeakHandleBase::WeakHandleBase(BaseHandle)"); - BaseHandle emptyHandle; + BaseHandle emptyHandle; WeakHandleBase emptyObject(emptyHandle); DALI_TEST_CHECK(!emptyObject.GetBaseHandle()); - Actor actor = Actor::New(); + Actor actor = Actor::New(); WeakHandleBase object(actor); DALI_TEST_CHECK(object.GetBaseHandle() == actor); - Animation animation = Animation::New( 1.0f ); - WeakHandleBase animationObject( animation ); - DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation ); + Animation animation = Animation::New(1.0f); + WeakHandleBase animationObject(animation); + DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation); END_TEST; } @@ -253,16 +253,16 @@ int UtcDaliWeakHandleBaseMoveConstructor(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandleBase object( actor ); - DALI_TEST_CHECK( object.GetBaseHandle() == actor); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + WeakHandleBase object(actor); + DALI_TEST_CHECK(object.GetBaseHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandleBase move = std::move( object ); - DALI_TEST_CHECK(move.GetBaseHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased - DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved + WeakHandleBase move = std::move(object); + DALI_TEST_CHECK(move.GetBaseHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased + DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved END_TEST; } @@ -272,17 +272,17 @@ int UtcDaliWeakHandleBaseMoveAssignment(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandleBase object( actor ); - DALI_TEST_CHECK( object.GetBaseHandle() == actor); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + WeakHandleBase object(actor); + DALI_TEST_CHECK(object.GetBaseHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased WeakHandleBase move; - move = std::move( object ); - DALI_TEST_CHECK(move.GetBaseHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased - DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved + move = std::move(object); + DALI_TEST_CHECK(move.GetBaseHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased + DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved END_TEST; } @@ -318,7 +318,7 @@ int UtcDaliWeakHandleBaseEqualityOperatorN(void) WeakHandleBase object(actor); DALI_TEST_CHECK(object.GetBaseHandle() == actor); - Actor differentActor = Actor::New(); + Actor differentActor = Actor::New(); WeakHandleBase aDifferentWeakHandleBase(differentActor); DALI_TEST_CHECK(!(object == aDifferentWeakHandleBase)); @@ -336,7 +336,7 @@ int UtcDaliWeakHandleBaseInequalityOperatorP(void) WeakHandleBase object(actor); DALI_TEST_CHECK(object.GetBaseHandle() == actor); - Actor differentActor = Actor::New(); + Actor differentActor = Actor::New(); WeakHandleBase aDifferentWeakHandleBase(differentActor); DALI_TEST_CHECK(object != aDifferentWeakHandleBase); @@ -364,31 +364,31 @@ int UtcDaliWeakHandleBaseGetBaseHandle(void) TestApplication application; tet_infoline("Testing Dali::WeakHandleBase::GetBaseHandle()"); - Handle emptyHandle; + Handle emptyHandle; WeakHandleBase emptyObject(emptyHandle); DALI_TEST_CHECK(!emptyObject.GetBaseHandle()); - Actor actor = Actor::New(); + Actor actor = Actor::New(); WeakHandleBase object(actor); DALI_TEST_CHECK(object.GetBaseHandle() == actor); WeakHandleBase theSameObject = WeakHandleBase(actor); DALI_TEST_CHECK(object.GetBaseHandle() == theSameObject.GetBaseHandle()); - Actor differentActor = Actor::New(); + Actor differentActor = Actor::New(); WeakHandleBase aDifferentWeakHandleBase(differentActor); DALI_TEST_CHECK(object.GetBaseHandle() != aDifferentWeakHandleBase.GetBaseHandle()); - Animation animation = Animation::New( 1.0f ); - WeakHandleBase animationObject( animation ); - DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation ); + Animation animation = Animation::New(1.0f); + WeakHandleBase animationObject(animation); + DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation); - WeakHandleBase theSameAnimationObject = WeakHandleBase( animation ); - DALI_TEST_CHECK( animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle() ); + WeakHandleBase theSameAnimationObject = WeakHandleBase(animation); + DALI_TEST_CHECK(animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle()); - Animation differentAnimation = Animation::New( 1.0f ); - WeakHandleBase aDifferentAnimationObject( differentAnimation ); - DALI_TEST_CHECK( animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle() ); + Animation differentAnimation = Animation::New(1.0f); + WeakHandleBase aDifferentAnimationObject(differentAnimation); + DALI_TEST_CHECK(animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle()); END_TEST; } @@ -396,9 +396,9 @@ int UtcDaliWeakHandleBaseGetBaseHandle(void) int UtcDaliWeakHandleBaseReset(void) { TestApplication application; - tet_infoline( "Testing Daku::WeakHandleBase::Reset()" ); + tet_infoline("Testing Daku::WeakHandleBase::Reset()"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); WeakHandleBase object(actor); DALI_TEST_CHECK(object.GetBaseHandle() == actor); @@ -415,22 +415,22 @@ int UtcDaliWeakHandleGetHandle(void) TestApplication application; tet_infoline("Testing Dali::WeakHandle::GetHandle()"); - Actor actor = Actor::New(); + Actor actor = Actor::New(); WeakHandle object(actor); DALI_TEST_CHECK(object.GetHandle() == actor); - MyTestCustomActor customActor = MyTestCustomActor::New(); + MyTestCustomActor customActor = MyTestCustomActor::New(); WeakHandle customObject(customActor); DALI_TEST_CHECK(customObject.GetHandle() == customActor); DALI_TEST_CHECK(object.GetHandle() != customObject.GetHandle()); - Animation animation = Animation::New( 1.0f ); - WeakHandle animationObject( animation ); - DALI_TEST_CHECK( animationObject.GetHandle() == animation ); + Animation animation = Animation::New(1.0f); + WeakHandle animationObject(animation); + DALI_TEST_CHECK(animationObject.GetHandle() == animation); animation.Reset(); - DALI_TEST_CHECK( animationObject.GetHandle() == Animation() ); + DALI_TEST_CHECK(animationObject.GetHandle() == Animation()); END_TEST; } @@ -440,16 +440,16 @@ int UtcDaliWeakHandleMoveConstructor(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandle object( actor ); - DALI_TEST_CHECK( object.GetHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + WeakHandle object(actor); + DALI_TEST_CHECK(object.GetHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandle move = std::move( object ); - DALI_TEST_CHECK( move.GetHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased - DALI_TEST_CHECK( !object.GetHandle() ); // object moved + WeakHandle move = std::move(object); + DALI_TEST_CHECK(move.GetHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased + DALI_TEST_CHECK(!object.GetHandle()); // object moved END_TEST; } @@ -459,17 +459,17 @@ int UtcDaliWeakHandleMoveAssignment(void) TestApplication application; Actor actor = Actor::New(); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased - WeakHandle object( actor ); - DALI_TEST_CHECK( object.GetHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased + WeakHandle object(actor); + DALI_TEST_CHECK(object.GetHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased WeakHandle move; - move = std::move( object ); - DALI_TEST_CHECK( move.GetHandle() == actor ); - DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased - DALI_TEST_CHECK( !object.GetHandle() ); // object moved + move = std::move(object); + DALI_TEST_CHECK(move.GetHandle() == actor); + DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased + DALI_TEST_CHECK(!object.GetHandle()); // object moved END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-WheelEvent.cpp b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp index dd9ea50..bdd13a1 100644 --- a/automated-tests/src/dali/utc-Dali-WheelEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp @@ -15,31 +15,31 @@ * */ -#include -#include -#include -#include -#include #include +#include +#include +#include +#include + +#include using namespace Dali; namespace { - // Key Event Test references -const static unsigned int SHIFT_MODIFIER = 0x1; -const static unsigned int CTRL_MODIFIER = 0x2; -const static unsigned int ALT_MODIFIER = 0x4; -const static unsigned int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER; - +const static unsigned int SHIFT_MODIFIER = 0x1; +const static unsigned int CTRL_MODIFIER = 0x2; +const static unsigned int ALT_MODIFIER = 0x4; +const static unsigned int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER; // Stores data that is populated in the callback and will be read by the TET cases struct SignalData { SignalData() : functorCalled(false) - {} + { + } void Reset() { @@ -49,21 +49,24 @@ struct SignalData wheeledActor.Reset(); } - bool functorCalled; + bool functorCalled; WheelEvent receivedWheelEvent; - Actor wheeledActor; + Actor wheeledActor; }; // Functor that sets the data when called struct WheelEventReceivedFunctor { - WheelEventReceivedFunctor( SignalData& data ) : signalData( data ) { } + WheelEventReceivedFunctor(SignalData& data) + : signalData(data) + { + } - bool operator()( Actor actor, const WheelEvent& wheelEvent ) + bool operator()(Actor actor, const WheelEvent& wheelEvent) { - signalData.functorCalled = true; + signalData.functorCalled = true; signalData.receivedWheelEvent = wheelEvent; - signalData.wheeledActor = actor; + signalData.wheeledActor = actor; return true; } @@ -77,15 +80,15 @@ int UtcDaliWheelEventConstructor(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(Dali::WheelEvent::MOUSE_WHEEL, event.GetType(), TEST_LOCATION); // check type - DALI_TEST_EQUALS(1, event.GetDirection(), TEST_LOCATION); // check direction - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.GetPoint(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1, event.GetDelta(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1000u, event.GetTime(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1, event.GetDirection(), TEST_LOCATION); // check direction + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.GetPoint(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1, event.GetDelta(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1000u, event.GetTime(), TEST_LOCATION); // check modifier END_TEST; } @@ -94,8 +97,8 @@ int UtcDaliWheelEventIsShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); @@ -109,8 +112,8 @@ int UtcDaliWheelEventIsCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); @@ -123,12 +126,12 @@ int UtcDaliWheelEventIsAltModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); - DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier + DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier END_TEST; } @@ -137,10 +140,10 @@ int UtcDaliWheelEventIsNotShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); - DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION); END_TEST; @@ -151,10 +154,10 @@ int UtcDaliWheelEventIsNotCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); - DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION); END_TEST; @@ -165,10 +168,10 @@ int UtcDaliWheelEventIsNotAltModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION); END_TEST; @@ -179,11 +182,11 @@ int UtcDaliWheelEventANDModifer(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(true, event.IsCtrlModifier() && event.IsShiftModifier(), TEST_LOCATION); - Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); + Dali::WheelEvent newEvent = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsShiftModifier(), TEST_LOCATION); END_TEST; } @@ -193,11 +196,11 @@ int UtcDaliWheelEventORModifer(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + DALI_TEST_CHECK(event); DALI_TEST_EQUALS(true, event.IsCtrlModifier() || event.IsAltModifier(), TEST_LOCATION); - Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); + Dali::WheelEvent newEvent = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsAltModifier(), TEST_LOCATION); END_TEST; } @@ -207,8 +210,8 @@ int UtcDaliWheelEventSignalling(void) TestApplication application; // Reset all test adapter return codes Actor actor = Actor::New(); - actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); - actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); application.GetScene().Add(actor); // Render and notify @@ -216,56 +219,56 @@ int UtcDaliWheelEventSignalling(void) application.Render(); // Connect to actor's wheel event signal - SignalData data; - WheelEventReceivedFunctor functor( data ); - actor.WheelEventSignal().Connect( &application, functor ); + SignalData data; + WheelEventReceivedFunctor functor(data); + actor.WheelEventSignal().Connect(&application, functor); - Vector2 screenCoordinates( 10.0f, 10.0f ); + Vector2 screenCoordinates(10.0f, 10.0f); Integration::WheelEvent event(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); // Emit a wheel signal - application.ProcessEvent( event ); - DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.wheeledActor ); + application.ProcessEvent(event); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.wheeledActor); DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, data.receivedWheelEvent.GetType(), TEST_LOCATION); // check type - DALI_TEST_EQUALS(0, data.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction - DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1, data.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0, data.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction + DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1, data.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier data.Reset(); // Emit a wheel signal where the actor is not present, will hit the root actor though - Actor rootActor( application.GetScene().GetRootLayer() ); + Actor rootActor(application.GetScene().GetRootLayer()); // Connect to root actor's wheel event signal - SignalData rootData; - WheelEventReceivedFunctor rootFunctor( rootData ); // Consumes signal - rootActor.WheelEventSignal().Connect( &application, rootFunctor ); + SignalData rootData; + WheelEventReceivedFunctor rootFunctor(rootData); // Consumes signal + rootActor.WheelEventSignal().Connect(&application, rootFunctor); screenCoordinates.x = screenCoordinates.y = 300.0f; Integration::WheelEvent newEvent(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); - application.ProcessEvent( newEvent ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); - DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.wheeledActor ); + application.ProcessEvent(newEvent); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION); + DALI_TEST_CHECK(rootActor == rootData.wheeledActor); DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, rootData.receivedWheelEvent.GetType(), TEST_LOCATION); // check type - DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction - DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction + DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier + DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier // Remove actor from the scene - application.GetScene().Remove( actor ); + application.GetScene().Remove(actor); // Render and notify application.SendNotification(); application.Render(); // Emit a move at the same point, we should not be signalled. - application.ProcessEvent( event ); - DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); + application.ProcessEvent(event); + DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); data.Reset(); END_TEST; } diff --git a/dali/devel-api/actors/camera-actor-devel.h b/dali/devel-api/actors/camera-actor-devel.h index b95600f..eedf33a 100644 --- a/dali/devel-api/actors/camera-actor-devel.h +++ b/dali/devel-api/actors/camera-actor-devel.h @@ -18,7 +18,7 @@ * */ -#include +#include namespace Dali { -- 2.7.4