#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/touch-data-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/actors/actor-devel.h>
bool returnValue;
};
-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;
application.SendNotification();
application.Render();
- // Connect to actor's touched signal
+ // Connect to actor's touch signal
SignalData data;
TouchDataFunctor functor( data );
actor.TouchSignal().Connect( &application, functor );
END_TEST;
}
-int UtcDaliTouchDataAndEventUsage(void)
+int UtcDaliTouchDataUsage(void)
{
TestApplication application;
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;
}
END_TEST;
}
+
+int UtcDaliTouchDataIntegNewTouchData(void)
+{
+ uint32_t timestamp = 92858u;
+ TouchPoint tp(1, TouchPoint::State::Started, 34.4f, 123.89f, 5.0f, 7.0f);
+ Dali::TouchData touchData = Integration::NewTouchData(timestamp, tp);
+
+ DALI_TEST_EQUALS(touchData.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchData.GetState(0), PointState::Type::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS(touchData.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS(touchData.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION );
+
+
+ END_TEST;
+}