/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void Reset()
{
functorCalled = false;
-
- hoverEvent.time = 0u;
- hoverEvent.points.clear();
-
+ hoverEvent.Reset();
hoveredActor.Reset();
}
}
};
-Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
+Integration::HoverEvent GenerateSingleHover( PointState::Type state, const Vector2& screenPosition )
{
Integration::HoverEvent hoverEvent;
Integration::Point point;
- point.SetState( static_cast< PointState::Type >( state ) );
+ point.SetState( state );
point.SetScreenPosition( screenPosition );
hoverEvent.points.push_back( point );
return hoverEvent;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
-
- TouchPoint point = data.hoverEvent.GetPoint(0);
- DALI_TEST_EQUALS( TouchPoint::Started, point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, point.screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, point.local, 0.1f, TEST_LOCATION );
-
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
data.Reset();
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Motion, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
data.Reset();
// Emit a finished signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Finished, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Finished, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
data.Reset();
// Emit a started signal where the actor is not present
screenCoordinates.x = screenCoordinates.y = 200.0f;
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_CHECK( !data.hoverEvent );
+
END_TEST;
}
Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// Emit another interrupted signal, our signal handler should not be called.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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 started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
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( GenerateSingleHover( TouchPoint::Motion, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Motion, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Motion, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
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( GenerateSingleHover( TouchPoint::Finished, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Finished, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Finished, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::FINISHED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Emit a started 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( GenerateSingleHover( TouchPoint::Started, screenCoordinates ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
+ DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
END_TEST;
}
rootActor.HoveredSignal().Connect( &application, rootFunctor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Emit an interrupted signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Emit another started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
rootData.Reset();
application.Render();
// Emit an interrupted signal, only root actor's signal should be called.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Interrupted, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Emit another interrupted state, none of the signal's should be called.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Leave, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// Another motion outside of actor, no signalling
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
+ application.ProcessEvent( GenerateSingleHover( 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( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Motion, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// We do not want to listen to leave events anymore
actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false );
// Another motion event outside of actor, no signalling
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
rootActor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Leave, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Leave, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Another motion outside of actor, only rootActor signalled
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Motion, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Motion, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Motion, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
// Another motion event outside of root actor, only root signalled
Vector2 stageSize( application.GetScene().GetSize() );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) );
+ application.ProcessEvent( GenerateSingleHover( 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( TouchPoint::Leave, rootData.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
END_TEST;
}
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
// Change actor to insensitive
actor.SetProperty( Actor::Property::SENSITIVE, false );
// Emit a motion signal, signalled with an interrupted
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
END_TEST;
}
rootActor.HoveredSignal().Connect( &application, rootFunctor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Started, rootData.hoverEvent.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.points[0].hitActor );
+ DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
+ DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
data.Reset();
rootData.Reset();
rootActor.SetProperty( Actor::Property::SENSITIVE, false );
// Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
END_TEST;
}
actor1.HoveredSignal().Connect( &application, functor );
// Hit in hittable area, actor1 should be hit
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.hoveredActor == actor1 );
data.Reset();
// Make layer1 insensitive, nothing should be hit
layer1.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.hoveredActor == actor1 );
data.Reset();
// Make rootActor insensitive, nothing should be hit
rootActor.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
actor2.HoveredSignal().Connect( &application, functor );
// Emit an event, should hit layer2
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
//DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 insensitive, should hit actor1
layer2.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.hoveredActor == actor1 );
data.Reset();
// Make layer2 sensitive again, should hit layer2
layer2.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
//DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
application.Render();
// Should hit actor1
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( data.hoveredActor == actor1 );
data.Reset();
application.Render();
// Should not hit anything
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
layer.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Started, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
DALI_TEST_CHECK( actor == data.hoveredActor );
END_TEST;
actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
application.Render();
// Emit another started event
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
END_TEST;
}
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
END_TEST;
}
actor.HoveredSignal().Connect( &application, functor );
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit a started and motion
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2( 11.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 12.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( 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( GenerateSingleHover( TouchPoint::Motion, Vector2( 200.0f, 200.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( TouchPoint::Leave, data.hoverEvent.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
data.Reset();
END_TEST;
actor.HoveredSignal().Connect( &application, functor );
// Emit an event within clipped area - no hit.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
data.Reset();
// Emit an event outside the clipped area but within the actor area, we should have a hit.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 60.0f, 60.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 60.0f, 60.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
clippingChild.HoveredSignal().Connect( &application, functor );
// Emit an event inside part of the child which is within the clipped area, we should have a hit.
- application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 30.0f, 30.0f ) ) );
+ application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 30.0f, 30.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/events/multi-point-event-util.h>
+#include <dali/internal/event/events/hover-event-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
/**
* Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached.
*/
-Dali::Actor EmitHoverSignals( Dali::Actor actor, const HoverEvent& event )
+Dali::Actor EmitHoverSignals( Dali::Actor actor, const Dali::HoverEvent& event )
{
Dali::Actor consumedActor;
return consumedActor;
}
+Dali::Actor AllocAndEmitHoverSignals( unsigned long time, Dali::Actor actor, const Integration::Point& point )
+{
+ HoverEventPtr hoverEvent( new HoverEvent( time ) );
+ Dali::HoverEvent hoverEventHandle( hoverEvent.Get() );
+
+ hoverEvent->AddPoint( point );
+
+ return EmitHoverSignals( actor, hoverEventHandle );
+}
+
/**
* Changes the state of the primary point to leave and emits the hover signals
*/
-Dali::Actor EmitHoverSignals( Actor* actor, RenderTask& renderTask, const HoverEvent& originalEvent, TouchPoint::State state )
+Dali::Actor EmitHoverSignals( Actor* actor, RenderTask& renderTask, const HoverEventPtr& originalEvent, PointState::Type state )
{
- HoverEvent hoverEvent( originalEvent );
+ HoverEventPtr hoverEvent = HoverEvent::Clone( *originalEvent.Get() );
DALI_ASSERT_DEBUG( NULL != actor && "NULL actor pointer" );
if( actor )
{
- TouchPoint& primaryPoint = hoverEvent.points[0];
+ Integration::Point& primaryPoint = hoverEvent->GetPoint( 0 );
- actor->ScreenToLocal( renderTask, primaryPoint.local.x, primaryPoint.local.y, primaryPoint.screen.x, primaryPoint.screen.y );
+ const Vector2& screenPosition = primaryPoint.GetScreenPosition();
+ Vector2 localPosition;
+ actor->ScreenToLocal( renderTask, localPosition.x, localPosition.y, screenPosition.x, screenPosition.y );
- primaryPoint.hitActor = Dali::Actor(actor);
- primaryPoint.state = state;
+ primaryPoint.SetLocalPosition( localPosition );
+ primaryPoint.SetHitActor( Dali::Actor( actor ) );
+ primaryPoint.SetState( state );
}
- return EmitHoverSignals( Dali::Actor(actor), hoverEvent );
+ return EmitHoverSignals( Dali::Actor(actor), Dali::HoverEvent( hoverEvent.Get() ) );
}
/**
PRINT_HIERARCHY(gLogFilter);
// Copy so we can add the results of a hit-test.
- HoverEvent hoverEvent( event.time );
+ HoverEventPtr hoverEvent( new HoverEvent( event.time ) );
// 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 ( state == TouchPoint::Interrupted )
{
Dali::Actor consumingActor;
- hoverEvent.points.push_back( event.points[0].GetTouchPoint() );
+ Integration::Point currentPoint( event.points[0] );
Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
if ( lastPrimaryHitActor )
{
Dali::Actor lastPrimaryHitActorHandle( lastPrimaryHitActor );
- hoverEvent.points[0].hitActor = lastPrimaryHitActorHandle;
- consumingActor = EmitHoverSignals( lastPrimaryHitActorHandle, hoverEvent );
+ currentPoint.SetHitActor( lastPrimaryHitActorHandle );
+ consumingActor = AllocAndEmitHoverSignals( event.time, lastPrimaryHitActorHandle, currentPoint );
}
// If the last consumed actor was different to the primary hit actor then inform it as well (if it has not already been informed).
lastConsumedActor != consumingActor )
{
Dali::Actor lastConsumedActorHandle( lastConsumedActor );
- hoverEvent.points[0].hitActor = lastConsumedActorHandle;
- EmitHoverSignals( lastConsumedActorHandle, hoverEvent );
+ currentPoint.SetHitActor( lastConsumedActorHandle );
+ AllocAndEmitHoverSignals( event.time, lastConsumedActorHandle, currentPoint );
}
// Tell the hover-start consuming actor as well, if required
hoverStartConsumedActor != consumingActor )
{
Dali::Actor hoverStartConsumedActorHandle( hoverStartConsumedActor );
- hoverEvent.points[0].hitActor = hoverStartConsumedActorHandle;
- EmitHoverSignals( hoverStartConsumedActorHandle, hoverEvent );
+ currentPoint.SetHitActor( hoverStartConsumedActorHandle );
+ AllocAndEmitHoverSignals( event.time, hoverStartConsumedActorHandle, currentPoint );
}
mLastPrimaryHitActor.SetActor( NULL );
mHoverStartConsumedActor.SetActor( NULL );
mLastRenderTask.Reset();
- hoverEvent.points[0].hitActor.Reset();
-
return; // No need for hit testing
}
// 2) Hit Testing.
+ Dali::HoverEvent hoverEventHandle( hoverEvent.Get() );
+
DALI_LOG_INFO( gLogFilter, Debug::Concise, "\n" );
DALI_LOG_INFO( gLogFilter, Debug::General, "Point(s): %d\n", event.GetPointCount() );
RenderTaskPtr currentRenderTask;
+ bool firstPointParsed = false;
- for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
+ for ( auto&& currentPoint : event.points )
{
HitTestAlgorithm::Results hitTestResults;
ActorHoverableCheck actorHoverableCheck;
- HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
+ HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, actorHoverableCheck );
- TouchPoint newPoint( iter->GetTouchPoint() );
- newPoint.hitActor = hitTestResults.actor;
- newPoint.local = hitTestResults.actorCoordinates;
+ Integration::Point newPoint( currentPoint );
+ newPoint.SetHitActor( hitTestResults.actor );
+ newPoint.SetLocalPosition( hitTestResults.actorCoordinates );
- hoverEvent.points.push_back( newPoint );
+ hoverEvent->AddPoint( newPoint );
DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
- TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y,
+ TOUCH_POINT_STATE[currentPoint.GetState()], currentPoint.GetScreenPosition().x, currentPoint.GetScreenPosition().y,
( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ),
( hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ),
hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
// Only set the currentRenderTask for the primary hit actor.
- if ( iter == beginIter && hitTestResults.renderTask )
+ if( !firstPointParsed )
{
+ firstPointParsed = true;
currentRenderTask = hitTestResults.renderTask;
}
}
Dali::Actor consumedActor;
if ( currentRenderTask )
{
- consumedActor = EmitHoverSignals( hoverEvent.points[0].hitActor, hoverEvent );
+ consumedActor = EmitHoverSignals( hoverEvent->GetHitActor( 0 ), hoverEventHandle );
}
- TouchPoint& primaryPoint = hoverEvent.points[0];
- Dali::Actor primaryHitActor = primaryPoint.hitActor;
- TouchPoint::State primaryPointState = primaryPoint.state;
+ Integration::Point primaryPoint = hoverEvent->GetPoint( 0 );
+ Dali::Actor primaryHitActor = primaryPoint.GetHitActor();
+ PointState::Type primaryPointState = primaryPoint.GetState();
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? reinterpret_cast< void* >( &primaryHitActor.GetBaseObject() ) : NULL, primaryHitActor ? primaryHitActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
- if ( ( primaryPointState == TouchPoint::Started ) &&
- ( hoverEvent.GetPointCount() == 1 ) &&
+ if ( ( primaryPointState == PointState::STARTED ) &&
+ ( hoverEvent->GetPointCount() == 1 ) &&
( consumedActor && GetImplementation( consumedActor ).OnScene() ) )
{
mHoverStartConsumedActor.SetActor( &GetImplementation( consumedActor ) );
Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
Actor* lastConsumedActor( mLastConsumedActor.GetActor() );
- if( (primaryPointState == TouchPoint::Motion) || (primaryPointState == TouchPoint::Finished) || (primaryPointState == TouchPoint::Stationary) )
+ if( (primaryPointState == PointState::MOTION) || (primaryPointState == PointState::FINISHED) || (primaryPointState == PointState::STATIONARY) )
{
if ( mLastRenderTask )
{
if ( lastPrimaryHitActor->GetLeaveRequired() )
{
DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() );
- leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Leave );
+ leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, 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", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() );
- leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted );
+ leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, PointState::INTERRUPTED );
}
}
if( lastConsumedActor->GetLeaveRequired() )
{
DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() );
- EmitHoverSignals( lastConsumedActor, lastRenderTaskImpl, hoverEvent, TouchPoint::Leave );
+ EmitHoverSignals( lastConsumedActor, lastRenderTaskImpl, hoverEvent, 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", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() );
- EmitHoverSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted );
+ EmitHoverSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, hoverEvent, PointState::INTERRUPTED );
}
}
}
// 5) If our primary point is an Finished 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::Finished )
+ if ( primaryPointState == PointState::FINISHED )
{
mLastPrimaryHitActor.SetActor( NULL );
mLastConsumedActor.SetActor( NULL );
// 6) Emit an interrupted event to the hover-started actor if it hasn't consumed the Finished.
- if ( hoverEvent.GetPointCount() == 1 ) // Only want the first hover started
+ if ( hoverEvent->GetPointCount() == 1 ) // Only want the first hover started
{
switch ( primaryPointState )
{
- case TouchPoint::Finished:
+ case PointState::FINISHED:
{
Actor* hoverStartConsumedActor( mHoverStartConsumedActor.GetActor() );
if ( hoverStartConsumedActor &&
hoverStartConsumedActor != lastConsumedActor )
{
Dali::Actor hoverStartConsumedActorHandle( hoverStartConsumedActor );
- hoverEvent.points[0].hitActor = hoverStartConsumedActorHandle;
- hoverEvent.points[0].state = TouchPoint::Interrupted;
- EmitHoverSignals( hoverStartConsumedActorHandle, hoverEvent );
+ Integration::Point primaryPoint = hoverEvent->GetPoint( 0 );
+ primaryPoint.SetHitActor( hoverStartConsumedActorHandle );
+ primaryPoint.SetState( PointState::INTERRUPTED );
+ AllocAndEmitHoverSignals( event.time, hoverStartConsumedActorHandle, primaryPoint );
// Restore hover-event to original state
- hoverEvent.points[0].hitActor = primaryHitActor;
- hoverEvent.points[0].state = primaryPointState;
+ primaryPoint.SetHitActor( primaryHitActor );
+ primaryPoint.SetState( primaryPointState );
}
mHoverStartConsumedActor.SetActor( NULL );
}
// No break, Fallthrough
- case TouchPoint::Started:
- case TouchPoint::Motion:
- case TouchPoint::Leave:
- case TouchPoint::Stationary:
- case TouchPoint::Interrupted:
- case TouchPoint::Last:
+ case PointState::STARTED:
+ case PointState::MOTION:
+ case PointState::LEAVE:
+ case PointState::STATIONARY:
+ case PointState::INTERRUPTED:
{
// Ignore
break;