Formatting automated-tests
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PanGesture.cpp
index 4c6ab70..fdadd3c 100644 (file)
  *
  */
 
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/events/pan-gesture-devel.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
 
 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<int32_t>(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<int32_t>(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<int32_t>(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<int32_t>(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<int32_t>(index2), 12, TEST_LOCATION);
+  DALI_TEST_EQUALS(detector2.GetCurrentProperty<int32_t>(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<int32_t>(index), 99 /*target*/, TEST_LOCATION);
+  DALI_TEST_EQUALS(detector.GetCurrentProperty<int32_t>(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<int32_t>(index2), -99, TEST_LOCATION);
+  DALI_TEST_EQUALS(detector2.GetCurrentProperty<int32_t>(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<int32_t>(index), 99, TEST_LOCATION);
+  DALI_TEST_EQUALS(detector.GetCurrentProperty<int32_t>(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;