Add Integration API to Create public event type 56/239956/9
authorDaekwang Ryu <dkdk.ryu@samsung.com>
Tue, 1 Sep 2020 05:24:31 +0000 (14:24 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 4 Sep 2020 07:18:10 +0000 (16:18 +0900)
Add intergration API to support GlWindow.
It is used gl-window-impl in dali-adaptor.

Change-Id: I296ed587911135c3fea616f7114352f5a6af6a9e

automated-tests/src/dali/utc-Dali-TouchEvent.cpp
dali/integration-api/events/touch-integ.cpp
dali/integration-api/events/touch-integ.h

index dbd663b..8d5b5a0 100644 (file)
@@ -114,3 +114,48 @@ int UtcDaliTouchEventMoveAssignmentP(void)
 
   END_TEST;
 }
+
+int UtcDaliTouchEventCopyConstructorWithPointP(void)
+{
+  Dali::Integration::Point point;
+
+  Vector2 touchPoint( 10.0, 20.0 );
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+
+  TouchEvent touchEvent = Integration::NewTouchEvent(123u, point);
+  DALI_TEST_CHECK( touchEvent );
+
+  const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+  TouchEvent touchEvent2( touchEvent );
+  DALI_TEST_CHECK( touchEvent );
+  DALI_TEST_CHECK( touchEvent2 );
+  DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
+  DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliTouchEventMoveConstructorWithPointP(void)
+{
+  Dali::Integration::Point point;
+
+  Vector2 touchPoint( 10.0, 20.0 );
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+
+  TouchEvent touchEvent = Integration::NewTouchEvent(123u, point);
+  DALI_TEST_CHECK( touchEvent );
+
+  const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+  TouchEvent touchEvent2( std::move(touchEvent) );
+  DALI_TEST_CHECK( !touchEvent );
+  DALI_TEST_CHECK( touchEvent2 );
+  DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+  END_TEST;
+}
index 978e9ed..a5e4e3e 100644 (file)
@@ -22,11 +22,16 @@ namespace Dali
 namespace Integration
 {
 
-Dali::TouchEvent NewTouchEvent(uint32_t timestamp, const TouchPoint& point)
+Dali::TouchEvent NewTouchEvent(uint32_t timeStamp, const TouchPoint& point)
 {
-  Internal::TouchEventPtr touchEventImpl( new Internal::TouchEvent(timestamp) );
-  touchEventImpl->AddPoint(Integration::Point(point));
-  Dali::TouchEvent handle(touchEventImpl.Get());
+  return NewTouchEvent( timeStamp, Integration::Point( point ) );
+}
+
+Dali::TouchEvent NewTouchEvent( uint32_t timeStamp, const Dali::Integration::Point& point )
+{
+  Internal::TouchEventPtr touchEventImpl( new Internal::TouchEvent( timeStamp ) );
+  touchEventImpl->AddPoint( point );
+  Dali::TouchEvent handle( touchEventImpl.Get() );
   return handle;
 }
 
index 3f48898..ae96fe9 100644 (file)
@@ -21,6 +21,7 @@
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/events/touch-event.h>
 #include <dali/devel-api/events/touch-point.h>
+#include <dali/integration-api/events/point.h>
 
 namespace Dali
 {
@@ -31,11 +32,20 @@ namespace Integration
 /**
  * Create a new touch data handle from timestamp and touch point.
  *
- * @param[in] timestamp The timestamp of the touch event.
+ * @param[in] timeStamp The time stamp of the touch event.
  * @param[in] point The point on screen where the touch occurred.
  * @return A new touch data handle.
  */
-DALI_CORE_API Dali::TouchEvent NewTouchEvent(uint32_t timestamp, const TouchPoint& point);
+DALI_CORE_API Dali::TouchEvent NewTouchEvent(uint32_t timeStamp, const TouchPoint& point);
+
+/**
+ * Create a new touch data handle from timestamp and point.
+ *
+ * @param[in] timeStamp The time stamp of the touch event.
+ * @param[in] point The point on screen where the touch occurred.
+ * @return A new touch data handle.
+ */
+DALI_CORE_API Dali::TouchEvent NewTouchEvent( uint32_t timeStamp, const Dali::Integration::Point& point );
 
 } // namespace Integration