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
struct TestGesture : public Internal::Gesture
{
public:
- TestGesture(Gesture::Type type, Gesture::State state)
+ TestGesture(GestureType::Value type, GestureState state)
: Gesture(type, state) {}
virtual ~TestGesture() {}
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;
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();
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;
{
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;
}
{
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;
}
{
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);
{
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;
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();
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;
{
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);
{
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);
{
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);
{
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;
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();
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;
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);
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);
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));
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));
--- /dev/null
+/*
+ * 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-processor.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
+#include <dali/internal/event/common/scene-impl.h>
+
+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;
+}
+
{
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;
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();
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;
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);
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));
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));
{
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 );
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;
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 );
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();
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;
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);
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);
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));
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));
--- /dev/null
+/*
+ * 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-processor.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
+#include <dali/internal/event/common/scene-impl.h>
+
+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;
+}
+
// 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 )
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
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);
// 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;
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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 );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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.
&application,
[&detector, &functorCalled](Actor actor, const LongPressGesture& gesture)
{
- if( gesture.GetState() == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
{
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;
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();
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;
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 ) );
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 ) );
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 ) );
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 ) );
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 );
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) );
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) );
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) );
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) );
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) );
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) );
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 );
// 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 )
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
// Generate a PanGesture
PanGesture GeneratePan( unsigned int time,
- Gesture::State state,
+ GestureState state,
Vector2 screenPosition,
Vector2 localPosition,
Vector2 screenDisplacement = Vector2::ONE,
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);
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);
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);
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);
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);
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);
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);
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();
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();
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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 );
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 );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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.
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
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();
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
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;
}
&application,
[&detector, &functorCalled](Actor actor, const PanGesture& pan)
{
- if( pan.GetState() == Gesture::Finished )
+ if( pan.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
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();
// 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 )
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
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);
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);
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);
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);
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);
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);
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
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();
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();
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);
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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 ),
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 ),
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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.
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
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
&application,
[&detector, &functorCalled](Actor actor, const PinchGesture& gesture)
{
- if( gesture.GetState() == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
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();
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;
}
// 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 )
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
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);
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);
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);
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);
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);
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
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();
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();
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);
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 );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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 ),
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 ),
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
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.
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
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
&application,
[&detector, &functorCalled](Actor actor, const RotationGesture& gesture)
{
- if( gesture.GetState() == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
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();
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;
}
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 );
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);
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);
// 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);
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;
namespace DevelPanGesture
{
-Dali::PanGesture New( Gesture::State state )
+Dali::PanGesture New( GestureState state )
{
return PanGesture( new Internal::PanGesture( state ) );
}
* @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.
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 > >;
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 )
* @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
{
ActorGestureData::ActorGestureData()
-: gesturesRequired( Gesture::Type( 0 ) ),
+: gesturesRequired( GestureType::Value( 0 ) ),
panDetectors( nullptr ),
pinchDetectors( nullptr ),
longPressDetectors( nullptr ),
void ActorGestureData::AddGestureDetector( GestureDetector& detector )
{
- const Gesture::Type type( detector.GetType() );
+ const GestureType::Value type( detector.GetType() );
GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) );
if ( NULL == containerPtr )
}
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" );
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;
}
* @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;
}
* @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:
* 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
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() )
* Retrieves the type of GestureDetector
* @return The GestureDetector Type
*/
- Gesture::Type GetType() const
+ GestureType::Value GetType() const
{
return mType;
}
* @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()
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.
{
switch (gestureDetector->GetType())
{
- case Dali::Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.AddGestureDetector(longPress, scene);
break;
}
- case Dali::Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents);
break;
}
- case Dali::Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.AddGestureDetector(pinch, scene);
break;
}
- case Dali::Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.AddGestureDetector(tap, scene);
break;
}
- case Dali::Gesture::Rotation:
+ case GestureType::ROTATION:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.AddGestureDetector(rotation, scene);
{
switch (gestureDetector->GetType())
{
- case Dali::Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.RemoveGestureDetector(longPress);
break;
}
- case Dali::Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.RemoveGestureDetector(pan);
break;
}
- case Dali::Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.RemoveGestureDetector(pinch);
break;
}
- case Dali::Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.RemoveGestureDetector(tap);
break;
}
- case Dali::Gesture::Rotation:
+ case GestureType::ROTATION:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.RemoveGestureDetector(rotation);
{
switch (gestureDetector->GetType())
{
- case Dali::Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.GestureDetectorUpdated(longPress);
break;
}
- case Dali::Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.GestureDetectorUpdated(pan);
break;
}
- case Dali::Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.GestureDetectorUpdated(pinch);
break;
}
- case Dali::Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.GestureDetectorUpdated(tap);
break;
}
- case Dali::Gesture::Rotation:
+ case GestureType::ROTATION:
{
// Nothing to do
break;
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 ) )
{
}
-GestureEvent::GestureEvent( Gesture::Type gesture, Gesture::State gestureState )
+GestureEvent::GestureEvent( GestureType::Value gesture, GestureState gestureState )
: gestureType( gesture ),
state( gestureState ),
time( 0 )
/**
* Gesture Type.
*/
- Gesture::Type gestureType;
+ GestureType::Value gestureType;
/**
* The state of the gesture.
*/
- Gesture::State state;
+ GestureState state;
/**
* The time the gesture took place.
* @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
{
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;
}
* @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;
}
*
* @return The state of the gesture.
*/
- inline State GetState() const
+ inline GestureState GetState() const
{
return mState;
}
* @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 )
{
virtual ~Gesture() = default;
private:
- Type mGestureType;
- State mState;
+ GestureType::Value mGestureType;
+ GestureState mState;
uint32_t mTime{0u};
};
*/
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 )
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 ),
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 ) );
/**
* Protected constructor. Cannot create an instance of GestureProcessor
*/
- GestureProcessor( Gesture::Type type );
+ GestureProcessor( GestureType::Value type );
/**
* Virtual protected destructor.
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
};
* 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.
* @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 )
* 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 )
{
}
protected:
Vector2 mScreenSize;
- Gesture::Type mType;
+ GestureType::Value mType;
Scene* mScene;
};
* Default Constructor
* @param[in] typeRequired The gesture type required
*/
- GestureRequest( Gesture::Type typeRequired )
+ GestureRequest( GestureType::Value typeRequired )
: type( typeRequired )
{
}
// Data Members
- Gesture::Type type; ///< The type of gesture required.
+ GestureType::Value type; ///< The type of gesture required.
};
/**
* Default Constructor
*/
PanGestureRequest()
- : GestureRequest(Dali::Gesture::Pan),
+ : GestureRequest(GestureType::PAN),
minTouches(1),
maxTouches(1)
{
* Default Constructor
*/
TapGestureRequest()
- : GestureRequest(Dali::Gesture::Tap),
+ : GestureRequest(GestureType::TAP),
minTaps(1),
maxTaps(1),
minTouches(1),
* Default Constructor
*/
LongPressGestureRequest()
- : GestureRequest(Dali::Gesture::LongPress),
+ : GestureRequest(GestureType::LONG_PRESS),
minTouches(1),
maxTouches(1)
{
}
}
- // 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 )
}
}
- // 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
{
}
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)
{
namespace Internal
{
-LongPressGestureEvent::LongPressGestureEvent( Gesture::State state )
-: GestureEvent( Dali::Gesture::LongPress, state ),
+LongPressGestureEvent::LongPressGestureEvent( GestureState state )
+: GestureEvent( GestureType::LONG_PRESS, state ),
numberOfTouches(1)
{
}
* 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
{
/**
* 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
/**
* 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 )
{
}
} // unnamed namespace
LongPressGestureProcessor::LongPressGestureProcessor()
-: GestureProcessor( Dali::Gesture::LongPress ),
+: GestureProcessor( GestureType::LONG_PRESS ),
mLongPressGestureDetectors(),
mCurrentEmitters(),
mCurrentRenderTask(),
{
switch ( longPressEvent.state )
{
- case Dali::Gesture::Possible:
+ case GestureState::POSSIBLE:
{
mCurrentEmitters.clear();
ResetActor();
break;
}
- case Dali::Gesture::Started:
+ case GestureState::STARTED:
{
Actor* currentGesturedActor = GetCurrentGesturedActor();
if ( currentGesturedActor )
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.
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;
}
}
} // 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 ),
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];
}
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;
}
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;
}
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;
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 )
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;
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<unsigned int>( 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 );
longPress.point /= static_cast<float>( touchPoints );
longPress.time = mTouchTime;
- if ( state != Dali::Gesture::Possible )
+ if ( state != GestureState::POSSIBLE )
{
longPress.time += mMinimumHoldingTime;
}
/**
* 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
{
* 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:
*/
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.
}
PanGestureDetector::PanGestureDetector( const SceneGraph::PanGesture& sceneObject )
-: GestureDetector( Dali::Gesture::Pan, &sceneObject ),
+: GestureDetector( GestureType::PAN, &sceneObject ),
mMinimumTouches(1),
mMaximumTouches(1)
{
{
-PanGestureEvent::PanGestureEvent(Gesture::State state)
-: GestureEvent(Dali::Gesture::Pan, state),
+PanGestureEvent::PanGestureEvent(GestureState state)
+: GestureEvent(GestureType::PAN, state),
timeDelta(0),
numberOfTouches(1)
{
* 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
{
* Default Constructor
* @param[in] state The state of the gesture
*/
- PanGestureEvent(Gesture::State state);
+ PanGestureEvent(GestureState state);
/**
* Virtual destructor
/**
* @brief Default constructor
*/
- PanGesture(Gesture::State state)
- : Gesture(Dali::Gesture::Pan, state)
+ PanGesture(GestureState state)
+ : Gesture(GestureType::PAN, state)
{
}
const char * GESTURE_STATES[ 6 ] =
{
- "Clear",
- "Started",
- "Continuing",
- "Finished",
- "Cancelled",
- "Possible"
+ "CLEAR",
+ "STARTED",
+ "CONTINUING",
+ "FINISHED",
+ "CANCELLED",
+ "POSSIBLE"
};
#endif // defined(DEBUG_ENABLED)
} // unnamed namespace
PanGestureProcessor::PanGestureProcessor( SceneGraph::UpdateManager& updateManager )
-: GestureProcessor( Dali::Gesture::Pan ),
+: GestureProcessor( GestureType::PAN ),
mPanGestureDetectors(),
mCurrentPanEmitters(),
mCurrentRenderTask(),
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<uint8_t>(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();
break;
}
- case Dali::Gesture::Started:
+ case GestureState::STARTED:
{
// Requires a core update
mNeedsUpdate = true;
break;
}
- case Dali::Gesture::Continuing:
+ case GestureState::CONTINUING:
{
// Requires a core update
mNeedsUpdate = true;
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.
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);
}
}
// 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();
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;
}
}
// 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;
}
const GestureDetectorContainer& gestureDetectors,
const PanGestureEvent& panEvent,
Vector2 localCurrent,
- Gesture::State state,
+ GestureState state,
RenderTaskPtr renderTask )
{
if ( actor && !gestureDetectors.empty() )
pan->SetDisplacement( localCurrent - localPrevious );
Vector2 previousPos( panEvent.previousPosition );
- if ( state == Dali::Gesture::Started )
+ if ( state == GestureState::STARTED )
{
previousPos = mPossiblePanPosition;
}
// 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 );
const GestureDetectorContainer& gestureDetectors,
const PanGestureEvent& panEvent,
Vector2 localCurrent,
- Gesture::State state,
+ GestureState state,
RenderTaskPtr renderTask );
// GestureProcessor overrides
} // 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<unsigned int>( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO ) ),
mPrimaryTouchDownTime( 0 ),
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 ))
{
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);
break;
}
- case Possible:
+ case POSSIBLE:
{
unsigned int pointCount(event.GetPointCount());
if ( (pointCount >= mMinimumTouchesRequired)&&(pointCount <= mMaximumTouchesRequired) )
( delta.LengthSquared() >= static_cast<float>( 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)
Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation);
if (delta.LengthSquared() >= static_cast<float>( 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);
{
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;
{
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;
}
}
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;
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();
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;
* @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:
*/
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.
}
PinchGestureDetector::PinchGestureDetector()
-: GestureDetector(Dali::Gesture::Pinch)
+: GestureDetector(GestureType::PINCH)
{
}
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()
* 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
{
* Default Constructor
* @param[in] state The state of the gesture
*/
- PinchGestureEvent(Gesture::State state);
+ PinchGestureEvent(GestureState state);
/**
* Virtual destructor
/**
* @brief Default constructor
*/
- PinchGesture( Gesture::State state )
- : Gesture(Dali::Gesture::Pinch, state)
+ PinchGesture( GestureState state )
+ : Gesture(GestureType::PINCH, state)
{
}
} // unnamed namespace
PinchGestureProcessor::PinchGestureProcessor()
-: GestureProcessor( Dali::Gesture::Pinch ),
+: GestureProcessor( GestureType::PINCH ),
mPinchGestureDetectors(),
mCurrentPinchEmitters(),
mCurrentPinchEvent(NULL),
{
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.
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.
}
// 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();
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;
}
}
} // 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 ),
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
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
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();
}
}
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
{
mTouchEvents.push_back(event);
// Send pinch finished event
- SendPinch(Dali::Gesture::Finished, event);
+ SendPinch(GestureState::FINISHED, event);
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send pinch continuing
- SendPinch(Dali::Gesture::Continuing, event);
+ SendPinch(GestureState::CONTINUING, event);
mTouchEvents.clear();
}
// 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);
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Dali::Gesture::Cancelled;
+ gesture.state = GestureState::CANCELLED;
}
gesture.time = currentEvent.time;
* @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:
*/
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.
}
RotationGestureDetector::RotationGestureDetector()
-: GestureDetector( Dali::Gesture::Rotation )
+: GestureDetector( GestureType::ROTATION )
{
}
/**
* 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
{
* 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 )
{
}
/**
* @brief Default constructor
*/
- RotationGesture( Gesture::State state )
- : Gesture( Dali::Gesture::Rotation, state )
+ RotationGesture( GestureState state )
+ : Gesture( GestureType::ROTATION, state )
{
}
} // unnamed namespace
RotationGestureProcessor::RotationGestureProcessor()
-: GestureProcessor( Dali::Gesture::Rotation ),
+: GestureProcessor( GestureType::ROTATION ),
mRotationGestureDetectors(),
mCurrentRotationEmitters(),
mCurrentRotationEvent( nullptr ),
{
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.
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.
}
// 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();
break;
}
- case Dali::Gesture::Clear:
- case Dali::Gesture::Possible:
+ case GestureState::CLEAR:
+ case GestureState::POSSIBLE:
{
// Nothing to do
break;
} // 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 ),
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
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
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();
}
}
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
{
mTouchEvents.push_back( event );
// Send rotation finished event
- SendRotation( Dali::Gesture::Finished, event );
+ SendRotation( GestureState::FINISHED, event );
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send rotation continuing
- SendRotation( Dali::Gesture::Continuing, event );
+ SendRotation( GestureState::CONTINUING, event );
mTouchEvents.clear();
}
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() )
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Dali::Gesture::Cancelled;
+ gesture.state = GestureState::CANCELLED;
}
gesture.time = currentEvent.time;
* @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:
*/
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.
}
TapGestureDetector::TapGestureDetector()
-: GestureDetector( Dali::Gesture::Tap ),
+: GestureDetector( GestureType::TAP ),
mMinimumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mMaximumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
}
TapGestureDetector::TapGestureDetector( unsigned int tapsRequired )
-: GestureDetector( Dali::Gesture::Tap ),
+: GestureDetector( GestureType::TAP ),
mMinimumTapsRequired( tapsRequired ),
mMaximumTapsRequired( tapsRequired ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
namespace Internal
{
-TapGestureEvent::TapGestureEvent( Gesture::State state )
-: GestureEvent(Dali::Gesture::Tap, state),
+TapGestureEvent::TapGestureEvent( GestureState state )
+: GestureEvent(GestureType::TAP, state),
numberOfTaps(1),
numberOfTouches(1)
{
* 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
{
/**
* 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
/**
* @brief Default constructor
*/
- TapGesture( Gesture::State state )
- : Gesture(Dali::Gesture::Tap, state)
+ TapGesture( GestureState state )
+ : Gesture(GestureType::TAP, state)
{
}
} // unnamed namespace
TapGestureProcessor::TapGestureProcessor()
-: GestureProcessor( Dali::Gesture::Tap ),
+: GestureProcessor( GestureType::TAP ),
mTapGestureDetectors(),
mMinTapsRequired( 1 ),
mMaxTapsRequired( 1 ),
{
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;
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;
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;
}
}
} // 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),
switch (mState)
{
- case Clear:
+ case CLEAR:
{
if (pointState == PointState::DOWN)
{
break;
}
- case Touched:
+ case TOUCHED:
{
uint32_t deltaBetweenTouchDownTouchUp = event.time - mTouchTime;
{
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 )
{
{
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)
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);
}
}
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;
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) )
{
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));
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 );
* @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
*/
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.
// INTERNAL INCLUDES
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/events/gesture-enumerations.h>
namespace Dali
{
{
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 )
{
}
Vector2 position;
Vector2 displacement;
Vector2 velocity;
- int state;
+ GestureState state;
};
typedef std::vector< PanGestureProfiling::Position > PanPositionContainer;
// 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;
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;
}
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
readGesture.screen.displacement, readGesture.screen.velocity, readGesture.state ) );
}
- if( readGesture.state == Dali::Gesture::Started )
+ if( readGesture.state == GestureState::STARTED )
{
// Clear pan data.
mPanHistory.clear();
}
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;
*/
PanInfo()
: time( 0u ),
- state( Dali::Gesture::Clear ),
+ state( GestureState::CLEAR ),
read( true )
{
}
// Data
unsigned int time;
- Gesture::State state;
+ GestureState state;
Info local;
Info screen;
volatile bool read;
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;
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/gesture-detector.h>
+#include <dali/public-api/events/gesture-enumerations.h>
#include <dali/public-api/events/gesture.h>
#include <dali/public-api/events/hover-event.h>
#include <dali/public-api/events/key-event.h>
--- /dev/null
+#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 <cstdint>
+
+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
{
}
-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();
}
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/events/gesture-enumerations.h>
namespace Dali
{
~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.
* @SINCE_1_9.28
* @return The state of the gesture
*/
- State GetState() const;
+ GestureState GetState() const;
/**
* @brief The time the gesture took place.
* @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
/**
* @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.
*
/**
* @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).
* @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.
* 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.
${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