utc-Dali-TextureSet.cpp
utc-Dali-Thread.cpp
utc-Dali-ThreadPool.cpp
+ utc-Dali-TouchEvent.cpp
utc-Dali-TouchEventCombiner.cpp
utc-Dali-TouchProcessing.cpp
utc-Dali-TypeRegistry.cpp
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-integ.h>
+#include <dali-test-suite-utils.h>
+
+void utc_dali_touch_event_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_touch_event_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+TouchPoint GenerateTouchPoint()
+{
+ return TouchPoint(1, PointState::STARTED, 100.0f, 200.0f);
+}
+}
+
+int UtcDaliTouchEventConstructorP(void)
+{
+ TouchEvent touchEvent;
+ DALI_TEST_CHECK( !touchEvent );
+ END_TEST;
+}
+
+int UtcDaliTouchEventCopyConstructorP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ 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 UtcDaliTouchEventMoveConstructorP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ 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;
+}
+
+int UtcDaliTouchEventCopyAssignmentP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2;
+ DALI_TEST_CHECK( !touchEvent2 );
+
+ 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 UtcDaliTouchEventMoveAssignmentP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2;
+ DALI_TEST_CHECK( !touchEvent2 );
+
+ touchEvent2 = std::move(touchEvent);
+ DALI_TEST_CHECK( !touchEvent );
+ DALI_TEST_CHECK( touchEvent2 );
+ DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+ END_TEST;
+}
return hoverEvent;
}
-HoverEvent::~HoverEvent()
-{
-}
-
unsigned long HoverEvent::GetTime() const
{
return mTime;
*/
static HoverEventPtr Clone( const HoverEvent& rhs );
- /**
- * @brief Destructor
- */
- ~HoverEvent();
-
// Getters
/**
private:
+ /**
+ * @brief Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~HoverEvent() = default;
+
// Not copyable or movable
HoverEvent( const HoverEvent& rhs ) = delete; ///< Deleted copy constructor
{
}
-KeyEvent::~KeyEvent()
-{
-}
-
KeyEventPtr KeyEvent::New( const std::string& keyName,
const std::string& logicalKey,
const std::string& keyString,
const Device::Subclass::Type deviceSubclass );
/**
- * @brief Destructor.
- */
- ~KeyEvent();
-
- /**
* Create a new KeyEvent.
*
* @param[in] keyName The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
private:
+ /**
+ * @brief Destructor.
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~KeyEvent() = default;
+
// Not copyable or movable
KeyEvent( const KeyEvent& rhs ) = delete; ///< Deleted copy constructor
namespace Internal
{
-TouchEvent::TouchEvent()
-: mPoints(),
- mTime( 0 )
-{
-}
-
-TouchEvent::TouchEvent( unsigned long time )
-: mPoints(),
- mTime( time )
-{
-}
-
TouchEventPtr TouchEvent::Clone( const TouchEvent& other )
{
TouchEventPtr touchEvent( new TouchEvent );
return touchEvent;
}
-TouchEvent::~TouchEvent()
-{
-}
-
-unsigned long TouchEvent::GetTime() const
-{
- return mTime;
-}
-
-std::size_t TouchEvent::GetPointCount() const
-{
- return mPoints.size();
-}
-
int32_t TouchEvent::GetDeviceId( std::size_t point ) const
{
if( point < mPoints.size() )
return mPoints[ point ];
}
-void TouchEvent::AddPoint( const Integration::Point& point )
-{
- mPoints.push_back( point );
-}
-
Device::Class::Type TouchEvent::GetDeviceClass( std::size_t point ) const
{
if( point < mPoints.size() )
return MouseButton::INVALID;
}
+void TouchEvent::AddPoint( const Integration::Point& point )
+{
+ mPoints.push_back( point );
+}
+
} // namsespace Internal
} // namespace Dali
/**
* @brief Default constructor
*/
- TouchEvent();
+ TouchEvent() = default;
/**
* @brief Constructor
* @param[in] time The time the event occurred
*/
- TouchEvent( unsigned long time );
+ TouchEvent( unsigned long time )
+ : mTime( time )
+ {
+ }
/**
* @brief Clones the TouchEvent object.
*/
static TouchEventPtr Clone( const TouchEvent& other );
- /**
- * @brief Destructor
- */
- ~TouchEvent();
+ TouchEvent( const TouchEvent& other ) = delete; ///< Deleted copy constructor.
+ TouchEvent( TouchEvent&& other ) = delete; ///< Deleted move constructor.
+ TouchEvent& operator=( const TouchEvent& other ) = delete; ///< Deleted copy assignment operator.
+ TouchEvent& operator=( TouchEvent&& other ) = delete; ///< Deleted move assignment operator.
// Getters
/**
* @copydoc Dali::TouchEvent::GetTime()
*/
- unsigned long GetTime() const;
+ inline unsigned long GetTime() const
+ {
+ return mTime;
+ }
/**
* @copydoc Dali::TouchEvent::GetPointCount()
*/
- std::size_t GetPointCount() const;
+ inline std::size_t GetPointCount() const
+ {
+ return mPoints.size();
+ }
/**
* @copydoc Dali::TouchEvent::GetDeviceId()
*/
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 Integration::Point& point );
-
/**
* @brief Get the device class the mouse/touch event originated from
*
*/
MouseButton::Type GetMouseButton( std::size_t point ) const;
+ // Setters
-private:
+ /**
+ * @brief Adds a point to this touch event handler.
+ * @param[in] point The point to add to the touch event handler.
+ */
+ void AddPoint( const Integration::Point& point );
- /// Undefined Copy constructor
- TouchEvent( const TouchEvent& other );
+private:
- /// Undefined
- TouchEvent& operator=( const TouchEvent& other );
+ /**
+ * @brief Virtual Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TouchEvent() = default;
private:
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.
+ unsigned long mTime{0u}; ///< The time (in ms) that the touch event occurred.
};
} // namespace Internal
{
}
-WheelEvent::~WheelEvent()
-{
-}
-
WheelEventPtr WheelEvent::New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
{
WheelEventPtr wheelEvent = new WheelEvent( type, direction, modifiers, point, delta, timeStamp );
WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
/**
- * @brief Destructor
- */
- ~WheelEvent();
-
- /**
* Create a new WheelEvent.
*
* @param[in] type The type of the wheel event
private:
+ /**
+ * @brief Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~WheelEvent() = default;
+
// Not copyable or movable
WheelEvent( const WheelEvent& rhs ) = delete; ///< Deleted copy constructor
namespace Dali
{
-TouchEvent::TouchEvent()
-: BaseHandle()
-{
-}
+TouchEvent::TouchEvent() = default;
-TouchEvent::TouchEvent( const TouchEvent& other )
-: BaseHandle( other )
-{
-}
+TouchEvent::TouchEvent( const TouchEvent& other ) = default;
-TouchEvent::~TouchEvent()
-{
-}
+TouchEvent::TouchEvent( TouchEvent&& other ) = default;
-TouchEvent& TouchEvent::operator=( const TouchEvent& other )
-{
- BaseHandle::operator=( other );
- return *this;
-}
+TouchEvent::~TouchEvent() = default;
+
+TouchEvent& TouchEvent::operator=( const TouchEvent& other ) = default;
+
+TouchEvent& TouchEvent::operator=( TouchEvent&& other ) = default;
unsigned long TouchEvent::GetTime() const
{
TouchEvent( const TouchEvent& other );
/**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.28
+ * @param[in] other The TouchEvent to move
+ */
+ TouchEvent( TouchEvent&& other );
+
+ /**
* @brief Destructor.
*
* @SINCE_1_9.26
*/
TouchEvent& operator=( const TouchEvent& other );
+ /**
+ * @brief Move assignment Operator.
+ *
+ * @SINCE_1_9.28
+ * @param[in] other The TouchEvent to move
+ * @return A reference to this
+ */
+ TouchEvent& operator=( TouchEvent&& other );
+
// Getters
/**