utc-Dali-Internal-Core.cpp
utc-Dali-Internal-FixedSizeMemoryPool.cpp
utc-Dali-Internal-FrustumCulling.cpp
+ utc-Dali-Internal-Gesture.cpp
utc-Dali-Internal-Handles.cpp
+ utc-Dali-Internal-LongPressGesture.cpp
utc-Dali-Internal-MemoryPoolObjectAllocator.cpp
utc-Dali-Internal-OwnerPointer.cpp
+ utc-Dali-Internal-PinchGesture.cpp
+ utc-Dali-Internal-RotationGesture.cpp
+ utc-Dali-Internal-TapGesture.cpp
)
LIST(APPEND TC_SOURCES
--- /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/gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+// TestGesture Struct (Gesture constructor is protected)
+struct TestGesture : public Internal::Gesture
+{
+public:
+ TestGesture(Gesture::Type type, Gesture::State state)
+ : Gesture(type, state) {}
+
+ virtual ~TestGesture() {}
+};
+
+} // anon namespace
+
+int UtcDaliGestureConstructorP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ 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 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);
+
+ // Test copy constructor
+ Gesture pan2(pan);
+ DALI_TEST_EQUALS(Gesture::Pan, pan2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureAssignmentP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ // Test Assignment operator
+ Gesture pan( new TestGesture(Gesture::Pan, Gesture::Finished) );
+ DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION);
+
+ Gesture 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);
+
+ // Copy assignment
+ test = pan;
+ DALI_TEST_EQUALS(Gesture::Pan, test.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Finished, test.GetState(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = pan.GetObjectPtr()->ReferenceCount();
+ Gesture pan3;
+ 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(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetTypeP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) );
+ DALI_TEST_EQUALS(Gesture::Pan, pan.GetType(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetStateP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) );
+ DALI_TEST_EQUALS(Gesture::Started, pan.GetState(), TEST_LOCATION);
+
+ GetImplementation(pan).SetState(Gesture::Finished);
+ DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetTimeP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(Gesture::Pan, Gesture::Started) );
+ DALI_TEST_EQUALS(0, pan.GetTime(), TEST_LOCATION);
+
+ GetImplementation(pan).SetTime(61282);
+ DALI_TEST_EQUALS(61282, pan.GetTime(), TEST_LOCATION);
+
+ END_TEST;
+}
+
--- /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/long-press-gesture/long-press-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_long_press_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_long_press_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliLongPressGestureConstructorP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture( Gesture::Started ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::LongPress, 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);
+
+ // 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureAssignmentP(void)
+{
+ // Test Assignment operator
+ LongPressGesture gesture(new Internal::LongPressGesture( Gesture::Started ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::LongPress, gesture.GetType(), TEST_LOCATION);
+
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+
+ LongPressGesture gesture2(new Internal::LongPressGesture( Gesture::Finished ));
+ DALI_TEST_EQUALS(Gesture::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);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ LongPressGesture gesture3;
+ 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetNumberOfTouchesP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTouches(4);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 4, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetScreenPointP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenPoint(Vector2(100.0f, 300.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetLocalPointP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalPoint(Vector2(100.0f, 300.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ END_TEST;
+}
--- /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-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_pinch_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_pinch_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Positive test case for a method
+int UtcDaliPinchGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ PinchGesture gesture(new Internal::PinchGesture( Gesture::Started ));
+ DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION);
+ 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);
+
+ PinchGesture gesture2(new Internal::PinchGesture( Gesture::Continuing ));
+ DALI_TEST_EQUALS(Gesture::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);
+
+ PinchGesture gesture3(new Internal::PinchGesture( Gesture::Finished ));
+ DALI_TEST_EQUALS(Gesture::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);
+
+ // 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(3.0f, pinch.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5.0f, pinch.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(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);
+ 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);
+
+ PinchGesture gesture2(new Internal::PinchGesture( Gesture::Continuing ));
+ DALI_TEST_EQUALS(Gesture::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);
+
+ GetImplementation( gesture2 ).SetScale( 3.0f );
+ GetImplementation( gesture2 ).SetSpeed( 5.0f );
+
+ gesture = gesture2;
+ DALI_TEST_EQUALS(Gesture::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);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PinchGesture gesture3;
+ 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetScaleP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetScale(), 0.0f, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScale(123.0f);
+ DALI_TEST_EQUALS(gesture.GetScale(), 123.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetSpeedP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetSpeed(), 0.0f, TEST_LOCATION);
+
+ GetImplementation(gesture).SetSpeed(123.0f);
+ DALI_TEST_EQUALS(gesture.GetSpeed(), 123.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetScreenCenterPointP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetLocalCenterPointP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_rotation_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_rotation_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Positive test case for a method
+int UtcDaliRotationGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ RotationGesture gesture(new Internal::RotationGesture( Gesture::Started ));
+ DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture2(new Internal::RotationGesture( Gesture::Continuing ));
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Rotation, gesture2.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture3(new Internal::RotationGesture( Gesture::Finished ));
+ DALI_TEST_EQUALS(Gesture::Finished, gesture3.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture3.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(3.0f, rotation.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(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);
+ DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture2(new Internal::RotationGesture( Gesture::Continuing ));
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(3.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Rotation, gesture.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ RotationGesture gesture3;
+ 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetRotationP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetRotation(), Radian(), TEST_LOCATION);
+
+ GetImplementation(gesture).SetRotation(Dali::ANGLE_270);
+ DALI_TEST_EQUALS(gesture.GetRotation(), Dali::ANGLE_270, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetScreenCenterPointP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetLocalCenterPointP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
--- /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-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_tap_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_tap_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+// Positive test case for a method
+int UtcDaliTapGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ TapGesture gesture(new Internal::TapGesture( Gesture::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);
+
+ // Test Copy constructor
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation( gesture ).SetNumberOfTaps( 2u );
+
+ 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);
+
+ // 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureAssignment(void)
+{
+ // Test Assignment operator
+ TapGesture gesture(new Internal::TapGesture( Gesture::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);
+
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation( gesture ).SetNumberOfTaps( 2u );
+
+ TapGesture gesture2;
+ 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);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ TapGesture gesture3;
+ 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetNumberOfTapsP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 1u, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTaps(123u);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 123u, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetNumberOfTouchesP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1u, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTouches(321u);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 321u, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetScreenPointP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetLocalPointP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(Gesture::Started));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
utc-Dali-FrameBuffer.cpp
utc-Dali-FrameCallbackInterface.cpp
utc-Dali-Geometry.cpp
- utc-Dali-Gesture.cpp
utc-Dali-GestureDetector.cpp
utc-Dali-Handle.cpp
utc-Dali-Hash.cpp
utc-Dali-KeyEvent.cpp
utc-Dali-Layer.cpp
utc-Dali-LocklessBuffer.cpp
- utc-Dali-LongPressGesture.cpp
utc-Dali-LongPressGestureDetector.cpp
utc-Dali-LongPressGestureRecognizer.cpp
utc-Dali-MathUtils.cpp
utc-Dali-PanGestureDetector.cpp
utc-Dali-PanGestureRecognizer.cpp
utc-Dali-Path.cpp
- utc-Dali-PinchGesture.cpp
utc-Dali-PinchGestureDetector.cpp
utc-Dali-PinchGestureRecognizer.cpp
utc-Dali-Pixel.cpp
utc-Dali-Renderer.cpp
utc-Dali-RenderTask.cpp
utc-Dali-RenderTaskList.cpp
- utc-Dali-RotationGesture.cpp
utc-Dali-RotationGestureDetector.cpp
utc-Dali-RotationGestureRecognizer.cpp
utc-Dali-Sampler.cpp
utc-Dali-SignalTemplates.cpp
utc-Dali-SingletonService.cpp
utc-Dali-Stage.cpp
- utc-Dali-TapGesture.cpp
utc-Dali-TapGestureDetector.cpp
utc-Dali-TapGestureRecognizer.cpp
utc-Dali-Texture.cpp
+++ /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>
-
-using namespace Dali;
-
-void utc_dali_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-
-// TestGesture Struct (Gesture constructor is protected)
-struct TestGesture : public Gesture
-{
-public:
- TestGesture(Gesture::Type type, Gesture::State state)
- : Gesture(type, state) {}
-
- virtual ~TestGesture() {}
-};
-
-} // anon namespace
-
-int UtcDaliGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- TestGesture pan(Gesture::Pan, Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, pan.state, TEST_LOCATION);
-
- TestGesture pinch(Gesture::Pinch, Gesture::Clear);
- DALI_TEST_EQUALS(Gesture::Pinch, pinch.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Clear, pinch.state, TEST_LOCATION);
-
- // Test copy constructor
- TestGesture pan2(pan);
- DALI_TEST_EQUALS(Gesture::Pan, pan2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, pan2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliGestureAssignment(void)
-{
- // Test Assignment operator
- TestGesture pan(Gesture::Pan, Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, pan.state, TEST_LOCATION);
-
- TestGesture test(Gesture::Pinch, Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Pinch, test.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, test.state, TEST_LOCATION);
-
- test = pan;
- DALI_TEST_EQUALS(Gesture::Pan, test.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, test.state, TEST_LOCATION);
- END_TEST;
-}
+++ /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>
-
-using namespace Dali;
-
-void utc_dali_long_press_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_long_press_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-// Positive test case for a method
-int UtcDaliLongPressGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- LongPressGesture gesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture.type, TEST_LOCATION);
-
- // Test Copy constructor
- gesture.numberOfTouches = 5u;
-
- LongPressGesture gesture2(gesture);
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliLongPressGestureAssignment(void)
-{
- // Test Assignment operator
- LongPressGesture gesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture.type, TEST_LOCATION);
-
- gesture.numberOfTouches = 5u;
-
- LongPressGesture gesture2( Gesture::Finished );
- DALI_TEST_EQUALS(Gesture::Finished, gesture2.state, TEST_LOCATION);
- gesture2 = gesture;
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliLongPressGestureDynamicAllocation(void)
-{
- LongPressGesture* gesture = new LongPressGesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled( false ),
voidFunctorCalled( false ),
- receivedGesture( Gesture::Clear ),
+ receivedGesture(),
pressedActor()
{}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pressedActor.Reset();
}
{
GestureReceivedFunctor::operator()( actor, longPress );
- if ( longPress.state == stateToUnstage )
+ if ( longPress.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
// Do a long press inside actor's area
TestGenerateLongPress( application, 50.0f, 50.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 50.0f, 50.0f);
END_TEST;
}
// Start long press within the actor's area
TestGenerateLongPress( application, 20.0f, 20.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 20.0f, 20.0f);
// repeat the long press within the actor's area - we should still receive the signal
data.Reset();
TestGenerateLongPress( application, 50.0f, 50.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 50.0f, 50.0f);
// Detach actor
TestGenerateLongPress( application, 5.0f, 5.0f );
TestEndLongPress( application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestGenerateLongPress( application, 5.0f, 5.0f );
TestEndLongPress( application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
TestEndLongPress( application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pressedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points
// (Also proves that you can detach and then re-attach another actor)
TestEndLongPress( application, 51.0f, 51.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pressedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
&application,
[&detector, &functorCalled](Actor actor, const LongPressGesture& gesture)
{
- if( gesture.state == Gesture::Finished )
+ if( gesture.GetState() == Gesture::Finished )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pressedActor.Reset();
}
* 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
+ * See the License for the specific language governing permissions an
+ * d
* limitations under the License.
*
*/
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/pan-gesture-devel.h>
using namespace Dali;
test_return_value = TET_PASS;
}
-
-
-int UtcDaliPanGestureConstructor(void)
+int UtcDaliPanGestureConstructorP(void)
{
TestApplication application; // Reset all test adapter return codes
- PanGesture gesture;
- DALI_TEST_EQUALS(Gesture::Clear, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Clear );
+
+ DALI_TEST_EQUALS(Gesture::Clear, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture.GetType(), TEST_LOCATION);
+
+ PanGesture gesture2 = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Gesture::Started, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture2.GetType(), TEST_LOCATION);
- PanGesture gesture2(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture2.type, TEST_LOCATION);
+ PanGesture gesture3 = DevelPanGesture::New( Gesture::Continuing );
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture3.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture3.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture3.GetType(), TEST_LOCATION);
- PanGesture gesture3(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture3.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture3.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture3.type, TEST_LOCATION);
+ PanGesture gesture4 = DevelPanGesture::New( Gesture::Finished );
- PanGesture gesture4(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture4.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture4.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture4.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Finished, gesture4.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture4.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture4.GetType(), TEST_LOCATION);
// Test copy constructor
- gesture4.numberOfTouches = 3u;
+ DevelPanGesture::SetNumberOfTouches( gesture4, 3u );
PanGesture pan(gesture4);
- DALI_TEST_EQUALS(Gesture::Finished, pan.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3u, pan.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Finished, pan.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, pan.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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(gesture5.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
END_TEST;
}
-int UtcDaliPanGestureAssignment(void)
+int UtcDaliPanGestureAssignmentP(void)
{
// Test Assignment operator
- PanGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Gesture::Started, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture.GetType(), TEST_LOCATION);
- PanGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture2.type, TEST_LOCATION);
+ PanGesture gesture2 = DevelPanGesture::New( Gesture::Continuing );
- gesture2.numberOfTouches = 3u;
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture2.GetType(), TEST_LOCATION);
+
+ DevelPanGesture::SetNumberOfTouches( gesture2, 3u );
gesture = gesture2;
- DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Continuing, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Pan, gesture.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PanGesture gesture3;
+ 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(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
END_TEST;
}
-int UtcDaliPanGestureGetSpeed(void)
+int UtcDaliPanGestureGetSpeedP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
- gesture.velocity = Vector2(3.0f, -4.0f);
+ DevelPanGesture::SetVelocity( gesture, Vector2( 3.0f, -4.0f ) );
DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetDistance(void)
+int UtcDaliPanGestureGetDistanceP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION);
- gesture.displacement = Vector2(-30.0f, -40.0f);
+ DevelPanGesture::SetDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
DALI_TEST_EQUALS(50.0f, gesture.GetDistance(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetScreenSpeed(void)
+int UtcDaliPanGestureGetScreenSpeedP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
DALI_TEST_EQUALS(0.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
- gesture.screenVelocity = Vector2(3.0f, -4.0f);
+ DevelPanGesture::SetScreenVelocity( gesture, Vector2( 3.0f, -4.0f ) );
DALI_TEST_EQUALS(5.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetScreenDistance(void)
+int UtcDaliPanGestureGetScreenDistanceP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
DALI_TEST_EQUALS(0.0f, gesture.GetScreenDistance(), TEST_LOCATION);
- gesture.screenDisplacement = Vector2(-30.0f, -40.0f);
+ DevelPanGesture::SetScreenDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
DALI_TEST_EQUALS(50.0f, gesture.GetScreenDistance(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureDynamicAllocation(void)
-{
- PanGesture* gesture = new PanGesture( Gesture::Started );
- DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
-
-int UtcDaliPanGestureDetectorRegisterProperty(void)
+int UtcDaliPanGestureDetectorRegisterPropertyP(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliPanGestureSetGetTimeP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(0, gesture.GetTime(), TEST_LOCATION);
+
+ DevelPanGesture::SetTime( gesture, 123123 );
+
+ DALI_TEST_EQUALS(123123, gesture.GetTime(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetVelocityP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetVelocity(), TEST_LOCATION);
+
+ DevelPanGesture::SetVelocity( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetVelocity(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetDisplacementP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetDisplacement(), TEST_LOCATION);
+
+ DevelPanGesture::SetDisplacement( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetDisplacement(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetPositionP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetPosition(), TEST_LOCATION);
+
+ DevelPanGesture::SetPosition( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetPosition(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenVelocityP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenVelocity(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenVelocity( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenVelocity(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenDisplacementP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenDisplacement(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenDisplacement( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenDisplacement(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenPositionP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenPosition(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenPosition( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenPosition(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetNumberOfTouchesP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( Gesture::Started );
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+
+ DevelPanGesture::SetNumberOfTouches( gesture, 3123 );
+
+ DALI_TEST_EQUALS(3123, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ END_TEST;
+}
#include <dali/integration-api/input-options.h>
#include <dali-test-suite-utils.h>
#include <test-touch-event-utils.h>
+#include <dali/devel-api/events/pan-gesture-devel.h>
using namespace Dali;
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Clear)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Clear;
- receivedGesture.velocity = Vector2(0.0f, 0.0f);
- receivedGesture.displacement = Vector2(0.0f, 0.0f);
- receivedGesture.position = Vector2(0.0f, 0.0f);
- receivedGesture.screenPosition = Vector2(0.0f, 0.0f);
- receivedGesture.numberOfTouches = 0;
+ receivedGesture.Reset();
pannedActor.Reset();
}
{
GestureReceivedFunctor::operator()( actor, pan );
- if ( pan.state == stateToUnstage )
+ if ( pan.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
Vector2 localVelocity = Vector2::ONE,
unsigned int numberOfTouches = 1 )
{
- PanGesture pan( state );
+ Dali::PanGesture pan = DevelPanGesture::New( state );
- pan.time = time;
+ DevelPanGesture::SetTime( pan, time );
- pan.screenPosition = screenPosition;
- pan.position = localPosition;
+ DevelPanGesture::SetScreenPosition( pan, screenPosition );
+ DevelPanGesture::SetPosition( pan, localPosition );
- pan.screenDisplacement = screenDisplacement;
- pan.displacement = localDisplacement;
+ DevelPanGesture::SetScreenDisplacement( pan, screenDisplacement );
+ DevelPanGesture::SetDisplacement( pan, localDisplacement );
- pan.screenVelocity = screenVelocity;
- pan.velocity = localVelocity;
+ DevelPanGesture::SetScreenVelocity( pan, screenVelocity );
+ DevelPanGesture::SetVelocity( pan, localVelocity );
- pan.numberOfTouches = numberOfTouches;
+ DevelPanGesture::SetNumberOfTouches( pan, numberOfTouches );
return pan;
}
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(0.5f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(320.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(20.0f, data.receivedGesture.GetSpeed(), 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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-32.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-2.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(32.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(2.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
END_TEST;
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(0.5f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-1.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
END_TEST;
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
END_TEST;
}
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pannedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-2.0f, 16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(-2.0f, 16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Attach child and generate same touch points to yield a different displacement
// (Also proves that you can detach and then re-attach another actor)
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pannedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
END_TEST;
}
TestEndPan( application, Vector2(26.0f, 20.0f), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.velocity.x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.velocity.y ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.screenVelocity.x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.screenVelocity.y ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().x ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().y ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().x ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().y ) );
data.Reset();
data.Reset();
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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
&application,
[&detector, &functorCalled](Actor actor, const PanGesture& pan)
{
- if( pan.state == Gesture::Finished )
+ if( pan.GetState() == Gesture::Finished )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pannedActor.Reset();
}
+++ /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>
-
-using namespace Dali;
-
-void utc_dali_pinch_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_pinch_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-// Positive test case for a method
-int UtcDaliPinchGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- PinchGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
-
- PinchGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture2.type, TEST_LOCATION);
-
- PinchGesture gesture3(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture3.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture3.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture3.type, TEST_LOCATION);
-
- // Test copy constructor
- gesture3.scale = 3.0f;
- gesture3.speed = 5.0f;
-
- PinchGesture pinch(gesture3);
- DALI_TEST_EQUALS(Gesture::Finished, pinch.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, pinch.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(5.0f, pinch.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, pinch.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliPinchGestureAssignment(void)
-{
- // Test Assignment operator
- PinchGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
-
- PinchGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture2.type, TEST_LOCATION);
-
- gesture2.scale = 3.0f;
- gesture2.speed = 5.0f;
-
- gesture = gesture2;
- DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(5.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliPinchGestureDynamicAllocation(void)
-{
- PinchGesture* gesture = new PinchGesture( Gesture::Started );
- DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture->scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture->speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.scale = 0.0f;
- receivedGesture.speed = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pinchedActor.Reset();
}
{
GestureReceivedFunctor::operator()( actor, pinch );
- if ( pinch.state == stateToUnstage )
+ if ( pinch.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.666f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(66.666f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Continue the pan 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( 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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.2666f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(80.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1.333f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(213.333f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.333f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(600.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.555f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(106.667f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, 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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.277f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(66.666f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION);
// Remove the actor from stage and reset the data
application.GetScene().Remove(actor);
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(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, 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);
+ DALI_TEST_EQUALS(Vector2(70.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, 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);
+ DALI_TEST_EQUALS(Vector2(30.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, 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);
+ DALI_TEST_EQUALS(Vector2(30.0f, 70.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pinchedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, 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);
// Attach child and generate same touch points to yield same results
// (Also proves that you can detach and then re-attach another actor)
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pinchedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, 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);
+ DALI_TEST_EQUALS(Vector2(20.0f, 80.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state == Gesture::Finished )
+ if( gesture.GetState() == Gesture::Finished )
{
detector.Detach(actor);
functorCalled = true;
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pinchedActor.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.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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 ), 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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
+++ /dev/null
-/*
- * 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.
- *
- */
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_rotation_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_rotation_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-// Positive test case for a method
-int UtcDaliRotationGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- RotationGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
-
- RotationGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION);
-
- RotationGesture gesture3(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture3.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture3.type, TEST_LOCATION);
-
- // Test copy constructor
- gesture3.rotation = 3.0f;
-
- RotationGesture rotation(gesture3);
- DALI_TEST_EQUALS(Gesture::Finished, rotation.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, rotation.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, rotation.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliRotationGestureAssignment(void)
-{
- // Test Assignment operator
- RotationGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
-
- RotationGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION);
-
- gesture2.rotation.radian = 3.0f;
-
- gesture = gesture2;
- DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, gesture.rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliRotationGestureDynamicAllocation(void)
-{
- RotationGesture* gesture = new RotationGesture( Gesture::Started );
- DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture->rotation.radian, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Rotation, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.rotation = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
rotatedActor.Reset();
}
{
GestureReceivedFunctor::operator()( actor, rotation );
- if ( rotation.state == stateToUnstage )
+ if ( rotation.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.244f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(12.5f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
// Gesture ends - we would receive a finished state
data.Reset();
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
END_TEST;
}
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.404892f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
// 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( 29.0f, 15.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
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.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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);
END_TEST;
}
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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION);
// Remove the actor from stage and reset the data
application.GetScene().Remove(actor);
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(67.5f, 27.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(27.0f, 32.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(32.5f, 73.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 25.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.rotatedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.463648f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points to yield same results
// (Also proves that you can detach and then re-attach another actor)
Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 35.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.rotatedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.982794f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 27.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.982794f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 27.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(27.5f, 76.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state == Gesture::Finished )
+ if( gesture.GetState() == Gesture::Finished )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
void utc_dali_rotation_gesture_recognizer_startup(void)
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.rotation = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
rotatedActor.Reset();
}
SignalData& signalData;
};
+Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+{
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ point.SetDeviceClass( Device::Class::TOUCH );
+ point.SetDeviceSubclass( Device::Subclass::NONE );
+ touchEvent.points.push_back( point );
+ touchEvent.time = time;
+ return touchEvent;
+}
+
Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
{
Integration::TouchEvent touchEvent;
} // anon namespace
///////////////////////////////////////////////////////////////////////////////
+int UtcDaliRotationGestureRecognizerRealistic(void)
+{
+ TestApplication application;
+
+ RotationGestureDetector detector = RotationGestureDetector::New();
+
+ Actor actor = Actor::New();
+ actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ detector.Attach(actor);
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureRecognizerBasicInterrupted(void)
+{
+ TestApplication application;
+
+ RotationGestureDetector detector = RotationGestureDetector::New();
+
+ Actor actor = Actor::New();
+ actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ detector.Attach(actor);
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ // application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ // application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) );
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+
+ END_TEST;
+}
int UtcDaliRotationGestureRecognizerMinimumTouchEvents(void)
{
application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
- DALI_TEST_EQUALS( Gesture::Started, data.receivedGesture.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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 ), 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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::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.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
+++ /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>
-
-using namespace Dali;
-
-void utc_dali_tap_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_tap_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-// Positive test case for a method
-int UtcDaliTapGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- TapGesture gesture;
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture.type, TEST_LOCATION);
-
- // Test Copy constructor
- gesture.numberOfTouches = 5u;
- gesture.numberOfTaps = 2u;
-
- TapGesture gesture2(gesture);
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(2u, gesture2.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture2.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureAssignment(void)
-{
- // Test Assignment operator
- TapGesture gesture;
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture.type, TEST_LOCATION);
-
- gesture.numberOfTouches = 5u;
- gesture.numberOfTaps = 2u;
-
- TapGesture gesture2;
- gesture2 = gesture;
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(2u, gesture2.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture2.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureDynamicAllocation(void)
-{
- TapGesture* gesture = new TapGesture;
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture->numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTaps = 0u;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
tappedActor.Reset();
}
// Do a tap inside actor's area
TestGenerateTap( application, 50.0f, 50.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
END_TEST;
}
// Start tap within the actor's area
TestGenerateTap( application, 20.0f, 20.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// repeat the tap within the actor's area - we should still receive the signal
data.Reset();
TestGenerateTap( application, 50.0f, 50.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// Detach actor
detector.DetachAll();
// Do tap, only check finished value
TestGenerateTap( application, 5.0f, 5.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
data.Reset();
TestGenerateTap( application, 5.0f, 5.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
TestGenerateTap( application, 50.0f, 50.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points
// (Also proves that you can detach and then re-attach another actor)
TestGenerateTap( application, 51.0f, 51.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
tappedActor.Reset();
}
SignalData()
: functorCalled( false ),
voidFunctorCalled( false ),
- receivedGesture( Gesture::Clear ),
+ receivedGesture( ),
pressedActor()
{}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pressedActor.Reset();
}
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/events/pan-gesture-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
+
+
+namespace Dali
+{
+
+namespace DevelPanGesture
+{
+
+Dali::PanGesture New( Gesture::State state )
+{
+ return PanGesture( new Internal::PanGesture( state ) );
+}
+
+void SetTime( Dali::PanGesture& gesture, uint32_t time )
+{
+ GetImplementation( gesture ).SetTime( time );
+}
+
+void SetVelocity( Dali::PanGesture& gesture, const Vector2& velocity)
+{
+ GetImplementation( gesture ).SetVelocity( velocity );
+}
+
+void SetDisplacement( Dali::PanGesture& gesture, const Vector2& displacement)
+{
+ GetImplementation( gesture ).SetDisplacement( displacement );
+}
+
+void SetPosition( Dali::PanGesture& gesture, const Vector2& position)
+{
+ GetImplementation( gesture ).SetPosition( position );
+}
+
+void SetScreenVelocity( Dali::PanGesture& gesture, const Vector2& screenVelocity)
+{
+ GetImplementation( gesture ).SetScreenVelocity( screenVelocity );
+}
+
+void SetScreenDisplacement( Dali::PanGesture& gesture, const Vector2& screenDisplacement)
+{
+ GetImplementation( gesture ).SetScreenDisplacement( screenDisplacement );
+}
+
+void SetScreenPosition( Dali::PanGesture& gesture, const Vector2& screenPosition)
+{
+ GetImplementation( gesture ).SetScreenPosition( screenPosition );
+}
+
+void SetNumberOfTouches( Dali::PanGesture& gesture, uint32_t numberOfTouches )
+{
+ GetImplementation( gesture ).SetNumberOfTouches( numberOfTouches );
+}
+
+} // namespace DevelPanGesture
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_PAN_GESTURE_DEVEL_H
+#define DALI_PAN_GESTURE_DEVEL_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/pan-gesture.h>
+
+namespace Dali
+{
+
+namespace DevelPanGesture
+{
+
+/**
+ * @brief Create a PanGeture for internal.
+ * @param[in] state The state of the PanGesture
+ */
+DALI_CORE_API Dali::PanGesture New(Gesture::State state);
+
+/**
+ * @brief Set the time the gesture took place.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] time The time the gesture took place
+ */
+DALI_CORE_API void SetTime(Dali::PanGesture& gesture, uint32_t time);
+
+/**
+ * @brief Set the velocity at which the user is moving their fingers.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] velocity The Vector2 in local coordinates to set
+ */
+DALI_CORE_API void SetVelocity(Dali::PanGesture& gesture, const Vector2& velocity);
+
+/**
+ * @brief Set the displacement.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] displacement The Vector2 in local coordinates to set
+ */
+DALI_CORE_API void SetDisplacement(Dali::PanGesture& gesture, const Vector2& displacement);
+
+/**
+ * @brief Set the current touch position of the primary touch point in local actor coordinates.
+ * @param[in] gesture The PanGesture to set.
+ * @param[in] position The current touch position to set.
+ */
+DALI_CORE_API void SetPosition(Dali::PanGesture& gesture, const Vector2& position);
+
+/**
+ * @brief Set the velocity at which the user is moving their fingers.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] screenVelocity The Vector2 in screen coordinates to set
+ */
+DALI_CORE_API void SetScreenVelocity(Dali::PanGesture& gesture, const Vector2& screenVelocity);
+
+/**
+ * @brief Set the screen displacement.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] screenDisplacement The Vector2 in screen coordinates to set
+ */
+DALI_CORE_API void SetScreenDisplacement(Dali::PanGesture& gesture, const Vector2& screenDisplacement);
+
+/**
+ * @brief Set the current touch position of the primary touch point in screen coordinates.
+ * @param[in] gesture The PanGesture to set.
+ * @param[in] screenPosition The Vector2 in screen coordinates to set.
+ */
+DALI_CORE_API void SetScreenPosition(Dali::PanGesture& gesture, const Vector2& screenPosition);
+
+/**
+ * @brief Set the total number of fingers touching the screen in a pan gesture.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] numberOfTouches The total number of fingers touching the screen to set
+ */
+DALI_CORE_API void SetNumberOfTouches(Dali::PanGesture& gesture, uint32_t numberOfTouches);
+
+} // namespace DevelPanGesture
+
+} // namespace Dali
+
+#endif // DALI_PAN_GESTURE_DEVEL_H
${devel_api_src_dir}/common/stage-devel.cpp
${devel_api_src_dir}/common/stage.cpp
${devel_api_src_dir}/events/hit-test-algorithm.cpp
- ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp
${devel_api_src_dir}/events/key-event-devel.cpp
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp
+ ${devel_api_src_dir}/events/pan-gesture-devel.cpp
${devel_api_src_dir}/events/touch-point.cpp
${devel_api_src_dir}/events/wheel-event-devel.cpp
${devel_api_src_dir}/images/distance-field.cpp
SET( devel_api_core_events_header_files
${devel_api_src_dir}/events/hit-test-algorithm.h
- ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h
${devel_api_src_dir}/events/key-event-devel.h
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h
+ ${devel_api_src_dir}/events/pan-gesture-devel.h
${devel_api_src_dir}/events/touch-point.h
${devel_api_src_dir}/events/wheel-event-devel.h
)
{
switch ( type )
{
- case Gesture::Pan:
+ case Dali::Gesture::Pan:
{
return panDetectors;
}
- case Gesture::Pinch:
+ case Dali::Gesture::Pinch:
{
return pinchDetectors;
}
- case Gesture::LongPress:
+ case Dali::Gesture::LongPress:
{
return longPressDetectors;
}
- case Gesture::Tap:
+ case Dali::Gesture::Tap:
{
return tapDetectors;
}
- case Gesture::Rotation:
+ case Dali::Gesture::Rotation:
{
return rotationDetectors;
}
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.h>
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
-#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/integration-api/debug.h>
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case Dali::Gesture::LongPress:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.AddGestureDetector(longPress, scene);
break;
}
- case Gesture::Pan:
+ case Dali::Gesture::Pan:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents);
break;
}
- case Gesture::Pinch:
+ case Dali::Gesture::Pinch:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.AddGestureDetector(pinch, scene);
break;
}
- case Gesture::Tap:
+ case Dali::Gesture::Tap:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.AddGestureDetector(tap, scene);
break;
}
- case Gesture::Rotation:
+ case Dali::Gesture::Rotation:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.AddGestureDetector(rotation, scene);
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case Dali::Gesture::LongPress:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.RemoveGestureDetector(longPress);
break;
}
- case Gesture::Pan:
+ case Dali::Gesture::Pan:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.RemoveGestureDetector(pan);
break;
}
- case Gesture::Pinch:
+ case Dali::Gesture::Pinch:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.RemoveGestureDetector(pinch);
break;
}
- case Gesture::Tap:
+ case Dali::Gesture::Tap:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.RemoveGestureDetector(tap);
break;
}
- case Gesture::Rotation:
+ case Dali::Gesture::Rotation:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.RemoveGestureDetector(rotation);
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case Dali::Gesture::LongPress:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.GestureDetectorUpdated(longPress);
break;
}
- case Gesture::Pan:
+ case Dali::Gesture::Pan:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.GestureDetectorUpdated(pan);
break;
}
- case Gesture::Pinch:
+ case Dali::Gesture::Pinch:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.GestureDetectorUpdated(pinch);
break;
}
- case Gesture::Tap:
+ case Dali::Gesture::Tap:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.GestureDetectorUpdated(tap);
break;
}
- case Gesture::Rotation:
+ case Dali::Gesture::Rotation:
{
// Nothing to do
break;
}
}
-void GestureEventProcessor::SetGestureProperties( const Gesture& gesture )
+void GestureEventProcessor::SetGestureProperties( const Dali::Gesture& gesture )
{
- DALI_ASSERT_DEBUG( gesture.type == Gesture::Pan && "Only PanGesture has a scene object\n" );
+ DALI_ASSERT_DEBUG( gesture.GetType() == Dali::Gesture::Pan && "Only PanGesture has a scene object\n" );
- const PanGesture& pan = static_cast< const PanGesture& >( gesture );
+ const Dali::PanGesture& pan = static_cast< const Dali::PanGesture& >( gesture );
if( mPanGestureProcessor.SetPanGestureProperties( pan ) )
{
// We may not be updating so we need to ask the render controller for an update.
#define DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/events/gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
#include <dali/internal/event/events/long-press-gesture/long-press-gesture-processor.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-processor.h>
namespace Dali
{
-struct Gesture;
-
namespace Integration
{
* @param[in] gesture The gesture whose values will be used in the Update object.
* @note If we are in the middle of processing the gesture being set, then this call is ignored.
*/
- void SetGestureProperties( const Gesture& gesture );
+ void SetGestureProperties( const Dali::Gesture& gesture );
public: // Called by Core
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/gesture.h>
#include <dali/integration-api/events/event.h>
+#include <dali/internal/event/events/gesture-impl.h>
namespace Dali
{
--- /dev/null
+#ifndef DALI_INTERNAL_GESTURE_H
+#define DALI_INTERNAL_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/events/gesture.h>
+#include <dali/integration-api/events/event.h>
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class Gesture;
+typedef IntrusivePtr<Gesture> GesturePtr;
+
+/**
+ * This is the abstract base structure for any gestures that the adaptor detects and wishes to send
+ * to the Core.
+ */
+class Gesture : public BaseObject
+{
+public:
+
+ using State = Dali::Gesture::State;
+ using Type = Dali::Gesture::Type;
+
+public:
+
+ /**
+ * @brief Get the gesture type.
+ *
+ * @return The gesture type.
+ */
+ inline Type GetType() const
+ {
+ return mGestureType;
+ }
+
+ /**
+ * @brief Set the state of the gesture.
+ * @param[in] state The state of the gesture to set
+ */
+ inline void SetState( State state )
+ {
+ mState = state;
+ }
+
+ /**
+ * @brief Get the state of the gesture.
+ *
+ * @return The state of the gesture.
+ */
+ inline State GetState() const
+ {
+ return mState;
+ }
+
+ /**
+ * @brief Set The time the gesture took place.
+ * @param[in] time The time the gesture took place. to set
+ */
+ inline void SetTime( uint32_t time )
+ {
+ mTime = time;
+ }
+
+ /**
+ * @brief Get the time the gesture took place.
+ *
+ * @return The time the gesture took place.
+ */
+ inline uint32_t GetTime() const
+ {
+ return mTime;
+ }
+
+ Gesture(const Gesture&) = delete; ///< Deleted copy constructor
+ Gesture(Gesture&&) = delete; ///< Deleted move constructor
+ Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
+ Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
+
+protected:
+
+ /**
+ * This constructor is only used by derived classes.
+ * @param[in] gestureType The type of gesture event.
+ * @param[in] gestureState The state of the gesture event.
+ */
+ Gesture(Type gestureType, State gestureState)
+ : mGestureType( gestureType ),
+ mState( gestureState )
+ {
+ }
+
+ /**
+ * @brief Virtual destructor.
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~Gesture() = default;
+
+private:
+ Type mGestureType;
+ State mState;
+ uint32_t mTime{0u};
+};
+
+} // namespace Internal
+
+/**
+ * Helper methods for public API.
+ */
+inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
+{
+ DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+
+ BaseObject& handle = gesture.GetBaseObject();
+
+ return static_cast<Internal::Gesture&>(handle);
+}
+
+inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
+{
+ DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+
+ const BaseObject& handle = gesture.GetBaseObject();
+
+ return static_cast<const Internal::Gesture&>(handle);
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_GESTURE_H
* Default Constructor
*/
PanGestureRequest()
- : GestureRequest(Gesture::Pan),
+ : GestureRequest(Dali::Gesture::Pan),
minTouches(1),
maxTouches(1)
{
* Default Constructor
*/
TapGestureRequest()
- : GestureRequest(Gesture::Tap),
+ : GestureRequest(Dali::Gesture::Tap),
minTaps(1),
maxTaps(1),
minTouches(1),
* Default Constructor
*/
LongPressGestureRequest()
- : GestureRequest(Gesture::LongPress),
+ : GestureRequest(Dali::Gesture::LongPress),
minTouches(1),
maxTouches(1)
{
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
#include <cstring> // for strcmp
// INTERNAL INCLUDES
-#include <dali/public-api/events/long-press-gesture.h>
+
#include <dali/public-api/object/type-registry.h>
#include <dali/internal/event/events/gesture-event-processor.h>
}
LongPressGestureDetector::LongPressGestureDetector()
-: GestureDetector(Gesture::LongPress),
+: GestureDetector(Dali::Gesture::LongPress),
mMinimumTouchesRequired(DEFAULT_TOUCHES_REQUIRED),
mMaximumTouchesRequired(DEFAULT_TOUCHES_REQUIRED)
{
}
LongPressGestureDetector::LongPressGestureDetector(unsigned int minTouches, unsigned int maxTouches)
-: GestureDetector(Gesture::LongPress),
+: GestureDetector(Dali::Gesture::LongPress),
mMinimumTouchesRequired(minTouches),
mMaximumTouchesRequired(maxTouches)
{
return mMaximumTouchesRequired;
}
-void LongPressGestureDetector::EmitLongPressGestureSignal(Dali::Actor pressedActor, const LongPressGesture& longPress)
+void LongPressGestureDetector::EmitLongPressGestureSignal(Dali::Actor pressedActor, const Dali::LongPressGesture& longPress)
{
// Guard against destruction during signal emission
Dali::LongPressGestureDetector handle( this );
#define DALI_INTERNAL_LONG_PRESS_GESTURE_DETECTOR_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
-struct LongPressGesture;
-
namespace Internal
{
* @param[in] pressedActor The pressed actor.
* @param[in] longPress The long press
*/
- void EmitLongPressGestureSignal(Dali::Actor pressedActor, const LongPressGesture& longPress);
+ void EmitLongPressGestureSignal(Dali::Actor pressedActor, const Dali::LongPressGesture& longPress);
public: // Signals
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
{
LongPressGestureEvent::LongPressGestureEvent( Gesture::State state )
-: GestureEvent( Gesture::LongPress, state ),
+: GestureEvent( Dali::Gesture::LongPress, state ),
numberOfTouches(1)
{
}
--- /dev/null
+#ifndef DALI_INTERNAL_LONG_PRESS_GESTURE_H
+#define DALI_INTERNAL_LONG_PRESS_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/gesture-impl.h>
+#include <dali/public-api/events/long-press-gesture.h>
+#include <dali/public-api/math/vector2.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class LongPressGesture;
+typedef IntrusivePtr< LongPressGesture > LongPressGesturePtr;
+
+/**
+ * @copydoc Dali::LongPressGesture
+ */
+class LongPressGesture final : public Gesture
+{
+public:
+
+ /**
+ * Default Constructor
+ * @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(const LongPressGesture&) = delete; ///< Deleted copy constructor
+ LongPressGesture(LongPressGesture&&) = delete; ///< Deleted move constructor
+ LongPressGesture& operator=(const LongPressGesture&) = delete; ///< Deleted copy assignment operator
+ LongPressGesture& operator=(LongPressGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief Set the number of touch points.
+ * @param[in] numberOfTouches The number of touch points to set.
+ */
+ inline void SetNumberOfTouches( uint32_t numberOfTouches )
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetNumberOfTouches()
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @brief Set This is the point, in screen coordinates.
+ * @param[in] screenPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenPoint( const Vector2& screenPoint )
+ {
+ mScreenPoint = screenPoint;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetScreenPoint()
+ */
+ inline const Vector2& GetScreenPoint() const
+ {
+ return mScreenPoint;
+ }
+
+ /**
+ * @brief Set This is the point, in local actor coordinates.
+ * @param[in] localPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalPoint( const Vector2& localPoint )
+ {
+ mLocalPoint = localPoint;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetLocalPoint()
+ */
+ inline const Vector2& GetLocalPoint() const
+ {
+ return mLocalPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~LongPressGesture() = default;
+
+private:
+ Vector2 mScreenPoint;
+ Vector2 mLocalPoint;
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::LongPressGesture& GetImplementation( Dali::LongPressGesture& longPressGesture )
+{
+ DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
+
+ BaseObject& object = longPressGesture.GetBaseObject();
+
+ return static_cast< Internal::LongPressGesture& >( object );
+}
+
+inline const Internal::LongPressGesture& GetImplementation( const Dali::LongPressGesture& longPressGesture )
+{
+ DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
+
+ const BaseObject& object = longPressGesture.GetBaseObject();
+
+ return static_cast< const Internal::LongPressGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_LONG_PRESS_GESTURE_H
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/long-press-gesture.h>
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
#include <dali/internal/event/events/long-press-gesture/long-press-gesture-event.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
const LongPressGestureEvent& longPressEvent,
Vector2 localPoint)
{
- LongPressGesture longPress(longPressEvent.state);
- longPress.time = longPressEvent.time;
- longPress.numberOfTouches = longPressEvent.numberOfTouches;
- longPress.screenPoint = longPressEvent.point;
- longPress.localPoint = localPoint;
+ Internal::LongPressGesturePtr longPress( new Internal::LongPressGesture(longPressEvent.state ) );
+ longPress->SetTime( longPressEvent.time );
+ longPress->SetNumberOfTouches( longPressEvent.numberOfTouches );
+ longPress->SetScreenPoint( longPressEvent.point );
+ longPress->SetLocalPoint( localPoint );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< LongPressGestureDetector* >( *iter )->EmitLongPressGestureSignal( actorHandle, longPress );
+ static_cast< LongPressGestureDetector* >( *iter )->EmitLongPressGestureSignal( actorHandle, Dali::LongPressGesture( longPress.Get() ) );
}
}
} // unnamed namespace
LongPressGestureProcessor::LongPressGestureProcessor()
-: GestureProcessor( Gesture::LongPress ),
+: GestureProcessor( Dali::Gesture::LongPress ),
mLongPressGestureDetectors(),
mCurrentEmitters(),
mCurrentRenderTask(),
{
switch ( longPressEvent.state )
{
- case Gesture::Possible:
+ case Dali::Gesture::Possible:
{
mCurrentEmitters.clear();
ResetActor();
break;
}
- case Gesture::Started:
+ case Dali::Gesture::Started:
{
Actor* currentGesturedActor = GetCurrentGesturedActor();
if ( currentGesturedActor )
break;
}
- case Gesture::Finished:
+ case Dali::Gesture::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 Gesture::Cancelled:
+ case Dali::Gesture::Cancelled:
{
mCurrentEmitters.clear();
ResetActor();
break;
}
- case Gesture::Continuing:
+ case Dali::Gesture::Continuing:
{
DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" );
break;
}
- case Gesture::Clear:
+ case Dali::Gesture::Clear:
{
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, Gesture::LongPress ),
+: GestureRecognizer( screenSize, Dali::Gesture::LongPress ),
mObserver( observer ),
mState( Clear ),
mMinimumTouchesRequired( request.minTouches ),
// A long press gesture may be possible, tell Core about this and change state to Touched.
mState = Touched;
- EmitGesture( Gesture::Possible );
+ EmitGesture( Dali::Gesture::Possible );
}
break;
if (pointCount > mMaximumTouchesRequired)
{
// A long press did not occur, tell Core that it was cancelled and change state to Failed.
- EmitGesture( Gesture::Cancelled );
+ EmitGesture( Dali::Gesture::Cancelled );
mTouchPositions.clear();
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
case PointState::INTERRUPTED:
{
// System has interrupted us, long press is not possible, inform Core
- EmitGesture( Gesture::Cancelled );
+ EmitGesture( Dali::Gesture::Cancelled );
mTouchPositions.clear();
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
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( Gesture::Cancelled );
+ EmitGesture( Dali::Gesture::Cancelled );
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
mState = Failed;
if(mState == Finished)
{
// When the last touch point is lifted, we should inform the Core that the Long press has finished.
- EmitGesture(Gesture::Finished);
+ EmitGesture(Dali::Gesture::Finished);
}
mTouchPositions.clear();
mState = Clear; // Reset state to clear when last touch point is lifted.
bool LongPressGestureRecognizer::TimerCallback()
{
- EmitGesture(Gesture::Started);
+ EmitGesture(Dali::Gesture::Started);
mState = Finished;
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 == Gesture::Possible) ||
- (state == Gesture::Cancelled) ||
+ if ( (state == Dali::Gesture::Possible) ||
+ (state == Dali::Gesture::Cancelled) ||
(touchPoints >= mMinimumTouchesRequired) )
{
LongPressGestureEvent longPress( state );
longPress.point /= static_cast<float>( touchPoints );
longPress.time = mTouchTime;
- if ( state != Gesture::Possible )
+ if ( state != Dali::Gesture::Possible )
{
longPress.time += mMinimumHoldingTime;
}
#define DALI_INTERNAL_LONG_PRESS_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
* 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( Gesture::State state );
private:
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
return allowed;
}
-void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan)
+void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const Dali::PanGesture& pan)
{
if ( !mDetectedSignal.Empty() )
{
return connected;
}
-void PanGestureDetector::SetPanGestureProperties( const PanGesture& pan )
+void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan )
{
ThreadLocalStorage::Get().GetGestureEventProcessor().SetGestureProperties( pan );
}
PanGestureDetector::PanGestureDetector( const SceneGraph::PanGesture& sceneObject )
-: GestureDetector(Gesture::Pan, &sceneObject ),
+: GestureDetector( Dali::Gesture::Pan, &sceneObject ),
mMinimumTouches(1),
mMaximumTouches(1)
{
#define DALI_INTERNAL_PAN_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/events/pan-gesture-detector.h>
#include <dali/public-api/math/vector2.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
+#include <dali/public-api/events/pan-gesture.h>
namespace Dali
{
* @param[in] actor The panned actor.
* @param[in] pan The pan gesture.
*/
- void EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan);
+ void EmitPanGestureSignal(Dali::Actor actor, const Dali::PanGesture& pan);
public: // Signals
/**
* @copydoc Dali::PanGestureDetector::SetPanGestureProperties()
*/
- static void SetPanGestureProperties( const PanGesture& pan );
+ static void SetPanGestureProperties( const Dali::PanGesture& pan );
protected:
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
PanGestureEvent::PanGestureEvent(Gesture::State state)
-: GestureEvent(Gesture::Pan, state),
+: GestureEvent(Dali::Gesture::Pan, state),
timeDelta(0),
numberOfTouches(1)
{
--- /dev/null
+#ifndef DALI_INTERNAL_PAN_GESTURE_H
+#define DALI_INTERNAL_PAN_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class PanGesture;
+typedef IntrusivePtr< PanGesture > PanGesturePtr;
+
+/**
+ * @copydoc Dali::PanGesture
+ */
+class PanGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ PanGesture(Gesture::State state)
+ : Gesture(Dali::Gesture::Pan, state)
+ {
+ }
+
+ PanGesture(const PanGesture&) = delete; ///< Deleted copy constructor
+ PanGesture(PanGesture&&) = delete; ///< Deleted move constructor
+ PanGesture& operator=(const PanGesture&) = delete; ///< Deleted copy assignment operator
+ PanGesture& operator=(PanGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief Set The velocity at which the user is moving their fingers.
+ * @param[in] velocity The Vector2 in local coordinates to set.
+ */
+ inline void SetVelocity(const Vector2& velocity)
+ {
+ mVelocity = velocity;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetVelocity()
+ */
+ inline const Vector2& GetVelocity() const
+ {
+ return mVelocity;
+ }
+
+ /**
+ * @brief Set This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
+ * if the gesture has just started, then the amount panned since the user touched the screen.
+ * @param[in] displacement The Vector2 in local coordinates to set.
+ */
+ inline void SetDisplacement(const Vector2& displacement)
+ {
+ mDisplacement = displacement;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetDisplacement()
+ */
+ inline const Vector2& GetDisplacement() const
+ {
+ return mDisplacement;
+ }
+
+ /**
+ * @brief Set This current touch position of the primary touch point in local actor coordinates.
+ * @param[in] velocity The current touch position to set.
+ */
+ inline void SetPosition(const Vector2& position)
+ {
+ mPosition = position;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetPosition()
+ */
+ inline const Vector2& GetPosition() const
+ {
+ return mPosition;
+ }
+
+ /**
+ * @brief Set The velocity at which the user is moving their fingers.
+ * @param[in] screenVelocity The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenVelocity(const Vector2& screenVelocity)
+ {
+ mScreenVelocity = screenVelocity;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenVelocity()
+ */
+ inline const Vector2& GetScreenVelocity() const
+ {
+ return mScreenVelocity;
+ }
+
+ /**
+ * @brief Set This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
+ * if the gesture has just started, then the amount panned since the user touched the screen.
+ * @param[in] screenDisplacement The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenDisplacement(const Vector2& screenDisplacement)
+ {
+ mScreenDisplacement = screenDisplacement;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenDisplacement()
+ */
+ inline const Vector2& GetScreenDisplacement() const
+ {
+ return mScreenDisplacement;
+ }
+
+ /**
+ * @brief Set This current touch position of the primary touch point in screen coordinates.
+ * @param[in] screenPosition The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenPosition(const Vector2& screenPosition)
+ {
+ mScreenPosition = screenPosition;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenPosition()
+ */
+ inline const Vector2& GetScreenPosition() const
+ {
+ return mScreenPosition;
+ }
+
+ /**
+ * @brief The total number of fingers touching the screen in a pan gesture.
+ * @param[in] numberOfTouches The total number of fingers touching the screen to set.
+ */
+ inline void SetNumberOfTouches(uint32_t numberOfTouches)
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @brief The total number of fingers touching the screen in a pan gesture.
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetSpeed()
+ */
+ inline float GetSpeed() const
+ {
+ return mVelocity.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetDistance()
+ */
+ inline float GetDistance() const
+ {
+ return mDisplacement.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenSpeed()
+ */
+ inline float GetScreenSpeed() const
+ {
+ return mScreenVelocity.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenDistance()
+ */
+ inline float GetScreenDistance() const
+ {
+ return mScreenDisplacement.Length();
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~PanGesture() = default;
+
+private:
+ Vector2 mVelocity;
+ Vector2 mDisplacement;
+ Vector2 mPosition;
+ Vector2 mScreenVelocity;
+ Vector2 mScreenDisplacement;
+ Vector2 mScreenPosition;
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::PanGesture& GetImplementation( Dali::PanGesture& panGesture )
+{
+ DALI_ASSERT_ALWAYS( panGesture && "panGesture handle is empty" );
+
+ BaseObject& object = panGesture.GetBaseObject();
+
+ return static_cast< Internal::PanGesture& >( object );
+}
+
+inline const Internal::PanGesture& GetImplementation( const Dali::PanGesture& panGesture )
+{
+ DALI_ASSERT_ALWAYS( panGesture && "panGesture handle is empty" );
+
+ const BaseObject& object = panGesture.GetBaseObject();
+
+ return static_cast< const Internal::PanGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_PAN_GESTURE_H
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/event/events/multi-point-event-util.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
namespace Dali
} // unnamed namespace
PanGestureProcessor::PanGestureProcessor( SceneGraph::UpdateManager& updateManager )
-: GestureProcessor( Gesture::Pan ),
+: GestureProcessor( Dali::Gesture::Pan ),
mPanGestureDetectors(),
mCurrentPanEmitters(),
mCurrentRenderTask(),
switch( panEvent.state )
{
- case Gesture::Possible:
+ case Dali::Gesture::Possible:
{
mCurrentPanEmitters.clear();
ResetActor();
break;
}
- case Gesture::Started:
+ case Dali::Gesture::Started:
{
// Requires a core update
mNeedsUpdate = true;
break;
}
- case Gesture::Continuing:
+ case Dali::Gesture::Continuing:
{
// Requires a core update
mNeedsUpdate = true;
DALI_FALLTHROUGH;
}
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case Dali::Gesture::Finished:
+ case Dali::Gesture::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, Gesture::Finished, mCurrentRenderTask);
+ EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, Dali::Gesture::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 == Gesture::Finished ) || ( panEvent.state == Gesture::Cancelled ) )
+ if ( ( panEvent.state == Dali::Gesture::Finished ) || ( panEvent.state == Dali::Gesture::Cancelled ) )
{
mCurrentPanEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
+ case Dali::Gesture::Clear:
{
DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
break;
UpdateDetection();
}
-bool PanGestureProcessor::SetPanGestureProperties( const PanGesture& pan )
+bool PanGestureProcessor::SetPanGestureProperties( const Dali::PanGesture& pan )
{
// If we are currently processing a pan gesture then just ignore
if ( mCurrentPanEmitters.empty() && mSceneObject )
{
+ const PanGesture& panImpl( GetImplementation(pan) );
+
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( pan );
+ mSceneObject->AddGesture( panImpl );
- if( Gesture::Started == pan.state || Gesture::Continuing == pan.state )
+ if( Dali::Gesture::Started == panImpl.GetState() || Dali::Gesture::Continuing == panImpl.GetState() )
{
mNeedsUpdate = true;
}
{
if ( actor && !gestureDetectors.empty() )
{
- PanGesture pan(state);
- pan.time = panEvent.time;
+ Internal::PanGesturePtr pan( new Internal::PanGesture(state ) );
+
+ pan->SetTime( panEvent.time );
- pan.numberOfTouches = panEvent.numberOfTouches;
- pan.screenPosition = panEvent.currentPosition;
- pan.position = localCurrent;
+ pan->SetNumberOfTouches( panEvent.numberOfTouches );
+ pan->SetScreenPosition( panEvent.currentPosition );
+ pan->SetPosition( localCurrent );
RenderTask& renderTaskImpl( *renderTask.Get() );
Vector2 localPrevious;
actor->ScreenToLocal( renderTaskImpl, localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y );
- pan.displacement = localCurrent - localPrevious;
+ pan->SetDisplacement( localCurrent - localPrevious );
Vector2 previousPos( panEvent.previousPosition );
- if ( state == Gesture::Started )
+ if ( state == Dali::Gesture::Started )
{
previousPos = mPossiblePanPosition;
}
- pan.screenDisplacement = panEvent.currentPosition - previousPos;
+ pan->SetScreenDisplacement( panEvent.currentPosition - previousPos );
// Avoid dividing by 0
if ( panEvent.timeDelta > 0 )
{
- pan.velocity.x = pan.displacement.x / static_cast<float>( panEvent.timeDelta );
- pan.velocity.y = pan.displacement.y / static_cast<float>( panEvent.timeDelta );
-
- pan.screenVelocity.x = pan.screenDisplacement.x / static_cast<float>( panEvent.timeDelta );
- pan.screenVelocity.y = pan.screenDisplacement.y / static_cast<float>( panEvent.timeDelta );
+ Vector2 velocity;
+ velocity.x = pan->GetDisplacement().x / static_cast<float>( panEvent.timeDelta );
+ velocity.y = pan->GetDisplacement().y / static_cast<float>( panEvent.timeDelta );
+ pan->SetVelocity( velocity );
+
+ Vector2 screenVelocity;
+ screenVelocity.x = pan->GetScreenDisplacement().x / static_cast<float>( panEvent.timeDelta );
+ screenVelocity.y = pan->GetScreenDisplacement().y / static_cast<float>( panEvent.timeDelta );
+ pan->SetScreenVelocity( screenVelocity );
}
// 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 == Gesture::Finished ) && ( pan.screenVelocity == Vector2::ZERO ) &&
+ if ( ( state == Dali::Gesture::Finished ) && ( pan->GetScreenVelocity() == Vector2::ZERO ) &&
( panEvent.timeDelta < MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY ) )
{
- pan.velocity = mLastVelocity;
- pan.screenVelocity = mLastScreenVelocity;
+ pan->SetVelocity( mLastVelocity );
+ pan->SetScreenVelocity( mLastScreenVelocity );
}
else
{
// Store the current velocity for future iterations.
- mLastVelocity = pan.velocity;
- mLastScreenVelocity = pan.screenVelocity;
+ mLastVelocity = pan->GetVelocity();
+ mLastScreenVelocity = pan->GetScreenVelocity();
}
if ( mSceneObject )
{
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( pan );
+ mSceneObject->AddGesture( *pan.Get() );
}
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< PanGestureDetector* >( *iter )->EmitPanGestureSignal( actorHandle, pan );
+ static_cast< PanGestureDetector* >( *iter )->EmitPanGestureSignal( actorHandle, Dali::PanGesture( pan.Get() ) );
}
}
}
#define DALI_INTERNAL_EVENT_PAN_GESTURE_EVENT_PROCESSOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
* @return true if Core::Update required
* @note If we are already processing a normal pan, then this call is ignored.
*/
- bool SetPanGestureProperties( const PanGesture& pan );
+ bool SetPanGestureProperties( const Dali::PanGesture& pan );
/**
* Called to provide pan-gesture profiling information.
} // unnamed namespace
PanGestureRecognizer::PanGestureRecognizer( Observer& observer, Vector2 screenSize, const PanGestureRequest& request, int32_t minimumDistance, int32_t minimumPanEvents )
-: GestureRecognizer( screenSize, Gesture::Pan ),
+: GestureRecognizer( screenSize, Dali::Gesture::Pan ),
mObserver( observer ),
mState( Clear ),
mThresholdAdjustmentsRemaining( 0 ),
{
// If our pan had started and we are interrupted, then tell Core that pan is cancelled.
mTouchEvents.push_back(event);
- SendPan(Gesture::Cancelled, event);
+ SendPan(Dali::Gesture::Cancelled, event);
}
mState = Clear; // We should change our state to Clear.
mTouchEvents.clear();
{
// 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(Gesture::Possible, event);
+ SendPan(Dali::Gesture::Possible, event);
}
mTouchEvents.push_back(event);
{
// 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(Gesture::Started, event);
+ SendPan(Dali::Gesture::Started, event);
}
}
else if (primaryPointState == PointState::UP)
Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation);
if (delta.LengthSquared() >= static_cast<float>( mMinimumDistanceSquared ) )
{
- SendPan(Gesture::Started, event);
+ SendPan(Dali::Gesture::Started, event);
mTouchEvents.push_back(event);
- SendPan(Gesture::Finished, event);
+ SendPan(Dali::Gesture::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(Gesture::Cancelled, event);
+ SendPan(Dali::Gesture::Cancelled, event);
}
mState = Clear;
mTouchEvents.clear();
else
{
// We do not satisfy pan conditions, tell Core our Gesture has been cancelled.
- SendPan(Gesture::Cancelled, event);
+ SendPan(Dali::Gesture::Cancelled, event);
if (pointCount == 1 && primaryPointState == PointState::UP)
{
{
case PointState::MOTION:
// Pan is continuing, tell Core.
- SendPan(Gesture::Continuing, event);
+ SendPan(Dali::Gesture::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(Gesture::Finished, event);
+ SendPan(Dali::Gesture::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(Gesture::Finished, event);
+ SendPan(Dali::Gesture::Finished, event);
mState = Finished;
break;
}
else
{
// We have gone outside of the pan requirements, inform Core that the gesture is finished.
- SendPan(Gesture::Finished, event);
+ SendPan(Dali::Gesture::Finished, event);
if (pointCount == 1 && primaryPointState == PointState::UP)
{
uint32_t previousTime( previousEvent.time );
// If we've just started then we want to remove the threshold from Core calculations.
- if ( state == Gesture::Started )
+ if ( state == Dali::Gesture::Started )
{
previousPosition = mPrimaryTouchDownLocation;
previousTime = mPrimaryTouchDownTime;
#define DALI_INTERNAL_EVENT_PAN_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
}
PinchGestureDetector::PinchGestureDetector()
-: GestureDetector(Gesture::Pinch)
+: GestureDetector(Dali::Gesture::Pinch)
{
}
{
}
-void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch)
+void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch)
{
// Guard against destruction during signal emission
Dali::PinchGestureDetector handle( this );
#define DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/events/pinch-gesture-detector.h>
+#include <dali/public-api/events/pinch-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct PinchGesture;
-
namespace Internal
{
* @param[in] actor The pinched actor.
* @param[in] pinch The pinch gesture.
*/
- void EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch);
+ void EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch);
public: // Signals
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
{
PinchGestureEvent::PinchGestureEvent(Gesture::State state)
-: GestureEvent(Gesture::Pinch, state),
+: GestureEvent(Dali::Gesture::Pinch, state),
scale(0.0f),
speed(0.0f),
centerPoint()
#define DALI_INTERNAL_EVENT_PINCH_GESTURE_EVENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
--- /dev/null
+#ifndef DALI_INTERNAL_PINCH_GESTURE_H
+#define DALI_INTERNAL_PINCH_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/pinch-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class PinchGesture;
+typedef IntrusivePtr< PinchGesture > PinchGesturePtr;
+
+/**
+ * @copydoc Dali::PinchGesture
+ */
+class PinchGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ PinchGesture( Gesture::State state )
+ : Gesture(Dali::Gesture::Pinch, state)
+ {
+ }
+
+ PinchGesture(const PinchGesture&) = delete; ///< Deleted copy constructor
+ PinchGesture(PinchGesture&&) = delete; ///< Deleted move constructor
+ PinchGesture& operator=(const PinchGesture&) = delete; ///< Deleted copy assignment operator
+ PinchGesture& operator=(PinchGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
+ * @param[in] scale The scale to set.
+ */
+ inline void SetScale( float scale )
+ {
+ mScale = scale;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetScale()
+ */
+ inline float GetScale() const
+ {
+ return mScale;
+ }
+
+ /**
+ * @brief The speed at which the user is moving their fingers.
+ * @param[in] speed The speed to set.
+ */
+ inline void SetSpeed( float speed )
+ {
+ mSpeed = speed;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetSpeed()
+ */
+ inline float GetSpeed() const
+ {
+ return mSpeed;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
+ * @param[in] screenCenterPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
+ {
+ mScreenCenterPoint = screenCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetScreenCenterPoint()
+ */
+ inline const Vector2& GetScreenCenterPoint() const
+ {
+ return mScreenCenterPoint;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
+ * @param[in] localCenterPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
+ {
+ mLocalCenterPoint = localCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetLocalCenterPoint()
+ */
+ inline const Vector2& GetLocalCenterPoint() const
+ {
+ return mLocalCenterPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~PinchGesture() = default;
+
+private:
+ Vector2 mScreenCenterPoint;
+ Vector2 mLocalCenterPoint;
+ float mScale{0.0f};
+ float mSpeed{0.0f};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::PinchGesture& GetImplementation( Dali::PinchGesture& pinchGesture )
+{
+ DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
+
+ BaseObject& object = pinchGesture.GetBaseObject();
+
+ return static_cast< Internal::PinchGesture& >( object );
+}
+
+inline const Internal::PinchGesture& GetImplementation( const Dali::PinchGesture& pinchGesture )
+{
+ DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
+
+ const BaseObject& object = pinchGesture.GetBaseObject();
+
+ return static_cast< const Internal::PinchGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_PINCH_GESTURE_H
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
namespace Dali
const PinchGestureEvent& pinchEvent,
Vector2 localCenter)
{
- PinchGesture pinch(pinchEvent.state);
- pinch.time = pinchEvent.time;
+ Internal::PinchGesturePtr pinch( new Internal::PinchGesture(pinchEvent.state ) );
+ pinch->SetTime( pinchEvent.time );
- pinch.scale = pinchEvent.scale;
- pinch.speed = pinchEvent.speed;
- pinch.screenCenterPoint = pinchEvent.centerPoint;
+ pinch->SetScale( pinchEvent.scale );
+ pinch->SetSpeed( pinchEvent.speed );
+ pinch->SetScreenCenterPoint( pinchEvent.centerPoint );
- pinch.localCenterPoint = localCenter;
+ pinch->SetLocalCenterPoint( localCenter );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< PinchGestureDetector* >( *iter )->EmitPinchGestureSignal( actorHandle, pinch );
+ static_cast< PinchGestureDetector* >( *iter )->EmitPinchGestureSignal( actorHandle, Dali::PinchGesture( pinch.Get() ) );
}
}
} // unnamed namespace
PinchGestureProcessor::PinchGestureProcessor()
-: GestureProcessor( Gesture::Pinch ),
+: GestureProcessor( Dali::Gesture::Pinch ),
mPinchGestureDetectors(),
mCurrentPinchEmitters(),
mCurrentPinchEvent(NULL),
{
switch ( pinchEvent.state )
{
- case Gesture::Started:
+ case Dali::Gesture::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 Gesture::Continuing:
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case Dali::Gesture::Continuing:
+ case Dali::Gesture::Finished:
+ case Dali::Gesture::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 == Gesture::Finished || pinchEvent.state == Gesture::Cancelled )
+ if ( pinchEvent.state == Dali::Gesture::Finished || pinchEvent.state == Dali::Gesture::Cancelled )
{
mCurrentPinchEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
+ case Dali::Gesture::Clear:
{
DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
break;
}
- case Gesture::Possible:
+ case Dali::Gesture::Possible:
{
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, Gesture::Pinch ),
+: GestureRecognizer( screenSize, Dali::Gesture::Pinch ),
mObserver( observer ),
mState( Clear ),
mTouchEvents(),
mStartingDistance = GetDistance(mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1]);
// Send pinch started
- SendPinch(Gesture::Started, event);
+ SendPinch(Dali::Gesture::Started, event);
mState = Started;
}
{
// System interruption occurred, pinch should be cancelled
mTouchEvents.clear();
- SendPinch(Gesture::Cancelled, event);
+ SendPinch(Dali::Gesture::Cancelled, event);
mState = Clear;
mTouchEvents.clear();
}
else if (pointCount != 2)
{
// Send pinch finished event
- SendPinch(Gesture::Finished, event);
+ SendPinch(Dali::Gesture::Finished, event);
mState = Clear;
mTouchEvents.clear();
{
mTouchEvents.push_back(event);
// Send pinch finished event
- SendPinch(Gesture::Finished, event);
+ SendPinch(Dali::Gesture::Finished, event);
mState = Clear;
mTouchEvents.clear();
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send pinch continuing
- SendPinch(Gesture::Continuing, event);
+ SendPinch(Dali::Gesture::Continuing, event);
mTouchEvents.clear();
}
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Gesture::Cancelled;
+ gesture.state = Dali::Gesture::Cancelled;
}
gesture.time = currentEvent.time;
#define DALI_INTERNAL_EVENT_PINCH_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
}
RotationGestureDetector::RotationGestureDetector()
-: GestureDetector( Gesture::Rotation )
+: GestureDetector( Dali::Gesture::Rotation )
{
}
-void RotationGestureDetector::EmitRotationGestureSignal( Dali::Actor actor, const RotationGesture& rotation )
+void RotationGestureDetector::EmitRotationGestureSignal( Dali::Actor actor, const Dali::RotationGesture& rotation )
{
// Guard against destruction during signal emission
Dali::RotationGestureDetector handle( this );
// INTERNAL INCLUDES
#include <dali/public-api/events/rotation-gesture-detector.h>
+#include <dali/public-api/events/rotation-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct RotationGesture;
-
namespace Internal
{
* @param[in] actor The rotated actor
* @param[in] rotation The rotation gesture
*/
- void EmitRotationGestureSignal( Dali::Actor actor, const RotationGesture& rotation );
+ void EmitRotationGestureSignal( Dali::Actor actor, const Dali::RotationGesture& rotation );
public: // Signals
* @param[in] state The state of the gesture
*/
RotationGestureEvent( Gesture::State state )
- : GestureEvent( Gesture::Rotation, state )
+ : GestureEvent( Dali::Gesture::Rotation, state )
{
}
--- /dev/null
+#ifndef DALI_INTERNAL_ROTATION_GESTURE_H
+#define DALI_INTERNAL_ROTATION_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/rotation-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class RotationGesture;
+typedef IntrusivePtr< RotationGesture > RotationGesturePtr;
+
+/**
+ * @copydoc Dali::RotationGesture
+ */
+class RotationGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ RotationGesture( Gesture::State state )
+ : Gesture( Dali::Gesture::Rotation, state )
+ {
+ }
+
+ RotationGesture(const RotationGesture&) = delete; ///< Deleted copy constructor
+ RotationGesture(RotationGesture&&) = delete; ///< Deleted move constructor
+ RotationGesture& operator=(const RotationGesture&) = delete; ///< Deleted copy assignment operator
+ RotationGesture& operator=(RotationGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture.
+ * @param[in] rotation The rotation to set.
+ */
+ inline void SetRotation( const Radian& rotation )
+ {
+ mRotation = rotation;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetRotation()
+ */
+ inline const Radian& GetRotation() const
+ {
+ return mRotation;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the rotation gesture in screen coordinates.
+ * @param[in] screenCenterPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
+ {
+ mScreenCenterPoint = screenCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetScreenCenterPoint()
+ */
+ inline const Vector2& GetScreenCenterPoint() const
+ {
+ return mScreenCenterPoint;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the rotation gesture in local actor coordinates.
+ * @param[in] localCenterPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
+ {
+ mLocalCenterPoint = localCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetLocalCenterPoint()
+ */
+ inline const Vector2& GetLocalCenterPoint() const
+ {
+ return mLocalCenterPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~RotationGesture() = default;
+
+private:
+ Radian mRotation;
+ Vector2 mScreenCenterPoint;
+ Vector2 mLocalCenterPoint;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::RotationGesture& GetImplementation( Dali::RotationGesture& rotationGesture )
+{
+ DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
+
+ BaseObject& object = rotationGesture.GetBaseObject();
+
+ return static_cast< Internal::RotationGesture& >( object );
+}
+
+inline const Internal::RotationGesture& GetImplementation( const Dali::RotationGesture& rotationGesture )
+{
+ DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
+
+ const BaseObject& object = rotationGesture.GetBaseObject();
+
+ return static_cast< const Internal::RotationGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ROTATION_GESTURE_H
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h>
#include <dali/internal/event/events/gesture-requests.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
namespace Dali
{
const RotationGestureEvent& rotationEvent,
Vector2 localCenter)
{
- RotationGesture rotation(rotationEvent.state);
- rotation.time = rotationEvent.time;
- rotation.rotation = rotationEvent.rotation;
- rotation.screenCenterPoint = rotationEvent.centerPoint;
- rotation.localCenterPoint = localCenter;
+ Internal::RotationGesturePtr rotation( new Internal::RotationGesture(rotationEvent.state ) );
+ rotation->SetTime( rotationEvent.time );
+ rotation->SetRotation( rotationEvent.rotation );
+ rotation->SetScreenCenterPoint( rotationEvent.centerPoint );
+ rotation->SetLocalCenterPoint( localCenter );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< RotationGestureDetector* >( *iter )->EmitRotationGestureSignal( actorHandle, rotation );
+ static_cast< RotationGestureDetector* >( *iter )->EmitRotationGestureSignal( actorHandle, Dali::RotationGesture( rotation.Get() ) );
}
}
} // unnamed namespace
RotationGestureProcessor::RotationGestureProcessor()
-: GestureProcessor( Gesture::Rotation ),
+: GestureProcessor( Dali::Gesture::Rotation ),
mRotationGestureDetectors(),
mCurrentRotationEmitters(),
mCurrentRotationEvent( nullptr ),
{
switch ( rotationEvent.state )
{
- case Gesture::Started:
+ case Dali::Gesture::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 Gesture::Continuing:
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case Dali::Gesture::Continuing:
+ case Dali::Gesture::Finished:
+ case Dali::Gesture::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 == Gesture::Finished || rotationEvent.state == Gesture::Cancelled )
+ if ( rotationEvent.state == Dali::Gesture::Finished || rotationEvent.state == Dali::Gesture::Cancelled )
{
mCurrentRotationEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
- case Gesture::Possible:
+ case Dali::Gesture::Clear:
+ case Dali::Gesture::Possible:
{
// Nothing to do
break;
} // unnamed namespace
RotationGestureRecognizer::RotationGestureRecognizer( Observer& observer, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart )
-: GestureRecognizer( Gesture::Rotation ),
+: GestureRecognizer( Dali::Gesture::Rotation ),
mObserver( observer ),
mState( Clear ),
mTouchEvents(),
mStartingAngle = GetAngle( mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1] );
// Send rotation started
- SendRotation( Gesture::Started, event );
+ SendRotation( Dali::Gesture::Started, event );
mState = Started;
}
{
// System interruption occurred, rotation should be cancelled
mTouchEvents.clear();
- SendRotation(Gesture::Cancelled, event);
+ SendRotation(Dali::Gesture::Cancelled, event);
mState = Clear;
mTouchEvents.clear();
}
else if( pointCount != 2 )
{
// Send rotation finished event
- SendRotation( Gesture::Finished, event );
+ SendRotation( Dali::Gesture::Finished, event );
mState = Clear;
mTouchEvents.clear();
{
mTouchEvents.push_back( event );
// Send rotation finished event
- SendRotation( Gesture::Finished, event );
+ SendRotation( Dali::Gesture::Finished, event );
mState = Clear;
mTouchEvents.clear();
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send rotation continuing
- SendRotation( Gesture::Continuing, event );
+ SendRotation( Dali::Gesture::Continuing, event );
mTouchEvents.clear();
}
void RotationGestureRecognizer::SendRotation( Gesture::State state, const Integration::TouchEvent& currentEvent )
{
RotationGestureEvent gesture( state );
-
if( !mTouchEvents.empty() )
{
// Assert if we have been holding TouchEvents that do not have 2 points
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Gesture::Cancelled;
+ gesture.state = Dali::Gesture::Cancelled;
}
gesture.time = currentEvent.time;
#define DALI_INTERNAL_EVENT_ROTATION_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
}
TapGestureDetector::TapGestureDetector()
-: GestureDetector( Gesture::Tap ),
+: GestureDetector( Dali::Gesture::Tap ),
mMinimumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mMaximumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
}
TapGestureDetector::TapGestureDetector( unsigned int tapsRequired )
-: GestureDetector( Gesture::Tap ),
+: GestureDetector( Dali::Gesture::Tap ),
mMinimumTapsRequired( tapsRequired ),
mMaximumTapsRequired( tapsRequired ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
return mTouchesRequired;
}
-void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const TapGesture& tap)
+void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const Dali::TapGesture& tap)
{
// Guard against destruction during signal emission
Dali::TapGestureDetector handle( this );
#define DALI_INTERNAL_TAP_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/events/tap-gesture-detector.h>
+#include <dali/public-api/events/tap-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct TapGesture;
-
namespace Internal
{
* @param[in] tappedActor The tapped actor.
* @param[in] tap The tap gesture.
*/
- void EmitTapGestureSignal(Dali::Actor tappedActor, const TapGesture& tap);
+ void EmitTapGestureSignal(Dali::Actor tappedActor, const Dali::TapGesture& tap);
public: // Signals
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
{
TapGestureEvent::TapGestureEvent( Gesture::State state )
-: GestureEvent(Gesture::Tap, state),
+: GestureEvent(Dali::Gesture::Tap, state),
numberOfTaps(1),
numberOfTouches(1)
{
#define DALI_INTERNAL_EVENT_TAP_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
--- /dev/null
+#ifndef DALI_INTERNAL_TAP_GESTURE_H
+#define DALI_INTERNAL_TAP_GESTURE_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/tap-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class TapGesture;
+typedef IntrusivePtr< TapGesture > TapGesturePtr;
+
+/**
+ * @copydoc Dali::TapGesture
+ */
+class TapGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ TapGesture( Gesture::State state )
+ : Gesture(Dali::Gesture::Tap, state)
+ {
+ }
+
+ TapGesture(const TapGesture&) = delete; ///< Deleted copy constructor
+ TapGesture(TapGesture&&) = delete; ///< Deleted move constructor
+ TapGesture& operator=(const TapGesture&) = delete; ///< Deleted copy assignment operator
+ TapGesture& operator=(TapGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The number of taps in this tap gesture.
+ * @param[in] numberOfTaps The number of taps to set.
+ */
+ inline void SetNumberOfTaps( uint32_t numberOfTaps )
+ {
+ mNumberOfTaps = numberOfTaps;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetNumberOfTaps()
+ */
+ inline uint32_t GetNumberOfTaps() const
+ {
+ return mNumberOfTaps;
+ }
+
+ /**
+ * @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the screen to generate the tap gesture.
+ * @param[in] numberOfTouches The number of touch points in this tap gesture to set.
+ */
+ inline void SetNumberOfTouches( uint32_t numberOfTouches )
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetPointCount()
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @brief This is the point, in screen coordinates, where the tap occurred.
+ * @param[in] screenPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenPoint( const Vector2& screenPoint )
+ {
+ mScreenPoint = screenPoint;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetDeviceId()
+ */
+ inline const Vector2& GetScreenPoint() const
+ {
+ return mScreenPoint;
+ }
+
+ /**
+ * @brief This is the point, in local actor coordinates, where the tap occurred.
+ * @param[in] localPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalPoint( const Vector2& localPoint )
+ {
+ mLocalPoint = localPoint;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetGetState()
+ */
+ inline const Vector2& GetLocalPoint() const
+ {
+ return mLocalPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TapGesture() = default;
+
+private:
+ Vector2 mScreenPoint;
+ Vector2 mLocalPoint;
+ uint32_t mNumberOfTaps{1u};
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::TapGesture& GetImplementation( Dali::TapGesture& tapGesture )
+{
+ DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
+
+ BaseObject& object = tapGesture.GetBaseObject();
+
+ return static_cast< Internal::TapGesture& >( object );
+}
+
+inline const Internal::TapGesture& GetImplementation( const Dali::TapGesture& tapGesture )
+{
+ DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
+
+ const BaseObject& object = tapGesture.GetBaseObject();
+
+ return static_cast< const Internal::TapGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TAP_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
const TapGestureEvent& tapEvent,
Vector2 localPoint)
{
- TapGesture tap;
- tap.time = tapEvent.time;
- tap.numberOfTaps = tapEvent.numberOfTaps;
- tap.numberOfTouches = tapEvent.numberOfTouches;
- tap.screenPoint = tapEvent.point;
- tap.localPoint = localPoint;
+ Internal::TapGesturePtr tap( new Internal::TapGesture(tapEvent.state) );
+ tap->SetTime( tapEvent.time );
+ tap->SetNumberOfTaps(tapEvent.numberOfTaps);
+ tap->SetNumberOfTouches(tapEvent.numberOfTouches);
+ tap->SetScreenPoint(tapEvent.point);
+ tap->SetLocalPoint(localPoint);
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< TapGestureDetector* >( *iter )->EmitTapGestureSignal( actorHandle, tap );
+ static_cast< TapGestureDetector* >( *iter )->EmitTapGestureSignal( actorHandle, Dali::TapGesture( tap.Get() ) );
}
}
} // unnamed namespace
TapGestureProcessor::TapGestureProcessor()
-: GestureProcessor( Gesture::Tap ),
+: GestureProcessor( Dali::Gesture::Tap ),
mTapGestureDetectors(),
mMinTapsRequired( 1 ),
mMaxTapsRequired( 1 ),
{
switch ( tapEvent.state )
{
- case Gesture::Possible:
+ case Dali::Gesture::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 Gesture::Started:
+ case Dali::Gesture::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 Gesture::Cancelled:
+ case Dali::Gesture::Cancelled:
{
mPossibleProcessed = false;
ResetActor();
break;
}
- case Gesture::Continuing:
+ case Dali::Gesture::Continuing:
{
DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" );
break;
}
- case Gesture::Finished:
+ case Dali::Gesture::Finished:
{
DALI_ABORT( "Incorrect state received from Integration layer: Finished\n" );
break;
}
- case Gesture::Clear:
+ case Dali::Gesture::Clear:
{
DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
break;
} // unnamed namespace
TapGestureRecognizer::TapGestureRecognizer( Observer& observer, Vector2 screenSize, const TapGestureRequest& request)
-: GestureRecognizer( screenSize, Gesture::Tap ),
+: GestureRecognizer( screenSize, Dali::Gesture::Tap ),
mObserver(observer),
mState(Clear),
mMinimumTapsRequired(request.minTaps),
else
{
++mTapsRegistered;
- EmitGesture( Gesture::Started, event.time );
+ EmitGesture( Dali::Gesture::Started, event.time );
mState = Clear;
}
}
mState = Failed;
// We have entered a multi-touch event so emit registered gestures if required.
- EmitGesture(Gesture::Started, event.time);
+ EmitGesture(Dali::Gesture::Started, event.time);
}
}
void TapGestureRecognizer::EmitPossibleState( const Integration::TouchEvent& event )
{
- TapGestureEvent tapEvent( Gesture::Possible );
+ TapGestureEvent tapEvent( Dali::Gesture::Possible );
tapEvent.point = mTouchPosition;
tapEvent.time = event.time;
void TapGestureRecognizer::EmitGesture( Gesture::State state, uint32_t time )
{
- if ( (state == Gesture::Cancelled) ||
+ if ( (state == Dali::Gesture::Cancelled) ||
(mTapsRegistered >= mMinimumTapsRequired && mTapsRegistered <= mMaximumTapsRequired) )
{
void TapGestureRecognizer::EmitSingleTap( uint32_t time, const Integration::Point& point )
{
- TapGestureEvent event( Gesture::Started );
+ TapGestureEvent event( Dali::Gesture::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 = Gesture::Cancelled;
+ event.state = Dali::Gesture::Cancelled;
}
mTapsRegistered = 1u;
EmitTap( time, event );
#define DALI_INTERNAL_EVENT_EVENTS_TAP_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * 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.
delete mProfiling;
}
-void PanGesture::AddGesture( const Dali::PanGesture& gesture )
+void PanGesture::AddGesture( const Internal::PanGesture& gesture )
{
Dali::Mutex::ScopedLock lock( mMutex );
mGestures[ mWritePosition ] = gesture;
// add event to history
mPanHistory.push_back( currentGesture );
- if( currentGesture.state == Gesture::Started )
+ if( currentGesture.state == Dali::Gesture::Started )
{
info.justStarted = true;
// clear just finished as we have started new pan
info.justFinished = false;
}
- info.justFinished |= ( currentGesture.state == Gesture::Finished || currentGesture.state == Gesture::Cancelled );
+ info.justFinished |= ( currentGesture.state == Dali::Gesture::Finished || currentGesture.state == Dali::Gesture::Cancelled );
// Update our read position.
previousReadPosition = mReadPosition;
info.frameGesture.screen.velocity += lastReadGesture.screen.velocity;
info.frameGesture.local.velocity += lastReadGesture.local.velocity;
- if( lastReadGesture.state == Gesture::Started )
+ if( lastReadGesture.state == Dali::Gesture::Started )
{
// Clear just finished as we have started new pan.
info.justFinished = false;
}
else
{
- info.justFinished |= ( lastReadGesture.state == Gesture::Finished || lastReadGesture.state == Gesture::Cancelled );
+ info.justFinished |= ( lastReadGesture.state == Dali::Gesture::Finished || lastReadGesture.state == Dali::Gesture::Cancelled );
}
// Add event to history
readGesture.screen.displacement, readGesture.screen.velocity, readGesture.state ) );
}
- if( readGesture.state == Gesture::Started )
+ if( readGesture.state == Dali::Gesture::Started )
{
// Clear pan data.
mPanHistory.clear();
}
else
{
- justFinished |= ( readGesture.state == Gesture::Finished || readGesture.state == Gesture::Cancelled );
+ justFinished |= ( readGesture.state == Dali::Gesture::Finished || readGesture.state == Dali::Gesture::Cancelled );
}
rateConvertedGesture.screen.position += readGesture.screen.position;
#define DALI_INTERNAL_SCENE_GRAPH_PAN_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/devel-api/threading/mutex.h>
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/internal/update/common/property-owner.h>
#include <dali/internal/update/gestures/gesture-properties.h>
namespace Dali
{
-struct PanGesture;
+class PanGesture;
namespace Internal
{
*/
PanInfo()
: time( 0u ),
- state( Gesture::Clear ),
+ state( Dali::Gesture::Clear ),
read( true )
{
}
* Assignment operator
* @param[in] gesture A Dali::Gesture
*/
- PanInfo& operator=( const Dali::PanGesture& rhs )
+ PanInfo& operator=( const Internal::PanGesture& rhs )
{
- time = rhs.time;
- state = rhs.state;
+ time = rhs.GetTime();
+ state = rhs.GetState();
- local.velocity = rhs.velocity;
- local.displacement = rhs.displacement;
- local.position = rhs.position;
+ local.velocity = rhs.GetVelocity();
+ local.displacement = rhs.GetDisplacement();
+ local.position = rhs.GetPosition();
- screen.velocity = rhs.screenVelocity;
- screen.displacement = rhs.screenDisplacement;
- screen.position = rhs.screenPosition;
+ screen.velocity = rhs.GetScreenVelocity();
+ screen.displacement = rhs.GetScreenDisplacement();
+ screen.position = rhs.GetScreenPosition();
return *this;
}
* Adds a PanGesture to the internal circular-buffer waiting to be handled by UpdateProperties.
* @param[in] gesture The latest pan gesture.
*/
- void AddGesture( const Dali::PanGesture& gesture );
+ void AddGesture( const Internal::PanGesture& gesture );
/**
* @brief Removes pan events from the history that are older than maxAge, leaving at least minEvents
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// CLASS HEADER
#include <dali/public-api/events/gesture.h>
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/gesture-impl.h>
+
namespace Dali
{
-Gesture::Gesture( const Gesture& rhs )
-: type(rhs.type),
- state(rhs.state),
- time(rhs.time)
+Gesture::Gesture()
{
}
-Gesture& Gesture::operator=( const Gesture& rhs )
+Gesture::Gesture(Internal::Gesture* internal)
+: BaseHandle(internal)
{
- if( this != &rhs )
- {
- type = rhs.type;
- state = rhs.state;
- time = rhs.time;
- }
-
- return *this;
}
+Gesture::Gesture( const Gesture& rhs ) = default;
+
+Gesture::Gesture( Gesture&& rhs ) = default;
+
+Gesture& Gesture::operator=( const Gesture& rhs ) = default;
+
+Gesture& Gesture::operator=( Gesture&& rhs ) = default;
+
Gesture::~Gesture()
{
}
-Gesture::Gesture(Type gestureType, State gestureState)
-: type(gestureType),
- state(gestureState),
- time(0)
+Gesture::Type Gesture::GetType() const
+{
+ return GetImplementation(*this).GetType();
+}
+
+Gesture::State Gesture::GetState() const
+{
+ return GetImplementation(*this).GetState();
+}
+
+uint32_t Gesture::GetTime() const
{
+ return GetImplementation(*this).GetTime();
}
} // namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
* @{
*/
+namespace Internal DALI_INTERNAL
+{
+class Gesture;
+}
+
/**
* @brief Base structure for different gestures that an application can receive.
*
* To receive a particular gesture, the application has to create and connect to the appropriate
* GestureDetector.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @note An instance of this class cannot be created.
* @see GestureDetector
*
*/
-struct DALI_CORE_API Gesture
+class DALI_CORE_API Gesture : public BaseHandle
{
+public:
+
+ /**
+ * @brief Creates an uninitialized Gesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
+ */
+ Gesture();
+
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
Gesture( const Gesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ */
+ Gesture( Gesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
Gesture& operator=( const Gesture& rhs );
- // Destruction
+ /**
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ * @return A reference to this
+ */
+ Gesture& operator=( Gesture&& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
*/
- virtual ~Gesture();
+ ~Gesture();
/**
* @brief Enumeration for type of gesture.
Possible ///< A gesture is possible. @SINCE_1_0.0
};
- // Data
-
/**
* @brief The gesture type.
+ * @SINCE_1_9.28
+ * @return The gesture type
*/
- Type type;
+ Type GetType() const;
/**
* @brief The gesture state.
*
* Please see the description in the sub-classes to see the states
* used by the actual gesture.
+ * @SINCE_1_9.28
+ * @return The state of the gesture
*/
- State state;
+ State GetState() const;
/**
* @brief The time the gesture took place.
+ * @SINCE_1_9.28
+ * @return The time the gesture took place
*/
- uint32_t time;
+ uint32_t GetTime() const;
-protected: // Creation
+public: // Not intended for application developers
+ /// @cond internal
/**
- * @brief This constructor is only used by derived classes.
- *
- * @SINCE_1_0.0
- * @param[in] gestureType The type of gesture event.
- * @param[in] gestureState The state of the gesture event.
+ * @brief Internal constructor.
+ * @SINCE_1_9.28
+ * @param[in] gesture Pointer to internal gesture
*/
- Gesture(Type gestureType, State gestureState);
-
+ explicit DALI_INTERNAL Gesture(Internal::Gesture* gesture);
+ /// @endcond
};
/**
#define DALI_LONG_PRESS_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
class LongPressGestureDetector;
}
-struct LongPressGesture;
+class LongPressGesture;
/**
* @brief This class emits a signals when a long press gesture occurs that meets the requirements set by the application.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// CLASS HEADER
#include <dali/public-api/events/long-press-gesture.h>
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
+
namespace Dali
{
-LongPressGesture::LongPressGesture(Gesture::State state)
-: Gesture( Gesture::LongPress, state ),
- numberOfTouches( 1 )
+LongPressGesture::LongPressGesture( Internal::LongPressGesture* internal )
+: Gesture( internal )
{
}
-LongPressGesture::LongPressGesture( const LongPressGesture& rhs )
-: Gesture( rhs ),
- numberOfTouches( rhs.numberOfTouches ),
- screenPoint( rhs.screenPoint ),
- localPoint( rhs.localPoint )
+LongPressGesture::LongPressGesture() = default;
+
+LongPressGesture::LongPressGesture( const LongPressGesture& rhs ) = default;
+
+LongPressGesture::LongPressGesture( LongPressGesture&& rhs ) = default;
+
+LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs ) = default;
+
+LongPressGesture& LongPressGesture::operator=( LongPressGesture&& rhs ) = default;
+
+LongPressGesture::~LongPressGesture() = default;
+
+uint32_t LongPressGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
-LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs )
+const Vector2& LongPressGesture::GetScreenPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- numberOfTouches = rhs.numberOfTouches;
- screenPoint = rhs.screenPoint;
- localPoint = rhs.localPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPoint();
}
-LongPressGesture::~LongPressGesture()
+const Vector2& LongPressGesture::GetLocalPoint() const
{
+ return GetImplementation( *this ).GetLocalPoint();
}
} // namespace Dali
#define DALI_LONG_PRESS_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class LongPressGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
*
* Long press gesture finishes when all touches have been released.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @see LongPressGestureDetector
*/
-struct DALI_CORE_API LongPressGesture : public Gesture
+class DALI_CORE_API LongPressGesture : public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Constructor.
+ * @brief Creates an uninitialized LongPressGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- LongPressGesture(Gesture::State state);
+ LongPressGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
LongPressGesture( const LongPressGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ */
+ LongPressGesture( LongPressGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
LongPressGesture& operator=( const LongPressGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~LongPressGesture();
+ LongPressGesture& operator=( LongPressGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~LongPressGesture();
/**
- * @brief The number of touch points in this long press gesture, i.e. the number of fingers the user had
- * on the screen to generate the long press gesture.
+ * @brief The number of touch points in this long press gesture.
+ *
+ * In other words, the number of fingers the user had on the screen to generate the long press gesture.
+ * @SINCE_1_9.28
+ * @return The number of touch points
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
/**
* @brief This is the point, in screen coordinates, where the long press occurred.
*
* If a multi-touch long press, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
+ * @return The point where the long press occurred (in screen coordinates)
*/
- Vector2 screenPoint;
+ const Vector2& GetScreenPoint() const;
/**
* @brief This is the point, in local actor coordinates, where the long press occurred.
*
* If a multi-touch long press, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
* @return The point where tap has occurred (in local actor coordinates)
*/
- Vector2 localPoint;
+ const Vector2& GetLocalPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized LongPressGesture handle.
+ *
+ * @param[in] longPressGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL LongPressGesture( Internal::LongPressGesture* longPressGesture );
+ /// @endcond
+
};
/**
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
return GetImplementation(*this).DetectedSignal();
}
-void PanGestureDetector::SetPanGestureProperties( const PanGesture& pan )
+void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan )
{
Internal::PanGestureDetector::SetPanGestureProperties( pan );
}
#define DALI_PAN_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/events/gesture-detector.h>
+#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/object/property-index-ranges.h>
#include <dali/public-api/signals/dali-signal.h>
class PanGestureDetector;
}
-struct PanGesture;
-
/**
* @addtogroup dali_core_events
* @{
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
namespace Dali
{
-PanGesture::PanGesture()
-: Gesture(Gesture::Pan, Gesture::Clear),
- numberOfTouches(1)
+PanGesture::PanGesture( Internal::PanGesture* internal )
+: Gesture( internal )
{
}
-PanGesture::PanGesture(Gesture::State state)
-: Gesture(Gesture::Pan, state),
- numberOfTouches(1)
+PanGesture::PanGesture() = default;
+
+PanGesture::PanGesture( const PanGesture& rhs ) = default;
+
+PanGesture::PanGesture( PanGesture&& rhs ) = default;
+
+PanGesture& PanGesture::operator=( const PanGesture& rhs ) = default;
+
+PanGesture& PanGesture::operator=( PanGesture&& rhs ) = default;
+
+PanGesture::~PanGesture() = default;
+
+const Vector2& PanGesture::GetVelocity() const
+{
+ return GetImplementation( *this ).GetVelocity();
+}
+
+const Vector2& PanGesture::GetDisplacement() const
+{
+ return GetImplementation( *this ).GetDisplacement();
+}
+
+const Vector2& PanGesture::GetPosition() const
+{
+ return GetImplementation( *this ).GetPosition();
+}
+
+const Vector2& PanGesture::GetScreenVelocity() const
{
+ return GetImplementation( *this ).GetScreenVelocity();
}
-PanGesture::PanGesture( const PanGesture& rhs )
-: Gesture( rhs ),
- velocity( rhs.velocity ),
- displacement( rhs.displacement ),
- position( rhs.position ),
- screenVelocity( rhs.screenVelocity ),
- screenDisplacement( rhs.screenDisplacement ),
- screenPosition( rhs.screenPosition ),
- numberOfTouches( rhs.numberOfTouches )
+const Vector2& PanGesture::GetScreenDisplacement() const
{
+ return GetImplementation( *this ).GetScreenDisplacement();
}
-PanGesture& PanGesture::operator=( const PanGesture& rhs )
+const Vector2& PanGesture::GetScreenPosition() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- velocity = rhs.velocity;
- displacement = rhs.displacement;
- position = rhs.position;
- screenVelocity = rhs.screenVelocity;
- screenDisplacement = rhs.screenDisplacement;
- screenPosition = rhs.screenPosition;
- numberOfTouches = rhs.numberOfTouches;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPosition();
}
-PanGesture::~PanGesture()
+uint32_t PanGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
float PanGesture::GetSpeed() const
{
- return velocity.Length();
+ return GetImplementation( *this ).GetSpeed();
}
float PanGesture::GetDistance() const
{
- return displacement.Length();
+ return GetImplementation( *this ).GetDistance();
}
float PanGesture::GetScreenSpeed() const
{
- return screenVelocity.Length();
+ return GetImplementation( *this ).GetScreenSpeed();
}
float PanGesture::GetScreenDistance() const
{
- return screenDisplacement.Length();
+ return GetImplementation( *this ).GetScreenDistance();
}
} // namespace Dali
#define DALI_PAN_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class PanGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
* - Cancelled by the system.
*
* A pan gesture will continue to be sent to the actor under than initial pan until it ends.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API PanGesture: public Gesture
+class DALI_CORE_API PanGesture: public Gesture
{
- // Construction & Destruction
-
- /**
- * @brief Default Constructor.
- * @SINCE_1_0.0
- */
- PanGesture();
+public:
/**
- * @brief Constructor.
+ * @brief Creates an uninitialized PanGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- PanGesture(Gesture::State state);
+ PanGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
PanGesture( const PanGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ PanGesture( PanGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
PanGesture& operator=( const PanGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~PanGesture();
+ PanGesture& operator=( PanGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~PanGesture();
/**
* @brief The velocity at which the user is moving their fingers.
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y values means upwards.
* This value represents the local coordinates of the actor attached to the PanGestureDetector.
+ * @SINCE_1_9.28
+ * @return The velocity of the pan
*/
- Vector2 velocity;
+ const Vector2& GetVelocity() const;
/**
* @brief This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
* A positive y value shows that the user is panning downwards, a negative y value means upwards.
* This value is in local actor coordinates, the actor being the one attached to the
* PanGestureDetector.
+ * @SINCE_1_9.28
+ * @return The displacement of the pan
*/
- Vector2 displacement;
+ const Vector2& GetDisplacement() const;
/**
* @brief This current touch position of the primary touch point in local actor coordinates.
+ * @SINCE_1_9.28
+ * @return The current position of the pan (in local actor coordinates)
*/
- Vector2 position;
+ const Vector2& GetPosition() const;
/**
* @brief The velocity at which the user is moving their fingers.
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y values means upwards.
* This value represents the screen coordinates.
+ * @SINCE_1_9.28
+ * @return The velocity of the pan (in screen coordinates)
*/
- Vector2 screenVelocity;
+ const Vector2& GetScreenVelocity() const;
/**
* @brief This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y value means upwards.
* This value is in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The displacement of the pan (in screen coordinates)
*/
- Vector2 screenDisplacement;
+ const Vector2& GetScreenDisplacement() const;
/**
* @brief This current touch position of the primary touch point in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The current position of the pan (in screen coordinates)
*/
- Vector2 screenPosition;
+ const Vector2& GetScreenPosition() const;
/**
* @brief The total number of fingers touching the screen in a pan gesture.
+ * @SINCE_1_9.28
+ * @return The number of touches in the pan
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
// Convenience Methods
* @brief Returns the speed at which the user is moving their fingers.
*
* This is the pixel movement per millisecond.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The speed of the pan (in pixels per millisecond)
*/
float GetSpeed() const;
* if the gesture has just started, then the distance moved since the user touched the screen.
*
* This is always a positive value.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The distance, as a float, a user's finger has panned
*/
float GetDistance() const;
* @brief Returns the speed at which the user is moving their fingers relative to screen coordinates.
*
* This is the pixel movement per millisecond.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The speed of the pan (in pixels per millisecond)
*/
float GetScreenSpeed() const;
* since the user touched the screen.
*
* This is always a positive value.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The distance, as a float, a user's finger has panned
*/
float GetScreenDistance() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized PanGesture handle.
+ *
+ * @param[in] panGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL PanGesture( Internal::PanGesture* panGesture );
+ /// @endcond
+
};
/**
#define DALI_PINCH_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
class PinchGestureDetector;
}
-struct PinchGesture;
+class PinchGesture;
/**
* @brief This class looks for pinching gestures involving two touches.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
namespace Dali
{
-PinchGesture::PinchGesture(Gesture::State state)
-: Gesture(Gesture::Pinch, state),
- scale(0.0f),
- speed(0.0f)
+PinchGesture::PinchGesture( Internal::PinchGesture* internal )
+: Gesture( internal )
{
}
-PinchGesture::PinchGesture( const PinchGesture& rhs )
-: Gesture( rhs ),
- scale( rhs.scale ),
- speed( rhs.speed ),
- screenCenterPoint( rhs.screenCenterPoint ),
- localCenterPoint( rhs.localCenterPoint )
+PinchGesture::PinchGesture() = default;
+
+PinchGesture::PinchGesture( const PinchGesture& rhs ) = default;
+
+PinchGesture::PinchGesture( PinchGesture&& rhs ) = default;
+
+PinchGesture& PinchGesture::operator=( const PinchGesture& rhs ) = default;
+
+PinchGesture& PinchGesture::operator=( PinchGesture&& rhs ) = default;
+
+PinchGesture::~PinchGesture() = default;
+
+float PinchGesture::GetScale() const
+{
+ return GetImplementation( *this ).GetScale();
+}
+
+float PinchGesture::GetSpeed() const
{
+ return GetImplementation( *this ).GetSpeed();
}
-PinchGesture& PinchGesture::operator=( const PinchGesture& rhs )
+const Vector2& PinchGesture::GetScreenCenterPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- scale = rhs.scale;
- speed = rhs.speed;
- screenCenterPoint = rhs.screenCenterPoint;
- localCenterPoint = rhs.localCenterPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenCenterPoint();
}
-PinchGesture::~PinchGesture()
+const Vector2& PinchGesture::GetLocalCenterPoint() const
{
+ return GetImplementation( *this ).GetLocalCenterPoint();
}
} // namespace Dali
#define DALI_PINCH_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class PinchGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
*
* A pinch gesture will continue to be sent to the actor under the center point of the pinch
* until the pinch ends.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API PinchGesture: public Gesture
+class DALI_CORE_API PinchGesture: public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
+ * @brief Creates an uninitialized PinchGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- PinchGesture(Gesture::State state);
+ PinchGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
PinchGesture( const PinchGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ PinchGesture( PinchGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
PinchGesture& operator=( const PinchGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~PinchGesture();
+ PinchGesture& operator=( PinchGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~PinchGesture();
/**
* @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
*
- * If the user is moving their fingers away from each other, then
- * this value increases. Conversely, if the user is moving their
- * fingers towards each other, this value will decrease.
+ * If the user is moving their fingers away from each other, then this value increases.
+ * Conversely, if the user is moving their fingers towards each other, this value will
+ * decrease.
+ * @SINCE_1_9.28
+ * @return The scale of the pinch (from the pinch start)
*/
- float scale;
+ float GetScale() const;
/**
* @brief The speed at which the user is moving their fingers.
*
* This is the pixel movement per second.
+ * @SINCE_1_9.28
+ * @return The speed of the pinch (pixels per second)
*/
- float speed;
+ float GetSpeed() const;
/**
* @brief The center point of the two points that caused the pinch gesture in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The current center point of the pinch (in screen coordinates)
*/
- Vector2 screenCenterPoint;
+ const Vector2& GetScreenCenterPoint() const;
/**
* @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
+ * @SINCE_1_9.28
+ * @return The current center point of the pinch (in local actor coordinates)
+ */
+ const Vector2& GetLocalCenterPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized PinchGesture handle.
+ *
+ * @param[in] PinchGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
*/
- Vector2 localCenterPoint;
+ explicit DALI_INTERNAL PinchGesture( Internal::PinchGesture* pinchGesture );
+ /// @endcond
+
};
/**
class RotationGestureDetector;
}
-struct RotationGesture;
+class RotationGesture;
/**
* @brief This class looks for a rotation gesture involving two touches.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
namespace Dali
{
-RotationGesture::RotationGesture( Gesture::State state )
-: Gesture( Gesture::Rotation, state )
+RotationGesture::RotationGesture( Internal::RotationGesture* internal )
+: Gesture( internal )
{
}
-RotationGesture::RotationGesture( const RotationGesture& rhs )
-: Gesture( rhs ),
- rotation( rhs.rotation ),
- screenCenterPoint( rhs.screenCenterPoint ),
- localCenterPoint( rhs.localCenterPoint )
+RotationGesture::RotationGesture() = default;
+
+RotationGesture::RotationGesture( const RotationGesture& rhs ) = default;
+
+RotationGesture::RotationGesture( RotationGesture&& rhs ) = default;
+
+RotationGesture& RotationGesture::operator=( const RotationGesture& rhs ) = default;
+
+RotationGesture& RotationGesture::operator=( RotationGesture&& rhs ) = default;
+
+RotationGesture::~RotationGesture() = default;
+
+const Radian& RotationGesture::GetRotation() const
{
+ return GetImplementation( *this ).GetRotation();
}
-RotationGesture& RotationGesture::operator=( const RotationGesture& rhs )
+const Vector2& RotationGesture::GetScreenCenterPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=( rhs );
- rotation = rhs.rotation;
- screenCenterPoint = rhs.screenCenterPoint;
- localCenterPoint = rhs.localCenterPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenCenterPoint();
}
-RotationGesture::~RotationGesture()
+const Vector2& RotationGesture::GetLocalCenterPoint() const
{
+ return GetImplementation( *this ).GetLocalCenterPoint();
}
} // namespace Dali
namespace Dali
{
+namespace Internal DALI_INTERNAL
+{
+class RotationGesture;
+}
+
/**
* @brief A RotationGesture is emitted when the user moves two fingers that are opposite each other
* in a rotational/circular gesture.
*
* A rotation gesture will continue to be sent to the actor under the center point of the rotation
* until the rotation ends.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API RotationGesture: public Gesture
+class DALI_CORE_API RotationGesture: public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
- * @SINCE_1_9.27
- * @param[in] state The state of the gesture
+ * @brief Creates an uninitialized RotationGesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- RotationGesture( Gesture::State state );
+ RotationGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
RotationGesture( const RotationGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ RotationGesture( RotationGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
RotationGesture& operator=( const RotationGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_9.27
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~RotationGesture();
+ RotationGesture& operator=( RotationGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~RotationGesture();
/**
* @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The rotation from the start of the rotation gesture till the latest rotation gesture.
*/
- Radian rotation;
+ const Radian& GetRotation() const;
/**
* @brief The center point of the two points that caused the rotation gesture in screen coordinates.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The center point in screen coordinates
*/
- Vector2 screenCenterPoint;
+ const Vector2& GetScreenCenterPoint() const;
/**
* @brief The center point of the two points that caused the rotation gesture in local actor coordinates.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The center point in local actor coordinates
+ */
+ const Vector2& GetLocalCenterPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized RotationGesture handle.
+ *
+ * @param[in] rotationGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
*/
- Vector2 localCenterPoint;
+ explicit DALI_INTERNAL RotationGesture( Internal::RotationGesture* rotationGesture );
+ /// @endcond
};
} // namespace Dali
#define DALI_TAP_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
class TapGestureDetector;
}
-struct TapGesture;
+class TapGesture;
/**
* @brief This class emits a signal when a tap gesture occurs that meets the requirements set by the
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// CLASS HEADER
#include <dali/public-api/events/tap-gesture.h>
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
+
namespace Dali
{
-TapGesture::TapGesture()
-: Gesture(Gesture::Tap, Gesture::Clear),
- numberOfTaps(1),
- numberOfTouches(1)
+TapGesture::TapGesture( Internal::TapGesture* internal )
+: Gesture( internal )
+{
+}
+
+TapGesture::TapGesture() = default;
+
+TapGesture::TapGesture( const TapGesture& rhs ) = default;
+
+TapGesture::TapGesture( TapGesture&& rhs ) = default;
+
+TapGesture& TapGesture::operator=( const TapGesture& rhs ) = default;
+
+TapGesture& TapGesture::operator=( TapGesture&& rhs ) = default;
+
+TapGesture::~TapGesture() = default;
+
+uint32_t TapGesture::GetNumberOfTaps() const
{
+ return GetImplementation( *this ).GetNumberOfTaps();
}
-TapGesture::TapGesture( const TapGesture& rhs )
-: Gesture( rhs ),
- numberOfTaps( rhs.numberOfTaps ),
- numberOfTouches( rhs.numberOfTouches ),
- screenPoint( rhs.screenPoint ),
- localPoint( rhs.localPoint )
+uint32_t TapGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
-TapGesture& TapGesture::operator=( const TapGesture& rhs )
+const Vector2& TapGesture::GetScreenPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- numberOfTaps = rhs.numberOfTaps;
- numberOfTouches = rhs.numberOfTouches;
- screenPoint = rhs.screenPoint;
- localPoint = rhs.localPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPoint();
}
-TapGesture::~TapGesture()
+const Vector2& TapGesture::GetLocalPoint() const
{
+ return GetImplementation( *this ).GetLocalPoint();
}
} // namespace Dali
#define DALI_TAP_GESTURE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class TapGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
* @brief A TapGesture is emitted when the user taps the screen with the stated number of fingers a stated number of times.
*
* This is a discrete gesture so does not have any state information.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @see TapGestureDetector
*/
-struct DALI_CORE_API TapGesture : public Gesture
+class DALI_CORE_API TapGesture : public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
- * @SINCE_1_0.0
+ * @brief Creates an uninitialized TapGesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
TapGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param rhs A reference to the copied handle
*/
TapGesture( const TapGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param rhs The handle to move.
+ */
+ TapGesture( TapGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param rhs A reference to the copied handle
* @return A reference to this
*/
TapGesture& operator=( const TapGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param rhs The handle to move.
*/
- virtual ~TapGesture();
+ TapGesture& operator=( TapGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~TapGesture();
/**
* @brief The number of taps in this tap gesture.
+ * @SINCE_1_9.28
+ * @return The number of taps
*/
- uint32_t numberOfTaps;
+ uint32_t GetNumberOfTaps() const;
/**
* @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the
* screen to generate the tap gesture.
+ * @SINCE_1_9.28
+ * @return The number of touchs
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
/**
* @brief This is the point, in screen coordinates, where the tap occurred.
*
* If a multi-touch tap, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
+ * @return The point where tap has occurred( in screen coordinates)
*/
- Vector2 screenPoint;
+ const Vector2& GetScreenPoint() const;
/**
* @brief This is the point, in local actor coordinates, where the tap occurred.
*
* If a multi-touch tap, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
* @return The point where tap has occurred (in local actor coordinates)
*/
- Vector2 localPoint;
+ const Vector2& GetLocalPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized TapGesture handle.
+ *
+ * @param[in] tapGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL TapGesture( Internal::TapGesture* tapGesture );
+ /// @endcond
};
/**