[Tizen] Add SetTime in TouchEvent 38/308838/1
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 1 Apr 2024 08:03:16 +0000 (17:03 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Tue, 2 Apr 2024 00:41:30 +0000 (09:41 +0900)
Change-Id: Iad92d4c0e3e07fded7f1fdbb44e59d967502f2c9

automated-tests/src/dali/utc-Dali-TouchEvent.cpp
dali/devel-api/events/touch-event-devel.cpp [new file with mode: 0644]
dali/devel-api/events/touch-event-devel.h [new file with mode: 0644]
dali/devel-api/file.list
dali/internal/event/events/touch-event-impl.cpp
dali/internal/event/events/touch-event-impl.h

index bd58584..df3d713 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/touch-event-devel.h>
 #include <dali/integration-api/events/touch-integ.h>
 #include <dali/public-api/dali-core.h>
 #include <stdlib.h>
@@ -159,3 +160,18 @@ int UtcDaliTouchEventMoveConstructorWithPointP(void)
 
   END_TEST;
 }
+
+int UtcDaliTouchEventSetTime(void)
+{
+  TestApplication application;
+
+  TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+  DALI_TEST_CHECK(touchEvent);
+
+  DALI_TEST_EQUALS(123lu, touchEvent.GetTime(), TEST_LOCATION);
+
+  DevelTouchEvent::SetTime(touchEvent, 200lu);
+  DALI_TEST_EQUALS(200lu, touchEvent.GetTime(), TEST_LOCATION);
+
+  END_TEST;
+}
diff --git a/dali/devel-api/events/touch-event-devel.cpp b/dali/devel-api/events/touch-event-devel.cpp
new file mode 100644 (file)
index 0000000..73d571c
--- /dev/null
@@ -0,0 +1,32 @@
+/*\r
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/devel-api/events/touch-event-devel.h>\r
+#include <dali/internal/event/events/touch-event-impl.h>\r
+\r
+namespace Dali\r
+{\r
+namespace DevelTouchEvent\r
+{\r
+void SetTime(TouchEvent touchEvent, uint64_t time)\r
+{\r
+  GetImplementation(touchEvent).SetTime(time);\r
+}\r
+} // namespace DevelTouchEvent\r
+\r
+} // namespace Dali\r
diff --git a/dali/devel-api/events/touch-event-devel.h b/dali/devel-api/events/touch-event-devel.h
new file mode 100644 (file)
index 0000000..e62377f
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef DALI_TOUCH_EVENT_DEVEL_H\r
+#define DALI_TOUCH_EVENT_DEVEL_H\r
+\r
+/*\r
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/public-api/events/touch-event.h>\r
+\r
+namespace Dali\r
+{\r
+namespace DevelTouchEvent\r
+{\r
+\r
+/**\r
+ * @brief Set the time (in ms) that the touch event occurred.\r
+ *\r
+ * @param[in] touchEvent The instance of TouchEvent.\r
+ * @param[in] time The time (in ms)\r
+ */\r
+DALI_CORE_API void SetTime(TouchEvent touchEvent, uint64_t time);\r
+\r
+} // namespace DevelTouchEvent\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_TOUCH_EVENT_DEVEL_H\r
index a4947e6..aeed979 100644 (file)
@@ -19,6 +19,7 @@ SET( devel_api_src_files
   ${devel_api_src_dir}/events/hit-test-algorithm.cpp
   ${devel_api_src_dir}/events/hover-event-devel.cpp
   ${devel_api_src_dir}/events/key-event-devel.cpp
+  ${devel_api_src_dir}/events/touch-event-devel.cpp
   ${devel_api_src_dir}/events/long-press-gesture-devel.cpp
   ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp
   ${devel_api_src_dir}/events/pan-gesture-devel.cpp
@@ -85,6 +86,7 @@ SET( devel_api_core_events_header_files
   ${devel_api_src_dir}/events/hit-test-algorithm.h
   ${devel_api_src_dir}/events/hover-event-devel.h
   ${devel_api_src_dir}/events/key-event-devel.h
+  ${devel_api_src_dir}/events/touch-event-devel.h
   ${devel_api_src_dir}/events/long-press-gesture-devel.h
   ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h
   ${devel_api_src_dir}/events/pan-gesture-devel.h
index 2c6ae4d..b1ce087 100644 (file)
@@ -158,6 +158,11 @@ void TouchEvent::AddPoint(const Integration::Point& point)
   mPoints.push_back(point);
 }
 
+void TouchEvent::SetTime(uint64_t time)
+{
+  mTime = time;
+}
+
 } // namespace Internal
 
 } // namespace Dali
index e645c75..7e2c472 100644 (file)
@@ -201,6 +201,13 @@ public:
     mRenderTask = renderTask;
   }
 
+  /**
+   * @brief Set the time (in ms) that the touch event occurred.
+   *
+   * @param[in] time The time (in ms)
+   */
+  void SetTime(uint64_t time);
+
 private:
   /**
    * @brief Virtual Destructor