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++)
{
}
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 )
}
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;
}
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
//
// Angle
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++)
{
// 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;
}
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;