Merge "Removed TouchEvent from dali-core" into devel/master
authorDavid Steele <david.steele@samsung.com>
Thu, 13 Aug 2020 16:59:34 +0000 (16:59 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 13 Aug 2020 16:59:34 +0000 (16:59 +0000)
12 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp
dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h

index 9f4656c..9f87146 100644 (file)
@@ -232,7 +232,6 @@ Impl::DummyControl::DummyControl()
   childRemoveCalled(false),
   sizeSetCalled(false),
   sizeAnimationCalled(false),
-  touchEventCalled(false),
   hoverEventCalled(false),
   wheelEventCalled(false),
   keyEventCalled(false),
@@ -249,7 +248,7 @@ Impl::DummyControl::~DummyControl()
 
 void Impl::DummyControl::OnInitialize() { initializeCalled = true; }
 bool Impl::DummyControl::OnAccessibilityActivated() { activatedCalled = true; return true; }
-bool Impl::DummyControl::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
+bool Impl::DummyControl::OnAccessibilityTouch(const TouchData& touchData) { onAccTouchedCalled = true; return true; }
 bool Impl::DummyControl::OnAccessibilityValueChange( bool isIncrease )
 {
   onAccValueChangeCalled = true; return true;
@@ -270,7 +269,6 @@ void Impl::DummyControl::OnChildAdd(Actor& child) { childAddCalled = true; }
 void Impl::DummyControl::OnChildRemove(Actor& child) { childRemoveCalled = true; }
 void Impl::DummyControl::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
 void Impl::DummyControl::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
-bool Impl::DummyControl::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
 bool Impl::DummyControl::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
 bool Impl::DummyControl::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
 bool Impl::DummyControl::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
index 87b9748..c4b0257 100644 (file)
@@ -154,7 +154,7 @@ private: // From Internal::Control
 
   virtual void OnInitialize();
   virtual bool OnAccessibilityActivated();
-  virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
+  virtual bool OnAccessibilityTouch( const TouchData& touchData );
   virtual bool OnAccessibilityValueChange( bool isIncrease );
 
   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
@@ -172,7 +172,6 @@ private: // From CustomActorImpl
   virtual void OnChildRemove(Actor& child);
   virtual void OnSizeSet(const Vector3& targetSize);
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
-  virtual bool OnTouchEvent(const TouchEvent& event);
   virtual bool OnHoverEvent(const HoverEvent& event);
   virtual bool OnWheelEvent(const WheelEvent& event);
   virtual bool OnKeyEvent(const KeyEvent& event);
@@ -201,7 +200,6 @@ public:
   bool childRemoveCalled;
   bool sizeSetCalled;
   bool sizeAnimationCalled;
-  bool touchEventCalled;
   bool hoverEventCalled;
   bool wheelEventCalled;
   bool keyEventCalled;
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-touch-utils.h
deleted file mode 100644 (file)
index 3a623cb..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef TEST_TOUCH_UTILS_H
-#define TEST_TOUCH_UTILS_H
-
-/*
- * Copyright (c) 2019 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 <dali/public-api/actors/actor.h>
-
-namespace Dali
-{
-
-// Data for touch events
-struct TouchEventData
-{
-  TouchEventData()
-  : functorCalled(false),
-    receivedTouch(),
-    touchActor()
-  {
-  }
-
-  void Reset()
-  {
-    functorCalled = false;
-
-    receivedTouch.points.clear();
-    receivedTouch.time = 0;
-
-    touchActor.Reset();
-  }
-
-  bool functorCalled;
-  TouchEvent receivedTouch;
-  Actor touchActor;
-};
-
-// Functor that sets the data when called
-struct TouchEventDataFunctor
-{
-  TouchEventDataFunctor(TouchEventData& data) : touchEventData(data) { }
-
-  bool operator()(Actor actor, const TouchEvent& touch)
-  {
-    touchEventData.functorCalled = true;
-    touchEventData.touchActor = actor;
-    touchEventData.receivedTouch = touch;
-    return false;
-  }
-
-  // Generate a touch-event
-  Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition ) const
-  {
-    Integration::TouchEvent touchEvent;
-    Integration::Point point;
-    point.SetState( state );
-    point.SetScreenPosition( screenPosition );
-    touchEvent.points.push_back( point );
-    return touchEvent;
-  }
-
-  TouchEventData& touchEventData;
-};
-
-
-} // namespace Dali
-
-#endif // TEST_TOUCH_UTILS_H
index df3e5d5..8c37474 100644 (file)
@@ -20,6 +20,7 @@
 #include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
 #include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
 #include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
+#include <dali/integration-api/events/touch-data-integ.h>
 
 namespace Dali
 {
@@ -240,9 +241,8 @@ bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, unsi
 {
   if( mActionHandler )
   {
-    Dali::TouchEvent touchEvent;
-    touchEvent.points.push_back( point );
-    return mActionHandler->AccessibilityActionScroll( touchEvent );
+    Dali::TouchData touchData = Integration::NewTouchData(timeStamp, point);
+    return mActionHandler->AccessibilityActionScroll( touchData );
   }
   return false;
 }
@@ -251,9 +251,8 @@ bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsig
 {
   if( mActionHandler )
   {
-    Dali::TouchEvent touchEvent;
-    touchEvent.points.push_back( point );
-    return mActionHandler->AccessibilityActionTouch( touchEvent );
+    Dali::TouchData touchData = Integration::NewTouchData(timeStamp, point);
+    return mActionHandler->AccessibilityActionTouch( touchData );
   }
   return false;
 }
index 964a2c9..06cc50f 100644 (file)
@@ -2218,10 +2218,11 @@ public:
   {
   }
 
-  bool Callback( AccessibilityManager& accessibilityManager, const Dali::TouchEvent& touchEvent )
+  bool Callback( AccessibilityManager& accessibilityManager, const Dali::TouchData& touchEvent )
   {
     mCalls++;
-    mTouchEvent = touchEvent;
+    Dali::TouchData handle(touchEvent); // Ensure it's ref-counted
+    mTouchData = handle;
     tet_infoline( "Signal called" );
     return true;
   }
@@ -2231,14 +2232,14 @@ public:
     return mCalls;
   }
 
-  const Dali::TouchEvent& GetTouchEvent() const
+  const Dali::TouchData& GetTouchData() const
   {
-    return mTouchEvent;
+    return mTouchData;
   }
 
 private:
   unsigned int mCalls;         ///< Keeps track of how many times the signal has been called.
-  Dali::TouchEvent mTouchEvent; ///< Stores the last touch event received.
+  Dali::TouchData mTouchData ; ///< Stores the last touch event received.
 };
 
 int UtcDaliAccessibilityManagerActionScrollSignalP(void)
@@ -2260,14 +2261,13 @@ int UtcDaliAccessibilityManagerActionScrollSignalP(void)
 
   DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
 
-  const TouchEvent& signalTouchEvent = callback.GetTouchEvent();
-  DALI_TEST_EQUALS( signalTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+  const TouchData& signalTouchData = callback.GetTouchData();
+  DALI_TEST_EQUALS( signalTouchData.GetPointCount(), 1u, TEST_LOCATION );
 
-  const TouchPoint& signalTouchPoint = signalTouchEvent.GetPoint( 0u );
 
-  DALI_TEST_EQUALS( signalTouchPoint.state, TouchPoint::Started, TEST_LOCATION );
-  DALI_TEST_EQUALS( signalTouchPoint.screen.x, 100.0f, TEST_LOCATION );
-  DALI_TEST_EQUALS( signalTouchPoint.screen.y, 200.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( signalTouchData.GetState(0), PointState::STARTED, TEST_LOCATION );
+  DALI_TEST_EQUALS( signalTouchData.GetScreenPosition(0).x, 100.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( signalTouchData.GetScreenPosition(0).y, 200.0f, TEST_LOCATION );
 
   END_TEST;
 }
index bdd74f9..b1bbe19 100644 (file)
@@ -465,62 +465,6 @@ int UtcDaliControlImplSizeAnimation(void)
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-int UtcDaliControlImplTouchEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
-    Integration::TouchEvent touchEvent(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::DOWN );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    touchEvent.AddPoint(point);
-    application.ProcessEvent(touchEvent);
-    DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
-
-    application.GetScene().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    Integration::TouchEvent touchEvent(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::DOWN );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    touchEvent.AddPoint(point);
-    application.ProcessEvent(touchEvent);
-
-    application.GetScene().Remove(dummy);
-  }
-  END_TEST;
-}
-
 int UtcDaliControlImplHoverEvent(void)
 {
   ToolkitTestApplication application;
@@ -826,7 +770,7 @@ int UtcDaliControlImplOnAccessibilityTouchP(void)
   ToolkitTestApplication application;
   Control dummy = Control::New();
   Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy );
-  TouchEvent touch;
+  TouchData touch;
   DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityTouch( touch ), TEST_LOCATION );
 
   END_TEST;
index 1d82bd6..5390b5c 100644 (file)
@@ -141,10 +141,6 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper
     mTargetSize = targetSize;
     Control::OnSizeAnimation( animation, targetSize );
   }
-  virtual bool OnTouchEvent( const TouchEvent& event )
-  {
-    return true;
-  }
   virtual bool OnHoverEvent( const HoverEvent& event )
   {
     return true;
index 87c5c5f..878e4a6 100755 (executable)
@@ -71,7 +71,7 @@ public:
    * @SINCE_1_0.0
    */
   typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; ///< Generic signal type @SINCE_1_0.0
-  typedef Signal< bool ( AccessibilityManager&, const Dali::TouchEvent& )> AccessibilityActionScrollSignalType; ///< Scroll signal type @SINCE_1_0.0
+  typedef Signal< bool ( AccessibilityManager&, const Dali::TouchData& )> AccessibilityActionScrollSignalType; ///< Scroll signal type @SINCE_1_0.0
 
   /**
    * @brief Enumeration for accessibility that needs four information which will be read by screen-reader.
@@ -794,7 +794,7 @@ public:
    *
    * A callback of the following type may be connected:
    * @code
-   *   bool YourCallback( AccessibilityManager& manager, const TouchEvent& event );
+   *   bool YourCallback( AccessibilityManager& manager, const TouchData& event );
    * @endcode
    * @SINCE_1_0.0
    * @return The signal to connect to
index 6b4433d..e67cb27 100644 (file)
@@ -963,12 +963,12 @@ bool AccessibilityManager::ClearAccessibilityFocus()
   }
 }
 
-bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchEvent& touchEvent )
+bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchData& touchData )
 {
   Dali::Toolkit::AccessibilityManager handle( this );
   if( !mActionScrollSignal.Empty() )
   {
-    mActionScrollSignal.Emit( handle, touchEvent );
+    mActionScrollSignal.Emit( handle, touchData );
   }
 
   return true;
@@ -1302,7 +1302,7 @@ bool AccessibilityManager::AccessibilityActionStartStop()
   return mIsAccessibilityTtsEnabled;
 }
 
-bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
+bool AccessibilityManager::AccessibilityActionTouch(const TouchData& touchData)
 {
   bool handled = false;
 
@@ -1311,7 +1311,7 @@ bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent
   Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
   if(control)
   {
-    handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
+    handled = GetImplementation( control ).OnAccessibilityTouch(touchData);
   }
 
   return handled;
index ac7a379..76b34b3 100644 (file)
@@ -506,10 +506,10 @@ private:
 
   /**
    * Perform the accessibility action associated with a scroll event.
-   * @param touchEvent The touch point (and time) of the event.
+   * @param touchData The touch point (and time) of the event.
    * @return whether the focus is cleared or not.
    */
-  virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent );
+  virtual bool AccessibilityActionScroll( Dali::TouchData& touchData );
 
   /**
    * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up).
@@ -659,10 +659,10 @@ private:
 
   /**
    * Perform the accessibility action to mouse move (by one finger tap & hold and move).
-   * @param touchEvent touch event structure
+   * @param touchData touch point and time of the event
    * @return whether the accessibility action is performed or not.
    */
-  virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent);
+  virtual bool AccessibilityActionTouch(const TouchData& touchData);
 
   /**
    * This function is connected to the TtsPlayer StateChangeSignal.
index eec35fb..372cfdb 100644 (file)
@@ -386,7 +386,7 @@ bool Control::OnAccessibilityPan(PanGesture gesture)
   return false; // Accessibility pan gesture is not handled by default
 }
 
-bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent)
+bool Control::OnAccessibilityTouch(const TouchData& touchData)
 {
   return false; // Accessibility touch event is not handled by default
 }
@@ -627,11 +627,6 @@ void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
   // @todo size negotiate background to new size, animate as well?
 }
 
-bool Control::OnTouchEvent(const TouchEvent& event)
-{
-  return false; // Do not consume
-}
-
 bool Control::OnHoverEvent(const HoverEvent& event)
 {
   return false; // Do not consume
index f127317..114f223 100644 (file)
@@ -339,11 +339,6 @@ protected: // From CustomActorImpl
   virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ) override;
 
   /**
-   * @copydoc CustomActorImpl::OnTouchEvent()
-   */
-  virtual bool OnTouchEvent( const TouchEvent& event ) override;
-
-  /**
    * @copydoc CustomActorImpl::OnHoverEvent()
    */
   virtual bool OnHoverEvent( const HoverEvent& event ) override;
@@ -487,10 +482,10 @@ public: // API for derived classes to override
    * touch event.
    *
    * @SINCE_1_0.0
-   * @param[in] touchEvent The touch event
+   * @param[in] touchData The touch event
    * @return true if the touch event has been consumed by this control
    */
-  virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
+  virtual bool OnAccessibilityTouch( const TouchData& touchData );
 
   /**
    * @brief This method should be overridden by deriving classes when they wish to respond