/*
- * 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/integration-api/profiling.h>
#include <dali/integration-api/input-options.h>
#include <dali-test-suite-utils.h>
-#include <test-touch-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();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage )
+ UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage )
+ stateToUnstage( stateToUnstage ),
+ scene( scene )
{
}
{
GestureReceivedFunctor::operator()( actor, pan );
- if ( pan.state == stateToUnstage )
+ if ( pan.GetState() == stateToUnstage )
{
- Stage::GetCurrent().Remove( actor );
+ scene.Remove( actor );
}
}
Gesture::State& stateToUnstage;
-};
-
-// Functor for receiving a touch event
-struct TouchEventFunctor
-{
- bool operator()(Actor actor, const TouchEvent& touch)
- {
- return false;
- }
+ Integration::Scene scene;
};
// Data for constraints
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;
}
// 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);
+ actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
detector.Attach(actor);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
// Attach an actor and change the minimum 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();
// 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);
+ 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();
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();
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();
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;
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();
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;
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();
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();
// Attach a temporary actor to stop detector being removed from PanGestureProcessor when main actor
// is destroyed.
Actor tempActor = Actor::New();
- tempActor.SetSize(100.0f, 100.0f);
- tempActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(tempActor);
+ tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ application.GetScene().Add(tempActor);
detector.Attach(tempActor);
uint32_t time = 100;
// 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();
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();
TestApplication application;
Actor actor = Actor::New();
- actor.SetSize(100.0f, 100.0f);
- actor.SetOrientation(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();
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.SetOrientation(Dali::Degree(180.0f), Vector3::ZAXIS);
+ actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
application.SendNotification();
application.Render();
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.SetOrientation(Dali::Degree(270.0f), Vector3::ZAXIS);
+ actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
application.SendNotification();
application.Render();
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;
}
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.SetOrientation(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;
- child.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
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;
}
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();
detector.Attach(second);
detector.DetectedSignal().Connect(&application, functor);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), first.GetParent(), TEST_LOCATION);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), second.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION);
// Start pan within second actor's area
uint32_t time = 100;
TestStartPan( application, Vector2( 110.0f, 20.0f ), Vector2( 126.0f, 20.0f ), time );
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), first.GetParent(), TEST_LOCATION);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), second.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.pannedActor, TEST_LOCATION);
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();
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();
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);
Actor actor2 = Actor::New();
- actor2.SetSize(100.0f, 100.0f);
- actor2.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(actor2);
+ actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ application.GetScene().Add(actor2);
// Render and notify
application.SendNotification();
TestApplication application;
Actor actor1 = Actor::New();
- actor1.SetSize(100.0f, 100.0f);
- actor1.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor1);
+ actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor1);
SignalData data1;
GestureReceivedFunctor functor1(data1);
PanGestureDetector detector1 = PanGestureDetector::New();
detector1.DetectedSignal().Connect(&application, functor1);
Actor actor2 = Actor::New();
- actor2.SetSize(100.0f, 100.0f);
- actor2.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
- actor2.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(actor2);
+ actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+ application.GetScene().Add(actor2);
SignalData data2;
GestureReceivedFunctor functor2(data2);
PanGestureDetector detector2 = PanGestureDetector::New();
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();
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 );
Actor child = Actor::New();
- child.SetSize(100.0f, 100.0f);
- child.SetAnchorPoint(AnchorPoint::CENTER);
- child.SetParentOrigin(ParentOrigin::CENTER);
+ 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);
parent.Add( child );
// Create detector for parent and attach
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();
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();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor in to the long press position.
- actor.SetPosition( 0.0f, 0.0f );
+ actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f ));
// Render and notify
application.SendNotification();
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();
// Attach actor to detector
SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage );
+ UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect( &application, functor );
application.Render();
// Re-add actor to stage
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Re-add actor to stage
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
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);
// Create and add a second actor so that GestureDetector destruction does not come into play.
Actor dummyActor( Actor::New() );
- dummyActor.SetSize( 100.0f, 100.0f );
- dummyActor.SetPosition( 100.0f, 100.0f );
- dummyActor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(dummyActor);
+ dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
+ dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(dummyActor);
// Render and notify
application.SendNotification();
// Attach actor to detector
SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage );
+ UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
application.Render();
// Re add to the stage, we should not be signalled
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
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);
Actor child = Actor::New();
- child.SetSize(100.0f, 100.0f);
- child.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
parent.Add(child);
// Render and notify
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);
Actor child = Actor::New();
- child.SetSize(100.0f, 100.0f);
- child.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
parent.Add(child);
// Render and notify
Integration::SetPanGestureSmoothingMode(0);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureSmoothingMode(1);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureSmoothingMode(0);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureSmoothingMode(1);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureSmoothingAmount( 0.25f );
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureMultitapSmoothingRange( 34 );
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::EnableProfiling( Integration::PROFILING_TYPE_PAN_GESTURE );
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureMultitapSmoothingRange( 34 );
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGestureSmoothingMode(0);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
Integration::SetPanGesturePredictionMode(0);
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
// 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.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
data.Reset();
// Set layer to consume all touch
- layer.SetTouchConsumed( true );
+ layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
// Render and notify
application.SendNotification();
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 pan detector
PanGestureDetector detector = PanGestureDetector::New();
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();
+ END_TEST;
+}
+
+int UtcDaliPanGestureInterruptedWhenTouchConsumed(void)
+{
+ 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);
+
+ bool consume = false;
+ TouchEventFunctorConsumeSetter touchFunctor(consume);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ // Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed
+ uint32_t time = 100;
+ TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
+ // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
+ consume = true;
+
+ TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ time += TestGetFrameInterval();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.GetState(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPanGestureDisableDetectionDuringPanN(void)
+{
+ // Crash 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 pan detector
+ PanGestureDetector detector = PanGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach( actor );
+ detector.DetectedSignal().Connect(
+ &application,
+ [&detector, &functorCalled](Actor actor, const PanGesture& pan)
+ {
+ if( pan.GetState() == Gesture::Finished )
+ {
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Try the gesture, should not crash
+ try
+ {
+ uint32_t time = 100;
+ TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestEndPan( application, Vector2(26.0f, 20.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
+ }
+
END_TEST;
}