Refactored Integration and internal touch processing to use new Point rather than TouchPoint
so we can store the new parameters.
Change-Id: If35d6c4a156c19391c736b750c7673631a7a4ef0
}
// Generate a touch-event
- Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, Vector2 screenPosition ) const
+ Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition ) const
{
Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ touchEvent.points.push_back( point );
return touchEvent;
}
gTouchCallBackCalled = false;
// simulate a touch event
- Dali::TouchPoint point( 0, TouchPoint::Down, 25.0f, 25.0f );
+ Dali::Integration::Point point;
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 25.0f, 25.0f ) );
Dali::Integration::TouchEvent event;
event.AddPoint( point );
app.ProcessEvent( event );
// simulate a touch event in the middle of the screen
Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
- Dali::TouchPoint point( 1, TouchPoint::Down, touchPoint.x, touchPoint.y );
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
Dali::Integration::TouchEvent event;
event.AddPoint( point );
application.ProcessEvent( event );
// simulate a hover event in the middle of the screen
Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
- Dali::TouchPoint point( 1, TouchPoint::Motion, touchPoint.x, touchPoint.y );
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::MOTION );
+ point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
Dali::Integration::HoverEvent event;
event.AddPoint( point );
application.ProcessEvent( event );
// connect to its touch signal
actor.TouchedSignal().Connect(TestCallback);
- Dali::TouchPoint point( 0, TouchPoint::Down, hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y );
+ Dali::Integration::Point point;
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) );
Dali::Integration::TouchEvent event;
event.AddPoint( point );
application.Render(1000);
// simulate a touch event
- Dali::TouchPoint point( 0, TouchPoint::Down, 240, 400 );
+ Dali::Integration::Point point;
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 240, 400 ) );
Dali::Integration::TouchEvent event;
event.AddPoint( point );
application.ProcessEvent( event );
application.Render();
// simulate a touch event
- Dali::TouchPoint point( 0, TouchPoint::Down, 1, 1 );
+ Dali::Integration::Point point;
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 1, 1 ) );
Dali::Integration::TouchEvent event;
event.AddPoint( point );
application.ProcessEvent( event );
application.Render();
// simulate a hover event
- Dali::TouchPoint point( 0, TouchPoint::Motion, 1, 1 );
+ Dali::Integration::Point point;
+ point.SetState( PointState::MOTION );
+ point.SetScreenPosition( Vector2( 1, 1 ) );
Dali::Integration::HoverEvent event;
event.AddPoint( point );
application.ProcessEvent( event );
}
};
-Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, Vector2 screenPosition )
+Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
{
Integration::HoverEvent hoverEvent;
- hoverEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+ Integration::Point point;
+ point.SetState( static_cast< PointState::Type >( state ) );
+ point.SetScreenPosition( screenPosition );
+ hoverEvent.points.push_back( point );
return hoverEvent;
}
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);
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
application.Render();
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);
END_TEST;
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoordsStart ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoordsStart ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoordsStart ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoordsStart ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
detector.Attach(actor);
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);
- TouchPoint point2(1, TouchPoint::Down, 20.0f, 20.0f, 20.0f, 20.0f);
+ Integration::Point point2;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ point.SetLocalPosition( Vector2( 20.0f, 20.0f ) );
touchEvent.AddPoint(point2);
application.ProcessEvent(touchEvent);
END_TEST;
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
bool& mSignalVerified;
};
+void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition )
+{
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ touchEvent.points.push_back( point );
+ application.ProcessEvent( touchEvent );
+}
+
} // unnamed namespace
// Basic test: No actors, single touch (down then up).
{
- Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
DALI_TEST_CHECK( !data.receivedTouchEvent.points[0].hitActor );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Up;
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
// Actor on scene, single touch, down in actor, motion, then up outside actor.
{
- Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
DALI_TEST_CHECK( data.receivedTouchEvent.points[0].hitActor == actor );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Motion;
- touchEvent.points[0].screen.x = 150.0f; // Some motion
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Up;
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
// Multiple touch. Should only receive a touch on first down and last up.
{
Integration::TouchEvent touchEvent;
+ Integration::Point point;
// 1st point
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+ touchEvent.points.push_back( point );
application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
data.Reset();
// 2nd point
- touchEvent.points[0].state = TouchPoint::Stationary;
- touchEvent.points.push_back( TouchPoint( 1, TouchPoint::Down, 50.0f, 50.0f ) );
+ touchEvent.points[0].SetState( PointState::STATIONARY );
+ point.SetDeviceId( 1 );
+ point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
+ touchEvent.points.push_back( point );
application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0u, TEST_LOCATION );
data.Reset();
// Primary point is up
- touchEvent.points[0].state = TouchPoint::Up;
- touchEvent.points[1].state = TouchPoint::Stationary;
+ touchEvent.points[0].SetState( PointState::UP );
+ touchEvent.points[1].SetState( PointState::STATIONARY );
application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0u, TEST_LOCATION );
// Remove 1st point now, 2nd point is now in motion
touchEvent.points.erase( touchEvent.points.begin() );
- touchEvent.points[0].state = TouchPoint::Motion;
- touchEvent.points[0].screen.x = 150.0f;
+ touchEvent.points[0].SetState( PointState::MOTION );
+ touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 0u, TEST_LOCATION );
data.Reset();
// Final point Up
- touchEvent.points[0].state = TouchPoint::Up;
+ touchEvent.points[0].SetState( PointState::UP );
application.ProcessEvent( touchEvent );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
// No actors, single touch, down, motion then up.
{
- Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Down, 10.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
data.Reset();
// Confirm there is no signal when the touchpoint is only moved.
- touchEvent.points[0].state = TouchPoint::Motion;
- touchEvent.points[0].screen.x = 1200.0f; // Some motion
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Confirm a following up event generates a signal.
- touchEvent.points[0].state = TouchPoint::Up;
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
// Actor on scene. Interrupted before down and interrupted after down.
{
- Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Interrupted, 10.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Interrupted );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Down;
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
DALI_TEST_CHECK( data.receivedTouchEvent.points[0].state == TouchPoint::Down );
data.Reset();
- touchEvent.points[0].state = TouchPoint::Interrupted;
- application.ProcessEvent( touchEvent );
+ GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
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);
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
touchData.Reset();
// Do touch in the same area
- application.ProcessEvent( touchFunctor.GenerateSingleTouch( TouchPoint::Down, screenCoords ) );
+ application.ProcessEvent( touchFunctor.GenerateSingleTouch( PointState::DOWN, screenCoords ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, touchData.functorCalled, TEST_LOCATION );
Actor hitActor;
Vector2 local;
Vector2 screen;
+ float radius;
+ Vector2 ellipseRadius;
+ float pressure;
+ Degree angle;
TestPoint()
- : deviceId(-1), state(PointState::FINISHED)
+ : deviceId(-1), state(PointState::FINISHED), radius(0), pressure(0)
{
}
static const TestPoint ZERO;
p.hitActor = touchData.GetHitActor(i);
p.local = touchData.GetLocalPosition(i);
p.screen = touchData.GetScreenPosition(i);
+ p.radius = touchData.GetRadius(i);
+ p.ellipseRadius = touchData.GetEllipseRadius(i);
+ p.pressure = touchData.GetPressure(i);
+ p.angle = touchData.GetAngle(i);
signalData.touchData.points.push_back(p);
}
bool returnValue;
};
-Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, Vector2 screenPosition )
+struct TouchEventFunctor
+{
+ /**
+ * Constructor.
+ * @param[in] functorCalled Reference to a boolean which is set to true if the touch event functor is called.
+ */
+ TouchEventFunctor( bool& functorCalled )
+ : functorCalled( functorCalled )
+ {
+ }
+
+ bool operator()( Actor actor, const TouchEvent& touch )
+ {
+ functorCalled = true;
+ return true;
+ }
+
+ bool& functorCalled;
+};
+
+Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition )
{
Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ touchEvent.points.push_back( point );
return touchEvent;
}
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
const TestPoint *point1 = &data.touchData.GetPoint(0);
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) );
const TestPoint *point2 = &data.touchData.GetPoint(0);
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
// Emit an up signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) );
const TestPoint *point3 = &data.touchData.GetPoint(0);
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
// Emit a down signal where the actor is not present
screenCoordinates.x = screenCoordinates.y = 200.0f;
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
END_TEST;
}
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( -1, data.point.deviceId, TEST_LOCATION );
Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
// Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
// Emit another interrupted signal, our signal handler should not be called.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
END_TEST;
}
rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
screenCoordinates.x = screenCoordinates.y = 11.0f;
actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
screenCoordinates.x = screenCoordinates.y = 12.0f;
actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.touchData.GetPointCount(), TEST_LOCATION );
// Emit a down signal where the actor is not present, will hit the root actor though
screenCoordinates.x = screenCoordinates.y = 200.0f;
rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, rootData.touchData.GetPointCount(), TEST_LOCATION );
rootActor.TouchSignal().Connect( &application, rootFunctor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Emit an interrupted signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, data.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Emit another down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
application.Render();
// Emit an interrupted signal, only root actor's signal should be called.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Emit another interrupted state, none of the signal's should be called.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION );
END_TEST;
actor.SetLeaveRequired( true );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::LEAVE, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
// Another motion outside of actor, no signalling
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::MOTION, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
actor.SetLeaveRequired( false );
// Another motion event outside of actor, no signalling
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
rootActor.SetLeaveRequired( true );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::LEAVE, data.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Another motion outside of actor, only rootActor signalled
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::MOTION, rootData.touchData.points[0].state, TEST_LOCATION );
rootData.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::MOTION, data.touchData.points[0].state, TEST_LOCATION );
// Another motion event outside of root actor, only root signalled
Vector2 stageSize( Stage::GetCurrent().GetSize() );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::LEAVE, rootData.touchData.points[0].state, TEST_LOCATION );
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
actor.SetSensitive( false );
// Emit a motion signal, signalled with an interrupted
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
rootActor.TouchSignal().Connect( &application, rootFunctor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
rootActor.SetSensitive( false );
// Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
actor1.TouchSignal().Connect( &application, functor );
// Hit in hittable area, actor1 should be hit
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.touchedActor == actor1 );
data.Reset();
// Make layer1 insensitive, nothing should be hit
layer1.SetSensitive( false );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Make layer1 sensitive again, again actor1 will be hit
layer1.SetSensitive( true );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.touchedActor == actor1 );
data.Reset();
// Make rootActor insensitive, nothing should be hit
rootActor.SetSensitive( false );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
actor2.TouchSignal().Connect( &application, functor );
// Emit an event, should hit layer2
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
//DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 insensitive, should hit actor1
layer2.SetSensitive( false );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.touchedActor == actor1 );
data.Reset();
// Make layer2 sensitive again, should hit layer2
layer2.SetSensitive( true );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
//DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
application.Render();
// Should hit actor1
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.touchedActor == actor1 );
data.Reset();
application.Render();
// Should not hit anything
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Disable input on renderTask, should not be hittable
renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
layer.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Disable input on renderTask, should not be hittable
renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.touchedActor );
END_TEST;
actor.SetLeaveRequired( true );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit another down event
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
actor.Reset();
// Emit event, should not crash and should not receive an event.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
END_TEST;
}
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
END_TEST;
}
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit a move at the same point, we should not be signalled.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
application.Render();
// Emit a down signal, the system overlay is drawn last so is at the top, should hit the systemActor.
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( systemActor == data.touchedActor );
END_TEST;
application.Render();
// Emit a few touch signals
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit the same signals again, should not receive
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
actor.TouchSignal().Connect( &application, functor );
// Emit a down and motion
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 11.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 11.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
stage.Add( actor );
// Emit a motion within the actor's bounds
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 12.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 12.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a motion outside the actor's bounds
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::LEAVE, data.touchData.points[0].state, TEST_LOCATION );
data.Reset();
actor.TouchSignal().Connect( &application, functor );
// Emit an event within stencil area
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit an event outside the stencil area but within the actor area, we should have a hit!
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 60.0f, 60.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 60.0f, 60.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.touchData.points[0].hitActor );
actor.TouchSignal().Connect( &application, functor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.touchData.points[0].hitActor );
parent.TouchSignal().Connect( &application, parentFunctor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.touchData.points[0].hitActor );
application.Render();
// Emit a motion signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
data.Reset();
rootActor.TouchSignal().Connect( &application, rootFunctor );
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.touchData.points[0].hitActor );
parent.TouchSignal().Connect( &application, secondFunctor );
// Emit an interrupted signal, all three should STILL be called
- application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( PointState::INTERRUPTED, data.touchData.points[0].state, TEST_LOCATION );
DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliTouchDataGetRadius(void)
+{
+ TestApplication application;
+
+ 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();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchDataFunctor functor( data );
+ actor.TouchSignal().Connect( &application, functor );
+
+ // Emit a down signal with an angle
+ Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ touchEvent.points[ 0 ].SetRadius( 100.0f );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( 100.0f, data.touchData.points[0].radius, TEST_LOCATION );
+ DALI_TEST_EQUALS( 100.0f, data.touchData.points[0].ellipseRadius.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( 100.0f, data.touchData.points[0].ellipseRadius.y, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchDataGetEllipseRadius(void)
+{
+ TestApplication application;
+
+ 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();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchDataFunctor functor( data );
+ actor.TouchSignal().Connect( &application, functor );
+
+ // Emit a down signal with an angle
+ Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ touchEvent.points[ 0 ].SetRadius( 100.0f, Vector2( 20.0f, 10.0f ) );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( 100.0f, data.touchData.points[0].radius, TEST_LOCATION );
+ DALI_TEST_EQUALS( 20.0f, data.touchData.points[0].ellipseRadius.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( 10.0f, data.touchData.points[0].ellipseRadius.y, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchDataGetAngle(void)
+{
+ TestApplication application;
+
+ 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();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchDataFunctor functor( data );
+ actor.TouchSignal().Connect( &application, functor );
+
+ // Emit a down signal with an angle
+ Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ touchEvent.points[ 0 ].SetAngle( Degree( 90.0f ) );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( Degree( 90.0f ), data.touchData.points[0].angle, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchDataGetPressure(void)
+{
+ TestApplication application;
+
+ 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();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchDataFunctor functor( data );
+ actor.TouchSignal().Connect( &application, functor );
+
+ // Emit a down signal with an angle
+ Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ touchEvent.points[ 0 ].SetPressure( 10.0f );
+ application.ProcessEvent( touchEvent );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::DOWN, data.touchData.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( 10.0f, data.touchData.points[0].pressure, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchDataAndEventUsage(void)
+{
+ TestApplication application;
+
+ 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();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchDataFunctor functor( data );
+ actor.TouchSignal().Connect( &application, functor );
+
+ // Connect to actor's touched signal (OLD)
+ bool touchEventFunctorCalled = false;
+ TouchEventFunctor eventFunctor( touchEventFunctorCalled );
+ actor.TouchedSignal().Connect( &application, eventFunctor );
+
+ // Emit a down signal with an angle
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
+ DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS( true, touchEventFunctorCalled, TEST_LOCATION );
+
+ END_TEST;
+
+
+}
using namespace Dali;
using namespace Dali::Integration;
+namespace
+{
+Point GeneratePoint( int deviceId, PointState::Type state, float x, float y )
+{
+ Point point;
+ point.SetDeviceId( deviceId );
+ point.SetState( state );
+ point.SetScreenPosition( Vector2( x, y ) );
+ return point;
+}
+}
+
void utc_dali_touch_event_combiner_startup(void)
{
test_return_value = TET_UNDEF;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 101.0f, 101.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 101.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
// Motion event, but same time
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 103.0f, 103.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 103.0f, 103.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 103.0f, 103.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 103.0f, 103.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Finished, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Motion, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::MOTION, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Down, 200.0f, 200.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::DOWN, 200.0f, 200.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
// 2nd point motion, no time diff
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Motion, 200.0f, 200.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::MOTION, 200.0f, 200.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Motion, 201.0f, 201.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::MOTION, 201.0f, 201.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 101.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Motion, 202.0f, 202.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::MOTION, 202.0f, 202.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 2, TouchPoint::Up, 202.0f, 202.0f );
+ Integration::Point point = GeneratePoint( 2, PointState::UP, 202.0f, 202.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
END_TEST;
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( pointCount, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( pointCount, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
}
// Send up, should not be able to send as combiner has been reset.
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
}
// Send up, should not be able to send as combiner has been reset.
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- TouchPoint point( 1, TouchPoint::Stationary, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint( 1, PointState::STATIONARY, 100.0f, 100.0f );
DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
}
};
-Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, Vector2 screenPosition )
+Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, const Vector2& screenPosition )
{
Integration::TouchEvent touchEvent;
- touchEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+ Integration::Point point;
+ point.SetState( static_cast< PointState::Type >( state ) );
+ point.SetScreenPosition( screenPosition );
+ touchEvent.points.push_back( point );
return touchEvent;
}
{
}
-void MultiPointEvent::AddPoint(const TouchPoint& point)
+void MultiPointEvent::AddPoint( const Point& point )
{
points.push_back(point);
}
-TouchPoint& MultiPointEvent::GetPoint(unsigned int point)
+Point& MultiPointEvent::GetPoint( unsigned int point )
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
}
-const TouchPoint& MultiPointEvent::GetPoint(unsigned int point) const
+const Point& MultiPointEvent::GetPoint( unsigned int point ) const
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/events/event.h>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/integration-api/events/point.h>
namespace Dali DALI_IMPORT_API
{
namespace Integration
{
+typedef std::vector< Point > PointContainer; ///< Container of points
+typedef PointContainer::iterator PointContainerIterator; ///< Iterator for Dali::Integration::PointContainer
+typedef PointContainer::const_iterator PointContainerConstIterator; ///< Const iterator for Dali::Integration::PointContainer
+
/**
* An instance of this structure should be used by the adaptor to send a multi-point event to Dali core.
*
MultiPointEvent(Type eventType, unsigned long time);
public:
+
// Data
/**
- * @copydoc Dali::MultiPointEvent::points
+ * @brief A series of points
*/
- std::vector<TouchPoint> points;
+ PointContainer points;
/**
- * @copydoc Dali::MultiPointEvent::time
+ * @brief The time
*/
unsigned long time;
// Convenience Methods
/**
- * Adds a point to the MultiPointEvent.
+ * @brief Adds a point to the MultiPointEvent.
* @param[in] point The point to add.
*/
- void AddPoint(const TouchPoint& point);
+ void AddPoint( const Point& point );
/**
- * @copydoc Dali::MultiPointEvent::GetPoint()
+ * @brief Retrieves the Point at position point.
+ * @return The Point at position point.
*/
- TouchPoint& GetPoint(unsigned int point);
+ Point& GetPoint( unsigned int point );
/**
- * @copydoc Dali::MultiPointEvent::GetPoint()
+ * @brief Retrieves a const ref of the Point at position point.
+ * @return The const ref of the Point at position point.
*/
- const TouchPoint& GetPoint(unsigned int point) const;
+ const Point& GetPoint( unsigned int point ) const;
/**
- * @copydoc Dali::MultiPointEvent::GetPointCount() const
+ * @brief The total number of Points in this TouchEvent.
+ * @return The point count.
*/
unsigned int GetPointCount() const;
};
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/integration-api/events/point.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+Point::Point()
+: mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
+ mEllipseRadius(),
+ mAngle( 0.0f ),
+ mPressure( 1.0f ),
+ mRadius( 0.0f )
+{
+}
+
+Point::Point( const TouchPoint& touchPoint )
+: mTouchPoint( touchPoint ),
+ mEllipseRadius(),
+ mAngle( 0.0f ),
+ mPressure( 1.0f ),
+ mRadius( 0.0f )
+{
+}
+
+Point::~Point()
+{
+}
+
+void Point::SetDeviceId( int deviceId )
+{
+ mTouchPoint.deviceId = deviceId;
+}
+
+void Point::SetState( PointState::Type state )
+{
+ mTouchPoint.state = static_cast< TouchPoint::State >( state );
+}
+
+void Point::SetScreenPosition( const Vector2& screenPosition )
+{
+ mTouchPoint.screen = screenPosition;
+}
+
+void Point::SetRadius( float radius )
+{
+ mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
+}
+
+void Point::SetRadius( float radius, Vector2 ellipseRadius )
+{
+ mRadius = radius;
+ mEllipseRadius = ellipseRadius;
+}
+
+void Point::SetPressure( float pressure )
+{
+ mPressure = pressure;
+}
+
+void Point::SetAngle( Degree angle )
+{
+ mAngle = angle;
+}
+
+int Point::GetDeviceId() const
+{
+ return mTouchPoint.deviceId;
+}
+
+PointState::Type Point::GetState() const
+{
+ return static_cast< PointState::Type >( mTouchPoint.state );
+}
+
+const Vector2& Point::GetScreenPosition() const
+{
+ return mTouchPoint.screen;
+}
+
+float Point::GetRadius() const
+{
+ return mRadius;
+}
+
+const Vector2& Point::GetEllipseRadius() const
+{
+ return mEllipseRadius;
+}
+
+float Point::GetPressure() const
+{
+ return mPressure;
+}
+
+Degree Point::GetAngle() const
+{
+ return mAngle;
+}
+
+void Point::SetHitActor( Actor hitActor )
+{
+ mTouchPoint.hitActor = hitActor;
+}
+
+void Point::SetLocalPosition( const Vector2& localPosition )
+{
+ mTouchPoint.local = localPosition;
+}
+
+Actor Point::GetHitActor() const
+{
+ return mTouchPoint.hitActor;
+}
+
+const Vector2& Point::GetLocalPosition() const
+{
+ return mTouchPoint.local;
+}
+
+const TouchPoint& Point::GetTouchPoint() const
+{
+ return mTouchPoint;
+}
+
+} // namespace Integration
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTEGRATION_POINT_H__
+#define __DALI_INTEGRATION_POINT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/events/point-state.h>
+#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/events/touch-point.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+/**
+ * @brief A Point represents a point on the screen that is currently being touched or where touch has stopped.
+ */
+struct DALI_IMPORT_API Point
+{
+ /**
+ * @brief Default Constructor
+ */
+ Point();
+
+ /**
+ * @brief Constructor which creates a Point instance from a TouchPoint.
+ * @param[in] touchPoint The touch-point to copy from.
+ */
+ explicit Point( const TouchPoint& touchPoint );
+
+ /**
+ * @brief Destructor
+ */
+ ~Point();
+
+ /**
+ * @brief Set the Unique Device ID.
+ *
+ * Each touch point has a unique device ID which specifies the touch device for that point.
+ *
+ * @param[in] deviceId The Unique Device ID.
+ */
+ void SetDeviceId( int deviceId );
+
+ /**
+ * @brief Set the state of the point.
+ * @param[in] state The state of the point.
+ */
+ void SetState( PointState::Type state );
+
+ /**
+ * @brief Set the screen position of the point from the top-left of the screen.
+ * @param[in] screenPosition The screen position of the point from the top-left of the screen.
+ */
+ void SetScreenPosition( const Vector2& screenPosition );
+
+ /**
+ * @brief Set the radius of the press point.
+ *
+ * This is the average of both the horizontal and vertical radii of the press point.
+ * @param[in] radius The average of both the horizontal and vertical radii.
+ */
+ void SetRadius( float radius );
+
+ /**
+ * @brief Set the radius of the press point as an ellipse.
+ * @param[in] radius The average of both the horizontal and vertical radii.
+ * @param[in] ellipseRadius The horizontal and vertical radii of the press point (different if an ellipse).
+ */
+ void SetRadius( float radius, Vector2 ellipseRadius );
+
+ /**
+ * @brief Sets the touch pressure.
+ *
+ * The pressure range starts at 0.0f.
+ * Normal pressure is defined as 1.0f.
+ * A value between 0.0f and 1.0f means light pressure has been applied.
+ * A value greater than 1.0f means more pressure than normal has been applied.
+ *
+ * @param[in] pressure The touch pressure.
+ */
+ void SetPressure( float pressure );
+
+ /**
+ * @brief Sets the angle of the press point relative to the Y-Axis.
+ * @param[in] angle The angle of the press point relative to the Y-Axis.
+ */
+ void SetAngle( Degree angle );
+
+ /**
+ * @brief Retrieve the Unique Device ID of the point.
+ * @return The Unique Device ID of the point.
+ */
+ int GetDeviceId() const;
+
+ /**
+ * @brief Retrieve the state of the point.
+ * @return The state of the point.
+ */
+ PointState::Type GetState() const;
+
+ /**
+ * @brief Retrieve the screen position from the top-left of the screen.
+ * @return The screen position from the top-left of the screen.
+ */
+ const Vector2& GetScreenPosition() const;
+
+ /**
+ * @brief Retrieve the radius of the press point.
+ * @return The radius of the press point.
+ * @see SetRadius(float)
+ * @see SetRadius(float,Vector2)
+ */
+ float GetRadius() const;
+
+ /**
+ * @brief Retrieve BOTH the horizontal and the vertical radii of the press point.
+ * @return The radius of the press point.
+ * @see SetRadius(float)
+ * @see SetRadius(float,Vector2)
+ */
+ const Vector2& GetEllipseRadius() const;
+
+ /**
+ * @brief Retrieves the touch pressure.
+ *
+ * @return The touch pressure.
+ * @see SetPressure()
+ */
+ float GetPressure() const;
+
+ /**
+ * @brief Retrieve the angle of the press point relative to the Y-Axis.
+ * @return The angle of the press point.
+ */
+ Degree GetAngle() const;
+
+public: // Not intended for Integration API developers
+
+ /**
+ * @brief Sets the hit actor under this point.
+ * @param[in] hitActor The hit actor.
+ */
+ DALI_INTERNAL void SetHitActor( Actor hitActor );
+
+ /**
+ * @brief Set the co-ordinates relative to the top-left of the hit-actor.
+ * @param[in] localPosition The local position.
+ * @note The top-left of an actor is (0.0, 0.0, 0.5).
+ */
+ DALI_INTERNAL void SetLocalPosition( const Vector2& localPosition );
+
+ /**
+ * @brief Retrieve the Hit Actor.
+ * @return The hit actor.
+ */
+ DALI_INTERNAL Actor GetHitActor() const;
+
+ /**
+ * @brief Retrieve the local position relative to the top-left of the hit-actor.
+ * @return The local position.
+ * @note The top-left of an actor is (0.0, 0.0, 0.5).
+ */
+ DALI_INTERNAL const Vector2& GetLocalPosition() const;
+
+ /**
+ * @brief Retrieve the touch point equivalent of this point for old API.
+ * @return The touch point equivalent.
+ */
+ DALI_INTERNAL const TouchPoint& GetTouchPoint() const;
+
+private:
+
+ TouchPoint mTouchPoint; ///< Stores screen position, device Id, local & screen positions and the hit-actor. @see TouchPoint
+ Vector2 mEllipseRadius; ///< Radius of both the horizontal and vertical radius (useful if an ellipse).
+ Degree mAngle; ///< The angle of the press point, relative to the Y-Axis.
+ float mPressure; ///< The touch pressure.
+ float mRadius; ///< Radius of the press point, an average of the ellipse radius.
+};
+
+} // namespace Integration
+
+} // namespace Dali
+
+#endif // __DALI_TOUCH_POINT_H__
* @param[in] touchPoint The point to add.
* @param[in] pointTime The time of the point event.
*/
- PointInfo( const TouchPoint& touchPoint, unsigned long pointTime )
+ PointInfo( const Point& touchPoint, unsigned long pointTime )
: point( touchPoint ),
time( pointTime )
{
// Data
- TouchPoint point; ///< The point.
+ Point point; ///< The point.
unsigned long time; ///< The time the point event took place.
};
{
}
-TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( const TouchPoint& point, unsigned long time, TouchEvent& touchEvent, HoverEvent& hoverEvent )
+TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( const Point& point, unsigned long time, TouchEvent& touchEvent, HoverEvent& hoverEvent )
{
TouchEventCombiner::EventDispatchType dispatchEvent( TouchEventCombiner::DispatchNone );
+ const PointState::Type state = point.GetState();
+ const int deviceId = point.GetDeviceId();
- switch ( point.state )
+ switch ( state )
{
- case TouchPoint::Started:
+ case PointState::STARTED:
{
touchEvent.time = time;
bool addToContainer( true );
// Iterate through already stored touch points and add to TouchEvent
for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
{
- if ( iter->point.deviceId != point.deviceId )
+ if ( iter->point.GetDeviceId() != deviceId )
{
- iter->point.state = TouchPoint::Stationary;
+ iter->point.SetState( PointState::STATIONARY );
}
else
{
PointInfoContainer::iterator match( mHoveredPoints.end() );
for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
{
- if ( point.deviceId == iter->point.deviceId )
+ if ( deviceId == iter->point.GetDeviceId() )
{
match = iter;
// Add new point to the HoverEvent
- iter->point.state = TouchPoint::Finished;
+ iter->point.SetState( PointState::FINISHED );
hoverEvent.AddPoint( iter->point );
}
else
{
- iter->point.state = TouchPoint::Stationary;
+ iter->point.SetState( PointState::STATIONARY );
hoverEvent.AddPoint( iter->point );
}
}
break;
}
- case TouchPoint::Finished:
+ case PointState::FINISHED:
{
touchEvent.time = time;
PointInfoContainer::iterator match( mPressedPoints.end() );
for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
{
- if ( point.deviceId == iter->point.deviceId )
+ if ( deviceId == iter->point.GetDeviceId() )
{
match = iter;
}
else
{
- iter->point.state = TouchPoint::Stationary;
+ iter->point.SetState( PointState::STATIONARY );
touchEvent.AddPoint( iter->point );
}
}
// Iterate through already stored touch points for HoverEvent and delete them
for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
{
- if ( iter->point.deviceId == point.deviceId )
+ if ( iter->point.GetDeviceId() == deviceId )
{
iter = mHoveredPoints.erase( iter );
}
break;
}
- case TouchPoint::Motion:
+ case PointState::MOTION:
{
bool fromNewDeviceId = false;
bool ignore = false;
PointInfoContainer::iterator match = mPressedPoints.end();
+ const Vector2& pointScreenPosition = point.GetScreenPosition();
for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
{
- if ( point.deviceId == iter->point.deviceId )
+ if ( deviceId == iter->point.GetDeviceId() )
{
unsigned long timeDiff( time - iter->time );
break;
}
- if ( ( std::abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) &&
- ( std::abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) )
+ const Vector2& currentScreenPosition = iter->point.GetScreenPosition();
+ if ( ( std::abs( pointScreenPosition.x - currentScreenPosition.x ) < mMinMotionDistance.x ) &&
+ ( std::abs( pointScreenPosition.y - currentScreenPosition.y ) < mMinMotionDistance.y ) )
{
// Not enough positional change from last event so ignore
ignore = true;
}
else
{
- iter->point.state = TouchPoint::Stationary;
+ iter->point.SetState( PointState::STATIONARY );
touchEvent.AddPoint( iter->point );
}
}
// Iterate through already stored touch points and add to HoverEvent
bool ignore = false;
PointInfoContainer::iterator match = mHoveredPoints.end();
+ const Vector2& pointScreenPosition = point.GetScreenPosition();
for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
{
- if ( iter->point.deviceId == point.deviceId )
+ if ( iter->point.GetDeviceId() == deviceId )
{
unsigned long timeDiff( time - iter->time );
break;
}
- if ( ( std::abs( point.screen.x - iter->point.screen.x ) < mMinMotionDistance.x ) &&
- ( std::abs( point.screen.y - iter->point.screen.y ) < mMinMotionDistance.y ) )
+ const Vector2& currentScreenPosition = iter->point.GetScreenPosition();
+ if ( ( std::abs( pointScreenPosition.x - currentScreenPosition.x ) < mMinMotionDistance.x ) &&
+ ( std::abs( pointScreenPosition.y - currentScreenPosition.y ) < mMinMotionDistance.y ) )
{
// Not enough positional change from last event so ignore
ignore = true;
}
else
{
- iter->point.state = TouchPoint::Stationary;
+ iter->point.SetState( PointState::STATIONARY );
hoverEvent.AddPoint( iter->point );
}
}
{
if( match == mHoveredPoints.end() )
{
- TouchPoint hoverPoint(point);
- hoverPoint.state = TouchPoint::Started; // The first hover event received
+ Point hoverPoint(point);
+ hoverPoint.SetState( PointState::STARTED ); // The first hover event received
mHoveredPoints.push_back( PointInfo( hoverPoint, time ) );
hoverEvent.AddPoint( hoverPoint );
}
break;
}
- case TouchPoint::Interrupted:
+ case PointState::INTERRUPTED:
{
Reset();
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/events/touch-point.h>
#include <dali/public-api/math/vector2.h>
+#include <dali/integration-api/events/point.h>
-namespace Dali DALI_IMPORT_API
+namespace Dali
{
namespace Integration
/**
* Dali::Integration::TouchEventCombiner is a utility class, an instance of which, should be created
* upon initialisation. It accepts single Point(s) containing information about a touch area and
- * creates a TouchEvent and/or HoverEvent combining the latest event's information with previous TouchPoint(s).
+ * creates a TouchEvent and/or HoverEvent combining the latest event's information with previous Point(s).
*
* The created TouchEvent and/or HoverEvent can then be sent to the Dali Core as indicated by the GetNextTouchEvent()
* method.
* - Motion event throttling is carried out to satisfy the minimum distance and time delta required.
* - If an interrupted event is received, then any stored Point history is cleared.
*/
-class TouchEventCombiner
+class DALI_IMPORT_API TouchEventCombiner
{
public:
*
* @return true if the point is beyond the different thresholds set thus, should be sent to core, false otherwise.
*/
- EventDispatchType GetNextTouchEvent( const TouchPoint& point, unsigned long time, TouchEvent& touchEvent, HoverEvent& hoverEvent );
+ EventDispatchType GetNextTouchEvent( const Point& point, unsigned long time, TouchEvent& touchEvent, HoverEvent& hoverEvent );
/**
* Sets the minimum time (in ms) that should occur between motion events.
/**
* This resets any information contained by the TouchEventCombiner.
* This may be required if some platform event has occurred which makes it necessary to reset any
- * TouchPoint information that the combiner may store.
+ * Point information that the combiner may store.
*/
void Reset();
$(platform_abstraction_src_dir)/events/multi-point-event-integ.cpp \
$(platform_abstraction_src_dir)/events/pan-gesture-event.cpp \
$(platform_abstraction_src_dir)/events/pinch-gesture-event.cpp \
+ $(platform_abstraction_src_dir)/events/point.cpp \
$(platform_abstraction_src_dir)/events/tap-gesture-event.cpp \
$(platform_abstraction_src_dir)/events/touch-event-combiner.cpp \
$(platform_abstraction_src_dir)/events/touch-event-integ.cpp
$(platform_abstraction_src_dir)/events/multi-point-event-integ.h \
$(platform_abstraction_src_dir)/events/pan-gesture-event.h \
$(platform_abstraction_src_dir)/events/pinch-gesture-event.h \
+ $(platform_abstraction_src_dir)/events/point.h \
$(platform_abstraction_src_dir)/events/tap-gesture-event.h \
$(platform_abstraction_src_dir)/events/touch-event-combiner.h \
$(platform_abstraction_src_dir)/events/touch-event-integ.h
consumed = mTouchSignal.Emit( handle, touch );
}
- if( !mTouchedSignal.Empty() || !mTouchSignal.Empty() )
+ if( !mTouchedSignal.Empty() )
{
Dali::Actor handle( this );
consumed |= mTouchedSignal.Emit( handle, event );
DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty HoverEvent sent from Integration\n" );
Stage& stage = mStage;
+ TouchPoint::State state = static_cast< TouchPoint::State >( event.points[0].GetState() );
PRINT_HIERARCHY(gLogFilter);
// 1) Check if it is an interrupted event - we should inform our last primary hit actor about this
// and emit the stage signal as well.
- if ( event.points[0].state == TouchPoint::Interrupted )
+ if ( state == TouchPoint::Interrupted )
{
Dali::Actor consumingActor;
- hoverEvent.points.push_back(event.points[0]);
+ hoverEvent.points.push_back( event.points[0].GetTouchPoint() );
Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
if ( lastPrimaryHitActor )
Dali::RenderTask currentRenderTask;
- for ( TouchPointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
+ for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
{
HitTestAlgorithm::Results hitTestResults;
ActorHoverableCheck actorHoverableCheck;
- HitTestAlgorithm::HitTest( stage, iter->screen, hitTestResults, actorHoverableCheck );
+ HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
- TouchPoint newPoint( iter->deviceId, iter->state, iter->screen.x, iter->screen.y );
+ TouchPoint newPoint( iter->GetTouchPoint() );
newPoint.hitActor = hitTestResults.actor;
newPoint.local = hitTestResults.actorCoordinates;
hoverEvent.points.push_back( newPoint );
DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
- TOUCH_POINT_STATE[iter->state], iter->screen.x, iter->screen.y,
+ TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y,
( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ),
( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ),
hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
{
}
+TouchDataPtr TouchData::Clone( const TouchData& other )
+{
+ TouchDataPtr touchData( new TouchData );
+ touchData->mPoints = other.mPoints;
+ touchData->mTime = other.mTime;
+ return touchData;
+}
+
TouchData::~TouchData()
{
}
return mTime;
}
-size_t TouchData::GetPointCount() const
+std::size_t TouchData::GetPointCount() const
{
return mPoints.size();
}
-int32_t TouchData::GetDeviceId( size_t point ) const
+int32_t TouchData::GetDeviceId( std::size_t point ) const
{
if( point < mPoints.size() )
{
- return mPoints[ point ].deviceId;
+ return mPoints[ point ].GetDeviceId();
}
return -1;
}
-PointState::Type TouchData::GetState( size_t point ) const
+PointState::Type TouchData::GetState( std::size_t point ) const
{
if( point < mPoints.size() )
{
- return static_cast< PointState::Type >( mPoints[ point ].state );
+ return mPoints[ point ].GetState();
}
return PointState::FINISHED;
}
-Dali::Actor TouchData::GetHitActor( size_t point ) const
+Dali::Actor TouchData::GetHitActor( std::size_t point ) const
{
if( point < mPoints.size() )
{
- return mPoints[ point ].hitActor;
+ return mPoints[ point ].GetHitActor();
}
return Dali::Actor();
}
-const Vector2& TouchData::GetLocalPosition( size_t point ) const
+const Vector2& TouchData::GetLocalPosition( std::size_t point ) const
+{
+ if( point < mPoints.size() )
+ {
+ return mPoints[ point ].GetLocalPosition();
+ }
+ return Vector2::ZERO;
+}
+
+const Vector2& TouchData::GetScreenPosition( std::size_t point ) const
{
if( point < mPoints.size() )
{
- return mPoints[ point ].local;
+ return mPoints[ point ].GetScreenPosition();
}
return Vector2::ZERO;
}
-const Vector2& TouchData::GetScreenPosition( size_t point ) const
+float TouchData::GetRadius( std::size_t point ) const
+{
+ if( point < mPoints.size() )
+ {
+ return mPoints[ point ].GetRadius();
+ }
+ return 0.0f;
+}
+
+const Vector2& TouchData::GetEllipseRadius( std::size_t point ) const
{
if( point < mPoints.size() )
{
- return mPoints[ point ].screen;
+ return mPoints[ point ].GetEllipseRadius();
}
return Vector2::ZERO;
}
-const TouchPoint& TouchData::GetPoint( size_t point ) const
+float TouchData::GetPressure( std::size_t point ) const
+{
+ if( point < mPoints.size() )
+ {
+ return mPoints[ point ].GetPressure();
+ }
+ return 1.0f;
+}
+
+Degree TouchData::GetAngle( std::size_t point ) const
+{
+ if( point < mPoints.size() )
+ {
+ return mPoints[ point ].GetAngle();
+ }
+ return Degree();
+}
+
+const Integration::Point& TouchData::GetPoint( std::size_t point ) const
{
DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
return mPoints[ point ];
}
-void TouchData::AddPoint( const TouchPoint& point )
+Integration::Point& TouchData::GetPoint( std::size_t point )
{
- mPoints.push_back( point );
+ DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
+ return mPoints[ point ];
}
-void TouchData::SetPoints( const TouchPointContainer& points )
+void TouchData::AddPoint( const Integration::Point& point )
{
- mPoints = points;
+ mPoints.push_back( point );
}
} // namsespace Internal
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/point-state.h>
#include <dali/public-api/events/touch-data.h>
-#include <dali/public-api/events/touch-point.h>
#include <dali/public-api/object/base-object.h>
+#include <dali/integration-api/events/point.h>
namespace Dali
{
namespace Internal
{
+class TouchData;
+typedef IntrusivePtr< TouchData > TouchDataPtr;
+
/**
* @copydoc Dali::TouchData
*/
TouchData( unsigned long time );
/**
+ * @brief Clones the TouchData object.
+ *
+ * Required because base class copy constructor is not implemented.
+ * @param[in] other The TouchData to clone from.
+ * @return A new TouchData object which is has the same touch point data.
+ */
+ static TouchDataPtr Clone( const TouchData& other );
+
+ /**
* @brief Destructor
*/
~TouchData();
/**
* @copydoc Dali::TouchData::GetPointCount()
*/
- size_t GetPointCount() const;
+ std::size_t GetPointCount() const;
/**
* @copydoc Dali::TouchData::GetDeviceId()
*/
- int32_t GetDeviceId( size_t point ) const;
+ int32_t GetDeviceId( std::size_t point ) const;
/**
* @copydoc Dali::TouchData::GetGetState()
*/
- PointState::Type GetState( size_t point ) const;
+ PointState::Type GetState( std::size_t point ) const;
/**
* @copydoc Dali::TouchData::GetHitActor()
*/
- Dali::Actor GetHitActor( size_t point ) const;
+ Dali::Actor GetHitActor( std::size_t point ) const;
/**
* @copydoc Dali::TouchData::GetLocalPosition()
*/
- const Vector2& GetLocalPosition( size_t point ) const;
+ const Vector2& GetLocalPosition( std::size_t point ) const;
/**
* @copydoc Dali::TouchData::GetScreenPosition()
*/
- const Vector2& GetScreenPosition( size_t point ) const;
+ const Vector2& GetScreenPosition( std::size_t point ) const;
+
+ /**
+ * @copydoc Dali::TouchData::GetRadius()
+ */
+ float GetRadius( std::size_t point ) const;
+
+ /**
+ * @copydoc Dali::TouchData::GetEllipseRadius()
+ */
+ const Vector2& GetEllipseRadius( std::size_t point ) const;
+
+ /**
+ * @copydoc Dali::TouchData::GetPressure()
+ */
+ float GetPressure( std::size_t point ) const;
+
+ /**
+ * @copydoc Dali::TouchData::GetAngle()
+ */
+ Degree GetAngle( std::size_t point ) const;
+
+ /**
+ * @brief Returns a const reference to a point at the index requested.
+ *
+ * The first point in the set is always the primary point (i.e. the first point touched in a multi-touch event).
+ *
+ * @param[in] point The index of the required Point.
+ * @return A const reference to the Point at the position requested
+ * @note point should be less than the value returned by GetPointCount(). Will assert if out of range.
+ */
+ const Integration::Point& GetPoint( std::size_t point ) const;
/**
* @brief Returns a reference to a point at the index requested.
*
* The first point in the set is always the primary point (i.e. the first point touched in a multi-touch event).
*
- * @SINCE_1_1.36
* @param[in] point The index of the required Point.
* @return A reference to the Point at the position requested
* @note point should be less than the value returned by GetPointCount(). Will assert if out of range.
*/
- const TouchPoint& GetPoint( size_t point ) const;
+ Integration::Point& GetPoint( std::size_t point );
// Setters
* @brief Adds a point to this touch event handler.
* @param[in] point The point to add to the touch event handler.
*/
- void AddPoint( const TouchPoint& point );
-
- /**
- * @brief Overwrites the internal container with the point container specified.
- *
- * @param[in] points The point container.
- */
- void SetPoints( const TouchPointContainer& points );
+ void AddPoint( const Integration::Point& point );
private:
/// Undefined
TouchData& operator=( const TouchData& other );
- TouchPointContainer mPoints; ///< Container of the points for this touch event.
- unsigned long mTime; ///< The time (in ms) that the touch event occurred.
+ std::vector< Integration::Point > mPoints; ///< Container of the points for this touch event.
+ unsigned long mTime; ///< The time (in ms) that the touch event occurred.
};
} // namespace Internal
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TOUCH_PROCESSOR" );
-const char * TOUCH_POINT_STATE[TouchPoint::Last] =
+const char * TOUCH_POINT_STATE[ 6 ] =
{
- "Down",
- "Up",
- "Motion",
- "Leave",
- "Stationary",
- "Interrupted",
+ "DOWN",
+ "UP",
+ "MOTION",
+ "LEAVE",
+ "STATIONARY",
+ "INTERRUPTED",
};
#endif // defined(DEBUG_ENABLED)
return consumedActor;
}
-Dali::Actor AllocAndEmitTouchSignals( unsigned long time, Dali::Actor actor, const TouchPoint& point )
+Dali::Actor AllocAndEmitTouchSignals( unsigned long time, Dali::Actor actor, const Integration::Point& point )
{
TouchEvent touchEvent( time );
- IntrusivePtr< TouchData > touchData( new TouchData( time ) );
+ TouchDataPtr touchData( new TouchData( time ) );
Dali::TouchData touchDataHandle( touchData.Get() );
- touchEvent.points.push_back( point );
+ touchEvent.points.push_back( point.GetTouchPoint() );
touchData->AddPoint( point );
return EmitTouchSignals( actor, touchEvent, touchDataHandle );
/**
* Changes the state of the primary point to leave and emits the touch signals
*/
-Dali::Actor EmitTouchSignals( Actor* actor, RenderTask& renderTask, const TouchEvent& originalEvent, TouchPoint::State state )
+Dali::Actor EmitTouchSignals( Actor* actor, RenderTask& renderTask, const TouchEvent& originalEvent, const TouchDataPtr& originalTouchData, PointState::Type state )
{
- TouchEvent touchEvent( originalEvent );
+ Dali::Actor consumingActor;
- DALI_ASSERT_DEBUG( NULL != actor && "NULL actor pointer" );
if( actor )
{
- TouchPoint& primaryPoint = touchEvent.points[0];
+ TouchDataPtr touchData = TouchData::Clone( *originalTouchData.Get() );
- actor->ScreenToLocal( renderTask, primaryPoint.local.x, primaryPoint.local.y, primaryPoint.screen.x, primaryPoint.screen.y );
+ Integration::Point& primaryPoint = touchData->GetPoint( 0 );
- primaryPoint.hitActor = Dali::Actor(actor);
- primaryPoint.state = state;
- }
+ const Vector2& screenPosition = primaryPoint.GetScreenPosition();
+ Vector2 localPosition;
+ actor->ScreenToLocal( renderTask, localPosition.x, localPosition.y, screenPosition.x, screenPosition.y );
+
+ primaryPoint.SetLocalPosition( localPosition );
+ primaryPoint.SetHitActor( Dali::Actor( actor ) );
+ primaryPoint.SetState( state );
- IntrusivePtr< TouchData > touchData( new TouchData( touchEvent.time ) );
- touchData->SetPoints( touchEvent.points );
+ TouchEvent touchEvent( originalEvent );
+ touchEvent.points[0] = primaryPoint.GetTouchPoint();
+
+ consumingActor = EmitTouchSignals( Dali::Actor(actor), touchEvent, Dali::TouchData( touchData.Get() ) );
+ }
- return EmitTouchSignals( Dali::Actor(actor), touchEvent, Dali::TouchData( touchData.Get() ) );
+ return consumingActor;
}
} // unnamed namespace
// 1) Check if it is an interrupted event - we should inform our last primary hit actor about this
// and emit the stage signal as well.
- if ( event.points[0].state == TouchPoint::Interrupted )
+ if ( event.points[0].GetState() == PointState::INTERRUPTED )
{
Dali::Actor consumingActor;
- TouchPoint currentPoint( event.points[0] );
+ Integration::Point currentPoint( event.points[0] );
Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
if ( lastPrimaryHitActor )
{
Dali::Actor lastPrimaryHitActorHandle( lastPrimaryHitActor );
- currentPoint.hitActor = lastPrimaryHitActorHandle;
+ currentPoint.SetHitActor( lastPrimaryHitActorHandle );
consumingActor = AllocAndEmitTouchSignals( event.time, lastPrimaryHitActorHandle, currentPoint );
}
lastConsumedActor != consumingActor )
{
Dali::Actor lastConsumedActorHandle( lastConsumedActor );
- currentPoint.hitActor = lastConsumedActorHandle;
+ currentPoint.SetHitActor( lastConsumedActorHandle );
AllocAndEmitTouchSignals( event.time, lastConsumedActorHandle, currentPoint );
}
{
Dali::Actor touchDownConsumedActorHandle( touchDownConsumedActor );
- currentPoint.hitActor = touchDownConsumedActorHandle;
+ currentPoint.SetHitActor( touchDownConsumedActorHandle );
AllocAndEmitTouchSignals( event.time, touchDownConsumedActorHandle, currentPoint );
}
mTouchDownConsumedActor.SetActor( NULL );
mLastRenderTask.Reset();
- currentPoint.hitActor.Reset();
+ currentPoint.SetHitActor( Dali::Actor() );
TouchEvent touchEvent( event.time );
- IntrusivePtr< TouchData > touchData( new TouchData( event.time ) );
+ TouchDataPtr touchData( new TouchData( event.time ) );
Dali::TouchData touchDataHandle( touchData.Get() );
- touchEvent.points.push_back( currentPoint );
+ touchEvent.points.push_back( currentPoint.GetTouchPoint() );
touchData->AddPoint( currentPoint );
mStage.EmitTouchedSignal( touchEvent, touchDataHandle );
// 2) Hit Testing.
TouchEvent touchEvent( event.time );
- IntrusivePtr< TouchData > touchData( new TouchData( event.time ) );
+ TouchDataPtr touchData( new TouchData( event.time ) );
Dali::TouchData touchDataHandle( touchData.Get() );
DALI_LOG_INFO( gLogFilter, Debug::Concise, "\n" );
Dali::RenderTask currentRenderTask;
- for ( TouchPointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
+ for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
{
HitTestAlgorithm::Results hitTestResults;
- HitTestAlgorithm::HitTest( stage, iter->screen, hitTestResults );
+ HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults );
- TouchPoint newPoint( iter->deviceId, iter->state, iter->screen.x, iter->screen.y, hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
- newPoint.hitActor = hitTestResults.actor;
+ Integration::Point newPoint( *iter );
+ newPoint.SetHitActor( hitTestResults.actor );
+ newPoint.SetLocalPosition( hitTestResults.actorCoordinates );
- touchEvent.points.push_back( newPoint );
+ touchEvent.points.push_back( newPoint.GetTouchPoint() );
touchData->AddPoint( newPoint );
DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
- TOUCH_POINT_STATE[iter->state], iter->screen.x, iter->screen.y,
+ TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y,
( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ),
( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ),
hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
Dali::Actor consumedActor;
if ( currentRenderTask )
{
- consumedActor = EmitTouchSignals( touchEvent.points[0].hitActor, touchEvent, touchDataHandle );
+ consumedActor = EmitTouchSignals( touchData->GetPoint( 0 ).GetHitActor(), touchEvent, touchDataHandle );
}
- TouchPoint& primaryPoint = touchEvent.points[0];
- Dali::Actor primaryHitActor = primaryPoint.hitActor;
- TouchPoint::State primaryPointState = primaryPoint.state;
+ Integration::Point& primaryPoint = touchData->GetPoint( 0 );
+ Dali::Actor primaryHitActor = primaryPoint.GetHitActor();
+ PointState::Type primaryPointState = primaryPoint.GetState();
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? (void*)&primaryPoint.hitActor.GetBaseObject() : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? (void*)&primaryHitActor.GetBaseObject() : NULL, primaryHitActor ? primaryHitActor.GetName().c_str() : "" );
DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" );
- if ( ( primaryPointState == TouchPoint::Down ) &&
+ if ( ( primaryPointState == PointState::DOWN ) &&
( touchEvent.GetPointCount() == 1 ) &&
( consumedActor && consumedActor.OnStage() ) )
{
Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
Actor* lastConsumedActor( mLastConsumedActor.GetActor() );
- if( (primaryPointState == TouchPoint::Motion) || (primaryPointState == TouchPoint::Up) || (primaryPointState == TouchPoint::Stationary) )
+ if( ( primaryPointState == PointState::MOTION ) || ( primaryPointState == PointState::UP ) || ( primaryPointState == PointState::STATIONARY ) )
{
if ( mLastRenderTask )
{
if ( lastPrimaryHitActor->GetLeaveRequired() )
{
DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() );
- leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, TouchPoint::Leave );
+ leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE );
}
}
else
// At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one.
// An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() );
- leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, TouchPoint::Interrupted );
+ leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED );
}
}
if( lastConsumedActor->GetLeaveRequired() )
{
DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() );
- EmitTouchSignals( lastConsumedActor, lastRenderTaskImpl, touchEvent, TouchPoint::Leave );
+ EmitTouchSignals( lastConsumedActor, lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE );
}
}
else
// At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one.
// An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() );
- EmitTouchSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, touchEvent, TouchPoint::Interrupted );
+ EmitTouchSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED );
}
}
}
// 5) If our primary point is an Up event, then the primary point (in multi-touch) will change next
// time so set our last primary actor to NULL. Do the same to the last consumed actor as well.
- if ( primaryPointState == TouchPoint::Up )
+ if ( primaryPointState == PointState::UP )
{
mLastPrimaryHitActor.SetActor( NULL );
mLastConsumedActor.SetActor( NULL );
{
switch ( primaryPointState )
{
- case TouchPoint::Up:
+ case PointState::UP:
{
Actor* touchDownConsumedActor( mTouchDownConsumedActor.GetActor() );
if ( touchDownConsumedActor &&
{
Dali::Actor touchDownConsumedActorHandle( touchDownConsumedActor );
- TouchPoint currentPoint = touchData->GetPoint( 0 );
- currentPoint.hitActor = touchDownConsumedActorHandle;
- currentPoint.state = TouchPoint::Interrupted;
+ Integration::Point currentPoint = touchData->GetPoint( 0 );
+ currentPoint.SetHitActor( touchDownConsumedActorHandle );
+ currentPoint.SetState( PointState::INTERRUPTED );
AllocAndEmitTouchSignals( event.time, touchDownConsumedActorHandle, currentPoint );
}
}
// No break, Fallthrough
- case TouchPoint::Down:
+ case PointState::DOWN:
{
mStage.EmitTouchedSignal( touchEvent, touchDataHandle );
break;
}
- case TouchPoint::Motion:
- case TouchPoint::Leave:
- case TouchPoint::Stationary:
- case TouchPoint::Interrupted:
- case TouchPoint::Last:
+ case PointState::MOTION:
+ case PointState::LEAVE:
+ case PointState::STATIONARY:
+ case PointState::INTERRUPTED:
{
// Ignore
break;
if ( actor == mLastPrimaryHitActor.GetActor() )
{
Dali::Actor handle( actor );
- TouchEvent touchEvent( 0 );
- touchEvent.points.push_back( TouchPoint( 0, TouchPoint::Interrupted, 0.0f, 0.0f ) );
- touchEvent.points[0].hitActor = handle;
- IntrusivePtr< TouchData > touchData( new TouchData );
- touchData->SetPoints( touchEvent.points );
+ Integration::Point point;
+ point.SetState( PointState::INTERRUPTED );
+ point.SetHitActor( handle );
+ TouchDataPtr touchData( new TouchData );
+ touchData->AddPoint( point );
Dali::TouchData touchDataHandle( touchData.Get() );
+
+ TouchEvent touchEvent( 0 );
+ touchEvent.points.push_back( point.GetTouchPoint() );
+
Dali::Actor eventConsumer = EmitTouchSignals( handle, touchEvent, touchDataHandle );
if ( mLastConsumedActor.GetActor() != eventConsumer )
return GetImplementation( *this ).GetTime();
}
-size_t TouchData::GetPointCount() const
+std::size_t TouchData::GetPointCount() const
{
return GetImplementation( *this ).GetPointCount();
}
-int32_t TouchData::GetDeviceId( size_t point ) const
+int32_t TouchData::GetDeviceId( std::size_t point ) const
{
return GetImplementation( *this ).GetDeviceId( point );
}
-PointState::Type TouchData::GetState( size_t point ) const
+PointState::Type TouchData::GetState( std::size_t point ) const
{
return GetImplementation( *this ).GetState( point );
}
-Actor TouchData::GetHitActor( size_t point ) const
+Actor TouchData::GetHitActor( std::size_t point ) const
{
return GetImplementation( *this ).GetHitActor( point );
}
-const Vector2& TouchData::GetLocalPosition( size_t point ) const
+const Vector2& TouchData::GetLocalPosition( std::size_t point ) const
{
return GetImplementation( *this ).GetLocalPosition( point );
}
-const Vector2& TouchData::GetScreenPosition( size_t point ) const
+const Vector2& TouchData::GetScreenPosition( std::size_t point ) const
{
return GetImplementation( *this ).GetScreenPosition( point );
}
+float TouchData::GetRadius( std::size_t point ) const
+{
+ return GetImplementation( *this ).GetRadius( point );
+}
+
+const Vector2& TouchData::GetEllipseRadius( std::size_t point ) const
+{
+ return GetImplementation( *this ).GetEllipseRadius( point );
+}
+
+float TouchData::GetPressure( std::size_t point ) const
+{
+ return GetImplementation( *this ).GetPressure( point );
+}
+
+Degree TouchData::GetAngle( std::size_t point ) const
+{
+ return GetImplementation( *this ).GetAngle( point );
+}
+
TouchData::TouchData( Internal::TouchData* internal )
: BaseHandle( internal )
{
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/events/point-state.h>
#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/math/degree.h>
namespace Dali
{
* @brief Copy constructor
*
* @SINCE_1_1.37
- * @param[in] other The TouchEventHandle to copy from.
+ * @param[in] other The TouchData to copy from.
*/
TouchData( const TouchData& other );
* @brief Assignment Operator
*
* @SINCE_1_1.37
- * @param[in] other The TouchEventHandle to copy from.
+ * @param[in] other The TouchData to copy from.
*/
TouchData& operator=( const TouchData& other );
unsigned long GetTime() const;
/**
- * @brief Returns the total number of points in this TouchEventHandle.
+ * @brief Returns the total number of points in this TouchData.
*
* @SINCE_1_1.37
* @return Total number of Points.
*/
- size_t GetPointCount() const;
+ std::size_t GetPointCount() const;
/**
* @brief Returns the ID of the device used for the Point specified.
* @return The Device ID of this point.
* @note If point is greater than GetPointCount() then this method will return -1.
*/
- int32_t GetDeviceId( size_t point ) const;
+ int32_t GetDeviceId( std::size_t point ) const;
/**
* @brief Retrieves the State of the point specified.
* @SINCE_1_1.37
* @param[in] point The point required.
* @return The state of the point specified.
- * @note If point is greater than GetPointCount() then this method will
- * return PointState::FINISHED.
+ * @note If point is greater than GetPointCount() then this method will return PointState::FINISHED.
* @see State
*/
- PointState::Type GetState( size_t point ) const;
+ PointState::Type GetState( std::size_t point ) const;
/**
* @brief Retrieve the actor that was underneath the point specified.
* @SINCE_1_1.37
* @param[in] point The point required.
* @return The actor that was underneath the point specified.
- * @note If point is greater than GetPointCount() then this method will return
- * an empty handle.
+ * @note If point is greater than GetPointCount() then this method will return an empty handle.
*/
- Actor GetHitActor( size_t point ) const;
+ Actor GetHitActor( std::size_t point ) const;
/**
* @brief Retrieve the co-ordinates relative to the top-left of the hit-actor at the point specified.
* then you should use Actor::ScreenToLocal().
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetLocalPosition( size_t point ) const;
+ const Vector2& GetLocalPosition( std::size_t point ) const;
/**
* @brief Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
* @return The co-ordinates relative to the top-left of the screen of the point specified.
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetScreenPosition( size_t point ) const;
+ const Vector2& GetScreenPosition( std::size_t point ) const;
+
+ /**
+ * @brief Retrieve the radius of the press point.
+ *
+ * This is the average of both the horizontal and vertical radii of the press point.
+ *
+ * @SINCE_1_1.39
+ * @param[in] point The point required.
+ * @return The radius of the press point.
+ * @note If point is greater than GetPointCount() then this method will return 0.0f.
+ */
+ float GetRadius( std::size_t point ) const;
+
+ /**
+ * @brief Retrieve BOTH the horizontal and the vertical radii of the press point.
+ *
+ * @SINCE_1_1.39
+ * @param[in] point The point required.
+ * @return The horizontal and vertical radii of the press point.
+ * @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
+ */
+ const Vector2& GetEllipseRadius( std::size_t point ) const;
+
+ /**
+ * @brief Retrieve the touch pressure.
+ *
+ * The pressure range starts at 0.0f.
+ * Normal pressure is defined as 1.0f.
+ * A value between 0.0f and 1.0f means light pressure has been applied.
+ * A value greater than 1.0f means more pressure than normal has been applied.
+ *
+ * @SINCE_1_1.39
+ * @param[in] point The point required.
+ * @return The touch pressure.
+ * @note If point is greater than GetPointCount() then this method will return 1.0f.
+ */
+ float GetPressure( std::size_t point ) const;
+
+ /**
+ * @brief Retrieve the angle of the press point relative to the Y-Axis.
+ *
+ * @SINCE_1_1.39
+ * @param[in] point The point required.
+ * @return The angle of the press point.
+ * @note If point is greater than GetPointCount() then this method will return Degree().
+ */
+ Degree GetAngle( std::size_t point ) const;
public: // Not intended for application developers
*/
/**
- * @DEPRECATED_1_1.37 Use TouchEventHandle instead
+ * @DEPRECATED_1_1.37 Use TouchData instead
*
* @brief Touch events are a collection of touch points at a specific moment in time.
*