From 5bc264c723a4cce455771293a45092013a8fa3ae Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Mon, 29 Jun 2015 16:36:24 +0900 Subject: [PATCH] Implement additional UTC Signed-off-by: suhyung Eom Change-Id: I36e35ea1675f6f34b7850cb19a8902e8c61e8741 --- .../src/dali/utc-Dali-PanGestureDetector.cpp | 27 +++++++++++++++++++ automated-tests/src/dali/utc-Dali-Rect.cpp | 19 +++++++++++++ .../src/dali/utc-Dali-TouchProcessing.cpp | 21 ++++++++------- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp index 32db45f0e..0fd2325a9 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp @@ -1785,6 +1785,33 @@ int UtcDaliPanGestureAngleHandling(void) 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; +} + inline float RadiansToDegrees( float radian ) { return radian * 180.0f / Math::PI; diff --git a/automated-tests/src/dali/utc-Dali-Rect.cpp b/automated-tests/src/dali/utc-Dali-Rect.cpp index 33938daa5..708c25cb9 100644 --- a/automated-tests/src/dali/utc-Dali-Rect.cpp +++ b/automated-tests/src/dali/utc-Dali-Rect.cpp @@ -126,6 +126,16 @@ int UtcDaliRectIsEmpty(void) END_TEST; } +int UtcDaliRectLeft(void) +{ + TestApplication application; + + Rect rf(10.0f, 20.0f, 400.0f, 200.0f); + + DALI_TEST_EQUALS(rf.Left(), 10.0f, 0.001, TEST_LOCATION); + END_TEST; +} + int UtcDaliRectRight(void) { TestApplication application; @@ -136,6 +146,15 @@ int UtcDaliRectRight(void) END_TEST; } +int UtcDaliRectTop(void) +{ + TestApplication application; + + Rect rf(10.0f, 20.0f, 400.0f, 200.0f); + + DALI_TEST_EQUALS(rf.Top(), 20.0f, 0.001, TEST_LOCATION); + END_TEST; +} int UtcDaliRectBottom(void) { diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp index 8d09883b9..2fe2760ae 100644 --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp @@ -152,33 +152,36 @@ int UtcDaliTouchNormalProcessing(void) // Emit a down signal application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) ); + const TouchPoint *point1 = &data.touchEvent.GetPoint(0); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( TouchPoint::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( TouchPoint::Motion, screenCoordinates ) ); + const TouchPoint *point2 = &data.touchEvent.GetPoint(0); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( TouchPoint::Motion, data.touchEvent.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( TouchPoint::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( TouchPoint::Up, screenCoordinates ) ); + const TouchPoint *point3 = &data.touchEvent.GetPoint(0); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( TouchPoint::Up, data.touchEvent.points[0].state, TEST_LOCATION ); - DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION ); - DALI_TEST_EQUALS( localCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( TouchPoint::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 -- 2.34.1