ResourceManager ResourcePostProcessQueue no longer double bufferred
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PanGestureDetector.cpp
index 1db4833..4943ce6 100644 (file)
@@ -1740,10 +1740,10 @@ int UtcDaliPanGestureAngleHandling(void)
   TestApplication application;
 
   PanGestureDetector detector = PanGestureDetector::New();
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 0, 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(), 1, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 1u, TEST_LOCATION );
   bool found = false;
   for( size_t i = 0; i < detector.GetAngleCount(); i++)
   {
@@ -1762,14 +1762,14 @@ int UtcDaliPanGestureAngleHandling(void)
   }
 
   detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Radian( Math::PI * 0.25 ) );
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
 
   // Remove something not in the container.
   detector.RemoveAngle( PanGestureDetector::DIRECTION_UP );
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
 
   detector.RemoveAngle( PanGestureDetector::DIRECTION_RIGHT );
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 1, TEST_LOCATION );
+  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 )
@@ -1781,7 +1781,34 @@ int UtcDaliPanGestureAngleHandling(void)
   }
 
   detector.ClearAngles();
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliPanGestureGetAngle(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();
   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_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_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 );
+
   END_TEST;
 }
 
@@ -1795,7 +1822,7 @@ int UtcDaliPanGestureAngleOutOfRange(void)
   TestApplication application;
 
   PanGestureDetector detector = PanGestureDetector::New();
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
 
   //
   // Angle
@@ -1928,10 +1955,10 @@ int UtcDaliPanGestureDirectionHandling(void)
   TestApplication application;
 
   PanGestureDetector detector = PanGestureDetector::New();
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 0, 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(), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
   bool found = false;
   for ( size_t i = 0; detector.GetAngleCount(); i++)
   {
@@ -1969,10 +1996,10 @@ int UtcDaliPanGestureDirectionHandling(void)
 
   // Remove something not in the container.
   detector.RemoveDirection( PanGestureDetector::DIRECTION_UP );
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
 
   detector.RemoveDirection( PanGestureDetector::DIRECTION_RIGHT );
-  DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
   END_TEST;
 }
 
@@ -2170,8 +2197,9 @@ int UtcDaliPanGestureNoPredictionSmoothing(void)
   PerformSwipeGestureSwipe(application, Vector2(1.0f, 1.0f), direction, PAN_GESTURE_UPDATE_COUNT, true);
   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), 0.1f, TEST_LOCATION );
-  DALI_TEST_EQUALS( constraintData.localPosition,  Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION );
+  // Take into account resampling done when prediction is off.
+  DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION );
+  DALI_TEST_EQUALS( constraintData.localPosition,  Vector2(1.0f, 1.0f) + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION );
 
   constraintData.Reset();
   END_TEST;