From 34745e42eed50817085b2e4868d301f8d43f9003 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gy=C3=B6rgy=20Straub?= Date: Wed, 2 Sep 2020 08:44:52 +0100 Subject: [PATCH] Moved Gesture::State and -::Type to gesture-enumerations.h. - GestureState is now an enum class; - Their values have been changed to upper case in compliance with the DALi coding standards; - Added tests for Pinch- & TapGestureProcessor abort cases; Change-Id: Iae9414e0f771535dffe6373e448c8769131f1b6d --- automated-tests/src/dali-internal/CMakeLists.txt | 2 + .../dali-internal/utc-Dali-Internal-Gesture.cpp | 52 +++++++------- .../utc-Dali-Internal-LongPressGesture.cpp | 30 ++++---- .../utc-Dali-Internal-PinchGesture.cpp | 50 ++++++------- .../utc-Dali-Internal-PinchGestureProcessor.cpp | 75 ++++++++++++++++++++ .../utc-Dali-Internal-RotationGesture.cpp | 48 ++++++------- .../dali-internal/utc-Dali-Internal-TapGesture.cpp | 24 +++---- .../utc-Dali-Internal-TapGestureProcessor.cpp | 81 ++++++++++++++++++++++ .../src/dali/utc-Dali-LongPressGestureDetector.cpp | 20 +++--- automated-tests/src/dali/utc-Dali-PanGesture.cpp | 72 +++++++++---------- .../src/dali/utc-Dali-PanGestureDetector.cpp | 50 ++++++------- .../src/dali/utc-Dali-PanGestureRecognizer.cpp | 2 +- .../src/dali/utc-Dali-PinchGestureDetector.cpp | 54 +++++++-------- .../src/dali/utc-Dali-PinchGestureRecognizer.cpp | 12 ++-- .../src/dali/utc-Dali-RotationGestureDetector.cpp | 60 ++++++++-------- .../dali/utc-Dali-RotationGestureRecognizer.cpp | 12 ++-- .../src/dali/utc-Dali-TapGestureDetector.cpp | 10 +-- dali/devel-api/events/pan-gesture-devel.cpp | 2 +- dali/devel-api/events/pan-gesture-devel.h | 2 +- dali/integration-api/scene.h | 2 +- dali/internal/event/actors/actor-impl.cpp | 4 +- dali/internal/event/actors/actor-impl.h | 2 +- dali/internal/event/events/actor-gesture-data.cpp | 24 +++---- dali/internal/event/events/actor-gesture-data.h | 8 +-- .../event/events/gesture-detector-impl.cpp | 2 +- dali/internal/event/events/gesture-detector-impl.h | 6 +- .../event/events/gesture-event-processor.cpp | 32 ++++----- dali/internal/event/events/gesture-event.cpp | 2 +- dali/internal/event/events/gesture-event.h | 6 +- dali/internal/event/events/gesture-impl.h | 17 ++--- dali/internal/event/events/gesture-processor.cpp | 12 ++-- dali/internal/event/events/gesture-processor.h | 4 +- dali/internal/event/events/gesture-recognizer.h | 8 +-- dali/internal/event/events/gesture-requests.h | 10 +-- .../event/events/hover-event-processor.cpp | 4 +- .../long-press-gesture-detector-impl.cpp | 4 +- .../long-press-gesture-event.cpp | 4 +- .../long-press-gesture/long-press-gesture-event.h | 14 ++-- .../long-press-gesture/long-press-gesture-impl.h | 8 +-- .../long-press-gesture-processor.cpp | 18 ++--- .../long-press-gesture-recognizer.cpp | 60 ++++++++-------- .../long-press-gesture-recognizer.h | 14 ++-- .../pan-gesture/pan-gesture-detector-impl.cpp | 2 +- .../event/events/pan-gesture/pan-gesture-event.cpp | 4 +- .../event/events/pan-gesture/pan-gesture-event.h | 16 ++--- .../event/events/pan-gesture/pan-gesture-impl.h | 4 +- .../events/pan-gesture/pan-gesture-processor.cpp | 42 +++++------ .../events/pan-gesture/pan-gesture-processor.h | 2 +- .../events/pan-gesture/pan-gesture-recognizer.cpp | 78 ++++++++++----------- .../events/pan-gesture/pan-gesture-recognizer.h | 12 ++-- .../pinch-gesture/pinch-gesture-detector-impl.cpp | 2 +- .../events/pinch-gesture/pinch-gesture-event.cpp | 4 +- .../events/pinch-gesture/pinch-gesture-event.h | 10 +-- .../events/pinch-gesture/pinch-gesture-impl.h | 4 +- .../pinch-gesture/pinch-gesture-processor.cpp | 20 +++--- .../pinch-gesture/pinch-gesture-recognizer.cpp | 46 ++++++------ .../pinch-gesture/pinch-gesture-recognizer.h | 8 +-- .../rotation-gesture-detector-impl.cpp | 2 +- .../rotation-gesture/rotation-gesture-event.h | 14 ++-- .../rotation-gesture/rotation-gesture-impl.h | 4 +- .../rotation-gesture-processor.cpp | 16 ++--- .../rotation-gesture-recognizer.cpp | 46 ++++++------ .../rotation-gesture/rotation-gesture-recognizer.h | 8 +-- .../tap-gesture/tap-gesture-detector-impl.cpp | 4 +- .../event/events/tap-gesture/tap-gesture-event.cpp | 4 +- .../event/events/tap-gesture/tap-gesture-event.h | 16 ++--- .../event/events/tap-gesture/tap-gesture-impl.h | 4 +- .../events/tap-gesture/tap-gesture-processor.cpp | 20 +++--- .../events/tap-gesture/tap-gesture-recognizer.cpp | 46 ++++++------ .../events/tap-gesture/tap-gesture-recognizer.h | 10 +-- .../update/gestures/pan-gesture-profiling.h | 5 +- .../update/gestures/scene-graph-pan-gesture.cpp | 12 ++-- .../update/gestures/scene-graph-pan-gesture.h | 6 +- dali/public-api/dali-core.h | 1 + dali/public-api/events/gesture-enumerations.h | 59 ++++++++++++++++ dali/public-api/events/gesture.cpp | 4 +- dali/public-api/events/gesture.h | 32 +-------- .../events/long-press-gesture-detector.h | 4 +- dali/public-api/events/long-press-gesture.h | 4 +- dali/public-api/events/pan-gesture.h | 6 +- dali/public-api/events/pinch-gesture.h | 6 +- dali/public-api/events/rotation-gesture.h | 6 +- dali/public-api/file.list | 1 + 83 files changed, 853 insertions(+), 664 deletions(-) create mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp create mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp create mode 100644 dali/public-api/events/gesture-enumerations.h diff --git a/automated-tests/src/dali-internal/CMakeLists.txt b/automated-tests/src/dali-internal/CMakeLists.txt index 0d5bcdd..3ace2e3 100644 --- a/automated-tests/src/dali-internal/CMakeLists.txt +++ b/automated-tests/src/dali-internal/CMakeLists.txt @@ -16,8 +16,10 @@ SET(TC_SOURCES utc-Dali-Internal-MemoryPoolObjectAllocator.cpp utc-Dali-Internal-OwnerPointer.cpp utc-Dali-Internal-PinchGesture.cpp + utc-Dali-Internal-PinchGestureProcessor.cpp utc-Dali-Internal-RotationGesture.cpp utc-Dali-Internal-TapGesture.cpp + utc-Dali-Internal-TapGestureProcessor.cpp ) LIST(APPEND TC_SOURCES 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 bf2b20e..25938e1 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-Gesture.cpp @@ -41,7 +41,7 @@ namespace struct TestGesture : public Internal::Gesture { public: - TestGesture(Gesture::Type type, Gesture::State state) + TestGesture(GestureType::Value type, GestureState state) : Gesture(type, state) {} virtual ~TestGesture() {} @@ -56,25 +56,25 @@ int UtcDaliGestureConstructorP(void) Gesture empty; DALI_TEST_CHECK( !empty ); - Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) ); - DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, pan.GetState(), TEST_LOCATION); + 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(Gesture::Pinch, Gesture::Clear) ); - DALI_TEST_EQUALS(Gesture::Pinch, pinch.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Clear, pinch.GetState(), TEST_LOCATION); + 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); // Test copy constructor Gesture pan2(pan); - DALI_TEST_EQUALS(Gesture::Pan, pan2.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, pan2.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, pan2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, pan2.GetState(), TEST_LOCATION); END_TEST; // Test move constructor const auto refCount = pan.GetObjectPtr()->ReferenceCount(); Gesture pan3( std::move( pan ) ); DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, pan3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -85,18 +85,18 @@ int UtcDaliGestureAssignmentP(void) TestApplication application; // Reset all test adapter return codes // Test Assignment operator - Gesture pan( new TestGesture(Gesture::Pan, Gesture::Finished) ); - DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION); + 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(Gesture::Pinch, Gesture::Started) ); - DALI_TEST_EQUALS(Gesture::Pinch, test.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, test.GetState(), TEST_LOCATION); + 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); // Copy assignment test = pan; - DALI_TEST_EQUALS(Gesture::Pan, test.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, test.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, test.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, test.GetState(), TEST_LOCATION); // Move assignment const auto refCount = pan.GetObjectPtr()->ReferenceCount(); @@ -104,7 +104,7 @@ int UtcDaliGestureAssignmentP(void) DALI_TEST_EQUALS(pan3, Gesture(), TEST_LOCATION); pan3 = std::move(pan); DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, pan3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -114,8 +114,8 @@ int UtcDaliGestureGetTypeP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) ); - DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION); + Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION); END_TEST; } @@ -124,11 +124,11 @@ int UtcDaliGestureGetStateP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) ); - DALI_TEST_EQUALS(Gesture::Started, pan.GetState(), TEST_LOCATION); + Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); + DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION); - GetImplementation(pan).SetState(Gesture::Finished); - DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION); + GetImplementation(pan).SetState(GestureState::FINISHED); + DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION); END_TEST; } @@ -137,7 +137,7 @@ int UtcDaliGestureGetTimeP(void) { TestApplication application; // Reset all test adapter return codes - Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) ); + Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) ); DALI_TEST_EQUALS(0, pan.GetTime(), TEST_LOCATION); GetImplementation(pan).SetTime(61282); 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 d1dda5f..b3c9bf3 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-LongPressGesture.cpp @@ -38,23 +38,23 @@ int UtcDaliLongPressGestureConstructorP(void) { TestApplication application; - LongPressGesture gesture(new Internal::LongPressGesture( Gesture::Started )); + LongPressGesture gesture(new Internal::LongPressGesture( GestureState::STARTED )); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION); // Test Copy constructor GetImplementation( gesture ).SetNumberOfTouches( 5u ); LongPressGesture gesture2(gesture); DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture2.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, gesture2.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION); // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); LongPressGesture gesture3( std::move( gesture ) ); DALI_TEST_EQUALS(gesture, LongPressGesture(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -63,18 +63,18 @@ int UtcDaliLongPressGestureConstructorP(void) int UtcDaliLongPressGestureAssignmentP(void) { // Test Assignment operator - LongPressGesture gesture(new Internal::LongPressGesture( Gesture::Started )); + LongPressGesture gesture(new Internal::LongPressGesture( GestureState::STARTED )); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION); GetImplementation( gesture ).SetNumberOfTouches( 5u ); - LongPressGesture gesture2(new Internal::LongPressGesture( Gesture::Finished )); - DALI_TEST_EQUALS(Gesture::Finished, gesture2.GetState(), TEST_LOCATION); + LongPressGesture gesture2(new Internal::LongPressGesture( GestureState::FINISHED )); + DALI_TEST_EQUALS(GestureState::FINISHED, gesture2.GetState(), TEST_LOCATION); gesture2 = gesture; DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture2.GetType(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, gesture2.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION); // Move assignment const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); @@ -82,7 +82,7 @@ int UtcDaliLongPressGestureAssignmentP(void) DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); DALI_TEST_EQUALS(gesture, Gesture(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::LongPress, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -92,7 +92,7 @@ int UtcDaliLongPressGestureGetNumberOfTouchesP(void) { TestApplication application; - LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started)); + LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTouches(4); @@ -105,7 +105,7 @@ int UtcDaliLongPressGestureGetScreenPointP(void) { TestApplication application; - LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started)); + LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION); DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION); @@ -120,7 +120,7 @@ int UtcDaliLongPressGestureGetLocalPointP(void) { TestApplication application; - LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started)); + LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION); DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION); 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 8ce75ac..0447e34 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGesture.cpp @@ -39,39 +39,39 @@ int UtcDaliPinchGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - PinchGesture gesture(new Internal::PinchGesture( Gesture::Started )); - DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION); + PinchGesture gesture(new Internal::PinchGesture( 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(Gesture::Pinch, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); - PinchGesture gesture2(new Internal::PinchGesture( Gesture::Continuing )); - DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION); + PinchGesture gesture2(new Internal::PinchGesture( 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(Gesture::Pinch, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION); - PinchGesture gesture3(new Internal::PinchGesture( Gesture::Finished )); - DALI_TEST_EQUALS(Gesture::Finished, gesture3.GetState(), TEST_LOCATION); + PinchGesture gesture3(new Internal::PinchGesture( 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(Gesture::Pinch, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION); // Test copy constructor GetImplementation( gesture3 ).SetScale( 3.0f ); GetImplementation( gesture3 ).SetSpeed( 5.0f ); PinchGesture pinch(gesture3); - DALI_TEST_EQUALS(Gesture::Finished, pinch.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, pinch.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3.0f, pinch.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(5.0f, pinch.GetSpeed(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pinch, pinch.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION); // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); PinchGesture gesture4( std::move( gesture ) ); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Pinch, gesture4.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture4.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -80,26 +80,26 @@ int UtcDaliPinchGestureConstructor(void) int UtcDaliPinchGestureAssignment(void) { // Test Assignment operator - PinchGesture gesture(new Internal::PinchGesture( Gesture::Started )); - DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION); + PinchGesture gesture(new Internal::PinchGesture( 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(Gesture::Pinch, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); - PinchGesture gesture2(new Internal::PinchGesture( Gesture::Continuing )); - DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION); + PinchGesture gesture2(new Internal::PinchGesture( 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(Gesture::Pinch, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION); GetImplementation( gesture2 ).SetScale( 3.0f ); GetImplementation( gesture2 ).SetSpeed( 5.0f ); gesture = gesture2; - DALI_TEST_EQUALS(Gesture::Continuing, gesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3.0f, gesture.GetScale(), TEST_LOCATION); DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pinch, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION); // Move assignment const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); @@ -107,7 +107,7 @@ int UtcDaliPinchGestureAssignment(void) DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Pinch, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -115,7 +115,7 @@ int UtcDaliPinchGestureAssignment(void) int UtcDaliPinchGestureSetGetScaleP(void) { - PinchGesture gesture(new Internal::PinchGesture(Gesture::Started)); + PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetScale(), 0.0f, TEST_LOCATION); GetImplementation(gesture).SetScale(123.0f); @@ -126,7 +126,7 @@ int UtcDaliPinchGestureSetGetScaleP(void) int UtcDaliPinchGestureSetGetSpeedP(void) { - PinchGesture gesture(new Internal::PinchGesture(Gesture::Started)); + PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetSpeed(), 0.0f, TEST_LOCATION); GetImplementation(gesture).SetSpeed(123.0f); @@ -137,7 +137,7 @@ int UtcDaliPinchGestureSetGetSpeedP(void) int UtcDaliPinchGestureSetGetScreenCenterPointP(void) { - PinchGesture gesture(new Internal::PinchGesture(Gesture::Started)); + PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f)); @@ -148,7 +148,7 @@ int UtcDaliPinchGestureSetGetScreenCenterPointP(void) int UtcDaliPinchGestureSetGetLocalCenterPointP(void) { - PinchGesture gesture(new Internal::PinchGesture(Gesture::Started)); + PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f)); diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp new file mode 100644 index 0000000..02c43eb --- /dev/null +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-PinchGestureProcessor.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +using namespace Dali; + +void utc_dali_internal_pinch_gesture_processor_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_internal_pinch_gesture_processor_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +void TestAbortWithState(GestureState state) +{ + TestApplication application; + + Internal::PinchGestureProcessor processor; + 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 + } + catch(...) + { + DALI_TEST_CHECK( true ); // We aborted, so the test has passed + } +} + +} // anon namespace + +int UtcDaliPinchGestureProcessorProcessClearStateN(void) +{ + TestAbortWithState(GestureState::CLEAR); + END_TEST; +} + +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 cb1c032..12f0313 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-RotationGesture.cpp @@ -39,34 +39,34 @@ int UtcDaliRotationGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - RotationGesture gesture(new Internal::RotationGesture( Gesture::Started )); - DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION); + RotationGesture gesture(new Internal::RotationGesture( GestureState::STARTED )); + DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); - RotationGesture gesture2(new Internal::RotationGesture( Gesture::Continuing )); - DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION); + RotationGesture gesture2(new Internal::RotationGesture( GestureState::CONTINUING )); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION); - RotationGesture gesture3(new Internal::RotationGesture( Gesture::Finished )); - DALI_TEST_EQUALS(Gesture::Finished, gesture3.GetState(), TEST_LOCATION); + RotationGesture gesture3(new Internal::RotationGesture( GestureState::FINISHED )); + DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture3.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION); // Test copy constructor GetImplementation( gesture3 ).SetRotation( Radian( 3.0f )); RotationGesture rotation(gesture3); - DALI_TEST_EQUALS(Gesture::Finished, rotation.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, rotation.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3.0f, rotation.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, rotation.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, rotation.GetType(), TEST_LOCATION); // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); RotationGesture gesture4( std::move( gesture ) ); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Rotation, gesture4.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture4.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -75,22 +75,22 @@ int UtcDaliRotationGestureConstructor(void) int UtcDaliRotationGestureAssignment(void) { // Test Assignment operator - RotationGesture gesture(new Internal::RotationGesture( Gesture::Started )); - DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION); + RotationGesture gesture(new Internal::RotationGesture( GestureState::STARTED )); + DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); - RotationGesture gesture2(new Internal::RotationGesture( Gesture::Continuing )); - DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION); + RotationGesture gesture2(new Internal::RotationGesture( GestureState::CONTINUING )); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION); GetImplementation( gesture2 ).SetRotation( Radian( 3.0f )); gesture = gesture2; - DALI_TEST_EQUALS(Gesture::Continuing, gesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3.0f, gesture.GetRotation().radian, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION); // Move assignment const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); @@ -98,7 +98,7 @@ int UtcDaliRotationGestureAssignment(void) DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Rotation, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -106,7 +106,7 @@ int UtcDaliRotationGestureAssignment(void) int UtcDaliRotationGestureSetGetRotationP(void) { - RotationGesture gesture(new Internal::RotationGesture(Gesture::Started)); + RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetRotation(), Radian(), TEST_LOCATION); GetImplementation(gesture).SetRotation(Dali::ANGLE_270); @@ -117,7 +117,7 @@ int UtcDaliRotationGestureSetGetRotationP(void) int UtcDaliRotationGestureSetGetScreenCenterPointP(void) { - RotationGesture gesture(new Internal::RotationGesture(Gesture::Started)); + RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f,321.0f)); @@ -128,7 +128,7 @@ int UtcDaliRotationGestureSetGetScreenCenterPointP(void) int UtcDaliRotationGestureSetGetLocalCenterPointP(void) { - RotationGesture gesture(new Internal::RotationGesture(Gesture::Started)); + RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f)); 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 d99af7d..de9a012 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGesture.cpp @@ -40,10 +40,10 @@ int UtcDaliTapGestureConstructor(void) { TestApplication application; // Reset all test adapter return codes - TapGesture gesture(new Internal::TapGesture( Gesture::Started )); + TapGesture gesture(new Internal::TapGesture( GestureState::STARTED )); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Tap, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION); // Test Copy constructor GetImplementation( gesture ).SetNumberOfTouches( 5u ); @@ -52,13 +52,13 @@ int UtcDaliTapGestureConstructor(void) TapGesture gesture2(gesture); DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(2u, gesture2.GetNumberOfTaps(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Tap, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture2.GetType(), TEST_LOCATION); // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); TapGesture gesture3( std::move( gesture ) ); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Tap, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -67,10 +67,10 @@ int UtcDaliTapGestureConstructor(void) int UtcDaliTapGestureAssignment(void) { // Test Assignment operator - TapGesture gesture(new Internal::TapGesture( Gesture::Started )); + TapGesture gesture(new Internal::TapGesture( GestureState::STARTED )); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Tap, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION); GetImplementation( gesture ).SetNumberOfTouches( 5u ); GetImplementation( gesture ).SetNumberOfTaps( 2u ); @@ -79,7 +79,7 @@ int UtcDaliTapGestureAssignment(void) gesture2 = gesture; DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(2u, gesture2.GetNumberOfTaps(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Tap, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture2.GetType(), TEST_LOCATION); // Move assignment const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); @@ -87,7 +87,7 @@ int UtcDaliTapGestureAssignment(void) DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Tap, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -95,7 +95,7 @@ int UtcDaliTapGestureAssignment(void) int UtcDaliTapGestureSetGetNumberOfTapsP(void) { - TapGesture gesture(new Internal::TapGesture(Gesture::Started)); + TapGesture gesture(new Internal::TapGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 1u, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTaps(123u); @@ -106,7 +106,7 @@ int UtcDaliTapGestureSetGetNumberOfTapsP(void) int UtcDaliTapGestureSetGetNumberOfTouchesP(void) { - TapGesture gesture(new Internal::TapGesture(Gesture::Started)); + TapGesture gesture(new Internal::TapGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1u, TEST_LOCATION); GetImplementation(gesture).SetNumberOfTouches(321u); @@ -117,7 +117,7 @@ int UtcDaliTapGestureSetGetNumberOfTouchesP(void) int UtcDaliTapGestureSetGetScreenPointP(void) { - TapGesture gesture(new Internal::TapGesture(Gesture::Started)); + TapGesture gesture(new Internal::TapGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetScreenPoint(Vector2(123.0f,321.0f)); @@ -128,7 +128,7 @@ int UtcDaliTapGestureSetGetScreenPointP(void) int UtcDaliTapGestureSetGetLocalPointP(void) { - TapGesture gesture(new Internal::TapGesture(Gesture::Started)); + TapGesture gesture(new Internal::TapGesture(GestureState::STARTED)); DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION); GetImplementation(gesture).SetLocalPoint(Vector2(123.0f,321.0f)); diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp new file mode 100644 index 0000000..231dfcb --- /dev/null +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-TapGestureProcessor.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +using namespace Dali; + +void utc_dali_internal_tap_gesture_processor_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void utc_dali_internal_tap_gesture_processor_cleanup(void) +{ + test_return_value = TET_PASS; +} + +namespace +{ + +void TestAbortWithState(GestureState state) +{ + TestApplication application; + + Internal::TapGestureProcessor processor; + 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 + } + catch(...) + { + DALI_TEST_CHECK( true ); // We aborted, so the test has passed + } +} + +} // anon namespace + +int UtcDaliTapGestureProcessorProcessClearStateN(void) +{ + TestAbortWithState(GestureState::CLEAR); + END_TEST; +} + +int UtcDaliTapGestureProcessorProcessContinuingStateN(void) +{ + TestAbortWithState(GestureState::CONTINUING); + END_TEST; +} + +int UtcDaliTapGestureProcessorProcessFinishedStateN(void) +{ + TestAbortWithState(GestureState::FINISHED); + END_TEST; +} + diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp index 412e948..0a1b6a9 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp @@ -91,7 +91,7 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene ) + UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) : GestureReceivedFunctor( data ), stateToUnstage( stateToUnstage ), scene( scene ) @@ -108,7 +108,7 @@ struct UnstageActorFunctor : public GestureReceivedFunctor } } - Gesture::State& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -699,7 +699,7 @@ int UtcDaliLongPressGestureSignalReceptionDifferentPossible(void) application.SendNotification(); application.Render(); - // Emit Started event, we should not receive the long press. + // Emit STARTED event, we should not receive the long press. TestTriggerLongPress( application ); TestEndLongPress( application, 50.0f, 10.0f ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -767,7 +767,7 @@ int UtcDaliLongPressGestureDetachAfterStarted(void) // Detach actor detector.Detach(actor); - // Emit Finished, no signal + // Emit FINISHED, no signal TestEndLongPress( application, 50.0f, 10.0f ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; @@ -787,7 +787,7 @@ int UtcDaliLongPressGestureActorUnstaged(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -814,8 +814,8 @@ int UtcDaliLongPressGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Finished; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::FINISHED; // Emit signals TestGenerateLongPress( application, 50.0f, 10.0f ); @@ -848,7 +848,7 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -858,7 +858,7 @@ int UtcDaliLongPressGestureActorStagedAndDestroyed(void) detector.Attach(dummyActor); detector.DetectedSignal().Connect( &application, functor ); - // Here we are testing a Started actor which is removed in the Started callback, but then added back + // 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. @@ -1051,7 +1051,7 @@ int UtcDaliLongPressGestureDisableDetectionDuringLongPressN(void) &application, [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture) { - if( gesture.GetState() == Gesture::Finished ) + if( gesture.GetState() == GestureState::FINISHED ) { detector.Detach(actor); functorCalled = true; diff --git a/automated-tests/src/dali/utc-Dali-PanGesture.cpp b/automated-tests/src/dali/utc-Dali-PanGesture.cpp index aabb6e6..4c6ab70 100644 --- a/automated-tests/src/dali/utc-Dali-PanGesture.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGesture.cpp @@ -39,41 +39,41 @@ int UtcDaliPanGestureConstructorP(void) { TestApplication application; // Reset all test adapter return codes - PanGesture gesture = DevelPanGesture::New( Gesture::Clear ); + PanGesture gesture = DevelPanGesture::New( GestureState::CLEAR ); - DALI_TEST_EQUALS(Gesture::Clear, gesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CLEAR, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION); - PanGesture gesture2 = DevelPanGesture::New( Gesture::Started ); - DALI_TEST_EQUALS(Gesture::Started, gesture2.GetState(), TEST_LOCATION); + 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(Gesture::Pan, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION); - PanGesture gesture3 = DevelPanGesture::New( Gesture::Continuing ); - DALI_TEST_EQUALS(Gesture::Continuing, gesture3.GetState(), TEST_LOCATION); + 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(Gesture::Pan, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION); - PanGesture gesture4 = DevelPanGesture::New( Gesture::Finished ); + PanGesture gesture4 = DevelPanGesture::New( GestureState::FINISHED ); - DALI_TEST_EQUALS(Gesture::Finished, gesture4.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, gesture4.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture4.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, gesture4.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture4.GetType(), TEST_LOCATION); // Test copy constructor DevelPanGesture::SetNumberOfTouches( gesture4, 3u ); PanGesture pan(gesture4); - DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3u, pan.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION); // Test move constructor const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); PanGesture gesture5( std::move( gesture ) ); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Pan, gesture5.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture5.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture5.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -82,23 +82,23 @@ int UtcDaliPanGestureConstructorP(void) int UtcDaliPanGestureAssignmentP(void) { // Test Assignment operator - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); - DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION); + 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(Gesture::Pan, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION); - PanGesture gesture2 = DevelPanGesture::New( Gesture::Continuing ); + PanGesture gesture2 = DevelPanGesture::New( GestureState::CONTINUING ); - DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, gesture2.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION); DevelPanGesture::SetNumberOfTouches( gesture2, 3u ); gesture = gesture2; - DALI_TEST_EQUALS(Gesture::Continuing, gesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(3u, gesture.GetNumberOfTouches(), TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Pan, gesture.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION); // Move assignment const auto refCount = gesture.GetObjectPtr()->ReferenceCount(); @@ -106,7 +106,7 @@ int UtcDaliPanGestureAssignmentP(void) DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION); gesture3 = std::move(gesture); DALI_TEST_CHECK(!gesture); - DALI_TEST_EQUALS(Gesture::Pan, gesture3.GetType(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION); DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION); END_TEST; @@ -114,7 +114,7 @@ int UtcDaliPanGestureAssignmentP(void) int UtcDaliPanGestureGetSpeedP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION); DevelPanGesture::SetVelocity( gesture, Vector2( 3.0f, -4.0f ) ); @@ -125,7 +125,7 @@ int UtcDaliPanGestureGetSpeedP(void) int UtcDaliPanGestureGetDistanceP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION); DevelPanGesture::SetDisplacement( gesture, Vector2( -30.0f, -40.0f ) ); @@ -136,7 +136,7 @@ int UtcDaliPanGestureGetDistanceP(void) int UtcDaliPanGestureGetScreenSpeedP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(0.0f, gesture.GetScreenSpeed(), TEST_LOCATION); DevelPanGesture::SetScreenVelocity( gesture, Vector2( 3.0f, -4.0f ) ); @@ -147,7 +147,7 @@ int UtcDaliPanGestureGetScreenSpeedP(void) int UtcDaliPanGestureGetScreenDistanceP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(0.0f, gesture.GetScreenDistance(), TEST_LOCATION); DevelPanGesture::SetScreenDisplacement( gesture, Vector2( -30.0f, -40.0f ) ); @@ -209,7 +209,7 @@ int UtcDaliPanGestureDetectorRegisterPropertyP(void) int UtcDaliPanGestureSetGetTimeP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(0, gesture.GetTime(), TEST_LOCATION); DevelPanGesture::SetTime( gesture, 123123 ); @@ -220,7 +220,7 @@ int UtcDaliPanGestureSetGetTimeP(void) int UtcDaliPanGestureSetGetVelocityP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetVelocity(), TEST_LOCATION); DevelPanGesture::SetVelocity( gesture, Vector2(123.0f, 321.0f) ); @@ -231,7 +231,7 @@ int UtcDaliPanGestureSetGetVelocityP(void) int UtcDaliPanGestureSetGetDisplacementP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetDisplacement(), TEST_LOCATION); DevelPanGesture::SetDisplacement( gesture, Vector2(123.0f, 321.0f) ); @@ -242,7 +242,7 @@ int UtcDaliPanGestureSetGetDisplacementP(void) int UtcDaliPanGestureSetGetPositionP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetPosition(), TEST_LOCATION); DevelPanGesture::SetPosition( gesture, Vector2(123.0f, 321.0f) ); @@ -253,7 +253,7 @@ int UtcDaliPanGestureSetGetPositionP(void) int UtcDaliPanGestureSetGetScreenVelocityP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenVelocity(), TEST_LOCATION); DevelPanGesture::SetScreenVelocity( gesture, Vector2(123.0f, 321.0f) ); @@ -264,7 +264,7 @@ int UtcDaliPanGestureSetGetScreenVelocityP(void) int UtcDaliPanGestureSetGetScreenDisplacementP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenDisplacement(), TEST_LOCATION); DevelPanGesture::SetScreenDisplacement( gesture, Vector2(123.0f, 321.0f) ); @@ -275,7 +275,7 @@ int UtcDaliPanGestureSetGetScreenDisplacementP(void) int UtcDaliPanGestureSetGetScreenPositionP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenPosition(), TEST_LOCATION); DevelPanGesture::SetScreenPosition( gesture, Vector2(123.0f, 321.0f) ); @@ -286,7 +286,7 @@ int UtcDaliPanGestureSetGetScreenPositionP(void) int UtcDaliPanGestureSetGetNumberOfTouchesP(void) { - PanGesture gesture = DevelPanGesture::New( Gesture::Started ); + PanGesture gesture = DevelPanGesture::New( GestureState::STARTED ); DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION); DevelPanGesture::SetNumberOfTouches( gesture, 3123 ); diff --git a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp index 46a8e88..48790fe 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp @@ -94,7 +94,7 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene ) + UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) : GestureReceivedFunctor( data ), stateToUnstage( stateToUnstage ), scene( scene ) @@ -111,7 +111,7 @@ struct UnstageActorFunctor : public GestureReceivedFunctor } } - Gesture::State& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -164,7 +164,7 @@ struct PanConstraint // Generate a PanGesture PanGesture GeneratePan( unsigned int time, - Gesture::State state, + GestureState state, Vector2 screenPosition, Vector2 localPosition, Vector2 screenDisplacement = Vector2::ONE, @@ -451,7 +451,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -465,7 +465,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -479,7 +479,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(320.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(20.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -492,7 +492,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionLeave(void) TestEndPan( application, Vector2(314.0f, 4.0f), time ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(-32.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(-2.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -526,7 +526,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -540,7 +540,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -553,7 +553,7 @@ int UtcDaliPanGestureSignalReceptionDownMotionUp(void) TestEndPan( application, Vector2(10.0f, 4.0f), time ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION); DALI_TEST_EQUALS(Vector2(-16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(-1.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION); @@ -1247,14 +1247,14 @@ int UtcDaliPanGestureSignalReceptionDifferentPossible(void) application.SendNotification(); application.Render(); - // Emit Started event, we should not receive the pan. + // 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 ); time += TestGetFrameInterval(); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - // LongPress possible in empty area. + // LONG_PRESS possible in empty area. TestStartLongPress( application, 10.0f, 20.0f, time ); time += TestGetFrameInterval(); @@ -1267,7 +1267,7 @@ int UtcDaliPanGestureSignalReceptionDifferentPossible(void) application.SendNotification(); application.Render(); - // Emit Started event, we should be receiving the pan now. + // 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 ); time += TestGetFrameInterval(); @@ -1296,7 +1296,7 @@ int UtcDaliPanGestureActorUnstaged(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -1328,8 +1328,8 @@ int UtcDaliPanGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Continuing; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::CONTINUING; // Emit signals TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); @@ -1360,8 +1360,8 @@ int UtcDaliPanGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Finished to remove - stateToUnstage = Gesture::Finished; + // Change state to GestureState::FINISHED to remove + stateToUnstage = GestureState::FINISHED; // Emit signals TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); @@ -1403,7 +1403,7 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -1413,7 +1413,7 @@ int UtcDaliPanGestureActorStagedAndDestroyed(void) detector.Attach(dummyActor); detector.DetectedSignal().Connect( &application, functor ); - // Here we are testing a Started actor which is removed in the Started callback, but then added back + // 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. @@ -2553,7 +2553,7 @@ int UtcDaliPanGestureSetProperties(void) Vector2 localDisplacement( 0.5f, 0.5f ); Vector2 localVelocity( 1.5f, 2.5f ); - PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, Gesture::Started, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity ) ); + 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 @@ -2613,7 +2613,7 @@ int UtcDaliPanGestureSetPropertiesAlreadyPanning(void) Vector2 screenPosition( 100.0f, 20.0f ); Vector2 localPosition( 110.0f, 110.0f ); - PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, Gesture::Started, screenPosition, localPosition ) ); + PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition ) ); // Render and notify application.SendNotification(); @@ -2860,7 +2860,7 @@ int UtcDaliPanGestureInterruptedWhenTouchConsumed(void) TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); data.Reset(); // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture @@ -2870,7 +2870,7 @@ int UtcDaliPanGestureInterruptedWhenTouchConsumed(void) time += TestGetFrameInterval(); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); END_TEST; } @@ -2894,7 +2894,7 @@ int UtcDaliPanGestureDisableDetectionDuringPanN(void) &application, [&detector, &functorCalled](Actor actor, const PanGesture& pan) { - if( pan.GetState() == Gesture::Finished ) + if( pan.GetState() == GestureState::FINISHED ) { detector.Detach(actor); functorCalled = true; diff --git a/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp index d435132..df4dd07 100644 --- a/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-PanGestureRecognizer.cpp @@ -543,7 +543,7 @@ int UtcDaliPanGestureRecognizerOtherEvent(void) 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::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(); diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp index 834267d..0693f23 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp @@ -88,7 +88,7 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene ) + UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) : GestureReceivedFunctor( data ), stateToUnstage( stateToUnstage ), scene( scene ) @@ -105,7 +105,7 @@ struct UnstageActorFunctor : public GestureReceivedFunctor } } - Gesture::State& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -279,7 +279,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) 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(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(66.666f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -290,18 +290,18 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) 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(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.2666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(80.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); - // Pan Gesture leaves actor's area - we should still receive the signal + // 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(1.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(213.333f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -312,7 +312,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionLeave(void) 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(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(600.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -344,7 +344,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) 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(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.555f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(106.667f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -355,7 +355,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) 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(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); DALI_TEST_EQUALS(0.277f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(66.666f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -366,7 +366,7 @@ int UtcDaliPinchGestureSignalReceptionDownMotionUp(void) 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(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); @@ -398,7 +398,7 @@ int UtcDaliPinchGestureSignalReceptionDetach(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 @@ -406,14 +406,14 @@ int UtcDaliPinchGestureSignalReceptionDetach(void) 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(Gesture::Continuing, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); // Detach actor detector.DetachAll(); @@ -449,14 +449,14 @@ int UtcDaliPinchGestureSignalReceptionDetachWhilePinching(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Detach actor during the pinch, we should not receive the next event detector.DetachAll(); @@ -504,14 +504,14 @@ int UtcDaliPinchGestureSignalReceptionActorDestroyedWhilePinching(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Remove the actor from stage and reset the data application.GetScene().Remove(actor); @@ -888,7 +888,7 @@ int UtcDaliPinchGestureActorUnstaged(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -918,8 +918,8 @@ int UtcDaliPinchGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Continuing; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::CONTINUING; // Emit signals TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), @@ -946,8 +946,8 @@ int UtcDaliPinchGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Finished; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::FINISHED; // Emit signals TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), @@ -986,7 +986,7 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -996,7 +996,7 @@ int UtcDaliPinchGestureActorStagedAndDestroyed(void) detector.Attach(dummyActor); detector.DetectedSignal().Connect( &application, functor ); - // Here we are testing a Started actor which is removed in the Started callback, but then added back + // 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. @@ -1139,7 +1139,7 @@ int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void) Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); data.Reset(); // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture @@ -1149,7 +1149,7 @@ int UtcDaliPinchGestureInterruptedWhenTouchConsumed(void) Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.GetState(), 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 @@ -1180,7 +1180,7 @@ int UtcDaliPinchGestureDisableDetectionDuringPinchN(void) &application, [&detector, &functorCalled](Actor actor, const PinchGesture& gesture) { - if( gesture.GetState() == Gesture::Finished ) + if( gesture.GetState() == GestureState::FINISHED ) { detector.Detach(actor); functorCalled = true; diff --git a/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp index 5a8096f..72b34fe 100644 --- a/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-PinchGestureRecognizer.cpp @@ -677,7 +677,7 @@ int UtcDaliPinchGestureRecognizerMinimumTouchEvents(void) 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( Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); data.Reset(); @@ -723,20 +723,20 @@ int UtcDaliPinchGestureRecognizerMinimumTouchEventsAfterStart(void) 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(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + 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 ) ); - // > Test : not enough touch events to make the gesture state "Continuing" - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + // > 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 ) ); - // > Test : 6 touch events after start make the gesture state "Continuing" - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + // > Test : 6 touch events after start make the gesture state "CONTINUING" + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp index b3fd67a..4298366 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp @@ -88,7 +88,7 @@ struct GestureReceivedFunctor // Functor that removes the gestured actor from stage struct UnstageActorFunctor : public GestureReceivedFunctor { - UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene ) + UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene ) : GestureReceivedFunctor( data ), stateToUnstage( stateToUnstage ), scene( scene ) @@ -105,7 +105,7 @@ struct UnstageActorFunctor : public GestureReceivedFunctor } } - Gesture::State& stateToUnstage; + GestureState& stateToUnstage; Integration::Scene scene; }; @@ -275,31 +275,31 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) detector.Attach(actor); detector.DetectedSignal().Connect(&application, functor); - // Start pan within the actor's area + // 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(12.5f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(12.48f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); - // Continue the pan within the actor's area - we should still receive the signal + // 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); - // Pan Gesture leaves actor's area - we should still receive the signal + // 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); @@ -309,7 +309,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionLeave(void) 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(Gesture::Finished, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); @@ -340,7 +340,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); @@ -350,7 +350,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) 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(Gesture::Continuing, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); @@ -360,7 +360,7 @@ int UtcDaliRotationGestureSignalReceptionDownMotionUp(void) 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(Gesture::Finished, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION); DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION); @@ -391,7 +391,7 @@ int UtcDaliRotationGestureSignalReceptionDetach(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 @@ -399,14 +399,14 @@ int UtcDaliRotationGestureSignalReceptionDetach(void) 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(Gesture::Continuing, data.receivedGesture.GetState(), 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); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION); // Detach actor detector.DetachAll(); @@ -442,14 +442,14 @@ int UtcDaliRotationGestureSignalReceptionDetachWhileRotationing(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Detach actor during the rotation, we should not receive the next event detector.DetachAll(); @@ -497,14 +497,14 @@ int UtcDaliRotationGestureSignalReceptionActorDestroyedWhileRotationing(void) 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(Gesture::Started, data.receivedGesture.GetState(), 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 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); // Remove the actor from stage and reset the data application.GetScene().Remove(actor); @@ -726,7 +726,7 @@ int UtcDaliRotationGestureSignalReceptionActorBecomesUntouchable(void) 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 + // 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 ); @@ -877,7 +877,7 @@ int UtcDaliRotationGestureActorUnstaged(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -907,8 +907,8 @@ int UtcDaliRotationGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Continuing; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::CONTINUING; // Emit signals TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), @@ -935,8 +935,8 @@ int UtcDaliRotationGestureActorUnstaged(void) application.SendNotification(); application.Render(); - // Change state to Gesture::Continuing to remove - stateToUnstage = Gesture::Finished; + // Change state to GestureState::CONTINUING to remove + stateToUnstage = GestureState::FINISHED; // Emit signals TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ), @@ -975,7 +975,7 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) application.Render(); // State to remove actor in. - Gesture::State stateToUnstage( Gesture::Started ); + GestureState stateToUnstage( GestureState::STARTED ); // Attach actor to detector SignalData data; @@ -985,7 +985,7 @@ int UtcDaliRotationGestureActorStagedAndDestroyed(void) detector.Attach(dummyActor); detector.DetectedSignal().Connect( &application, functor ); - // Here we are testing a Started actor which is removed in the Started callback, but then added back + // 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. @@ -1128,7 +1128,7 @@ int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void) Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 ); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION); data.Reset(); // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture @@ -1137,7 +1137,7 @@ int UtcDaliRotationGestureInterruptedWhenTouchConsumed(void) 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(Gesture::Cancelled, data.receivedGesture.GetState(), 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 @@ -1167,7 +1167,7 @@ int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) &application, [&detector, &functorCalled](Actor actor, const RotationGesture& gesture) { - if( gesture.GetState() == Gesture::Finished ) + if( gesture.GetState() == GestureState::FINISHED ) { detector.Detach(actor); functorCalled = true; diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp index 09d2c78..8c25595 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp @@ -213,7 +213,7 @@ int UtcDaliRotationGestureRecognizerMinimumTouchEvents(void) 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( Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION ); + DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); data.Reset(); @@ -257,20 +257,20 @@ int UtcDaliRotationGestureRecognizerMinimumTouchEventsAfterStart(void) 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(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + 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 ) ); - // > Test : not enough touch events to make the gesture state "Continuing" - DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION); + // > 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 ) ); - // > Test : 6 touch events after start make the gesture state "Continuing" - DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION); + // > Test : 6 touch events after start make the gesture state "CONTINUING" + DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp index 6421737..30a1441 100644 --- a/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp @@ -669,7 +669,7 @@ int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void) DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION); - // Pan changes to double-touch - we shouldn't receive event + // Tap changes to double-touch - we shouldn't receive event data.Reset(); TestGenerateTwoPointTap( application, 50.0f, 10.0f, 60.0f, 20.0f, 2000 ); @@ -745,7 +745,7 @@ int UtcDaliTapGestureSignalReceptionDifferentPossible(void) application.SendNotification(); application.Render(); - // Emit Started event, we should not receive the tap. + // Emit STARTED event, we should not receive the tap. TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -760,7 +760,7 @@ int UtcDaliTapGestureSignalReceptionDifferentPossible(void) application.SendNotification(); application.Render(); - // Emit Started event, we should not receive the tap. + // Emit STARTED event, we should not receive the tap. TestEndPan( application, Vector2(50.0f, 10.0f), 720 ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -819,7 +819,7 @@ int UtcDaliTapGestureDetectorRemovedWhilePossible(void) // Emit a possible - Down press, as emitted by long press function TestStartLongPress( application, 50.0f, 10.0f, 100 ); - // Detach actor and send a Started state, no signal. + // Detach actor and send a STARTED state, no signal. detector.DetachAll(); TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); @@ -855,7 +855,7 @@ int UtcDaliTapGestureActorRemovedWhilePossible(void) application.Render(); actor.Reset(); - // Send a Started state, no signal - Up motion as provided by end pan function + // Send a STARTED state, no signal - Up motion as provided by end pan function TestEndPan( application, Vector2(50.0f, 10.0f), 120 ); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; diff --git a/dali/devel-api/events/pan-gesture-devel.cpp b/dali/devel-api/events/pan-gesture-devel.cpp index a25c48c..e750480 100644 --- a/dali/devel-api/events/pan-gesture-devel.cpp +++ b/dali/devel-api/events/pan-gesture-devel.cpp @@ -28,7 +28,7 @@ namespace Dali namespace DevelPanGesture { -Dali::PanGesture New( Gesture::State state ) +Dali::PanGesture New( GestureState state ) { return PanGesture( new Internal::PanGesture( state ) ); } diff --git a/dali/devel-api/events/pan-gesture-devel.h b/dali/devel-api/events/pan-gesture-devel.h index aabda19..f204fcb 100644 --- a/dali/devel-api/events/pan-gesture-devel.h +++ b/dali/devel-api/events/pan-gesture-devel.h @@ -32,7 +32,7 @@ namespace DevelPanGesture * @brief Create a PanGeture for internal. * @param[in] state The state of the PanGesture */ -DALI_CORE_API Dali::PanGesture New(Gesture::State state); +DALI_CORE_API Dali::PanGesture New(GestureState state); /** * @brief Set the time the gesture took place. diff --git a/dali/integration-api/scene.h b/dali/integration-api/scene.h index 67cec73..cced7dd 100755 --- a/dali/integration-api/scene.h +++ b/dali/integration-api/scene.h @@ -60,7 +60,7 @@ public: typedef Signal< void (const Dali::KeyEvent&) > KeyEventSignalType; ///< Key event signal type typedef Signal< bool (const Dali::KeyEvent&) > KeyEventGeneratedSignalType; ///< key event generated signal type typedef Signal< void (const Dali::TouchEvent&) > TouchEventSignalType; ///< Touch signal type - typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< Touched signal type + typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< WheelEvent signal type using FrameCallbackContainer = std::vector< std::pair< std::unique_ptr< CallbackBase >, int32_t > >; diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 23cafc9..478f973 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1817,9 +1817,9 @@ ActorGestureData& Actor::GetGestureData() return *mGestureData; } -bool Actor::IsGestureRequred( Gesture::Type type ) const +bool Actor::IsGestureRequired( GestureType::Value type ) const { - return mGestureData && mGestureData->IsGestureRequred( type ); + return mGestureData && mGestureData->IsGestureRequired( type ); } bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch ) diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index b69d897..81bc969 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -1399,7 +1399,7 @@ public: * @param[in] type The gesture type. * @return True if the gesture is required, false otherwise. */ - bool IsGestureRequred( Gesture::Type type ) const; + bool IsGestureRequired( GestureType::Value type ) const; // Signals diff --git a/dali/internal/event/events/actor-gesture-data.cpp b/dali/internal/event/events/actor-gesture-data.cpp index 382c303..24cc051 100644 --- a/dali/internal/event/events/actor-gesture-data.cpp +++ b/dali/internal/event/events/actor-gesture-data.cpp @@ -25,7 +25,7 @@ namespace Internal { ActorGestureData::ActorGestureData() -: gesturesRequired( Gesture::Type( 0 ) ), +: gesturesRequired( GestureType::Value( 0 ) ), panDetectors( nullptr ), pinchDetectors( nullptr ), longPressDetectors( nullptr ), @@ -45,7 +45,7 @@ ActorGestureData::~ActorGestureData() void ActorGestureData::AddGestureDetector( GestureDetector& detector ) { - const Gesture::Type type( detector.GetType() ); + const GestureType::Value type( detector.GetType() ); GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) ); if ( NULL == containerPtr ) @@ -54,12 +54,12 @@ void ActorGestureData::AddGestureDetector( GestureDetector& detector ) } containerPtr->push_back( &detector ); - gesturesRequired = Gesture::Type( gesturesRequired | type ); + gesturesRequired = GestureType::Value( gesturesRequired | type ); } void ActorGestureData::RemoveGestureDetector( GestureDetector& detector ) { - const Gesture::Type type( detector.GetType() ); + const GestureType::Value type( detector.GetType() ); GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) ); DALI_ASSERT_DEBUG( containerPtr && "Container had not been created" ); @@ -71,42 +71,42 @@ void ActorGestureData::RemoveGestureDetector( GestureDetector& detector ) if ( container.empty() ) { - gesturesRequired = Gesture::Type( gesturesRequired & ~type ); + gesturesRequired = GestureType::Value( gesturesRequired & ~type ); delete containerPtr; containerPtr = NULL; } } -GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( Gesture::Type type ) +GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( GestureType::Value type ) { return *GetContainerPtr( type ); } -GestureDetectorContainer*& ActorGestureData::GetContainerPtr( Gesture::Type type ) +GestureDetectorContainer*& ActorGestureData::GetContainerPtr( GestureType::Value type ) { switch ( type ) { - case Dali::Gesture::Pan: + case GestureType::PAN: { return panDetectors; } - case Dali::Gesture::Pinch: + case GestureType::PINCH: { return pinchDetectors; } - case Dali::Gesture::LongPress: + case GestureType::LONG_PRESS: { return longPressDetectors; } - case Dali::Gesture::Tap: + case GestureType::TAP: { return tapDetectors; } - case Dali::Gesture::Rotation: + case GestureType::ROTATION: { return rotationDetectors; } diff --git a/dali/internal/event/events/actor-gesture-data.h b/dali/internal/event/events/actor-gesture-data.h index 55cfb99..b7e2eea 100644 --- a/dali/internal/event/events/actor-gesture-data.h +++ b/dali/internal/event/events/actor-gesture-data.h @@ -66,7 +66,7 @@ public: * @param[in] type The gesture type. * @return true if the gesture is required, false otherwise. */ - inline bool IsGestureRequred( Gesture::Type type ) const + inline bool IsGestureRequired( GestureType::Value type ) const { return type & gesturesRequired; } @@ -76,7 +76,7 @@ public: * @param[in] type The container type required * @pre Ensure IsGestureRequired() is used to check if the container is actually available. */ - GestureDetectorContainer& GetGestureDetectorContainer( Gesture::Type type ); + GestureDetectorContainer& GetGestureDetectorContainer( GestureType::Value type ); private: @@ -84,11 +84,11 @@ private: * Helper to retrieve the appropriate container type. * @param[in] type The container type required. */ - inline GestureDetectorContainer*& GetContainerPtr( Gesture::Type type ); + inline GestureDetectorContainer*& GetContainerPtr( GestureType::Value type ); private: - Gesture::Type gesturesRequired; ///< Stores which gestures are required + GestureType::Value gesturesRequired; ///< Stores which gestures are required GestureDetectorContainer* panDetectors; ///< Pointer to a container of pan-detectors GestureDetectorContainer* pinchDetectors; ///< Pointer to a container of pinch-detectors diff --git a/dali/internal/event/events/gesture-detector-impl.cpp b/dali/internal/event/events/gesture-detector-impl.cpp index 8d84221..8f2b0d0 100644 --- a/dali/internal/event/events/gesture-detector-impl.cpp +++ b/dali/internal/event/events/gesture-detector-impl.cpp @@ -34,7 +34,7 @@ namespace Dali namespace Internal { -GestureDetector::GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject ) +GestureDetector::GestureDetector( GestureType::Value type, const SceneGraph::PropertyOwner* sceneObject ) : Object( sceneObject ), mType( type ), mGestureEventProcessor( ThreadLocalStorage::Get().GetGestureEventProcessor() ) diff --git a/dali/internal/event/events/gesture-detector-impl.h b/dali/internal/event/events/gesture-detector-impl.h index ba8e71f..66c9a53 100644 --- a/dali/internal/event/events/gesture-detector-impl.h +++ b/dali/internal/event/events/gesture-detector-impl.h @@ -98,7 +98,7 @@ public: * Retrieves the type of GestureDetector * @return The GestureDetector Type */ - Gesture::Type GetType() const + GestureType::Value GetType() const { return mType; } @@ -118,7 +118,7 @@ protected: // Creation & Destruction * @param pointer to the scene object, nullptr if none * by default GestureDetectors don't have our own scene object */ - GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject = nullptr ); + GestureDetector( GestureType::Value type, const SceneGraph::PropertyOwner* sceneObject = nullptr ); /** * A reference counted object may only be deleted by calling Unreference() @@ -169,7 +169,7 @@ private: protected: - Gesture::Type mType; ///< The gesture detector will detect this type of gesture. + GestureType::Value mType; ///< The gesture detector will detect this type of gesture. GestureDetectorActorContainer mAttachedActors; ///< Object::Observer is used to provide weak-pointer behaviour GestureDetectorActorContainer mPendingAttachActors; ///< Object::Observer is used to provide weak-pointer behaviour GestureEventProcessor& mGestureEventProcessor; ///< A reference to the gesture event processor. diff --git a/dali/internal/event/events/gesture-event-processor.cpp b/dali/internal/event/events/gesture-event-processor.cpp index f77ea5c..5c9be29 100644 --- a/dali/internal/event/events/gesture-event-processor.cpp +++ b/dali/internal/event/events/gesture-event-processor.cpp @@ -65,35 +65,35 @@ void GestureEventProcessor::AddGestureDetector(GestureDetector* gestureDetector, { switch (gestureDetector->GetType()) { - case Dali::Gesture::LongPress: + case GestureType::LONG_PRESS: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.AddGestureDetector(longPress, scene); break; } - case Dali::Gesture::Pan: + case GestureType::PAN: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents); break; } - case Dali::Gesture::Pinch: + case GestureType::PINCH: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.AddGestureDetector(pinch, scene); break; } - case Dali::Gesture::Tap: + case GestureType::TAP: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.AddGestureDetector(tap, scene); break; } - case Dali::Gesture::Rotation: + case GestureType::ROTATION: { RotationGestureDetector* rotation = static_cast(gestureDetector); mRotationGestureProcessor.AddGestureDetector(rotation, scene); @@ -106,35 +106,35 @@ void GestureEventProcessor::RemoveGestureDetector(GestureDetector* gestureDetect { switch (gestureDetector->GetType()) { - case Dali::Gesture::LongPress: + case GestureType::LONG_PRESS: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.RemoveGestureDetector(longPress); break; } - case Dali::Gesture::Pan: + case GestureType::PAN: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.RemoveGestureDetector(pan); break; } - case Dali::Gesture::Pinch: + case GestureType::PINCH: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.RemoveGestureDetector(pinch); break; } - case Dali::Gesture::Tap: + case GestureType::TAP: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.RemoveGestureDetector(tap); break; } - case Dali::Gesture::Rotation: + case GestureType::ROTATION: { RotationGestureDetector* rotation = static_cast(gestureDetector); mRotationGestureProcessor.RemoveGestureDetector(rotation); @@ -147,35 +147,35 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec { switch (gestureDetector->GetType()) { - case Dali::Gesture::LongPress: + case GestureType::LONG_PRESS: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.GestureDetectorUpdated(longPress); break; } - case Dali::Gesture::Pan: + case GestureType::PAN: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.GestureDetectorUpdated(pan); break; } - case Dali::Gesture::Pinch: + case GestureType::PINCH: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.GestureDetectorUpdated(pinch); break; } - case Dali::Gesture::Tap: + case GestureType::TAP: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.GestureDetectorUpdated(tap); break; } - case Dali::Gesture::Rotation: + case GestureType::ROTATION: { // Nothing to do break; @@ -185,7 +185,7 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec void GestureEventProcessor::SetGestureProperties( const Dali::Gesture& gesture ) { - DALI_ASSERT_DEBUG( gesture.GetType() == Dali::Gesture::Pan && "Only PanGesture has a scene object\n" ); + DALI_ASSERT_DEBUG( gesture.GetType() == GestureType::PAN && "Only PanGesture has a scene object\n" ); const Dali::PanGesture& pan = static_cast< const Dali::PanGesture& >( gesture ); if( mPanGestureProcessor.SetPanGestureProperties( pan ) ) diff --git a/dali/internal/event/events/gesture-event.cpp b/dali/internal/event/events/gesture-event.cpp index 571c28d..9591ac3 100644 --- a/dali/internal/event/events/gesture-event.cpp +++ b/dali/internal/event/events/gesture-event.cpp @@ -28,7 +28,7 @@ GestureEvent::~GestureEvent() { } -GestureEvent::GestureEvent( Gesture::Type gesture, Gesture::State gestureState ) +GestureEvent::GestureEvent( GestureType::Value gesture, GestureState gestureState ) : gestureType( gesture ), state( gestureState ), time( 0 ) diff --git a/dali/internal/event/events/gesture-event.h b/dali/internal/event/events/gesture-event.h index 9085749..ef7982f 100644 --- a/dali/internal/event/events/gesture-event.h +++ b/dali/internal/event/events/gesture-event.h @@ -46,12 +46,12 @@ struct GestureEvent /** * Gesture Type. */ - Gesture::Type gestureType; + GestureType::Value gestureType; /** * The state of the gesture. */ - Gesture::State state; + GestureState state; /** * The time the gesture took place. @@ -65,7 +65,7 @@ protected: // Constructors only to be used by derived structures. * @param[in] gesture The type of gesture event. * @param[in] gestureState The state of the gesture event. */ - GestureEvent( Gesture::Type gesture, Gesture::State gestureState); + GestureEvent( GestureType::Value gesture, GestureState gestureState); }; } // namespace Internal diff --git a/dali/internal/event/events/gesture-impl.h b/dali/internal/event/events/gesture-impl.h index f0a733b..8e521db 100644 --- a/dali/internal/event/events/gesture-impl.h +++ b/dali/internal/event/events/gesture-impl.h @@ -40,17 +40,12 @@ class Gesture : public BaseObject { public: - using State = Dali::Gesture::State; - using Type = Dali::Gesture::Type; - -public: - /** * @brief Get the gesture type. * * @return The gesture type. */ - inline Type GetType() const + inline GestureType::Value GetType() const { return mGestureType; } @@ -59,7 +54,7 @@ public: * @brief Set the state of the gesture. * @param[in] state The state of the gesture to set */ - inline void SetState( State state ) + inline void SetState( GestureState state ) { mState = state; } @@ -69,7 +64,7 @@ public: * * @return The state of the gesture. */ - inline State GetState() const + inline GestureState GetState() const { return mState; } @@ -105,7 +100,7 @@ protected: * @param[in] gestureType The type of gesture event. * @param[in] gestureState The state of the gesture event. */ - Gesture(Type gestureType, State gestureState) + Gesture(GestureType::Value gestureType, GestureState gestureState) : mGestureType( gestureType ), mState( gestureState ) { @@ -119,8 +114,8 @@ protected: virtual ~Gesture() = default; private: - Type mGestureType; - State mState; + GestureType::Value mGestureType; + GestureState mState; uint32_t mTime{0u}; }; diff --git a/dali/internal/event/events/gesture-processor.cpp b/dali/internal/event/events/gesture-processor.cpp index f18671b..dab221d 100644 --- a/dali/internal/event/events/gesture-processor.cpp +++ b/dali/internal/event/events/gesture-processor.cpp @@ -41,15 +41,15 @@ namespace */ struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface { - GestureHitTestCheck( Gesture::Type type ) + GestureHitTestCheck( GestureType::Value type ) : mType( type ) { } virtual bool IsActorHittable( Actor* actor ) { - return actor->IsGestureRequred( mType ) && // Does the Application or derived actor type require the gesture? - actor->IsHittable(); // Is actor sensitive, visible and on the scene? + return actor->IsGestureRequired( mType ) && // Does the Application or derived actor type require the gesture? + actor->IsHittable(); // Is actor sensitive, visible and on the scene? } virtual bool DescendActorHierarchy( Actor* actor ) @@ -63,13 +63,13 @@ struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface return layer->IsTouchConsumed(); } - Gesture::Type mType; + GestureType::Value mType; }; } // unnamed namespace -GestureProcessor::GestureProcessor( Gesture::Type type ) +GestureProcessor::GestureProcessor( GestureType::Value type ) : mGestureRecognizer(), mNeedsUpdate( false ), mType( type ), @@ -96,7 +96,7 @@ void GestureProcessor::GetGesturedActor( Actor*& actor, GestureDetectorContainer while ( actor ) { // We may be checking a parent so ensure the parent requires this gesture (and do not unintentionally create the gesture data for the parent) - if ( actor->IsGestureRequred( mType ) ) + if ( actor->IsGestureRequired( mType ) ) { // Retrieve the actor's detectors and check if they satisfy current gesture const GestureDetectorContainer& connectedDetectors( actor->GetGestureData().GetGestureDetectorContainer( mType ) ); diff --git a/dali/internal/event/events/gesture-processor.h b/dali/internal/event/events/gesture-processor.h index 47e5dab..7131b2f 100644 --- a/dali/internal/event/events/gesture-processor.h +++ b/dali/internal/event/events/gesture-processor.h @@ -64,7 +64,7 @@ protected: /** * Protected constructor. Cannot create an instance of GestureProcessor */ - GestureProcessor( Gesture::Type type ); + GestureProcessor( GestureType::Value type ); /** * Virtual protected destructor. @@ -190,7 +190,7 @@ protected: //Data private: // Data - Gesture::Type mType; ///< Type of GestureProcessor + GestureType::Value mType; ///< Type of GestureProcessor Actor* mCurrentGesturedActor; ///< The current actor that has been gestured. bool mGesturedActorDisconnected:1; ///< Indicates whether the gestured actor has been disconnected from the scene }; diff --git a/dali/internal/event/events/gesture-recognizer.h b/dali/internal/event/events/gesture-recognizer.h index d616647..f76326d 100644 --- a/dali/internal/event/events/gesture-recognizer.h +++ b/dali/internal/event/events/gesture-recognizer.h @@ -75,7 +75,7 @@ public: * Returns the type of gesture detector. * @return Type of gesture detector. */ - Gesture::Type GetType() const { return mType; } + GestureType::Value GetType() const { return mType; } /** * Called when we get a touch event. @@ -95,7 +95,7 @@ protected: * @param[in] screenSize The size of the screen. * @param[in] detectorType The type of gesture detector. */ - GestureRecognizer( Vector2 screenSize, Gesture::Type detectorType ) + GestureRecognizer( Vector2 screenSize, GestureType::Value detectorType ) : mScreenSize( screenSize ), mType( detectorType ), mScene( nullptr ) @@ -108,7 +108,7 @@ protected: * Use this constructor with the screen size is not used in the dereived class. * @param[in] detectorType The type of gesture detector. */ - GestureRecognizer( Gesture::Type detectorType ) + GestureRecognizer( GestureType::Value detectorType ) : GestureRecognizer( Vector2::ZERO, detectorType ) { } @@ -120,7 +120,7 @@ protected: protected: Vector2 mScreenSize; - Gesture::Type mType; + GestureType::Value mType; Scene* mScene; }; diff --git a/dali/internal/event/events/gesture-requests.h b/dali/internal/event/events/gesture-requests.h index a74f35a..c01c3d5 100644 --- a/dali/internal/event/events/gesture-requests.h +++ b/dali/internal/event/events/gesture-requests.h @@ -38,7 +38,7 @@ struct GestureRequest * Default Constructor * @param[in] typeRequired The gesture type required */ - GestureRequest( Gesture::Type typeRequired ) + GestureRequest( GestureType::Value typeRequired ) : type( typeRequired ) { } @@ -50,7 +50,7 @@ struct GestureRequest // Data Members - Gesture::Type type; ///< The type of gesture required. + GestureType::Value type; ///< The type of gesture required. }; /** @@ -64,7 +64,7 @@ struct PanGestureRequest : public GestureRequest * Default Constructor */ PanGestureRequest() - : GestureRequest(Dali::Gesture::Pan), + : GestureRequest(GestureType::PAN), minTouches(1), maxTouches(1) { @@ -94,7 +94,7 @@ struct TapGestureRequest : public GestureRequest * Default Constructor */ TapGestureRequest() - : GestureRequest(Dali::Gesture::Tap), + : GestureRequest(GestureType::TAP), minTaps(1), maxTaps(1), minTouches(1), @@ -128,7 +128,7 @@ struct LongPressGestureRequest : public GestureRequest * Default Constructor */ LongPressGestureRequest() - : GestureRequest(Dali::Gesture::LongPress), + : GestureRequest(GestureType::LONG_PRESS), minTouches(1), maxTouches(1) { diff --git a/dali/internal/event/events/hover-event-processor.cpp b/dali/internal/event/events/hover-event-processor.cpp index 14b55fb..64e969f 100644 --- a/dali/internal/event/events/hover-event-processor.cpp +++ b/dali/internal/event/events/hover-event-processor.cpp @@ -350,7 +350,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even } } - // 5) If our primary point is an Finished event, then the primary point (in multi-touch) will change next + // 5) If our primary point is a FINISHED event, then the primary point (in multi-touch) will change next // time so set our last primary actor to NULL. Do the same to the last consumed actor as well. if ( primaryPointState == PointState::FINISHED ) @@ -386,7 +386,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even } } - // 6) Emit an interrupted event to the hover-started actor if it hasn't consumed the Finished. + // 6) Emit an interrupted event to the hover-started actor if it hasn't consumed the FINISHED. if ( hoverEvent->GetPointCount() == 1 ) // Only want the first hover started { diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-detector-impl.cpp b/dali/internal/event/events/long-press-gesture/long-press-gesture-detector-impl.cpp index 9f8fe0a..3c832a5 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-detector-impl.cpp +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-detector-impl.cpp @@ -72,14 +72,14 @@ LongPressGestureDetectorPtr LongPressGestureDetector::New(unsigned int minTouche } LongPressGestureDetector::LongPressGestureDetector() -: GestureDetector(Dali::Gesture::LongPress), +: GestureDetector(GestureType::LONG_PRESS), mMinimumTouchesRequired(DEFAULT_TOUCHES_REQUIRED), mMaximumTouchesRequired(DEFAULT_TOUCHES_REQUIRED) { } LongPressGestureDetector::LongPressGestureDetector(unsigned int minTouches, unsigned int maxTouches) -: GestureDetector(Dali::Gesture::LongPress), +: GestureDetector(GestureType::LONG_PRESS), mMinimumTouchesRequired(minTouches), mMaximumTouchesRequired(maxTouches) { diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-event.cpp b/dali/internal/event/events/long-press-gesture/long-press-gesture-event.cpp index 5d9f12d..1dae742 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-event.cpp +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-event.cpp @@ -24,8 +24,8 @@ namespace Dali namespace Internal { -LongPressGestureEvent::LongPressGestureEvent( Gesture::State state ) -: GestureEvent( Dali::Gesture::LongPress, state ), +LongPressGestureEvent::LongPressGestureEvent( GestureState state ) +: GestureEvent( GestureType::LONG_PRESS, state ), numberOfTouches(1) { } diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-event.h b/dali/internal/event/events/long-press-gesture/long-press-gesture-event.h index 4dc0539..2c4e7a3 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-event.h +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-event.h @@ -33,10 +33,10 @@ namespace Internal * send it to the Core. * * This gesture can be in four states: - * - Possible: When the user first puts their finger down - Core needs to hit test the down point. - * - Started: When the long-press gesture is actually detected. - * - Finished: When the user finally lifts all touches. - * - Cancelled: If, after a down event, no long press is detected, or a system interruption. + * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point. + * - STARTED: When the long-press gesture is actually detected. + * - FINISHED: When the user finally lifts all touches. + * - CANCELLED: If, after a down event, no long press is detected, or a system interruption. */ struct LongPressGestureEvent : public GestureEvent { @@ -44,10 +44,10 @@ struct LongPressGestureEvent : public GestureEvent /** * Default Constructor - * @param[in] state Started, when we detect a long press. - * Finished, when all touches are finished. + * @param[in] state STARTED, when we detect a long press. + * FINISHED, when all touches are finished. */ - LongPressGestureEvent( Gesture::State state ); + LongPressGestureEvent( GestureState state ); /** * Virtual destructor diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h b/dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h index d133b3a..651aad2 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h @@ -41,11 +41,11 @@ public: /** * Default Constructor - * @param[in] state Started, when we detect a long press. - * Finished, when all touches are finished. + * @param[in] state STARTED, when we detect a long press. + * FINISHED, when all touches are finished. */ - LongPressGesture( Gesture::State state ) - : Gesture( Dali::Gesture::LongPress, state ) + LongPressGesture( GestureState state ) + : Gesture( GestureType::LONG_PRESS, state ) { } diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-processor.cpp b/dali/internal/event/events/long-press-gesture/long-press-gesture-processor.cpp index 6e223c7..e52e3ea 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-processor.cpp +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-processor.cpp @@ -102,7 +102,7 @@ struct IsNotAttachedFunctor } // unnamed namespace LongPressGestureProcessor::LongPressGestureProcessor() -: GestureProcessor( Dali::Gesture::LongPress ), +: GestureProcessor( GestureType::LONG_PRESS ), mLongPressGestureDetectors(), mCurrentEmitters(), mCurrentRenderTask(), @@ -121,7 +121,7 @@ void LongPressGestureProcessor::Process( Scene& scene, const LongPressGestureEve { switch ( longPressEvent.state ) { - case Dali::Gesture::Possible: + case GestureState::POSSIBLE: { mCurrentEmitters.clear(); ResetActor(); @@ -134,7 +134,7 @@ void LongPressGestureProcessor::Process( Scene& scene, const LongPressGestureEve break; } - case Dali::Gesture::Started: + case GestureState::STARTED: { Actor* currentGesturedActor = GetCurrentGesturedActor(); if ( currentGesturedActor ) @@ -161,7 +161,7 @@ void LongPressGestureProcessor::Process( Scene& scene, const LongPressGestureEve break; } - case Dali::Gesture::Finished: + case GestureState::FINISHED: { // The gesture should only be sent to the gesture detector which first received it so that it // can be told when the gesture ends as well. @@ -195,22 +195,22 @@ void LongPressGestureProcessor::Process( Scene& scene, const LongPressGestureEve break; } - case Dali::Gesture::Cancelled: + case GestureState::CANCELLED: { mCurrentEmitters.clear(); ResetActor(); break; } - case Dali::Gesture::Continuing: + case GestureState::CONTINUING: { - DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CONTINUING\n" ); break; } - case Dali::Gesture::Clear: + case GestureState::CLEAR: { - DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" ); break; } } diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.cpp b/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.cpp index e4a9e02..d547853 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.cpp +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.cpp @@ -43,9 +43,9 @@ const float MAXIMUM_MOTION_ALLOWED = 60.0f; } // unnamed namespace LongPressGestureRecognizer::LongPressGestureRecognizer(Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request, uint32_t minimumHoldingTime ) -: GestureRecognizer( screenSize, Dali::Gesture::LongPress ), +: GestureRecognizer( screenSize, GestureType::LONG_PRESS ), mObserver( observer ), - mState( Clear ), + mState( CLEAR ), mMinimumTouchesRequired( request.minTouches ), mMaximumTouchesRequired( request.maxTouches ), mTouchTime( 0 ), @@ -71,8 +71,8 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) switch (mState) { - // Clear: Wait till one point touches the screen before starting timer. - case Clear: + // CLEAR: Wait till one point touches the screen before starting timer. + case CLEAR: { const Integration::Point& point = event.points[0]; @@ -89,25 +89,25 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) } mTimerId = platformAbstraction.StartTimer( mMinimumHoldingTime, MakeCallback( this, &LongPressGestureRecognizer::TimerCallback ) ); - // A long press gesture may be possible, tell Core about this and change state to Touched. - mState = Touched; - EmitGesture( Dali::Gesture::Possible ); + // A long press gesture may be possible, tell Core about this and change state to TOUCHED. + mState = TOUCHED; + EmitGesture( GestureState::POSSIBLE ); } break; } - // Touched: Monitor movement and addition/removal of points. - case Touched: + // TOUCHED: Monitor movement and addition/removal of points. + case TOUCHED: { if (pointCount > mMaximumTouchesRequired) { - // A long press did not occur, tell Core that it was cancelled and change state to Failed. - EmitGesture( Dali::Gesture::Cancelled ); + // A long press did not occur, tell Core that it was cancelled and change state to FAILED. + EmitGesture( GestureState::CANCELLED ); mTouchPositions.clear(); platformAbstraction.CancelTimer(mTimerId); mTimerId = 0; - mState = Failed; + mState = FAILED; break; } @@ -130,11 +130,11 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) case PointState::INTERRUPTED: { // System has interrupted us, long press is not possible, inform Core - EmitGesture( Dali::Gesture::Cancelled ); + EmitGesture( GestureState::CANCELLED ); mTouchPositions.clear(); platformAbstraction.CancelTimer(mTimerId); mTimerId = 0; - mState = ( pointCount == 1 ) ? Clear : Failed; // Change state to Clear if only one point, Failed otherwise. + mState = ( pointCount == 1 ) ? CLEAR : FAILED; // Change state to CLEAR if only one point, FAILED otherwise. endLoop = true; break; } @@ -146,11 +146,11 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if (distanceSquared > ( MAXIMUM_MOTION_ALLOWED * MAXIMUM_MOTION_ALLOWED ) ) { - // We have moved more than the allowable motion for a long press gesture. Inform Core and change state to Failed. - EmitGesture( Dali::Gesture::Cancelled ); + // We have moved more than the allowable motion for a long press gesture. Inform Core and change state to FAILED. + EmitGesture( GestureState::CANCELLED ); platformAbstraction.CancelTimer(mTimerId); mTimerId = 0; - mState = Failed; + mState = FAILED; endLoop = true; } break; @@ -166,9 +166,9 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) break; } - // Failed/Finished: Monitor the touches, waiting for all touches to be released. - case Failed: - case Finished: + // FAILED/FINISHED: Monitor the touches, waiting for all touches to be released. + case FAILED: + case FINISHED: { // eventually the final touch point will be removed, marking the end of this gesture. if ( pointCount == 1 ) @@ -177,13 +177,13 @@ void LongPressGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if ( (primaryPointState == PointState::UP) || (primaryPointState == PointState::INTERRUPTED) ) { - if(mState == Finished) + if(mState == FINISHED) { // When the last touch point is lifted, we should inform the Core that the Long press has finished. - EmitGesture(Dali::Gesture::Finished); + EmitGesture(GestureState::FINISHED); } mTouchPositions.clear(); - mState = Clear; // Reset state to clear when last touch point is lifted. + mState = CLEAR; // Reset state to clear when last touch point is lifted. } } break; @@ -207,22 +207,22 @@ void LongPressGestureRecognizer::SetMinimumHoldingTime( uint32_t time ) bool LongPressGestureRecognizer::TimerCallback() { - EmitGesture(Dali::Gesture::Started); + EmitGesture(GestureState::STARTED); - mState = Finished; + mState = FINISHED; mTimerId = 0; return false; } -void LongPressGestureRecognizer::EmitGesture(Gesture::State state) +void LongPressGestureRecognizer::EmitGesture(GestureState state) { unsigned int touchPoints ( static_cast( mTouchPositions.size() ) ); - // We should tell Core about the Possible and Cancelled states regardless of whether we have satisfied long press requirements. - if ( (state == Dali::Gesture::Possible) || - (state == Dali::Gesture::Cancelled) || + // We should tell Core about the POSSIBLE and CANCELLED states regardless of whether we have satisfied long press requirements. + if ( (state == GestureState::POSSIBLE) || + (state == GestureState::CANCELLED) || (touchPoints >= mMinimumTouchesRequired) ) { LongPressGestureEvent longPress( state ); @@ -236,7 +236,7 @@ void LongPressGestureRecognizer::EmitGesture(Gesture::State state) longPress.point /= static_cast( touchPoints ); longPress.time = mTouchTime; - if ( state != Dali::Gesture::Possible ) + if ( state != GestureState::POSSIBLE ) { longPress.time += mMinimumHoldingTime; } diff --git a/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.h b/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.h index 66369e3..5480ca6 100644 --- a/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.h +++ b/dali/internal/event/events/long-press-gesture/long-press-gesture-recognizer.h @@ -42,8 +42,8 @@ class CoreEventInterface; /** * When given a set of touch events, this detector attempts to determine if a long press gesture has taken place. - * Emits a LongPressGestureEvent (state = Started) when a long press has been detected (Touch held down for more than duration). - * Emits a further LongPressGestureEvent (state = Finished) when a long press has been completed (Touch Release). + * Emits a LongPressGestureEvent (state = GestureState::STARTED) when a long press has been detected (Touch held down for more than duration). + * Emits a further LongPressGestureEvent (state = GestureState::FINISHED) when a long press has been completed (Touch Release). */ class LongPressGestureRecognizer : public GestureRecognizer { @@ -96,7 +96,7 @@ private: * Emits the long press gesture if all conditions are applicable. * @param[in] state The state of this gesture event. */ - void EmitGesture( Gesture::State state ); + void EmitGesture( GestureState state ); private: @@ -108,10 +108,10 @@ private: */ enum State { - Clear, ///< No gesture detected. - Touched, ///< User is touching the screen. - Failed, ///< Gesture has failed. - Finished ///< Gesture has been detected and sent. + CLEAR, ///< No gesture detected. + TOUCHED, ///< User is touching the screen. + FAILED, ///< Gesture has failed. + FINISHED ///< Gesture has been detected and sent. }; State mState; ///< The current state of the detector. diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.cpp b/dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.cpp index 84592c8..bc1e201 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.cpp @@ -296,7 +296,7 @@ void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan ) } PanGestureDetector::PanGestureDetector( const SceneGraph::PanGesture& sceneObject ) -: GestureDetector( Dali::Gesture::Pan, &sceneObject ), +: GestureDetector( GestureType::PAN, &sceneObject ), mMinimumTouches(1), mMaximumTouches(1) { diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-event.cpp b/dali/internal/event/events/pan-gesture/pan-gesture-event.cpp index 17a6cec..fa17b11 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-event.cpp +++ b/dali/internal/event/events/pan-gesture/pan-gesture-event.cpp @@ -25,8 +25,8 @@ namespace Internal { -PanGestureEvent::PanGestureEvent(Gesture::State state) -: GestureEvent(Dali::Gesture::Pan, state), +PanGestureEvent::PanGestureEvent(GestureState state) +: GestureEvent(GestureType::PAN, state), timeDelta(0), numberOfTouches(1) { diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-event.h b/dali/internal/event/events/pan-gesture/pan-gesture-event.h index 9baca2d..6f7695c 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-event.h +++ b/dali/internal/event/events/pan-gesture/pan-gesture-event.h @@ -33,14 +33,14 @@ namespace Internal * send it to the Core. * * A Pan Gesture event should be in one of five states: - * - Possible: When the user first puts their finger down - Core needs to hit test the down point. - * - Started: If a pan is detected. - * - Continuing: If after a pan is detected, it continues. - * - Finished: If after a pan, the user lifts their finger(s). - * - Cancelled: If, after a down event, no pan is detected or a system interruption. + * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point. + * - STARTED: If a pan is detected. + * - CONTINUING: If after a pan is detected, it continues. + * - FINISHED: If after a pan, the user lifts their finger(s). + * - CANCELLED: If, after a down event, no pan is detected or a system interruption. * - * A Started state will be ignored if a Possible state does not precede it. - * Likewise, a Continuing or Finished state will be ignored if a Started state does not precede it. + * A STARTED state will be ignored if a POSSIBLE state does not precede it. + * Likewise, a CONTINUING or FINISHED state will be ignored if a STARTED state does not precede it. */ struct PanGestureEvent: public GestureEvent { @@ -50,7 +50,7 @@ struct PanGestureEvent: public GestureEvent * Default Constructor * @param[in] state The state of the gesture */ - PanGestureEvent(Gesture::State state); + PanGestureEvent(GestureState state); /** * Virtual destructor diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-impl.h b/dali/internal/event/events/pan-gesture/pan-gesture-impl.h index d727263..2f77ecc 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-impl.h +++ b/dali/internal/event/events/pan-gesture/pan-gesture-impl.h @@ -43,8 +43,8 @@ public: /** * @brief Default constructor */ - PanGesture(Gesture::State state) - : Gesture(Dali::Gesture::Pan, state) + PanGesture(GestureState state) + : Gesture(GestureType::PAN, state) { } diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-processor.cpp b/dali/internal/event/events/pan-gesture/pan-gesture-processor.cpp index 8b7a3c6..370a29d 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-processor.cpp +++ b/dali/internal/event/events/pan-gesture/pan-gesture-processor.cpp @@ -54,12 +54,12 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_PAN const char * GESTURE_STATES[ 6 ] = { - "Clear", - "Started", - "Continuing", - "Finished", - "Cancelled", - "Possible" + "CLEAR", + "STARTED", + "CONTINUING", + "FINISHED", + "CANCELLED", + "POSSIBLE" }; #endif // defined(DEBUG_ENABLED) @@ -124,7 +124,7 @@ struct IsNotAttachedAndOutsideTouchesRangeFunctor } // unnamed namespace PanGestureProcessor::PanGestureProcessor( SceneGraph::UpdateManager& updateManager ) -: GestureProcessor( Dali::Gesture::Pan ), +: GestureProcessor( GestureType::PAN ), mPanGestureDetectors(), mCurrentPanEmitters(), mCurrentRenderTask(), @@ -150,14 +150,14 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent DALI_LOG_INFO( gLogFilter, Debug::General, " Pan Event\n"); DALI_LOG_INFO( gLogFilter, Debug::General, " State: %s Touches: %d Time: %d TimeDelta: %d\n", - GESTURE_STATES[panEvent.state], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta); + GESTURE_STATES[static_cast(panEvent.state)], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta); DALI_LOG_INFO( gLogFilter, Debug::General, " Positions: Current: (%.0f, %.0f), Previous: (%.0f, %.0f)\n", panEvent.currentPosition.x, panEvent.currentPosition.y, panEvent.previousPosition.x, panEvent.previousPosition.y); #endif switch( panEvent.state ) { - case Dali::Gesture::Possible: + case GestureState::POSSIBLE: { mCurrentPanEmitters.clear(); ResetActor(); @@ -171,7 +171,7 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent break; } - case Dali::Gesture::Started: + case GestureState::STARTED: { // Requires a core update mNeedsUpdate = true; @@ -207,7 +207,7 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent break; } - case Dali::Gesture::Continuing: + case GestureState::CONTINUING: { // Requires a core update mNeedsUpdate = true; @@ -215,8 +215,8 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent DALI_FALLTHROUGH; } - case Dali::Gesture::Finished: - case Dali::Gesture::Cancelled: + case GestureState::FINISHED: + case GestureState::CANCELLED: { // Only send subsequent pan gesture signals if we processed the pan gesture when it started. // Check if actor is still touchable. @@ -241,7 +241,7 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent currentGesturedActor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y ); // EmitPanSignal checks whether we have a valid actor and whether the container we are passing in has emitters before it emits the pan. - EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, Dali::Gesture::Finished, mCurrentRenderTask); + EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, GestureState::FINISHED, mCurrentRenderTask); EmitPanSignal( currentGesturedActor, mCurrentPanEmitters, panEvent, actorCoords, panEvent.state, mCurrentRenderTask); } @@ -252,7 +252,7 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent } // Clear current gesture detectors if pan gesture has ended or been cancelled. - if ( ( panEvent.state == Dali::Gesture::Finished ) || ( panEvent.state == Dali::Gesture::Cancelled ) ) + if ( ( panEvent.state == GestureState::FINISHED ) || ( panEvent.state == GestureState::CANCELLED ) ) { mCurrentPanEmitters.clear(); ResetActor(); @@ -267,9 +267,9 @@ void PanGestureProcessor::Process( Scene& scene, const PanGestureEvent& panEvent break; } - case Dali::Gesture::Clear: + case GestureState::CLEAR: { - DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" ); break; } } @@ -349,7 +349,7 @@ bool PanGestureProcessor::SetPanGestureProperties( const Dali::PanGesture& pan ) // Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour. mSceneObject->AddGesture( panImpl ); - if( Dali::Gesture::Started == panImpl.GetState() || Dali::Gesture::Continuing == panImpl.GetState() ) + if( GestureState::STARTED == panImpl.GetState() || GestureState::CONTINUING == panImpl.GetState() ) { mNeedsUpdate = true; } @@ -498,7 +498,7 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, const PanGestureEvent& panEvent, Vector2 localCurrent, - Gesture::State state, + GestureState state, RenderTaskPtr renderTask ) { if ( actor && !gestureDetectors.empty() ) @@ -518,7 +518,7 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor, pan->SetDisplacement( localCurrent - localPrevious ); Vector2 previousPos( panEvent.previousPosition ); - if ( state == Dali::Gesture::Started ) + if ( state == GestureState::STARTED ) { previousPos = mPossiblePanPosition; } @@ -541,7 +541,7 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor, // When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement) // so we should use the last recorded velocity instead in this scenario. - if ( ( state == Dali::Gesture::Finished ) && ( pan->GetScreenVelocity() == Vector2::ZERO ) && + if ( ( state == GestureState::FINISHED ) && ( pan->GetScreenVelocity() == Vector2::ZERO ) && ( panEvent.timeDelta < MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY ) ) { pan->SetVelocity( mLastVelocity ); diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-processor.h b/dali/internal/event/events/pan-gesture/pan-gesture-processor.h index 9d08e51..80439bf 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-processor.h +++ b/dali/internal/event/events/pan-gesture/pan-gesture-processor.h @@ -254,7 +254,7 @@ private: const GestureDetectorContainer& gestureDetectors, const PanGestureEvent& panEvent, Vector2 localCurrent, - Gesture::State state, + GestureState state, RenderTaskPtr renderTask ); // GestureProcessor overrides diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp b/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp index 57ce7fa..be9b307 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp +++ b/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp @@ -46,9 +46,9 @@ const unsigned int MINIMUM_MOTION_EVENTS_BEFORE_PAN(2); } // unnamed namespace PanGestureRecognizer::PanGestureRecognizer( Observer& observer, Vector2 screenSize, const PanGestureRequest& request, int32_t minimumDistance, int32_t minimumPanEvents ) -: GestureRecognizer( screenSize, Dali::Gesture::Pan ), +: GestureRecognizer( screenSize, GestureType::PAN ), mObserver( observer ), - mState( Clear ), + mState( CLEAR ), mThresholdAdjustmentsRemaining( 0 ), mThresholdTotalAdjustments( static_cast( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO ) ), mPrimaryTouchDownTime( 0 ), @@ -85,20 +85,20 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if (primaryPointState == PointState::INTERRUPTED) { - if ( ( mState == Started ) || ( mState == Possible ) ) + if ( ( mState == STARTED ) || ( mState == POSSIBLE ) ) { // If our pan had started and we are interrupted, then tell Core that pan is cancelled. mTouchEvents.push_back(event); - SendPan(Dali::Gesture::Cancelled, event); + SendPan(GestureState::CANCELLED, event); } - mState = Clear; // We should change our state to Clear. + mState = CLEAR; // We should change our state to CLEAR. mTouchEvents.clear(); } else { switch (mState) { - case Clear: + case CLEAR: { if ( ( primaryPointState == PointState::DOWN ) || ( primaryPointState == PointState::STATIONARY ) || ( primaryPointState == PointState::MOTION )) { @@ -108,8 +108,8 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if (event.GetPointCount() == mMinimumTouchesRequired) { // We have satisfied the minimum touches required for a pan, tell core that a gesture may be possible and change our state accordingly. - mState = Possible; - SendPan(Dali::Gesture::Possible, event); + mState = POSSIBLE; + SendPan(GestureState::POSSIBLE, event); } mTouchEvents.push_back(event); @@ -117,7 +117,7 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) break; } - case Possible: + case POSSIBLE: { unsigned int pointCount(event.GetPointCount()); if ( (pointCount >= mMinimumTouchesRequired)&&(pointCount <= mMaximumTouchesRequired) ) @@ -133,8 +133,8 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) ( delta.LengthSquared() >= static_cast( mMinimumDistanceSquared ) ) ) { // If the touch point(s) have moved enough distance to be considered a pan, then tell Core that the pan gesture has started and change our state accordingly. - mState = Started; - SendPan(Dali::Gesture::Started, event); + mState = STARTED; + SendPan(GestureState::STARTED, event); } } else if (primaryPointState == PointState::UP) @@ -142,40 +142,40 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation); if (delta.LengthSquared() >= static_cast( mMinimumDistanceSquared ) ) { - SendPan(Dali::Gesture::Started, event); + SendPan(GestureState::STARTED, event); mTouchEvents.push_back(event); - SendPan(Dali::Gesture::Finished, event); + SendPan(GestureState::FINISHED, event); } else { - // If we have lifted the primary touch point then tell core the pan is cancelled and change our state to Clear. - SendPan(Dali::Gesture::Cancelled, event); + // If we have lifted the primary touch point then tell core the pan is cancelled and change our state to CLEAR. + SendPan(GestureState::CANCELLED, event); } - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } } else { // We do not satisfy pan conditions, tell Core our Gesture has been cancelled. - SendPan(Dali::Gesture::Cancelled, event); + SendPan(GestureState::CANCELLED, event); if (pointCount == 1 && primaryPointState == PointState::UP) { - // If we have lifted the primary touch point, then change our state to Clear... - mState = Clear; + // If we have lifted the primary touch point, then change our state to CLEAR... + mState = CLEAR; mTouchEvents.clear(); } else { - // ...otherwise change it to Failed. - mState = Failed; + // ...otherwise change it to FAILED. + mState = FAILED; } } break; } - case Started: + case STARTED: { mTouchEvents.push_back(event); @@ -186,13 +186,13 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) { case PointState::MOTION: // Pan is continuing, tell Core. - SendPan(Dali::Gesture::Continuing, event); + SendPan(GestureState::CONTINUING, event); break; case PointState::UP: - // Pan is finally finished when our primary point is lifted, tell Core and change our state to Clear. - mState = Clear; - SendPan(Dali::Gesture::Finished, event); + // Pan is finally finished when our primary point is lifted, tell Core and change our state to CLEAR. + mState = CLEAR; + SendPan(GestureState::FINISHED, event); mTouchEvents.clear(); break; @@ -204,9 +204,9 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) { if(iter->GetState() == PointState::UP) { - // The number of touch points will be less than the minimum required. Inform core and change our state to Finished. - SendPan(Dali::Gesture::Finished, event); - mState = Finished; + // The number of touch points will be less than the minimum required. Inform core and change our state to FINISHED. + SendPan(GestureState::FINISHED, event); + mState = FINISHED; break; } } @@ -220,30 +220,30 @@ void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event) else { // We have gone outside of the pan requirements, inform Core that the gesture is finished. - SendPan(Dali::Gesture::Finished, event); + SendPan(GestureState::FINISHED, event); if (pointCount == 1 && primaryPointState == PointState::UP) { - // If this was the primary point being released, then we change our state back to Clear... - mState = Clear; + // If this was the primary point being released, then we change our state back to CLEAR... + mState = CLEAR; mTouchEvents.clear(); } else { - // ...otherwise we change it to Finished. - mState = Finished; + // ...otherwise we change it to FINISHED. + mState = FINISHED; } } break; } - case Finished: - case Failed: + case FINISHED: + case FAILED: { if (primaryPointState == PointState::UP) { // Change our state back to clear when the primary touch point is released. - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } break; @@ -260,7 +260,7 @@ void PanGestureRecognizer::Update(const GestureRequest& request) mMaximumTouchesRequired = pan.maxTouches; } -void PanGestureRecognizer::SendPan(Gesture::State state, const Integration::TouchEvent& currentEvent) +void PanGestureRecognizer::SendPan(GestureState state, const Integration::TouchEvent& currentEvent) { PanGestureEvent gesture(state); gesture.currentPosition = currentEvent.points[0].GetScreenPosition(); @@ -275,7 +275,7 @@ void PanGestureRecognizer::SendPan(Gesture::State state, const Integration::Touc uint32_t previousTime( previousEvent.time ); // If we've just started then we want to remove the threshold from Core calculations. - if ( state == Dali::Gesture::Started ) + if ( state == GestureState::STARTED ) { previousPosition = mPrimaryTouchDownLocation; previousTime = mPrimaryTouchDownTime; diff --git a/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h b/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h index 946f6e1..17ad5e3 100644 --- a/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h +++ b/dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h @@ -81,7 +81,7 @@ private: * @param[in] state The state of the pan. * @param[in] currentEvent The latest touch event. */ - void SendPan(Gesture::State state, const Integration::TouchEvent& currentEvent); + void SendPan(GestureState state, const Integration::TouchEvent& currentEvent); private: @@ -93,11 +93,11 @@ private: */ enum State { - Clear, ///< No gesture detected. - Possible, ///< The current touch event data suggests that a gesture is possible. - Started, ///< A gesture has been detected. - Finished, ///< A previously started pan gesture has finished. - Failed, ///< Current touch event data suggests a pan gesture is not possible. + CLEAR, ///< No gesture detected. + POSSIBLE, ///< The current touch event data suggests that a gesture is possible. + STARTED, ///< A gesture has been detected. + FINISHED, ///< A previously started pan gesture has finished. + FAILED, ///< Current touch event data suggests a pan gesture is not possible. }; State mState; ///< The current state of the detector. diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.cpp b/dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.cpp index d1d9776..6584d2d 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.cpp @@ -58,7 +58,7 @@ PinchGestureDetectorPtr PinchGestureDetector::New() } PinchGestureDetector::PinchGestureDetector() -: GestureDetector(Dali::Gesture::Pinch) +: GestureDetector(GestureType::PINCH) { } diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-event.cpp b/dali/internal/event/events/pinch-gesture/pinch-gesture-event.cpp index f525129..fa9841b 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-event.cpp +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-event.cpp @@ -27,8 +27,8 @@ namespace Dali namespace Internal { -PinchGestureEvent::PinchGestureEvent(Gesture::State state) -: GestureEvent(Dali::Gesture::Pinch, state), +PinchGestureEvent::PinchGestureEvent(GestureState state) +: GestureEvent(GestureType::PINCH, state), scale(0.0f), speed(0.0f), centerPoint() diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-event.h b/dali/internal/event/events/pinch-gesture/pinch-gesture-event.h index 881fe26..204f9ef 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-event.h +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-event.h @@ -33,10 +33,10 @@ namespace Internal * send it to the Core. * * A Pinch Gesture event should be in one of four states: - * - Started: If a pinch is detected. - * - Continuing: If after a pinch is detected, it continues. - * - Finished: If after a pinch, the user lifts their finger(s). - * - Cancelled: If there is a system interruption. + * - STARTED: If a pinch is detected. + * - CONTINUING: If after a pinch is detected, it continues. + * - FINISHED: If after a pinch, the user lifts their finger(s). + * - CANCELLED: If there is a system interruption. */ struct PinchGestureEvent : public GestureEvent { @@ -46,7 +46,7 @@ struct PinchGestureEvent : public GestureEvent * Default Constructor * @param[in] state The state of the gesture */ - PinchGestureEvent(Gesture::State state); + PinchGestureEvent(GestureState state); /** * Virtual destructor diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h b/dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h index 7cfa82b..287756e 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h @@ -43,8 +43,8 @@ public: /** * @brief Default constructor */ - PinchGesture( Gesture::State state ) - : Gesture(Dali::Gesture::Pinch, state) + PinchGesture( GestureState state ) + : Gesture(GestureType::PINCH, state) { } diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-processor.cpp b/dali/internal/event/events/pinch-gesture/pinch-gesture-processor.cpp index 324f9ff..9d5af7b 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-processor.cpp +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-processor.cpp @@ -105,7 +105,7 @@ struct IsNotAttachedFunctor } // unnamed namespace PinchGestureProcessor::PinchGestureProcessor() -: GestureProcessor( Dali::Gesture::Pinch ), +: GestureProcessor( GestureType::PINCH ), mPinchGestureDetectors(), mCurrentPinchEmitters(), mCurrentPinchEvent(NULL), @@ -171,7 +171,7 @@ void PinchGestureProcessor::Process( Scene& scene, const PinchGestureEvent& pinc { switch ( pinchEvent.state ) { - case Dali::Gesture::Started: + case GestureState::STARTED: { // The pinch gesture should only be sent to the gesture detector which first received it so that // it can be told when the gesture ends as well. @@ -193,9 +193,9 @@ void PinchGestureProcessor::Process( Scene& scene, const PinchGestureEvent& pinc break; } - case Dali::Gesture::Continuing: - case Dali::Gesture::Finished: - case Dali::Gesture::Cancelled: + case GestureState::CONTINUING: + case GestureState::FINISHED: + case GestureState::CANCELLED: { // Only send subsequent pinch gesture signals if we processed the pinch gesture when it started. // Check if actor is still touchable. @@ -224,7 +224,7 @@ void PinchGestureProcessor::Process( Scene& scene, const PinchGestureEvent& pinc } // Clear current emitters if pinch gesture has ended or been cancelled. - if ( pinchEvent.state == Dali::Gesture::Finished || pinchEvent.state == Dali::Gesture::Cancelled ) + if ( pinchEvent.state == GestureState::FINISHED || pinchEvent.state == GestureState::CANCELLED ) { mCurrentPinchEmitters.clear(); ResetActor(); @@ -239,14 +239,14 @@ void PinchGestureProcessor::Process( Scene& scene, const PinchGestureEvent& pinc break; } - case Dali::Gesture::Clear: + case GestureState::CLEAR: { - DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" ); break; } - case Dali::Gesture::Possible: + case GestureState::POSSIBLE: { - DALI_ABORT( "Incorrect state received from Integration layer: Possible\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: POSSIBLE\n" ); break; } } diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp index 7d1df48..134dee4 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.cpp @@ -66,9 +66,9 @@ inline float GetDefaultMinimumPinchDistance( const Vector2& dpi ) } // unnamed namespace PinchGestureRecognizer::PinchGestureRecognizer( Observer& observer, Vector2 screenSize, Vector2 screenDpi, float minimumPinchDistance, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart ) -: GestureRecognizer( screenSize, Dali::Gesture::Pinch ), +: GestureRecognizer( screenSize, GestureType::PINCH ), mObserver( observer ), - mState( Clear ), + mState( CLEAR ), mTouchEvents(), mDefaultMinimumDistanceDelta( GetDefaultMinimumPinchDistance( screenDpi ) ), mStartingDistance( 0.0f ), @@ -94,23 +94,23 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) switch (mState) { - case Clear: + case CLEAR: { if (pointCount == 2) { // Change state to possible as we have two touch points. - mState = Possible; + mState = POSSIBLE; mTouchEvents.push_back(event); } break; } - case Possible: + case POSSIBLE: { if (pointCount != 2) { - // We no longer have two touch points so change state back to Clear. - mState = Clear; + // We no longer have two touch points so change state back to CLEAR. + mState = CLEAR; mTouchEvents.clear(); } else @@ -120,8 +120,8 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if (currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED) { - // One of our touch points has an Up event so change our state back to Clear. - mState = Clear; + // One of our touch points has an Up event so change our state back to CLEAR. + mState = CLEAR; mTouchEvents.clear(); } else @@ -149,18 +149,18 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) mStartingDistance = GetDistance(mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1]); // Send pinch started - SendPinch(Dali::Gesture::Started, event); + SendPinch(GestureState::STARTED, event); - mState = Started; + mState = STARTED; } mTouchEvents.clear(); } - if (mState == Possible) + if (mState == POSSIBLE) { // No pinch, so restart detection - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } } @@ -169,22 +169,22 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) break; } - case Started: + case STARTED: { if(event.points[0].GetState() == PointState::INTERRUPTED) { // System interruption occurred, pinch should be cancelled mTouchEvents.clear(); - SendPinch(Dali::Gesture::Cancelled, event); - mState = Clear; + SendPinch(GestureState::CANCELLED, event); + mState = CLEAR; mTouchEvents.clear(); } else if (pointCount != 2) { // Send pinch finished event - SendPinch(Dali::Gesture::Finished, event); + SendPinch(GestureState::FINISHED, event); - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } else @@ -196,9 +196,9 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) { mTouchEvents.push_back(event); // Send pinch finished event - SendPinch(Dali::Gesture::Finished, event); + SendPinch(GestureState::FINISHED, event); - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } else @@ -208,7 +208,7 @@ void PinchGestureRecognizer::SendEvent(const Integration::TouchEvent& event) if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart ) { // Send pinch continuing - SendPinch(Dali::Gesture::Continuing, event); + SendPinch(GestureState::CONTINUING, event); mTouchEvents.clear(); } @@ -224,7 +224,7 @@ void PinchGestureRecognizer::Update(const GestureRequest& request) // Nothing to do. } -void PinchGestureRecognizer::SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent) +void PinchGestureRecognizer::SendPinch(GestureState state, const Integration::TouchEvent& currentEvent) { PinchGestureEvent gesture(state); @@ -261,7 +261,7 @@ void PinchGestureRecognizer::SendPinch(Gesture::State state, const Integration:: else { // Something has gone wrong, just cancel the gesture. - gesture.state = Dali::Gesture::Cancelled; + gesture.state = GestureState::CANCELLED; } gesture.time = currentEvent.time; diff --git a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h index 6d91450..235a38b 100644 --- a/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h +++ b/dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h @@ -93,7 +93,7 @@ private: * @param[in] state The state of the pinch (whether it's starting, continuing or finished). * @param[in] currentEvent The latest touch event. */ - void SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent); + void SendPinch(GestureState state, const Integration::TouchEvent& currentEvent); private: @@ -105,9 +105,9 @@ private: */ enum State { - Clear, ///< No gesture detected. - Possible, ///< The current touch event data suggests that a gesture is possible. - Started, ///< A gesture has been detected. + CLEAR, ///< No gesture detected. + POSSIBLE, ///< The current touch event data suggests that a gesture is possible. + STARTED, ///< A gesture has been detected. }; State mState; ///< The current state of the detector. diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp index b26f8f8..7ca2101 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp @@ -58,7 +58,7 @@ RotationGestureDetectorPtr RotationGestureDetector::New() } RotationGestureDetector::RotationGestureDetector() -: GestureDetector( Dali::Gesture::Rotation ) +: GestureDetector( GestureType::ROTATION ) { } diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h b/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h index 31891e9..4a651ff 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h @@ -32,11 +32,11 @@ namespace Internal /** * When a rotation gesture is detected, this structure holds information regarding the gesture. * - * A Rotation Gesture event should be in one of four states: - * - Started: If a rotation is detected. - * - Continuing: If after a rotation is detected, it continues. - * - Finished: If after a rotation, the user lifts their finger(s). - * - Cancelled: If there is a system interruption. + * A ROTATION Gesture event should be in one of four states: + * - STARTED: If a rotation is detected. + * - CONTINUING: If after a rotation is detected, it continues. + * - FINISHED: If after a rotation, the user lifts their finger(s). + * - CANCELLED: If there is a system interruption. */ struct RotationGestureEvent : public GestureEvent { @@ -46,8 +46,8 @@ struct RotationGestureEvent : public GestureEvent * Default Constructor * @param[in] state The state of the gesture */ - RotationGestureEvent( Gesture::State state ) - : GestureEvent( Dali::Gesture::Rotation, state ) + RotationGestureEvent( GestureState state ) + : GestureEvent( GestureType::ROTATION, state ) { } diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h b/dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h index 95fbc41..0b3edff 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h @@ -43,8 +43,8 @@ public: /** * @brief Default constructor */ - RotationGesture( Gesture::State state ) - : Gesture( Dali::Gesture::Rotation, state ) + RotationGesture( GestureState state ) + : Gesture( GestureType::ROTATION, state ) { } diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp index 13287df..9c6df9a 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp @@ -102,7 +102,7 @@ struct IsNotAttachedFunctor } // unnamed namespace RotationGestureProcessor::RotationGestureProcessor() -: GestureProcessor( Dali::Gesture::Rotation ), +: GestureProcessor( GestureType::ROTATION ), mRotationGestureDetectors(), mCurrentRotationEmitters(), mCurrentRotationEvent( nullptr ), @@ -115,7 +115,7 @@ void RotationGestureProcessor::Process( Scene& scene, const RotationGestureEvent { switch ( rotationEvent.state ) { - case Dali::Gesture::Started: + case GestureState::STARTED: { // The rotation gesture should only be sent to the gesture detector which first received it so that // it can be told when the gesture ends as well. @@ -137,9 +137,9 @@ void RotationGestureProcessor::Process( Scene& scene, const RotationGestureEvent break; } - case Dali::Gesture::Continuing: - case Dali::Gesture::Finished: - case Dali::Gesture::Cancelled: + case GestureState::CONTINUING: + case GestureState::FINISHED: + case GestureState::CANCELLED: { // Only send subsequent rotation gesture signals if we processed the rotation gesture when it started. // Check if actor is still touchable. @@ -168,7 +168,7 @@ void RotationGestureProcessor::Process( Scene& scene, const RotationGestureEvent } // Clear current emitters if rotation gesture has ended or been cancelled. - if ( rotationEvent.state == Dali::Gesture::Finished || rotationEvent.state == Dali::Gesture::Cancelled ) + if ( rotationEvent.state == GestureState::FINISHED || rotationEvent.state == GestureState::CANCELLED ) { mCurrentRotationEmitters.clear(); ResetActor(); @@ -183,8 +183,8 @@ void RotationGestureProcessor::Process( Scene& scene, const RotationGestureEvent break; } - case Dali::Gesture::Clear: - case Dali::Gesture::Possible: + case GestureState::CLEAR: + case GestureState::POSSIBLE: { // Nothing to do break; diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp index 36b7fa2..6f85907 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp @@ -55,9 +55,9 @@ inline Vector2 GetCenterPoint( const Integration::Point& point1, const Integrati } // unnamed namespace RotationGestureRecognizer::RotationGestureRecognizer( Observer& observer, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart ) -: GestureRecognizer( Dali::Gesture::Rotation ), +: GestureRecognizer( GestureType::ROTATION ), mObserver( observer ), - mState( Clear ), + mState( CLEAR ), mTouchEvents(), mStartingAngle( 0.0f ), mMinimumTouchEvents( minimumTouchEvents ), @@ -72,23 +72,23 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event switch( mState ) { - case Clear: + case CLEAR: { if( pointCount == 2 ) { // Change state to possible as we have two touch points. - mState = Possible; + mState = POSSIBLE; mTouchEvents.push_back( event ); } break; } - case Possible: + case POSSIBLE: { if ( pointCount != 2 ) { - // We no longer have two touch points so change state back to Clear. - mState = Clear; + // We no longer have two touch points so change state back to CLEAR. + mState = CLEAR; mTouchEvents.clear(); } else @@ -98,8 +98,8 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event if( currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED ) { - // One of our touch points has an Up event so change our state back to Clear. - mState = Clear; + // One of our touch points has an Up event so change our state back to CLEAR. + mState = CLEAR; mTouchEvents.clear(); } else @@ -117,17 +117,17 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event mStartingAngle = GetAngle( mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1] ); // Send rotation started - SendRotation( Dali::Gesture::Started, event ); + SendRotation( GestureState::STARTED, event ); - mState = Started; + mState = STARTED; } mTouchEvents.clear(); - if( mState == Possible ) + if( mState == POSSIBLE ) { // No rotation, so restart detection - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } } @@ -136,22 +136,22 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event break; } - case Started: + case STARTED: { if(event.points[0].GetState() == PointState::INTERRUPTED) { // System interruption occurred, rotation should be cancelled mTouchEvents.clear(); - SendRotation(Dali::Gesture::Cancelled, event); - mState = Clear; + SendRotation(GestureState::CANCELLED, event); + mState = CLEAR; mTouchEvents.clear(); } else if( pointCount != 2 ) { // Send rotation finished event - SendRotation( Dali::Gesture::Finished, event ); + SendRotation( GestureState::FINISHED, event ); - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } else @@ -164,9 +164,9 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event { mTouchEvents.push_back( event ); // Send rotation finished event - SendRotation( Dali::Gesture::Finished, event ); + SendRotation( GestureState::FINISHED, event ); - mState = Clear; + mState = CLEAR; mTouchEvents.clear(); } else @@ -176,7 +176,7 @@ void RotationGestureRecognizer::SendEvent( const Integration::TouchEvent& event if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart ) { // Send rotation continuing - SendRotation( Dali::Gesture::Continuing, event ); + SendRotation( GestureState::CONTINUING, event ); mTouchEvents.clear(); } @@ -197,7 +197,7 @@ void RotationGestureRecognizer::SetMinimumTouchEventsAfterStart( uint32_t value mMinimumTouchEventsAfterStart = value; } -void RotationGestureRecognizer::SendRotation( Gesture::State state, const Integration::TouchEvent& currentEvent ) +void RotationGestureRecognizer::SendRotation( GestureState state, const Integration::TouchEvent& currentEvent ) { RotationGestureEvent gesture( state ); if( !mTouchEvents.empty() ) @@ -222,7 +222,7 @@ void RotationGestureRecognizer::SendRotation( Gesture::State state, const Integr else { // Something has gone wrong, just cancel the gesture. - gesture.state = Dali::Gesture::Cancelled; + gesture.state = GestureState::CANCELLED; } gesture.time = currentEvent.time; diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h index 14c21f9..a96d980 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h @@ -89,7 +89,7 @@ private: * @param[in] state The state of the rotation (whether it's starting, continuing or finished). * @param[in] currentEvent The latest touch event. */ - void SendRotation( Gesture::State state, const Integration::TouchEvent& currentEvent ); + void SendRotation( GestureState state, const Integration::TouchEvent& currentEvent ); private: @@ -101,9 +101,9 @@ private: */ enum State { - Clear, ///< No gesture detected. - Possible, ///< The current touch event data suggests that a gesture is possible. - Started, ///< A gesture has been detected. + CLEAR, ///< No gesture detected. + POSSIBLE, ///< The current touch event data suggests that a gesture is possible. + STARTED, ///< A gesture has been detected. }; State mState; ///< The current state of the detector. diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.cpp b/dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.cpp index f999d9b..bdca9c6 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.cpp +++ b/dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.cpp @@ -64,7 +64,7 @@ TapGestureDetectorPtr TapGestureDetector::New( unsigned int tapsRequired ) } TapGestureDetector::TapGestureDetector() -: GestureDetector( Dali::Gesture::Tap ), +: GestureDetector( GestureType::TAP ), mMinimumTapsRequired( DEFAULT_TAPS_REQUIRED ), mMaximumTapsRequired( DEFAULT_TAPS_REQUIRED ), mTouchesRequired( DEFAULT_TOUCHES_REQUIRED ) @@ -72,7 +72,7 @@ TapGestureDetector::TapGestureDetector() } TapGestureDetector::TapGestureDetector( unsigned int tapsRequired ) -: GestureDetector( Dali::Gesture::Tap ), +: GestureDetector( GestureType::TAP ), mMinimumTapsRequired( tapsRequired ), mMaximumTapsRequired( tapsRequired ), mTouchesRequired( DEFAULT_TOUCHES_REQUIRED ) diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-event.cpp b/dali/internal/event/events/tap-gesture/tap-gesture-event.cpp index eb53266..405a906 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-event.cpp +++ b/dali/internal/event/events/tap-gesture/tap-gesture-event.cpp @@ -24,8 +24,8 @@ namespace Dali namespace Internal { -TapGestureEvent::TapGestureEvent( Gesture::State state ) -: GestureEvent(Dali::Gesture::Tap, state), +TapGestureEvent::TapGestureEvent( GestureState state ) +: GestureEvent(GestureType::TAP, state), numberOfTaps(1), numberOfTouches(1) { diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-event.h b/dali/internal/event/events/tap-gesture/tap-gesture-event.h index c158991..6576974 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-event.h +++ b/dali/internal/event/events/tap-gesture/tap-gesture-event.h @@ -33,12 +33,12 @@ namespace Internal * send it to the Core. * * A Tap Gesture event should be in one of three states: - * - Possible: When the user first puts their finger down - Core needs to hit test the down point so + * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point so * that a tap (down and up quickly) is also on the same actor. - * - Started: If a tap is detected (No Finished state is expected). - * - Cancelled: If, after a down event, no tap is detected, or a system interruption. + * - STARTED: If a tap is detected (No FINISHED state is expected). + * - CANCELLED: If, after a down event, no tap is detected, or a system interruption. * - * A Started state will be ignored if a Possible state does not precede it. + * A STARTED state will be ignored if a POSSIBLE state does not precede it. */ struct TapGestureEvent : public GestureEvent { @@ -46,11 +46,11 @@ struct TapGestureEvent : public GestureEvent /** * Default Constructor - * @param[in] state Possible, denotes down press; - * Started, of a tap occurs; and - * Cancelled, when tap does not occur. + * @param[in] state POSSIBLE, denotes down press; + * STARTED, of a tap occurs; and + * CANCELLED, when tap does not occur. */ - TapGestureEvent( Gesture::State state ); + TapGestureEvent( GestureState state ); /** * Virtual destructor diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-impl.h b/dali/internal/event/events/tap-gesture/tap-gesture-impl.h index cdbef66..a317ca7 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-impl.h +++ b/dali/internal/event/events/tap-gesture/tap-gesture-impl.h @@ -43,8 +43,8 @@ public: /** * @brief Default constructor */ - TapGesture( Gesture::State state ) - : Gesture(Dali::Gesture::Tap, state) + TapGesture( GestureState state ) + : Gesture(GestureType::TAP, state) { } diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-processor.cpp b/dali/internal/event/events/tap-gesture/tap-gesture-processor.cpp index b327904..13a1427 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-processor.cpp +++ b/dali/internal/event/events/tap-gesture/tap-gesture-processor.cpp @@ -75,7 +75,7 @@ void EmitTapSignal( } // unnamed namespace TapGestureProcessor::TapGestureProcessor() -: GestureProcessor( Dali::Gesture::Tap ), +: GestureProcessor( GestureType::TAP ), mTapGestureDetectors(), mMinTapsRequired( 1 ), mMaxTapsRequired( 1 ), @@ -94,7 +94,7 @@ void TapGestureProcessor::Process( Scene& scene, const TapGestureEvent& tapEvent { switch ( tapEvent.state ) { - case Dali::Gesture::Possible: + case GestureState::POSSIBLE: { // Do a hit test and if an actor has been hit then save to see if tap event is still valid on a tap( same actor being hit ) HitTestAlgorithm::Results hitTestResults; @@ -113,7 +113,7 @@ void TapGestureProcessor::Process( Scene& scene, const TapGestureEvent& tapEvent break; } - case Dali::Gesture::Started: + case GestureState::STARTED: { // Ensure that we're processing a hit on the current actor and that we've already processed a touch down HitTestAlgorithm::Results hitTestResults; @@ -131,26 +131,26 @@ void TapGestureProcessor::Process( Scene& scene, const TapGestureEvent& tapEvent break; } - case Dali::Gesture::Cancelled: + case GestureState::CANCELLED: { mPossibleProcessed = false; ResetActor(); break; } - case Dali::Gesture::Continuing: + case GestureState::CONTINUING: { - DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CONTINUING\n" ); break; } - case Dali::Gesture::Finished: + case GestureState::FINISHED: { - DALI_ABORT( "Incorrect state received from Integration layer: Finished\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: FINISHED\n" ); break; } - case Dali::Gesture::Clear: + case GestureState::CLEAR: { - DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); + DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" ); break; } } diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp b/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp index 9170dea..5daa963 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp +++ b/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.cpp @@ -43,9 +43,9 @@ const unsigned long MAXIMUM_TIME_ALLOWED = 500u; } // unnamed namespace TapGestureRecognizer::TapGestureRecognizer( Observer& observer, Vector2 screenSize, const TapGestureRequest& request) -: GestureRecognizer( screenSize, Dali::Gesture::Tap ), +: GestureRecognizer( screenSize, GestureType::TAP ), mObserver(observer), - mState(Clear), + mState(CLEAR), mMinimumTapsRequired(request.minTaps), mMaximumTapsRequired(request.maxTaps), mTapsRegistered(0), @@ -70,7 +70,7 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event) switch (mState) { - case Clear: + case CLEAR: { if (pointState == PointState::DOWN) { @@ -79,7 +79,7 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event) break; } - case Touched: + case TOUCHED: { uint32_t deltaBetweenTouchDownTouchUp = event.time - mTouchTime; @@ -89,21 +89,21 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event) { mLastTapTime = mTouchTime; EmitSingleTap( event.time, point ); - mState = Registered; + mState = REGISTERED; } else { - mState = Clear; + mState = CLEAR; } } else if (pointState == PointState::INTERRUPTED) { - mState = Clear; + mState = CLEAR; } break; } - case Registered: + case REGISTERED: { if ( pointState == PointState::UP ) { @@ -117,18 +117,18 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event) { mLastTapTime = event.time; EmitSingleTap(event.time, point); - mState = Registered; + mState = REGISTERED; } else { ++mTapsRegistered; - EmitGesture( Dali::Gesture::Started, event.time ); - mState = Clear; + EmitGesture( GestureState::STARTED, event.time ); + mState = CLEAR; } } - else // Delta between touch down and touch up too long to be considered a Tap event + else // Delta between touch down and touch up too long to be considered a TAP event { - mState = Clear; + mState = CLEAR; } } else if (pointState == PointState::DOWN) @@ -153,20 +153,20 @@ void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event) break; } - case Failed: + case FAILED: default: { - mState = Clear; + mState = CLEAR; break; } } } else { - mState = Failed; + mState = FAILED; // We have entered a multi-touch event so emit registered gestures if required. - EmitGesture(Dali::Gesture::Started, event.time); + EmitGesture(GestureState::STARTED, event.time); } } @@ -176,13 +176,13 @@ void TapGestureRecognizer::SetupForTouchDown( const Integration::TouchEvent& eve mTouchTime = event.time; mLastTapTime = 0u; mTapsRegistered = 0; - mState = Touched; + mState = TOUCHED; EmitPossibleState( event ); } void TapGestureRecognizer::EmitPossibleState( const Integration::TouchEvent& event ) { - TapGestureEvent tapEvent( Dali::Gesture::Possible ); + TapGestureEvent tapEvent( GestureState::POSSIBLE ); tapEvent.point = mTouchPosition; tapEvent.time = event.time; @@ -198,9 +198,9 @@ void TapGestureRecognizer::Update(const GestureRequest& request) mMaximumTapsRequired = tap.maxTaps; } -void TapGestureRecognizer::EmitGesture( Gesture::State state, uint32_t time ) +void TapGestureRecognizer::EmitGesture( GestureState state, uint32_t time ) { - if ( (state == Dali::Gesture::Cancelled) || + if ( (state == GestureState::CANCELLED) || (mTapsRegistered >= mMinimumTapsRequired && mTapsRegistered <= mMaximumTapsRequired) ) { @@ -211,7 +211,7 @@ void TapGestureRecognizer::EmitGesture( Gesture::State state, uint32_t time ) void TapGestureRecognizer::EmitSingleTap( uint32_t time, const Integration::Point& point ) { - TapGestureEvent event( Dali::Gesture::Started ); + TapGestureEvent event( GestureState::STARTED ); const Vector2& screen( point.GetScreenPosition() ); Vector2 distanceDelta(std::abs(mTouchPosition.x - screen.x), std::abs(mTouchPosition.y - screen.y)); @@ -219,7 +219,7 @@ void TapGestureRecognizer::EmitSingleTap( uint32_t time, const Integration::Poin if (distanceDelta.x > MAXIMUM_MOTION_ALLOWED || distanceDelta.y > MAXIMUM_MOTION_ALLOWED ) { - event.state = Dali::Gesture::Cancelled; + event.state = GestureState::CANCELLED; } mTapsRegistered = 1u; EmitTap( time, event ); diff --git a/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h b/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h index f65eb63..c277c6d 100644 --- a/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h +++ b/dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h @@ -82,7 +82,7 @@ private: * @param[in] state current state of incomplete gesture * @param[in] time time of this latest touch event */ - void EmitGesture( Gesture::State state, uint32_t time ); + void EmitGesture( GestureState state, uint32_t time ); /** * Initialises tap gesture detector for next tap sequence @@ -132,10 +132,10 @@ private: */ enum State { - Clear, ///< No gesture detected. - Touched, ///< User is touching the screen. - Registered, ///< At least one tap has been registered. - Failed, ///< Gesture has failed. + CLEAR, ///< No gesture detected. + TOUCHED, ///< User is touching the screen. + REGISTERED, ///< At least one tap has been registered. + FAILED, ///< Gesture has failed. }; State mState; ///< Current state of the detector. diff --git a/dali/internal/update/gestures/pan-gesture-profiling.h b/dali/internal/update/gestures/pan-gesture-profiling.h index 1b01aa2..72664a4 100644 --- a/dali/internal/update/gestures/pan-gesture-profiling.h +++ b/dali/internal/update/gestures/pan-gesture-profiling.h @@ -21,6 +21,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -32,7 +33,7 @@ struct PanGestureProfiling { struct Position { - Position( unsigned int time, Vector2 position, Vector2 displacement, Vector2 velocity, int state ) + Position( unsigned int time, Vector2 position, Vector2 displacement, Vector2 velocity, GestureState state ) : time( time ), position( position ), displacement( displacement ), velocity( velocity ), state( state ) { } @@ -41,7 +42,7 @@ struct PanGestureProfiling Vector2 position; Vector2 displacement; Vector2 velocity; - int state; + GestureState state; }; typedef std::vector< PanGestureProfiling::Position > PanPositionContainer; diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp index 3f1247e..f689501 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp @@ -267,13 +267,13 @@ bool PanGesture::ReadGestures( FrameGestureInfo& info, unsigned int currentTimes // add event to history mPanHistory.push_back( currentGesture ); - if( currentGesture.state == Dali::Gesture::Started ) + if( currentGesture.state == GestureState::STARTED ) { info.justStarted = true; // clear just finished as we have started new pan info.justFinished = false; } - info.justFinished |= ( currentGesture.state == Dali::Gesture::Finished || currentGesture.state == Dali::Gesture::Cancelled ); + info.justFinished |= ( currentGesture.state == GestureState::FINISHED || currentGesture.state == GestureState::CANCELLED ); // Update our read position. previousReadPosition = mReadPosition; @@ -304,7 +304,7 @@ bool PanGesture::ReadAndResampleGestures( FrameGestureInfo& info, unsigned int c info.frameGesture.screen.velocity += lastReadGesture.screen.velocity; info.frameGesture.local.velocity += lastReadGesture.local.velocity; - if( lastReadGesture.state == Dali::Gesture::Started ) + if( lastReadGesture.state == GestureState::STARTED ) { // Clear just finished as we have started new pan. info.justFinished = false; @@ -312,7 +312,7 @@ bool PanGesture::ReadAndResampleGestures( FrameGestureInfo& info, unsigned int c } else { - info.justFinished |= ( lastReadGesture.state == Dali::Gesture::Finished || lastReadGesture.state == Dali::Gesture::Cancelled ); + info.justFinished |= ( lastReadGesture.state == GestureState::FINISHED || lastReadGesture.state == GestureState::CANCELLED ); } // Add event to history @@ -759,7 +759,7 @@ bool PanGesture::InputRateConversion( PanInfo& rateConvertedGesture, unsigned in readGesture.screen.displacement, readGesture.screen.velocity, readGesture.state ) ); } - if( readGesture.state == Dali::Gesture::Started ) + if( readGesture.state == GestureState::STARTED ) { // Clear pan data. mPanHistory.clear(); @@ -792,7 +792,7 @@ bool PanGesture::InputRateConversion( PanInfo& rateConvertedGesture, unsigned in } else { - justFinished |= ( readGesture.state == Dali::Gesture::Finished || readGesture.state == Dali::Gesture::Cancelled ); + justFinished |= ( readGesture.state == GestureState::FINISHED || readGesture.state == GestureState::CANCELLED ); } rateConvertedGesture.screen.position += readGesture.screen.position; diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.h b/dali/internal/update/gestures/scene-graph-pan-gesture.h index cf21919..c2a2d69 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.h +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.h @@ -118,7 +118,7 @@ public: */ PanInfo() : time( 0u ), - state( Dali::Gesture::Clear ), + state( GestureState::CLEAR ), read( true ) { } @@ -174,7 +174,7 @@ public: // Data unsigned int time; - Gesture::State state; + GestureState state; Info local; Info screen; volatile bool read; @@ -561,7 +561,7 @@ private: volatile unsigned int mWritePosition; ///< The next PanInfo buffer to write to. (starts at 0). unsigned int mReadPosition; ///< The next PanInfo buffer to read. (starts at 0). bool mNotAtTarget; ///< Keeps track of if the last gesture used was the most recent received. - bool mInGesture; ///< True if the gesture is currently being handled i.e. between Started <-> Finished/Cancelled. + bool mInGesture; ///< True if the gesture is currently being handled i.e. between STARTED <-> FINISHED/CANCELLED. bool mPredictionAmountOverridden; bool mSmoothingAmountOverridden; diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index d76ab2e..7e97f2d 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -45,6 +45,7 @@ #include #include +#include #include #include #include diff --git a/dali/public-api/events/gesture-enumerations.h b/dali/public-api/events/gesture-enumerations.h new file mode 100644 index 0000000..4d30123 --- /dev/null +++ b/dali/public-api/events/gesture-enumerations.h @@ -0,0 +1,59 @@ +#ifndef DALI_GESTURE_ENUMERATIONS_H +#define DALI_GESTURE_ENUMERATIONS_H + +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +/** + * @brief Enumeration for type of gesture. + * @SINCE_1_9.28 + */ +namespace GestureType +{ +enum Value : uint8_t +{ + PINCH = 1 << 0, ///< When two touch points move away or towards each other. @SINCE_1_9.28 + PAN = 1 << 1, ///< When the user drags their finger(s) in a particular direction. @SINCE_1_9.28 + TAP = 1 << 2, ///< When the user taps the screen. @SINCE_1_9.28 + LONG_PRESS = 1 << 3, ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_9.28 + ROTATION = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. @SINCE_1_9.28 +}; +} // namespace GestureType + +/** + * @brief Enumeration for state of the gesture. + * @SINCE_1_9.28 + */ +enum class GestureState : uint8_t +{ + CLEAR, ///< There is no state associated with this gesture. @SINCE_1_9.28 + STARTED, ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_9.28 + CONTINUING, ///< The gesture is continuing. @SINCE_1_9.28 + FINISHED, ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_9.28 + CANCELLED, ///< The gesture has been cancelled. @SINCE_1_9.28 + POSSIBLE ///< A gesture is possible. @SINCE_1_9.28 +}; + +} // namespace Dali + +#endif // DALI_GESTURE_ENUMERATIONS_H diff --git a/dali/public-api/events/gesture.cpp b/dali/public-api/events/gesture.cpp index 2af5ea8..11b124c 100644 --- a/dali/public-api/events/gesture.cpp +++ b/dali/public-api/events/gesture.cpp @@ -45,12 +45,12 @@ Gesture::~Gesture() { } -Gesture::Type Gesture::GetType() const +GestureType::Value Gesture::GetType() const { return GetImplementation(*this).GetType(); } -Gesture::State Gesture::GetState() const +GestureState Gesture::GetState() const { return GetImplementation(*this).GetState(); } diff --git a/dali/public-api/events/gesture.h b/dali/public-api/events/gesture.h index e634b9a..8f407d2 100644 --- a/dali/public-api/events/gesture.h +++ b/dali/public-api/events/gesture.h @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -101,38 +102,11 @@ public: ~Gesture(); /** - * @brief Enumeration for type of gesture. - * @SINCE_1_0.0 - */ - enum Type - { - Pinch = 1 << 0, ///< When two touch points move away or towards each other. @SINCE_1_0.0 - Pan = 1 << 1, ///< When the user drags their finger(s) in a particular direction. @SINCE_1_0.0 - Tap = 1 << 2, ///< When the user taps the screen. @SINCE_1_0.0 - LongPress = 1 << 3, ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_0.0 - Rotation = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. @SINCE_1_9.27 - }; - - /** - * @brief Enumeration for state of the gesture. - * @SINCE_1_0.0 - */ - enum State - { - Clear, ///< There is no state associated with this gesture. @SINCE_1_0.0 - Started, ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_0.0 - Continuing, ///< The gesture is continuing. @SINCE_1_0.0 - Finished, ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_0.0 - Cancelled, ///< The gesture has been cancelled. @SINCE_1_0.0 - Possible ///< A gesture is possible. @SINCE_1_0.0 - }; - - /** * @brief The gesture type. * @SINCE_1_9.28 * @return The gesture type */ - Type GetType() const; + GestureType::Value GetType() const; /** * @brief The gesture state. @@ -142,7 +116,7 @@ public: * @SINCE_1_9.28 * @return The state of the gesture */ - State GetState() const; + GestureState GetState() const; /** * @brief The time the gesture took place. diff --git a/dali/public-api/events/long-press-gesture-detector.h b/dali/public-api/events/long-press-gesture-detector.h index 937ec77..5265842 100644 --- a/dali/public-api/events/long-press-gesture-detector.h +++ b/dali/public-api/events/long-press-gesture-detector.h @@ -44,8 +44,8 @@ class LongPressGesture; * @SINCE_1_0.0 * * For any valid long press, two signals will be emitted: - * - First identifying the beginning (state = Started) i.e. when fingers held down for the required time. - * - Second identifying the ending (state = Finished) i.e. when fingers are released. + * - First identifying the beginning (state = GestureState::STARTED) i.e. when fingers held down for the required time. + * - Second identifying the ending (state = GestureState::FINISHED) i.e. when fingers are released. * * The application programmer can use this gesture detector as follows: * @code diff --git a/dali/public-api/events/long-press-gesture.h b/dali/public-api/events/long-press-gesture.h index 6da5e26..82355fd 100644 --- a/dali/public-api/events/long-press-gesture.h +++ b/dali/public-api/events/long-press-gesture.h @@ -38,8 +38,8 @@ class LongPressGesture; /** * @brief A LongPressGesture is emitted when the user touches and holds the screen with the stated number of fingers. * - * This gesture can be in one of two states, when the long-press gesture is first detected: Gesture::Started - * and when the long-press gesture ends: Gesture::Finished. + * This gesture can be in one of two states, when the long-press gesture is first detected: GestureState::STARTED + * and when the long-press gesture ends: GestureState::FINISHED. * * Long press gesture finishes when all touches have been released. * diff --git a/dali/public-api/events/pan-gesture.h b/dali/public-api/events/pan-gesture.h index 3087863..3c79a5f 100644 --- a/dali/public-api/events/pan-gesture.h +++ b/dali/public-api/events/pan-gesture.h @@ -38,9 +38,9 @@ class PanGesture; /** * @brief A PanGesture is emitted when the user moves one or more fingers in a particular direction. * - * This gesture can be in one of three states, when the pan gesture is first detected: Gesture::Started - * when the pan gesture is continuing: Gesture::Continuing and finally, when the pan gesture ends: - * Gesture::Finished. + * This gesture can be in one of three states, when the pan gesture is first detected: GestureState::STARTED + * when the pan gesture is continuing: GestureState::CONTINUING and finally, when the pan gesture ends: + * GestureState::FINISHED. * * A pan gesture will end in the following ways: * - User releases the primary finger (the first touch). diff --git a/dali/public-api/events/pinch-gesture.h b/dali/public-api/events/pinch-gesture.h index 71ec28a..aacbffa 100644 --- a/dali/public-api/events/pinch-gesture.h +++ b/dali/public-api/events/pinch-gesture.h @@ -39,9 +39,9 @@ class PinchGesture; * @brief A PinchGesture is emitted when the user moves two fingers towards or away from each other. * * This gesture can be in one of three states; when the pinch gesture is first detected, its - * state is set to Gesture::Started. After this, if there is change in the gesture, the state will - * be Gesture::Continuing. Finally, when the gesture ends, the state of the gesture changes to - * Gesture::Finished. + * state is set to GestureState::STARTED. After this, if there is change in the gesture, the state will + * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to + * GestureState::FINISHED. * * A pinch gesture will continue to be sent to the actor under the center point of the pinch * until the pinch ends. diff --git a/dali/public-api/events/rotation-gesture.h b/dali/public-api/events/rotation-gesture.h index eb49f4e..e3020f6 100644 --- a/dali/public-api/events/rotation-gesture.h +++ b/dali/public-api/events/rotation-gesture.h @@ -36,9 +36,9 @@ class RotationGesture; * in a rotational/circular gesture. * * This gesture can be in one of three states; when the rotation gesture is first detected, its - * state is set to Gesture::Started. After this, if there is change in the gesture, the state will - * be Gesture::Continuing. Finally, when the gesture ends, the state of the gesture changes to - * Gesture::Finished. + * state is set to GestureState::STARTED. After this, if there is change in the gesture, the state will + * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to + * GestureState::FINISHED. * * A rotation gesture will continue to be sent to the actor under the center point of the rotation * until the rotation ends. diff --git a/dali/public-api/file.list b/dali/public-api/file.list index f25d85f..43b1478 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -133,6 +133,7 @@ SET( public_api_core_events_header_files ${public_api_src_dir}/events/device.h ${public_api_src_dir}/events/gesture.h ${public_api_src_dir}/events/gesture-detector.h + ${public_api_src_dir}/events/gesture-enumerations.h ${public_api_src_dir}/events/hover-event.h ${public_api_src_dir}/events/key-event.h ${public_api_src_dir}/events/long-press-gesture.h -- 2.7.4