/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/tap-gesture-event.h>
-#include <dali/integration-api/system-overlay.h>
#include <dali-test-suite-utils.h>
-#include <test-touch-utils.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+#include <test-touch-event-utils.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false)
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ 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();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
TapGesture receivedGesture;
- Actor tappedActor;
+ Actor tappedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const TapGesture& tap)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = tap;
- signalData.tappedActor = actor;
+ signalData.tappedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data ) : GestureReceivedFunctor( data ) { }
+ UnstageActorFunctor(SignalData& data, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ scene(scene)
+ {
+ }
void operator()(Actor actor, const TapGesture& tap)
{
- GestureReceivedFunctor::operator()( actor, tap );
- Stage::GetCurrent().Remove( actor );
+ GestureReceivedFunctor::operator()(actor, tap);
+ scene.Remove(actor);
}
+
+ Integration::Scene scene;
};
// Functor for receiving a touch event
{
//For line coverage
unsigned int points = touch.GetPointCount();
- if( points > 0)
+ if(points > 0)
{
- const TouchPoint& touchPoint = touch.GetPoint(0);
- tet_printf("Touch Point state = %d\n", touchPoint.state);
+ tet_printf("Touch Point state = %d\n", touch.GetState(0));
}
return false;
}
};
-// Generate a TapGestureEvent to send to Core
-Integration::TapGestureEvent GenerateTap(
- Gesture::State state,
- unsigned int numberOfTaps,
- unsigned int numberOfTouches,
- Vector2 point)
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, int source, uint32_t time)
{
- Integration::TapGestureEvent tap( state );
-
- tap.numberOfTaps = numberOfTaps;
- tap.numberOfTouches = numberOfTouches;
- tap.point = point;
-
- return tap;
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState(state);
+ point.SetDeviceId(4);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ point.SetMouseButton(static_cast<MouseButton::Type>(source));
+ touchEvent.points.push_back(point);
+ touchEvent.time = time;
+ return touchEvent;
}
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
// Positive test case for a method
int UtcDaliTapGestureDetectorConstructor(void)
{
END_TEST;
}
+int UtcDaliTapGestureDetectorCopyConstructorP(void)
+{
+ TestApplication application;
+
+ TapGestureDetector detector = TapGestureDetector::New();
+
+ TapGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
+ END_TEST;
+}
+
+int UtcDaliTapGestureDetectorAssignmentOperatorP(void)
+{
+ TestApplication application;
+
+ TapGestureDetector detector = TapGestureDetector::New();
+ ;
+
+ TapGestureDetector assign;
+ assign = detector;
+ DALI_TEST_CHECK(detector);
+
+ DALI_TEST_CHECK(detector == assign);
+ END_TEST;
+}
int UtcDaliTapGestureDetectorNew(void)
{
TapGestureDetector detector = TapGestureDetector::New();
DALI_TEST_CHECK(detector);
- DALI_TEST_EQUALS(1u, detector.GetTapsRequired(), TEST_LOCATION);
- DALI_TEST_EQUALS(1u, detector.GetTouchesRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
- TapGestureDetector detector2 = TapGestureDetector::New(5u, 5u);
+ TapGestureDetector detector2 = TapGestureDetector::New(5u);
DALI_TEST_CHECK(detector2);
- DALI_TEST_EQUALS(5u, detector2.GetTapsRequired(), TEST_LOCATION);
- DALI_TEST_EQUALS(5u, detector2.GetTouchesRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5u, detector2.GetMinimumTapsRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5u, detector2.GetMaximumTapsRequired(), TEST_LOCATION);
//Scoped test to test destructor
{
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
detector.Attach(actor);
TouchEventFunctor touchFunctor;
- actor.TouchedSignal().Connect( &application, touchFunctor );
+ actor.TouchedSignal().Connect(&application, touchFunctor);
Integration::TouchEvent touchEvent(1);
- TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ Integration::Point point;
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point);
application.ProcessEvent(touchEvent);
application.SendNotification();
application.Render();
- // For line coverage, Initialise default constructor
- TouchEvent touchEvent2;
END_TEST;
}
TapGestureDetector detector2 = TapGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- TapGestureDetector detector3 = DownCast< TapGestureDetector >(object);
+ TapGestureDetector detector3 = DownCast<TapGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
TapGestureDetector detector4 = TapGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- TapGestureDetector detector5 = DownCast< TapGestureDetector >(unInitializedObject);
+ TapGestureDetector detector5 = DownCast<TapGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = TapGestureDetector::New();
+ GestureDetector detector6 = TapGestureDetector::New();
TapGestureDetector detector7 = TapGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
}
-int UtcDaliTapGestureSetTapsRequired(void)
+int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void)
{
TestApplication application;
- TapGestureDetector detector = TapGestureDetector::New();
-
- unsigned int taps = 3;
-
- DALI_TEST_CHECK(taps != detector.GetTapsRequired());
-
- detector.SetTapsRequired(taps);
-
- DALI_TEST_EQUALS(taps, detector.GetTapsRequired(), TEST_LOCATION);
-
// Attach an actor and change the required touches
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
- SignalData data;
- GestureReceivedFunctor functor(data);
-
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- TestGestureManager& gestureManager = application.GetGestureManager();
- gestureManager.Initialize();
+ // Set the minimum to be greater than the maximum, should Assert
- detector.SetTapsRequired(4);
-
- // Gesture detection should have been updated only
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
-
- // Reset values
- gestureManager.Initialize();
-
- // Create a second gesture detector that requires even less maximum touches
- TapGestureDetector secondDetector = TapGestureDetector::New();
- secondDetector.Attach(actor);
+ try
+ {
+ TapGestureDetector detector = TapGestureDetector::New();
+ detector.SetMinimumTapsRequired(7u);
+ detector.SetMaximumTapsRequired(3u);
+ detector.Attach(actor);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(DaliException& e)
+ {
+ DALI_TEST_CHECK(true);
+ }
- // Gesture detection should have been updated
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
END_TEST;
}
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
- DALI_TEST_EQUALS(1u, detector.GetTapsRequired(), TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureSetTouchesRequired(void)
-{
- TestApplication application;
-
- TapGestureDetector detector = TapGestureDetector::New();
-
- unsigned int max = 3;
-
- DALI_TEST_CHECK(max != detector.GetTouchesRequired());
-
- detector.SetTouchesRequired(max);
-
- DALI_TEST_EQUALS(max, detector.GetTouchesRequired(), TEST_LOCATION);
-
- // Attach an actor and change the maximum touches
-
- Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
-
- // Render and notify
- application.SendNotification();
- application.Render();
-
- SignalData data;
- GestureReceivedFunctor functor(data);
-
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- TestGestureManager& gestureManager = application.GetGestureManager();
- gestureManager.Initialize();
-
- detector.SetTouchesRequired(4);
-
- // Gesture detection should have been updated only
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
-
- // Reset values
- gestureManager.Initialize();
-
- // Create a second gesture detector that requires even less maximum touches
- TapGestureDetector secondDetector = TapGestureDetector::New();
- secondDetector.Attach(actor);
-
- // Gesture detection should have been updated
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureGetTouchesRequired(void)
-{
- TestApplication application;
-
- TapGestureDetector detector = TapGestureDetector::New();
- DALI_TEST_EQUALS(1u, detector.GetTouchesRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Do a tap outside actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(112.0f, 112.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(112.0f, 112.0f)));
+ TestGenerateTap(application, 112.0f, 112.0f, 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Do a tap inside actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
+ 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;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start tap within the actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
+ 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();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
+ 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();
// Ensure we are no longer signalled
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
+ TestGenerateTap(application, 20.0f, 20.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
+ TestGenerateTap(application, 50.0f, 50.0f, 1900);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
detector.Attach(actor);
// Start tap within the actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
+ TestGenerateTap(application, 20.0f, 20.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Remove the actor from stage and reset the data
- Stage::GetCurrent().Remove(actor);
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
// Actor should now have been destroyed
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 20.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 20.0f)));
+ TestGenerateTap(application, 20.0f, 20.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetRotation(Dali::Degree(90.0f), Vector3::ZAXIS);
- Stage::GetCurrent().Add(actor);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do tap, only check finished value
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(5.0f, 5.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(5.0f, 5.0f)));
+ 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.SetRotation(Dali::Degree(180.0f), Vector3::ZAXIS);
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do tap, should still receive event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(5.0f, 5.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(5.0f, 5.0f)));
+ 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.SetRotation(Dali::Degree(90.0f), Vector3::YAXIS);
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS));
application.SendNotification();
application.Render();
// Do tap, inside the actor's area (area if it is not rotated), Should not receive the event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(70.0f, 70.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(70.0f, 70.0f)));
+ TestGenerateTap(application, 70.0f, 70.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetSize(100.0f, 100.0f);
- parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(parent);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetSize(100.0f, 100.0f);
- child.SetAnchorPoint(AnchorPoint::CENTER);
- child.SetParentOrigin(ParentOrigin::CENTER);
- child.SetRotation(Dali::Degree(90.0f), Vector3::ZAXIS);
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
TouchEventFunctor touchFunctor;
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do tap - hits child area but parent should still receive it
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f)));
+ 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)
// Do an entire tap, only check finished value
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(51.0f, 51.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(51.0f, 51.0f)));
+ 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;
}
TestApplication application;
Actor first = Actor::New();
- first.SetSize(100.0f, 100.0f);
- first.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(first);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetSize(100.0f, 100.0f);
- second.SetX(100.0f);
- second.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(second);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Tap within second actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(120.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(120.0f, 10.0f)));
+ TestGenerateTap(application, 120.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
// Tap within first actor's area
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 10.0f)));
+ TestGenerateTap(application, 20.0f, 10.0f, 700);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
// second actor shouldn't receive event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(120.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(120.0f, 10.0f)));
+ TestGenerateTap(application, 120.0f, 10.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// first actor should continue receiving event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(20.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(20.0f, 10.0f)));
+ TestGenerateTap(application, 20.0f, 10.0f, 1900);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Tap in actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor become invisible - actor should not receive the next pan
- actor.SetVisible(false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// Tap in the same area, shouldn't receive event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TestGenerateTap(application, 50.0f, 10.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void)
{
TestApplication application;
- Dali::TestGestureManager& gestureManager = application.GetGestureManager();
Actor first = Actor::New();
- first.SetSize(100.0f, 100.0f);
- first.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(first);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetSize(100.0f, 100.0f);
- second.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- second.SetX(100.0f);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
first.Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector firstDetector = TapGestureDetector::New();
// secondDetector is scoped
{
- // Reset gestureManager statistics
- gestureManager.Initialize();
-
- TapGestureDetector secondDetector = TapGestureDetector::New();
- secondDetector.SetTapsRequired(2);
- secondDetector.SetTouchesRequired(2);
+ TapGestureDetector secondDetector = TapGestureDetector::New(2);
secondDetector.Attach(second);
secondDetector.DetectedSignal().Connect(&application, functor);
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
-
// Tap within second actor's area
- application.ProcessEvent(GenerateTap(Gesture::Possible, 2u, 2u, Vector2(150.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 2u, 2u, Vector2(150.0f, 10.0f)));
+ TestGenerateTap(application, 150.0f, 10.0f, 100);
+ TestGenerateTap(application, 150.0f, 10.0f, 200);
+
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
// Tap continues as single touch gesture - we should not receive any gesture
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(150.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(150.0f, 10.0f)));
+ TestGenerateTap(application, 150.0f, 10.0f, 800);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Single touch tap starts - first actor should be panned
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TestGenerateTap(application, 50.0f, 10.0f, 1400);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
- // Pan changes to double-touch - we shouldn't receive event
+ // Tap changes to double-touch - we shouldn't receive event
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Possible, 2u, 2u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 2u, 2u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // Reset gesture manager statistics
- gestureManager.Initialize();
+ TestGenerateTwoPointTap(application, 50.0f, 10.0f, 60.0f, 20.0f, 2000);
+
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
}
- // secondDetector has now been deleted. Gesture detection should have been updated only
- DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UpdateType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::RegisterType), TEST_LOCATION);
- DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
// Attach actor to one detector
- SignalData firstData;
+ SignalData firstData;
GestureReceivedFunctor firstFunctor(firstData);
- TapGestureDetector firstDetector = TapGestureDetector::New();
+ TapGestureDetector firstDetector = TapGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
+ SignalData secondData;
GestureReceivedFunctor secondFunctor(secondData);
- TapGestureDetector secondDetector = TapGestureDetector::New();
+ TapGestureDetector secondDetector = TapGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
// Tap in actor's area - both detector's functors should be called
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Gesture possible in actor's area.
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor somewhere else
- actor.SetPosition( 100.0f, 100.0f );
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
// Render and notify
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the long press.
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Emit STARTED event, we should not receive the tap.
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // LongPress possible in empty area.
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Tap possible in empty area.
+ TestStartLongPress(application, 50.0f, 10.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // Move actor in to the long press position.
- actor.SetPosition( 0.0f, 0.0f );
+ // Move actor in to the tap position.
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
// Render and notify
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the long press.
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Emit STARTED event, we should not receive the tap.
+ TestEndPan(application, Vector2(50.0f, 10.0f), 720);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // Normal long press in actor's area for completeness.
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Normal tap in actor's area for completeness.
+ TestGenerateTap(application, 50.0f, 10.0f, 1300);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureEmitIncorrectStateClear(void)
+int UtcDaliTapGestureActorUnstaged(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ UnstageActorFunctor functor(data, application.GetScene());
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
- // Try a Clear state
- try
- {
- application.ProcessEvent(GenerateTap(Gesture::Clear, 1u, 1u, Vector2(50.0f, 10.0f)));
- tet_result(TET_FAIL);
- }
- catch ( Dali::DaliException& e )
- {
- DALI_TEST_ASSERT( e, "false", TEST_LOCATION );
- }
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ tet_result(TET_PASS); // If we get here, then the actor removal on signal handler was handled gracefully.
END_TEST;
}
-int UtcDaliTapGestureEmitIncorrectStateContinuing(void)
+int UtcDaliTapGestureDetectorRemovedWhilePossible(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
- // Try a Continuing state
- try
- {
- application.ProcessEvent(GenerateTap(Gesture::Continuing, 1u, 1u, Vector2(50.0f, 10.0f)));
- tet_result(TET_FAIL);
- }
- catch ( Dali::DaliException& e )
- {
- DALI_TEST_ASSERT( e, "false", TEST_LOCATION );
- }
+ // Emit a possible - Down press, as emitted by long press function
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
+
+ // Detach actor and send a STARTED state, no signal.
+ detector.DetachAll();
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureEmitIncorrectStateFinished(void)
+int UtcDaliTapGestureActorRemovedWhilePossible(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ 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();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- // Try a Finished state
- try
- {
- application.ProcessEvent(GenerateTap(Gesture::Finished, 1u, 1u, Vector2(50.0f, 10.0f)));
- tet_result(TET_FAIL);
- }
- catch ( Dali::DaliException& e )
- {
- DALI_TEST_ASSERT( e, "false", TEST_LOCATION );
- }
- END_TEST;
-}
-
-int UtcDaliTapGestureActorUnstaged(void)
-{
- TestApplication application;
+ detector.DetectedSignal().Connect(&application, functor);
- Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ // Emit a possible - Down press, as emitted by long press function
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
- // Render and notify
+ // Remove, render and delete actor
+ application.GetScene().Remove(actor);
application.SendNotification();
application.Render();
+ actor.Reset();
- // Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- // Tap in Actor's area, actor removed in signal handler, should be handled gracefully.
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- tet_result( TET_PASS ); // If we get here, then the actor removal on signal handler was handled gracefully.
+ // Send a STARTED state, no signal - Up motion as provided by end pan function
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureRepeatedState(void)
+int UtcDaliTapGestureLayerConsumesTouch(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
+
+ // Add a detector
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ // Add a layer to overlap the actor
+ Layer layer = Layer::New();
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
+ layer.RaiseToTop();
// Render and notify
application.SendNotification();
application.Render();
- // Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- // Emit two possibles
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-
- // Send a couple of Started states, only first one should be received.
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Emit signals, should receive
+ TestGenerateTap(application, 50.0f, 50.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
-
- // Send a couple of cancelled states, no reception
- application.ProcessEvent(GenerateTap(Gesture::Cancelled, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Cancelled, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- END_TEST;
-}
-int UtcDaliTapGesturePossibleCancelled(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ // Set layer to consume all touch
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
- // Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
-
- // Emit a possible and then a cancelled, no reception
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
- application.ProcessEvent(GenerateTap(Gesture::Cancelled, 1u, 1u, Vector2(50.0f, 10.0f)));
+ // Emit the same signals again, should not receive
+ TestGenerateTap(application, 50.0f, 50.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
END_TEST;
}
-int UtcDaliTapGestureDetectorRemovedWhilePossible(void)
+int UtcDaliTapGestureDisableDetectionDuringTapN(void)
{
+ // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
+
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
+
+ // Add a detector
+ TapGestureDetector detector = TapGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(
+ &application,
+ [&detector, &functorCalled](Actor actor, const TapGesture& gesture) {
+ detector.Detach(actor);
+ functorCalled = true;
+ });
// Render and notify
application.SendNotification();
application.Render();
- // Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ // Try the gesture, should not crash
+ try
+ {
+ TestGenerateTap(application, 50.0f, 10.0f);
- // Emit a possible
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
+ DALI_TEST_CHECK(true); // No crash, test has passed
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
+ }
- // Detach actor and send a Started state, no signal.
- detector.DetachAll();
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureActorRemovedWhilePossible(void)
+int UtcDaliTapGestureWhenGesturePropargation(void)
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ Actor parentActor = Actor::New();
+ parentActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parentActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ Actor childActor = Actor::New();
+ childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ parentActor.Add(childActor);
+ application.GetScene().Add(parentActor);
// Render and notify
application.SendNotification();
application.Render();
- // Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ SignalData pData;
+ GestureReceivedFunctor pFunctor(pData);
- // Emit a possible
- application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f)));
+ TapGestureDetector parentDetector = TapGestureDetector::New();
+ parentDetector.Attach(parentActor);
+ parentDetector.DetectedSignal().Connect(&application, pFunctor);
- // Remove, render and delete actor
- Stage::GetCurrent().Remove(actor);
- application.SendNotification();
- application.Render();
- actor.Reset();
+ SignalData cData;
+ GestureReceivedFunctor cFunctor(cData);
+
+ TapGestureDetector childDetector = TapGestureDetector::New();
+ childDetector.Attach(childActor);
+ childDetector.DetectedSignal().Connect(&application, cFunctor);
+
+ // Start gesture within the actor's area, we receive the gesture not parent actor but child actor.
+ TestGenerateTap(application, 50.0f, 50.0f, 100);
+ DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, pData.functorCalled, TEST_LOCATION);
+ cData.Reset();
+ pData.Reset();
+
+ // If GesturePropargation is set, a gesture event is delivered to the parent.
+ Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+
+ // So now the parent got the gesture event.
+ TestGenerateTap(application, 50.0f, 50.0f, 700);
+ DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, pData.functorCalled, TEST_LOCATION);
+ cData.Reset();
+ pData.Reset();
- // Send a Started state, no signal.
- application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f)));
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureSystemOverlay(void)
+int UtcDaliTapGestureGetSourceType(void)
{
TestApplication application;
- Dali::Integration::Core& core = application.GetCore();
- Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- systemOverlay.Add(actor);
+ 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();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- Vector2 screenCoords( 50.0f, 50.0f );
+ // Emit a down signal with MouseButton
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 120));
+ application.SendNotification();
- // Do a tap inside actor's area
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- END_TEST;
-}
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::INVALID, TEST_LOCATION);
-int UtcDaliTapGestureBehindTouchableSystemOverlay(void)
-{
- TestApplication application;
- Dali::Integration::Core& core = application.GetCore();
- Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
-
- // SystemOverlay actor
- Actor systemOverlayActor = Actor::New();
- systemOverlayActor.SetSize(100.0f, 100.0f);
- systemOverlayActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- systemOverlay.Add(systemOverlayActor);
-
- // Stage actor
- Actor stageActor = Actor::New();
- stageActor.SetSize(100.0f, 100.0f);
- stageActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(stageActor);
+ data.Reset();
- // Render and notify
+ // Emit a down signal with MouseButton
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 700));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 720));
application.SendNotification();
- application.Render();
- // Set system-overlay actor to touchable
- TouchEventData touchData;
- TouchEventDataFunctor touchFunctor( touchData );
- systemOverlayActor.TouchedSignal().Connect(&application, touchFunctor);
-
- // Set stage actor to receive the gesture
- SignalData data;
- GestureReceivedFunctor functor(data);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::PRIMARY, TEST_LOCATION);
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(stageActor);
- detector.DetectedSignal().Connect(&application, functor);
+ data.Reset();
- Vector2 screenCoords( 50.0f, 50.0f );
+ // Emit a down signal with MouseButton
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 3, 1300));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 3, 1320));
+ application.SendNotification();
- // Do a tap inside both actors' area
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, touchData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::SECONDARY, TEST_LOCATION);
data.Reset();
- touchData.Reset();
- // Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
+ // Emit a down signal with MouseButton
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 2, 1900));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 2, 1920));
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::TERTIARY, TEST_LOCATION);
END_TEST;
}
-int UtcDaliTapGestureTouchBehindGesturedSystemOverlay(void)
+int UtcDaliTapGestureReceiveAllTapEvents(void)
{
TestApplication application;
- Dali::Integration::Core& core = application.GetCore();
- Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
-
- // SystemOverlay actor
- Actor systemOverlayActor = Actor::New();
- systemOverlayActor.SetSize(100.0f, 100.0f);
- systemOverlayActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- systemOverlay.Add(systemOverlayActor);
-
- // Stage actor
- Actor stageActor = Actor::New();
- stageActor.SetSize(100.0f, 100.0f);
- stageActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(stageActor);
+
+ 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();
- // Set stage actor to touchable
- TouchEventData touchData;
- TouchEventDataFunctor touchFunctor( touchData );
- stageActor.TouchedSignal().Connect(&application, touchFunctor);
-
- // Set system-overlay actor to have the gesture
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(systemOverlayActor);
+ detector.SetMaximumTapsRequired(2u);
+ detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- Vector2 screenCoords( 50.0f, 50.0f );
-
- // Do a tap inside both actors' area
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, touchData.functorCalled, TEST_LOCATION );
+ // Emit signals, Because MaximumTapsRequired is 2, a timer that checks whether it is a single tap or a double tap operates internally.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 120));
+ application.SendNotification();
+ // So detector don't get the tap event yet.
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- touchData.Reset();
-
- // Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTapGestureLayerConsumesTouch(void)
-{
- TestApplication application;
+ // Emit signals, Send the second tab.
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 130));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 150));
+ application.SendNotification();
+ application.GetPlatform().TriggerTimer();
- Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ // It find out to be a double tap. Detector receives events.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
- // Add a detector
- SignalData data;
- GestureReceivedFunctor functor(data);
- TapGestureDetector detector = TapGestureDetector::New();
- detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ // Detector want to receive all tap events.
+ detector.ReceiveAllTapEvents(true);
- // Add a layer to overlap the actor
- Layer layer = Layer::New();
- layer.SetSize(100.0f, 100.0f);
- layer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add( layer );
- layer.RaiseToTop();
-
- // Render and notify
+ // Emit signals, should receive
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 500));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 520));
application.SendNotification();
- application.Render();
-
- Vector2 screenCoords( 50.0f, 50.0f );
- // Emit signals, should receive
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- // Set layer to consume all touch
- layer.SetTouchConsumed( true );
-
- // Render and notify
+ // Emit signals, should receive
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 530));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 550));
application.SendNotification();
- application.Render();
- // Emit the same signals again, should not receive
- application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, screenCoords ) );
- application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, screenCoords ) );
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
-}
+}
\ No newline at end of file