#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali/devel-api/events/gesture-devel.h>
-#include <dali/devel-api/events/rotation-gesture.h>
-#include <dali/devel-api/events/rotation-gesture-detector.h>
#include <dali-test-suite-utils.h>
-#include <test-touch-utils.h>
-#include <test-touch-data-utils.h>
+#include <test-touch-event-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.rotation = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
rotatedActor.Reset();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
+ UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
stateToUnstage( stateToUnstage ),
scene( scene )
{
GestureReceivedFunctor::operator()( actor, rotation );
- if ( rotation.state == stateToUnstage )
+ if ( rotation.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
-// Functor for receiving a touch event
-struct TouchEventFunctor
-{
- bool operator()(Actor actor, const TouchEvent& touch)
- {
- return false;
- }
-};
-
} // anon namespace
///////////////////////////////////////////////////////////////////////////////
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- // Start pan within the actor's area
+ // Start rotation within the actor's area
TestStartRotation( application, Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 20.0f ),
Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 30.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.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(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.244f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(12.5f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(12.48f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
- // Continue the pan within the actor's area - we should still receive the signal
+ // Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.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(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
- // Pan Gesture leaves actor's area - we should still receive the signal
+ // Rotation Gesture leaves actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.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(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// 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(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
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(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.404892f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// 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(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// 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(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
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(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor
detector.DetachAll();
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor during the rotation, we should not receive the next event
detector.DetachAll();
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Remove the actor from stage and reset the data
application.GetScene().Remove(actor);
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;
}
child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
parent.Add(child);
- TouchEventFunctor touchFunctor;
- child.TouchedSignal().Connect(&application, touchFunctor);
-
// Render and notify
application.SendNotification();
application.Render();
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);
- // Pan continues within actor's area
+ // Rotation continues within actor's area
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Continuing;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::CONTINUING;
// Emit signals
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Finished;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::FINISHED;
// Emit signals
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
detector.Attach(dummyActor);
detector.DetectedSignal().Connect( &application, functor );
- // Here we are testing a Started actor which is removed in the Started callback, but then added back
+ // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
application.GetScene().Add(actor);
bool consume = false;
- TouchDataFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ TouchEventFunctorConsumeSetter touchFunctor(consume);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- // Start gesture within the actor's area, we should receive the pinch as the touch is NOT being consumed
+ // Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed
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(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
- // Start another pinch, we should not even get the callback this time
+ // Start another rotation, we should not even get the callback this time
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(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
+
+int UtcDaliRotationGestureDisableDetectionDuringRotationN(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.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
+ RotationGestureDetector detector = RotationGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach( actor );
+ detector.DetectedSignal().Connect(
+ &application,
+ [&detector, &functorCalled](Actor actor, const RotationGesture& gesture)
+ {
+ if( gesture.GetState() == GestureState::FINISHED )
+ {
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Try the gesture, should not crash
+ try
+ {
+ TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
+ Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
+ Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
+ TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
+ Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+
+ 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
+ }
+
+ END_TEST;
+}