From 89846d78efecfac2ae807b463ba7b6f8e924f448 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Mon, 1 Apr 2024 17:03:16 +0900 Subject: [PATCH] [Tizen] Add SetTime in TouchEvent Change-Id: Iad92d4c0e3e07fded7f1fdbb44e59d967502f2c9 --- automated-tests/src/dali/utc-Dali-TouchEvent.cpp | 16 +++++++++ dali/devel-api/events/touch-event-devel.cpp | 32 ++++++++++++++++++ dali/devel-api/events/touch-event-devel.h | 41 ++++++++++++++++++++++++ dali/devel-api/file.list | 2 ++ dali/internal/event/events/touch-event-impl.cpp | 5 +++ dali/internal/event/events/touch-event-impl.h | 7 ++++ 6 files changed, 103 insertions(+) create mode 100644 dali/devel-api/events/touch-event-devel.cpp create mode 100644 dali/devel-api/events/touch-event-devel.h diff --git a/automated-tests/src/dali/utc-Dali-TouchEvent.cpp b/automated-tests/src/dali/utc-Dali-TouchEvent.cpp index bd58584..df3d713 100644 --- a/automated-tests/src/dali/utc-Dali-TouchEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchEvent.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -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 index 0000000..73d571c --- /dev/null +++ b/dali/devel-api/events/touch-event-devel.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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. + * + */ + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ +namespace DevelTouchEvent +{ +void SetTime(TouchEvent touchEvent, uint64_t time) +{ + GetImplementation(touchEvent).SetTime(time); +} +} // namespace DevelTouchEvent + +} // namespace Dali diff --git a/dali/devel-api/events/touch-event-devel.h b/dali/devel-api/events/touch-event-devel.h new file mode 100644 index 0000000..e62377f --- /dev/null +++ b/dali/devel-api/events/touch-event-devel.h @@ -0,0 +1,41 @@ +#ifndef DALI_TOUCH_EVENT_DEVEL_H +#define DALI_TOUCH_EVENT_DEVEL_H + +/* + * Copyright (c) 2024 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. + * + */ + +// INTERNAL INCLUDES +#include + +namespace Dali +{ +namespace DevelTouchEvent +{ + +/** + * @brief Set the time (in ms) that the touch event occurred. + * + * @param[in] touchEvent The instance of TouchEvent. + * @param[in] time The time (in ms) + */ +DALI_CORE_API void SetTime(TouchEvent touchEvent, uint64_t time); + +} // namespace DevelTouchEvent + +} // namespace Dali + +#endif // DALI_TOUCH_EVENT_DEVEL_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index a4947e6..aeed979 100644 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -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 diff --git a/dali/internal/event/events/touch-event-impl.cpp b/dali/internal/event/events/touch-event-impl.cpp index 2c6ae4d..b1ce087 100644 --- a/dali/internal/event/events/touch-event-impl.cpp +++ b/dali/internal/event/events/touch-event-impl.cpp @@ -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 diff --git a/dali/internal/event/events/touch-event-impl.h b/dali/internal/event/events/touch-event-impl.h index e645c75..7e2c472 100644 --- a/dali/internal/event/events/touch-event-impl.h +++ b/dali/internal/event/events/touch-event-impl.h @@ -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 -- 2.7.4