From c35f47a46398a7d71180285e6e52a64243af0a6d Mon Sep 17 00:00:00 2001 From: Daniel McEwen Date: Thu, 11 Apr 2019 17:28:26 +0100 Subject: [PATCH] Gesture event refactor Changes for event refactor into core Change-Id: I6b73acf03a0cf443fffff636c167fbe885422c02 --- .../src/dali-toolkit-internal/CMakeLists.txt | 1 - .../src/dali-toolkit-styling/CMakeLists.txt | 1 - .../src/dali-toolkit-third-party/CMakeLists.txt | 1 - automated-tests/src/dali-toolkit/CMakeLists.txt | 2 +- .../dali-test-suite-utils.h | 9 +- .../dali-toolkit-test-utils/test-application.cpp | 6 - .../dali-toolkit-test-utils/test-application.h | 3 - .../test-gesture-generator.cpp | 164 +++++++++ .../test-gesture-generator.h | 108 ++++++ .../test-gesture-manager.cpp | 103 ------ .../dali-toolkit-test-utils/test-gesture-manager.h | 93 ----- .../test-platform-abstraction.cpp | 27 +- .../test-platform-abstraction.h | 25 +- .../toolkit-accessibility-adaptor.cpp | 10 +- .../toolkit-accessibility-adaptor.h | 12 +- .../dali-toolkit-test-utils/toolkit-adaptor.cpp | 6 +- .../dali-toolkit/utc-Dali-AccessibilityManager.cpp | 8 +- .../src/dali-toolkit/utc-Dali-ControlImpl.cpp | 105 +----- .../dali-toolkit/utc-Dali-DragAndDropDetector.cpp | 48 +-- .../src/dali-toolkit/utc-Dali-ItemView.cpp | 91 ++--- .../src/dali-toolkit/utc-Dali-PageTurnView.cpp | 111 +++--- .../src/dali-toolkit/utc-Dali-ScrollBar.cpp | 69 +--- .../src/dali-toolkit/utc-Dali-ScrollView.cpp | 375 ++++++++++++++------- .../src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp | 3 +- .../src/dali-toolkit/utc-Dali-Slider.cpp | 3 +- .../src/dali-toolkit/utc-Dali-TextEditor.cpp | 218 ++---------- .../src/dali-toolkit/utc-Dali-TextField.cpp | 239 +++---------- .../accessibility-manager-impl.cpp | 11 +- .../accessibility-manager-impl.h | 12 +- 29 files changed, 803 insertions(+), 1061 deletions(-) create mode 100644 automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.cpp create mode 100644 automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.h delete mode 100644 automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp delete mode 100644 automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 1494855..bd7def3 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -57,7 +57,6 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp - ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp diff --git a/automated-tests/src/dali-toolkit-styling/CMakeLists.txt b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt index bc765c7..f956e18 100644 --- a/automated-tests/src/dali-toolkit-styling/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt @@ -42,7 +42,6 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp - ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp diff --git a/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt index 6f50e82..084c2d5 100644 --- a/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt @@ -34,7 +34,6 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp - ../dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index f0be18f..36f4850 100755 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -101,7 +101,7 @@ LIST(APPEND TC_SOURCES dali-toolkit-test-utils/test-application.cpp dali-toolkit-test-utils/test-button.cpp dali-toolkit-test-utils/test-harness.cpp - dali-toolkit-test-utils/test-gesture-manager.cpp + dali-toolkit-test-utils/test-gesture-generator.cpp dali-toolkit-test-utils/test-gl-abstraction.cpp dali-toolkit-test-utils/test-gl-sync-abstraction.cpp dali-toolkit-test-utils/test-platform-abstraction.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h index 70f4254..577ca36 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TEST_SUITE_UTILS_H__ -#define __DALI_TEST_SUITE_UTILS_H__ +#ifndef DALI_TEST_SUITE_UTILS_H +#define DALI_TEST_SUITE_UTILS_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -34,6 +34,7 @@ void tet_printf(const char *format, ...); #include "test-application.h" #include "test-actor-utils.h" +#include "test-gesture-generator.h" using namespace Dali; @@ -442,4 +443,4 @@ private: } // namespace Test -#endif // __DALI_TEST_SUITE_UTILS_H__ +#endif // DALI_TEST_SUITE_UTILS_H diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index 1562d27..0b98b27 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -47,7 +47,6 @@ void TestApplication::Initialize() mPlatformAbstraction, mGlAbstraction, mGlSyncAbstraction, - mGestureManager, mDataRetentionPolicy, Integration::RenderToFrameBuffer::FALSE, Integration::DepthBufferAvailable::TRUE, @@ -141,11 +140,6 @@ TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction() return mGlSyncAbstraction; } -TestGestureManager& TestApplication::GetGestureManager() -{ - return mGestureManager; -} - void TestApplication::ProcessEvent(const Integration::Event& event) { mCore->QueueEvent(event); diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h index fc2929c..27aafd3 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -20,7 +20,6 @@ // INTERNAL INCLUDES #include -#include "test-gesture-manager.h" #include "test-gl-sync-abstraction.h" #include "test-gl-abstraction.h" #include "test-render-controller.h" @@ -68,7 +67,6 @@ public: TestRenderController& GetRenderController(); TestGlAbstraction& GetGlAbstraction(); TestGlSyncAbstraction& GetGlSyncAbstraction(); - TestGestureManager& GetGestureManager(); void ProcessEvent(const Integration::Event& event); void SendNotification(); bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL ); @@ -96,7 +94,6 @@ protected: TestRenderController mRenderController; TestGlAbstraction mGlAbstraction; TestGlSyncAbstraction mGlSyncAbstraction; - TestGestureManager mGestureManager; TestRenderSurface* mRenderSurface; Integration::UpdateStatus mStatus; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.cpp new file mode 100644 index 0000000..a0ac206 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.cpp @@ -0,0 +1,164 @@ +/* + * 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 "test-gesture-generator.h" + +// INTERNAL INCLUDES +#include + +namespace +{ +const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) + +Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) +{ + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState( state ); + point.SetDeviceId(4); + point.SetScreenPosition( screenPosition ); + point.SetDeviceClass( Device::Class::TOUCH ); + point.SetDeviceSubclass( Device::Subclass::NONE ); + touchEvent.points.push_back( point ); + touchEvent.time = time; + return touchEvent; +} + +Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time ) +{ + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState( stateA ); + point.SetDeviceId(4); + point.SetScreenPosition( screenPositionA ); + point.SetDeviceClass( Device::Class::TOUCH ); + point.SetDeviceSubclass( Device::Subclass::NONE ); + touchEvent.points.push_back( point ); + point.SetScreenPosition( screenPositionB ); + point.SetState( stateB); + point.SetDeviceId(7); + touchEvent.points.push_back( point ); + touchEvent.time = time; + return touchEvent; +} +} // namespace + +namespace Dali +{ +uint32_t TestGetFrameInterval() +{ + return RENDER_FRAME_INTERVAL; +} + +void TestStartLongPress( TestApplication& application, float x, float y, uint32_t time ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time ) ); +} + +void TestTriggerLongPress( TestApplication& application ) +{ + application.GetPlatform().TriggerTimer(); +} + +void TestGenerateLongPress( TestApplication& application, float x, float y, uint32_t time ) +{ + TestStartLongPress( application, x, y, time ); + TestTriggerLongPress( application ); +} + +void TestEndLongPress( TestApplication& application, float x, float y, uint32_t time ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time ) ); +} + +void TestGeneratePinch( TestApplication& application) +{ + application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 55.0f ), PointState::UP, Vector2( 20.0f, 58.0f ), 200 ) ); +} + +void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ) +{ + application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) ); +} + +void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ) +{ + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) ); +} + +void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ) +{ + application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) ); +} + +void TestGenerateMiniPan( TestApplication& application) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) ); + application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) ); + application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 255 ) ); +} + +void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, start, time ) ); + + time += RENDER_FRAME_INTERVAL; + + application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) ); + + time += RENDER_FRAME_INTERVAL; + + application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) ); + + time += RENDER_FRAME_INTERVAL; +} + +void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, pos, time ) ); +} + +void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::UP, pos, time ) ); +} + +void TestGenerateTap( TestApplication& application, float x, float y, uint32_t time_down ) +{ + application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time_down ) ); + application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time_down + 20 ) ); +} + +void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down ) +{ + application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( x1, y1 ), PointState::DOWN, Vector2( x2, y2 ), time_down ) ); + application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( x1, y1 ), PointState::UP, Vector2( x2, y2 ), time_down + 20 ) ); +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.h new file mode 100644 index 0000000..80611a0 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.h @@ -0,0 +1,108 @@ +#ifndef DALI_TEST_GESTURE_GENERATOR_H +#define DALI_TEST_GESTURE_GENERATOR_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 "test-application.h" + +namespace Dali +{ +/** + * These functions use touch events to trigger a gesture, assuming the default gesture parameters are used + */ + +/** + * Returns the frame interval used in ms + */ +uint32_t TestGetFrameInterval(); + +/** + * Produces the initial touch of a long press + */ +void TestStartLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 ); + +/** + * Triggers the timer to begin a long press gesture + */ +void TestTriggerLongPress( TestApplication& application ); + +/** + * Produces the initial press and triggers the timer to begin a long press gesture + */ +void TestGenerateLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 ); + +/** + * End a long press by lifting the touch + */ +void TestEndLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 ); + +/** + * Produces a vertical pinch gesture between (20,20) and (20,90) + */ +void TestGeneratePinch( TestApplication& application ); + +/** + * Produces the gesture started event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2 + */ +void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ); + +/** + * Produces a gesture continuing event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2 + */ +void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ); + +/** + * Produces a gesture finished event of a pinch, using 2 touches, 50ms apart + */ +void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time ); + +/** + * Produces a pan gesture from (20,20) to (20,40) + */ +void TestGenerateMiniPan( TestApplication& application ); + +/** + * Produces the start event of a pan gesture, assuming minimum distance moved between start and end is greater than 15 + * in either direction or 11 in both (x&y). Time will be incremented using the standard frame interval per touch movement + */ +void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time ); + +/** + * Continues a pan event by creating a single touch at pos. + * N.B This does not increment the time + */ +void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time = 400); + +/** + * End a pan gesture at position pos + */ +void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time = 500); + +/** + * Produces a single point tap gesture with a 20ms interval + */ +void TestGenerateTap( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100 ); + +/** + * Produce a tap gesture with two touch points and a 20ms interval + */ +void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down ); + +} // namespace Dali + +#endif // DALI_TEST_GESTURE_GENERATOR_H diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp deleted file mode 100644 index 2844ff1..0000000 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 "test-gesture-manager.h" - -namespace Dali -{ - -TestGestureManager::TestGestureManager() -{ - Initialize(); -} - -/** - * Destructor - */ -TestGestureManager::~TestGestureManager() -{ -} - -/** - * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type) - */ -void TestGestureManager::Register(const Integration::GestureRequest& request) -{ - mFunctionsCalled.Register = true; -} - -/** - * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type) - */ -void TestGestureManager::Unregister(const Integration::GestureRequest& request) -{ - mFunctionsCalled.Unregister = true; -} - -/** - * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type) - */ -void TestGestureManager::Update(const Integration::GestureRequest& request) -{ - mFunctionsCalled.Update = true; -} - - -/** Call this every test */ -void TestGestureManager::Initialize() -{ - mFunctionsCalled.Reset(); -} - -bool TestGestureManager::WasCalled(TestFuncEnum func) -{ - switch(func) - { - case RegisterType: return mFunctionsCalled.Register; - case UnregisterType: return mFunctionsCalled.Unregister; - case UpdateType: return mFunctionsCalled.Update; - } - return false; -} - -void TestGestureManager::ResetCallStatistics(TestFuncEnum func) -{ - switch(func) - { - case RegisterType: mFunctionsCalled.Register = false; break; - case UnregisterType: mFunctionsCalled.Unregister = false; break; - case UpdateType: mFunctionsCalled.Update = false; break; - } -} - -TestGestureManager::TestFunctions::TestFunctions() -: Register(false), - Unregister(false), - Update(false) -{ -} - -void TestGestureManager::TestFunctions::Reset() -{ - Register = false; - Unregister = false; - Update = false; -} - - - -} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h deleted file mode 100644 index 6fddd30..0000000 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-manager.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef __DALI_TEST_GESTURE_MANAGER_H__ -#define __DALI_TEST_GESTURE_MANAGER_H__ - -/* - * Copyright (c) 2018 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 -{ - -/** - * Concrete implementation of the gesture manager class. - */ -class DALI_CORE_API TestGestureManager : public Dali::Integration::GestureManager -{ - -public: - - /** - * Constructor - */ - TestGestureManager(); - - /** - * Destructor - */ - virtual ~TestGestureManager(); - - /** - * @copydoc Dali::Integration::GestureManager::Register(Gesture::Type) - */ - virtual void Register(const Integration::GestureRequest& request); - - /** - * @copydoc Dali::Integration::GestureManager::Unregister(Gesture::Type) - */ - virtual void Unregister(const Integration::GestureRequest& request); - - /** - * @copydoc Dali::Integration::GestureManager::Update(Gesture::Type) - */ - virtual void Update(const Integration::GestureRequest& request); - -public: // TEST FUNCTIONS - - // Enumeration of Gesture Manager methods - enum TestFuncEnum - { - RegisterType, - UnregisterType, - UpdateType, - }; - - /** Call this every test */ - void Initialize(); - bool WasCalled(TestFuncEnum func); - void ResetCallStatistics(TestFuncEnum func); - -private: - - struct TestFunctions - { - TestFunctions(); - void Reset(); - - bool Register; - bool Unregister; - bool Update; - }; - - TestFunctions mFunctionsCalled; -}; - -} // Dali - -#endif // __DALI_TEST_GESTURE_MANAGER_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp index 190aa63..39628701 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -28,7 +28,9 @@ TestPlatformAbstraction::TestPlatformAbstraction() mClosestSize(), mLoadFileResult(), mSaveFileResult( false ), - mSynchronouslyLoadedResource() + mSynchronouslyLoadedResource(), + mTimerId(0), + mCallbackFunction(nullptr) { Initialize(); } @@ -82,7 +84,6 @@ bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, return mLoadFileResult.loadResult; } - /** Call this every test */ void TestPlatformAbstraction::Initialize() { @@ -144,4 +145,24 @@ void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap ) mDecodedBitmap = bitmap; } +uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBase* callback ) +{ + mCallbackFunction = callback; + mTimerId++; + return mTimerId; +} + +void TestPlatformAbstraction::TriggerTimer() +{ + if (mCallbackFunction != nullptr) + { + CallbackBase::Execute( *mCallbackFunction ); + } +} + +void TestPlatformAbstraction::CancelTimer ( uint32_t timerId ) +{ + mCallbackFunction = nullptr; +} + } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h index dfa4d6c..7c1b010 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__ -#define __DALI_TEST_PLATFORM_ABSTRACTION_H__ +#ifndef DALI_TEST_PLATFORM_ABSTRACTION_H +#define DALI_TEST_PLATFORM_ABSTRACTION_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -89,6 +89,15 @@ public: */ virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; } + /** + * @copydoc PlatformAbstraction::StartTimer() + */ + virtual uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ); + + /* + * @copydoc PlatformAbstraction::CancelTimer() + */ + virtual void CancelTimer ( uint32_t timerId ); public: // TEST FUNCTIONS @@ -156,6 +165,11 @@ public: // TEST FUNCTIONS */ void SetDecodedBitmap( Integration::BitmapPtr bitmap ); + /** + * @brief Triggers the previously stored callback function + */ + void TriggerTimer(); + private: TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined @@ -184,8 +198,11 @@ private: Integration::ResourcePointer mSynchronouslyLoadedResource; Integration::BitmapPtr mDecodedBitmap; + + uint32_t mTimerId; + CallbackBase* mCallbackFunction; }; } // Dali -#endif /* __DALI_TEST_PLATFORM_ABSTRACTION_H__ */ +#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp index a4b0d87..df3e5d5 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * 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. @@ -16,10 +16,10 @@ */ #include -#include #include #include #include +#include namespace Dali { @@ -53,7 +53,7 @@ public: mIsEnabled = enabled; } - void SendPanGesture( const Dali::Integration::PanGestureEvent& panEvent ); + void SendPanGesture( const AccessibilityGestureEvent& panEvent ); public: @@ -140,7 +140,7 @@ bool AccessibilityAdaptor::IsEnabled() const return mIsEnabled; } -void AccessibilityAdaptor::SendPanGesture( const Integration::PanGestureEvent& panEvent ) +void AccessibilityAdaptor::SendPanGesture( const AccessibilityGestureEvent& panEvent ) { mGestureHandler->HandlePanGesture( panEvent ); } @@ -615,7 +615,7 @@ void SetEnabled( Dali::AccessibilityAdaptor adaptor, bool enabled ) Dali::Internal::Adaptor::GetImplementation(adaptor).SetEnabled(enabled); } -void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::Integration::PanGestureEvent& panEvent ) +void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::AccessibilityGestureEvent& panEvent ) { Dali::Internal::Adaptor::GetImplementation(adaptor).SendPanGesture( panEvent ); } diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h index 744f971..a463baf 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__ -#define __DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__ +#ifndef DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H +#define DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -20,7 +20,7 @@ // EXTERNAL INCLUDES #include -#include +#include namespace Test { @@ -29,9 +29,9 @@ namespace AccessibilityAdaptor void MockSetReadPosition( Dali::AccessibilityAdaptor adaptor, Dali::Vector2& position ); void SetEnabled( Dali::AccessibilityAdaptor adaptor, bool enabled); -void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::Integration::PanGestureEvent& panEvent ); +void SendPanGesture( Dali::AccessibilityAdaptor adaptor, const Dali::AccessibilityGestureEvent& panEvent ); } // namespace AccessibilityAdaptor } // namespace Test -#endif // +#endif // DALI_TEST_TOOLKIT_ACCESSIBILITY_ADAPTOR_H diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp index 10a2659..7acde34 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -185,10 +185,6 @@ void Adaptor::NotifyLanguageChanged() { } -void Adaptor::SetMinimumPinchDistance(float distance) -{ -} - void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp ) { } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp index 2044f1e..ee6f133 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -2344,7 +2344,7 @@ int UtcDaliAccessibilityManagerHandlePanGesture(void) dummyControl.SetSize(480, 800); Stage::GetCurrent().Add( dummyControl ); - Dali::Integration::PanGestureEvent panGestureEvent(Gesture::Started); + AccessibilityGestureEvent panGestureEvent(AccessibilityGestureEvent::Started); panGestureEvent.previousPosition = Vector2(0.f, 0.f); panGestureEvent.currentPosition = Vector2(100.f, 0.f); panGestureEvent.timeDelta = 16; @@ -2352,12 +2352,12 @@ int UtcDaliAccessibilityManagerHandlePanGesture(void) Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent ); - panGestureEvent.state = Gesture::Continuing; + panGestureEvent.state = AccessibilityGestureEvent::Continuing; panGestureEvent.previousPosition = Vector2(100.f, 0.f); panGestureEvent.currentPosition = Vector2(200.f, 0.f); Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent ); - panGestureEvent.state = Gesture::Finished; + panGestureEvent.state = AccessibilityGestureEvent::Finished; panGestureEvent.previousPosition = Vector2(200.f, 0.f); panGestureEvent.currentPosition = Vector2(300.f, 0.f); Test::AccessibilityAdaptor::SendPanGesture( accessibilityAdaptor, panGestureEvent ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 6150385..31f3094 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -28,10 +28,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -236,107 +232,32 @@ int UtcDaliControlImplOnGestureMethods(void) dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); DALI_TEST_CHECK( dummyImpl.pinchCalled == false ); - Integration::PinchGestureEvent pinch(Gesture::Started); - pinch.scale = 10.0f; - pinch.speed = 50.0f; - pinch.centerPoint = Vector2(20.0f, 20.0f); - application.ProcessEvent(pinch); + + TestGeneratePinch(application); + DALI_TEST_CHECK( dummyImpl.pinchCalled == true ); DALI_TEST_CHECK( dummyImpl.panCalled == false ); - Integration::PanGestureEvent pan(Gesture::Possible); - pan.previousPosition = Vector2(10.0f, 20.0f); - pan.currentPosition = Vector2(20.0f, 20.0f); - pan.timeDelta = 10; - pan.numberOfTouches = 1u; - application.ProcessEvent(pan); - pan.state = Gesture::Started; - application.ProcessEvent(pan); - DALI_TEST_CHECK( dummyImpl.panCalled == true ); - DALI_TEST_CHECK( dummyImpl.tapCalled == false ); - Integration::TapGestureEvent tap(Gesture::Possible); - tap.numberOfTaps = 1u; - tap.numberOfTouches = 1u; - tap.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(tap); - tap.state = Gesture::Started; - application.ProcessEvent(tap); - DALI_TEST_CHECK( dummyImpl.tapCalled == true ); + TestGenerateMiniPan(application); - DALI_TEST_CHECK( dummyImpl.longPressCalled == false ); - Integration::LongPressGestureEvent longPress(Gesture::Possible); - longPress.numberOfTouches = 1u; - longPress.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(longPress); - longPress.state = Gesture::Started; - application.ProcessEvent(longPress); - DALI_TEST_CHECK( dummyImpl.longPressCalled == true ); - longPress.state = Gesture::Finished; - application.ProcessEvent(longPress); - - Stage::GetCurrent().Remove(dummy); - } + DALI_TEST_CHECK( dummyImpl.panCalled == true ); - // Ensure full code coverage - { - DummyControl dummy = DummyControl::New(); - dummy.SetSize( Vector2( 100.0f, 100.0f ) ); + DALI_TEST_CHECK( dummyImpl.tapCalled == false ); - dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); - Stage::GetCurrent().Add(dummy); + TestGenerateTap(application); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); + DALI_TEST_CHECK( dummyImpl.tapCalled == true ); - DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + DALI_TEST_CHECK( dummyImpl.longPressCalled == false ); - DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f ); - Integration::PinchGestureEvent pinch(Gesture::Started); - pinch.scale = 10.0f; - pinch.speed = 50.0f; - pinch.centerPoint = Vector2(20.0f, 20.0f); - application.ProcessEvent(pinch); + TestGenerateLongPress(application); - // Render and notify a couple of times - application.SendNotification(); - application.Render(); - application.SendNotification(); - application.Render(); - DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f ); - - Integration::PanGestureEvent pan(Gesture::Possible); - pan.previousPosition = Vector2(10.0f, 20.0f); - pan.currentPosition = Vector2(20.0f, 20.0f); - pan.timeDelta = 10; - pan.numberOfTouches = 1u; - application.ProcessEvent(pan); - pan.state = Gesture::Started; - application.ProcessEvent(pan); - - Integration::TapGestureEvent tap(Gesture::Possible); - tap.numberOfTaps = 1u; - tap.numberOfTouches = 1u; - tap.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(tap); - tap.state = Gesture::Started; - application.ProcessEvent(tap); - - Integration::LongPressGestureEvent longPress(Gesture::Possible); - longPress.numberOfTouches = 1u; - longPress.point = Vector2(50.0f, 50.0f); - application.ProcessEvent(longPress); - longPress.state = Gesture::Started; - application.ProcessEvent(longPress); - longPress.state = Gesture::Finished; - application.ProcessEvent(longPress); + DALI_TEST_CHECK( dummyImpl.longPressCalled == true ); Stage::GetCurrent().Remove(dummy); } + END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DragAndDropDetector.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DragAndDropDetector.cpp index 3fbbfcd..e1282ad 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-DragAndDropDetector.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-DragAndDropDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -24,7 +24,6 @@ #include #include -#include using namespace Dali; using namespace Dali::Toolkit; @@ -91,25 +90,6 @@ namespace touchEvent.points.push_back(point); return touchEvent; } - - Integration::PanGestureEvent GeneratePan( - Gesture::State state, - Vector2 previousPosition, - Vector2 currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1, - unsigned int time = 1u) - { - Integration::PanGestureEvent pan(state); - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - pan.time = time; - - return pan; - } - } int UtcDaliDragAndDropDetectorConstructorN(void) @@ -305,12 +285,11 @@ int UtcDaliDragAndDropDetectorStartSignal(void) DragSignalFunctor functor(data); detector.StartedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(control, data.control, TEST_LOCATION); - DALI_TEST_EQUALS(Vector2(12.0f, 12.0f), data.detector.GetCurrentScreenPosition(), TEST_LOCATION); + DALI_TEST_EQUALS(Vector2(20.0f, 40.0f), data.detector.GetCurrentScreenPosition(), TEST_LOCATION); data.Reset(); END_TEST; @@ -345,8 +324,7 @@ int UtcDaliDragAndDropDetectorEnteredSignal(void) DragSignalFunctor functor(data); detector.EnteredSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); Vector2 screenCoordinates(10.0f, 110.0f); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates)); @@ -389,8 +367,7 @@ int UtcDaliDragAndDropDetectorMovedSignal(void) DragSignalFunctor functor(data); detector.MovedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); Vector2 screenCoordinates(10.0f, 110.0f); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates)); @@ -440,8 +417,7 @@ int UtcDaliDragAndDropDetectorExitedSignal(void) DragSignalFunctor functor(data); detector.ExitedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); Vector2 screenCoordinates(10.0f, 110.0f); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates)); @@ -486,8 +462,7 @@ int UtcDaliDragAndDropDetectorDroppedSignal(void) DragSignalFunctor functor(data); detector.DroppedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); Vector2 screenCoordinates(10.0f, 110.0f); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates)); @@ -535,14 +510,10 @@ int UtcDaliDragAndDropDetectorEndedSignal(void) DragSignalFunctor functor(data); detector.EndedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Down, Vector2(10.0f, 10.0f))); - application.ProcessEvent(GeneratePan(Gesture::Continuing, Vector2(10.0f, 10.0f), Vector2(120.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Finished, Vector2(120.0f, 12.0f), Vector2(120.0f, 20.0f), 10)); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(control1, data.control, TEST_LOCATION); data.Reset(); @@ -581,8 +552,7 @@ int UtcDaliDragAndDropDetectorGetContent(void) DragSignalFunctor functor(data); detector.DroppedSignal().Connect(&application, functor); - application.ProcessEvent(GeneratePan(Gesture::Possible, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); - application.ProcessEvent(GeneratePan(Gesture::Started, Vector2(10.0f, 10.0f), Vector2(12.0f, 12.0f), 10)); + TestGenerateMiniPan(application); Vector2 screenCoordinates(10.0f, 110.0f); application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates)); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index deca627..4891370 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -24,7 +24,7 @@ #include #include #include -#include + using namespace Dali; using namespace Toolkit; @@ -66,46 +66,18 @@ static void OnScrollUpdate( const Vector2& position ) gOnScrollUpdateCalled = true; } -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) +Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time ) { - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState( state ); + point.SetDeviceId(4); + point.SetScreenPosition( screenPosition ); + point.SetDeviceClass( Device::Class::TOUCH ); + point.SetDeviceSubclass( Device::Subclass::NONE ); + touchEvent.points.push_back( point ); + touchEvent.time = time; + return touchEvent; } /* @@ -1144,36 +1116,41 @@ int UtcDaliItemViewOvershootVertical(void) // Do a pan starting from 100,100 and moving down Vector2 pos(100.0f, 100.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + + application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) ); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); + pos.y += 5.0f; Wait(application, 100); for(int i = 0;i<200;i++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.y += 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); + Wait(application, 100); // Do a pan starting from 100,100 and moving up pos = Vector2(100.0f, 300.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + + application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) ); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); + pos.y -= 5.0f; Wait(application, 100); for(int i = 0;i<200;i++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.y -= 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); Wait(application, 100); END_TEST; } @@ -1205,36 +1182,36 @@ int UtcDaliItemViewOvershootHorizontal(void) // Do a pan starting from 100,100 and moving left Vector2 pos(100.0f, 100.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 )); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 )); pos.x -= 5.0f; Wait(application, 100); for(int i = 0;i<200;i++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.x -= 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); Wait(application, 100); // Do a pan starting from 100,100 and moving right pos = Vector2(100.0f, 100.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) ); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.x += 5.0f; Wait(application, 100); for(int i = 0;i<200;i++) { - SendPan(application, Gesture::Continuing, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) ); pos.x += 5.0f; Wait(application); } - SendPan(application, Gesture::Finished, pos); + application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) ); Wait(application, 100); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp index f7d5908..1607611 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -50,82 +50,47 @@ static void TestCallback(BaseHandle handle) * @param application Test application instance * @param duration Time to pass in milliseconds. */ -void Wait(ToolkitTestApplication& application, int duration = 0) +int Wait(ToolkitTestApplication& application, int duration = 0) { + int time = 0; + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) { application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; } -} - -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) -{ - Integration::PanGestureEvent pan(state); - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; + return time; } -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; -} - -static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool toStart = true, bool toFinish = true) +static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t& time, bool toStart = true, bool toFinish = true) { - // Now do a pan starting from (start) and heading (direction) - Vector2 pos(start); + Vector2 pos( start ); if( toStart ) { - SendPan(application, Gesture::Possible, pos); - Wait(application); - SendPan(application, Gesture::Started, pos); - Wait(application); + // Now do a pan starting from (start + 20) and heading (direction) + Vector2 pos_start_jump( start + Vector2(15.0f, 0.0f) ); + TestStartPan( application, start, pos_start_jump, time ); + pos += direction; } + time += Wait(application); + for(int i = 0;i(), 0, TEST_LOCATION ); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); - PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); - Wait(application, 1000); + time += Wait(application, 1000); DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); // the page is turned over DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), (int)(pageIndex+1), TEST_LOCATION ); @@ -507,7 +473,7 @@ int UtcDaliPageTurnPortraitViewSignals(void) //pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f ) start = Vector2( size.width, size.height*0.5f ); direction = Vector2(-size.width*0.025f, size.height*0.025f); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); @@ -515,12 +481,12 @@ int UtcDaliPageTurnPortraitViewSignals(void) signalVerified[0] = false; isTurningForwards = false; - PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start + direction*2 , direction, 5, time, false, true); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); // start the sliding back - Wait(application, 1000); + time += Wait(application, 1000); DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), (int)pageIndex, TEST_LOCATION ); // the page is not turned over @@ -534,13 +500,13 @@ int UtcDaliPageTurnPortraitViewSignals(void) isTurningForwards = false; start = size*0.25f; direction = Vector2(size.x*0.05f, 0.f); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 4, time, true, false); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); - PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); @@ -613,21 +579,22 @@ int UtcDaliPageTurnLanscapeViewSignals(void) pageIndex = 0; isTurningForwards = true; // Do a pan to the left. + uint32_t time = 0; Vector2 start = Vector2(stageSize.x * 0.85f, stageSize.y*0.5); Vector2 direction = Vector2(-stageSize.x*0.04f, -stageSize.x*0.03f); DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), 0, TEST_LOCATION ); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); - PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); - Wait(application, 1000); + time += Wait(application, 1000); DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); // the page is turned over DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), (int)(pageIndex+1), TEST_LOCATION ); @@ -642,17 +609,17 @@ int UtcDaliPageTurnLanscapeViewSignals(void) //pan 10 frames from position( size.width, size.height*0.5f ) to position( size * 0.75f ) start = Vector2( stageSize.x * 0.15f, stageSize.y*0.5f ); direction = Vector2(stageSize.x * 0.03f, 0.f); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); - PerformGestureDiagonalSwipe( application, start + direction*5.f , direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start + direction*5.f , direction, 5, time, false, true); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); - Wait(application, 1000); + time += Wait(application, 1000); DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified ); DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), 0, TEST_LOCATION ); // the first page is turned back @@ -664,13 +631,13 @@ int UtcDaliPageTurnLanscapeViewSignals(void) isTurningForwards = false; start = stageSize*0.55f; direction = Vector2(stageSize.x*0.025f, 0.f); - PerformGestureDiagonalSwipe( application, start, direction, 5, true, false); + PerformGestureDiagonalSwipe( application, start, direction, 5, time, true, false); DALI_TEST_CHECK( callbackPanStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); DALI_TEST_CHECK( !callbackPanFinished.mSignalVerified ); - PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, false, true); + PerformGestureDiagonalSwipe( application, start+direction*5.f, direction, 5, time, false, true); DALI_TEST_CHECK( !callbackTurnStarted.mSignalVerified ); DALI_TEST_CHECK( callbackPanFinished.mSignalVerified ); DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp index d4401ea..ff46053 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -20,7 +20,6 @@ #include #include #include -#include using namespace Dali; using namespace Toolkit; @@ -40,48 +39,6 @@ namespace const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; -} - /* * Simulate time passed by. * @@ -143,25 +100,29 @@ static void OnScrollPositionIntervalReached( float position ) gOnScrollPositionIntervalReachedSignalCalled = true; } -static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames) +static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t start_time) { gOnPanFinishedCalled = false; // Now do a pan starting from (start) and heading (direction) - Vector2 pos(start); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + Vector2 pos( start + ( direction * 15 ) ); + uint32_t time = start_time; + + TestStartPan( application, start, pos, time ); + Wait(application); for(int i = 0; i < frames; i++) { pos += direction; // Move in this direction - SendPan(application, Gesture::Continuing, pos); + time += RENDER_FRAME_INTERVAL; + TestMovePan( application, pos, time); Wait(application); } pos += direction; // Move in this direction. - SendPan(application, Gesture::Finished, pos); + time += RENDER_FRAME_INTERVAL; + TestEndPan(application, pos, time ); Wait(application); return pos; @@ -1754,7 +1715,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalP(void) application.Render(); // Perform a swipe gesture on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 1, 500); DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION ); DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION ); @@ -1790,7 +1751,7 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void) application.Render(); // Perform a vertical swipe gesture on the indicator when there is no source object set on the scroll bar - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 500); DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION ); // Create a source actor that owns the scroll properties required by the scroll bar @@ -1816,12 +1777,12 @@ int UtcDaliToolkitScrollBarPanFinishedSignalN(void) application.Render(); // Perform a swipe gesture on the scroll bar but not on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20, 2000); DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION ); DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION ); // Perform a swipe gesture on the indicator - PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20); + PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20, 4000); DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION ); DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index a59a708..3e66bf1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -20,7 +20,6 @@ #include #include #include -#include using namespace Dali; using namespace Toolkit; @@ -85,48 +84,6 @@ const float TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION = TEST_CUSTOM2_SNAP_OVERSHOOT_D const float TIME_TOLERANCE = 0.05f; ///< Allow testing tolerance between a 10th of second (+/- 3 frames) -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL)); - - last.x = pos.x; - last.y = pos.y; -} - /* * Simulate time passed by. * @@ -269,31 +226,38 @@ float TestAlphaFunction(float progress) return std::min( progress * 2.0f, 1.0f ); } -static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true) +/** + * Generate a complete pan gesture + * Note: To initiate the gesture it will go from start, diagonally SE on the screen, then continue in the direction for frames touches + */ +static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, uint32_t& time, bool finish = true) { gOnScrollStartCalled = false; gOnScrollUpdateCalled = false; gOnScrollCompleteCalled = false; gOnSnapStartCalled = false; - // Now do a pan starting from (start) and heading (direction) - Vector2 pos(start); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); + Vector2 pos( start ); + + // This is created to ensure a pan is started + Vector2 pos_start_jump( start + Vector2(11.0f, 11.0f) ); + TestStartPan( application, start, pos_start_jump, time ); + pos = pos_start_jump; + Wait(application); for(int i = 0;i(), overshootSize, TEST_LOCATION ); @@ -1424,11 +1457,11 @@ int UtcDaliToolkitScrollViewOvershoot(void) scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little. - Wait(application); + time += Wait(application); // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch) Vector2 currentPos = Vector2(100.0f, 100.0f); - currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false); + currentPos = PerformGestureSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, time, false); float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); Vector2 positionValue = scrollView.GetCurrentProperty< Vector2 >( ScrollView::Property::SCROLL_POSITION ); @@ -1439,7 +1472,8 @@ int UtcDaliToolkitScrollViewOvershoot(void) float timeToReachOrigin; // Now release touch. Overshoot should snap back to zero. - SendPan(application, Gesture::Finished, currentPos); + TestEndPan(application, currentPos, time); + timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); float minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + DEFAULT_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; @@ -1451,9 +1485,9 @@ int UtcDaliToolkitScrollViewOvershoot(void) // 2. Repeat Scroll, but this time change overshoot snap duration to shorter time scrollView.SetSnapOvershootDuration(TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION); - currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false); // Now release touch. Overshoot should snap back to zero. - SendPan(application, Gesture::Finished, currentPos); + TestEndPan(application, currentPos, time); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM1_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; @@ -1465,9 +1499,9 @@ int UtcDaliToolkitScrollViewOvershoot(void) // 3. Repeat Scroll, but this time change overshoot snap duration to longer time. scrollView.SetSnapOvershootDuration(TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION); - currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false); // Now release touch. Overshoot should snap back to zero. - SendPan(application, Gesture::Finished, currentPos); + TestEndPan(application, currentPos, time); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM2_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; @@ -1480,9 +1514,9 @@ int UtcDaliToolkitScrollViewOvershoot(void) scrollView.SetSnapOvershootDuration(TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION); scrollView.SetSnapOvershootAlphaFunction(TestAlphaFunction); - currentPos = PerformGestureDiagonalSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, false); + currentPos = PerformGestureSwipe(application, Vector2(100.0f, 100.0f), Vector2(5.0f, 5.0f), 100, time, false); // Now release touch. Overshoot should snap back to zero. - SendPan(application, Gesture::Finished, currentPos); + TestEndPan(application, currentPos, time); timeToReachOrigin = TestOvershootSnapDuration(application, scrollView); minTimeToReachOrigin = SCROLL_ANIMATION_DURATION + TEST_CUSTOM3_SNAP_OVERSHOOT_DURATION * (SNAP_POSITION_WITH_DECELERATED_VELOCITY.x / DEFAULT_MAX_OVERSHOOT) - TIME_TOLERANCE; @@ -1553,16 +1587,17 @@ int UtcDaliToolkitScrollViewSnapStartedSignalP(void) scrollView.SnapStartedSignal().Connect( &OnSnapStart ); scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. - Wait(application); + uint32_t time = 0; + time += Wait(application); // First try a snap. - PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, true); + PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(0.5f, 0.0f), 60, time, true); DALI_TEST_CHECK( gOnSnapStartCalled ); DALI_TEST_CHECK( gLastSnapType == Toolkit::Snap ); // Second try a swipe. - PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, true); + PerformGestureSwipe(application, CLAMP_TOUCH_START, Vector2(20.0f, 0.0f), 60, time, true); DALI_TEST_CHECK( gOnSnapStartCalled ); DALI_TEST_CHECK( gLastSnapType == Toolkit::Flick ); @@ -1624,35 +1659,49 @@ int UtcDaliToolkitScrollViewSetMaxOvershootP(void) scrollView.SetMaxOvershoot(50.0f, 50.0f); scrollView.ScrollTo(OVERSHOOT_START_SCROLL_POSITION, 0.0f); // move in a little. - Wait(application); + uint32_t time = 0; + time += Wait(application); // Scroll page in NW (-20,-20 pixels), then check that overshoot should be 0. (don't release touch) - Vector2 currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 20, false); + Vector2 currentPos = PerformGestureSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 10, time, false); float overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); float overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 0.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 0.0f, TEST_LOCATION); + time += Wait(application); // Scroll page further in NW (-105,-105 pixels), then check that overshoot should be around 0.5. (don't release touch) - currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 105, false); + for(int i = 0; i<106; i++) + { + TestMovePan(application, currentPos, time ); + currentPos += Vector2(1.0f, 1.0f); + time += Wait(application); + } + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); // The overshoot value is a 0.0f - 1.0f ranged value of the amount overshot related to the maximum overshoot. // EG. If we move 105, max overshoot is 50, then we overshot 50 / 105. - float correctOvershootValue = 50.0f / 105.f; + float correctOvershootValue = 0.508f; // This was measured and then set as the limit DALI_TEST_EQUALS( overshootXValue, correctOvershootValue, 0.001f, TEST_LOCATION ); DALI_TEST_EQUALS( overshootYValue, correctOvershootValue, 0.001f, TEST_LOCATION ); - // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch) - currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false); + // Scroll page further in NW (-25,-25 pixels), then check that overshoot should be now 1.0. (don't release touch) + for(int i = 0;i<25;i++) + { + TestMovePan(application, currentPos, time ); + currentPos += Vector2(1.0f, 1.0f); // Move in this direction + time += Wait(application); + } + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); - // Change the max overshoot to be 100 pixels in both X axis and Y axis - scrollView.SetMaxOvershoot(100.0f, 100.0f); - Wait(application); + // Change the max overshoot to be 250 pixels in both X axis and Y axis + scrollView.SetMaxOvershoot(250.0f, 250.0f); + time += Wait(application); // Check that overshoot should be now around 0.8. overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); @@ -1660,8 +1709,14 @@ int UtcDaliToolkitScrollViewSetMaxOvershootP(void) DALI_TEST_CHECK(overshootXValue > 0.79f && overshootXValue < 0.81f); DALI_TEST_CHECK(overshootYValue > 0.79f && overshootYValue < 0.81f); - // Scroll page further in NW (-30,-30 pixels), then check that overshoot should be now 1.0. (don't release touch) - currentPos = PerformGestureDiagonalSwipe(application, OVERSHOOT_START_SCROLL_POSITION, Vector2(1.0f, 1.0f), 30, false); + // Scroll page further in NW (-50,-50 pixels), then check that overshoot should be now 1.0. (don't release touch) + for(int i = 0;i<50;i++) + { + TestMovePan(application, currentPos, time ); + currentPos += Vector2(1.0f, 1.0f); // Move in this direction + time += Wait(application); + } + overshootXValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_X ); overshootYValue = scrollView.GetCurrentProperty< float >( ScrollView::Property::OVERSHOOT_Y ); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); @@ -1686,26 +1741,71 @@ int UtcDaliToolkitScrollViewSetScrollingDirectionP(void) Vector2 START_POSITION = Vector2(10.0f, 10.0f); scrollView.ScrollTo(START_POSITION, 0.0f); - Wait(application); + uint32_t time = 0; + time += Wait(application); + // Try a vertical swipe. - PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); + // PerformGestureSwipe not used as a different initial direction was required + + Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) ); + TestStartPan( application, START_POSITION, pos, time ); + time += Wait(application); + for( int i = 0; i<45; i++ ) + { + pos += Vector2(0.0f, 1.0f); + TestMovePan( application, pos, time ); + time += Wait( application ); + } + pos += Vector2(0.0f, 1.0f); + TestEndPan( application, pos, time ); + time += Wait( application ); + // Take into account resampling done when prediction is off. DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL); scrollView.ScrollTo(START_POSITION, 0.0f); - Wait(application); + time += Wait(application); + // Try a vertical swipe. - PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); - DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION ); + // PerformGestureSwipe not used as a different initial direction was required + pos = ( START_POSITION + Vector2(0.0f, 15.0f) ); + TestStartPan( application, START_POSITION, pos, time ); + time += Wait(application); + for( int i = 0; i<45; i++ ) + { + pos += Vector2(0.0f, 1.0f); + TestMovePan( application, pos, time ); + time += Wait( application ); + } + pos += Vector2(0.0f, 1.0f); + TestEndPan( application, pos, time ); + time += Wait( application ); + + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL); - scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f); - Wait(application); + scrollView.ScrollTo(START_POSITION, 0.0f); + + time += Wait(application); + // Try a vertical swipe. - PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); + // PerformGestureSwipe not used as a different initial direction was required + pos = ( START_POSITION + Vector2(0.0f, 15.0f) ); + TestStartPan( application, START_POSITION, pos, time ); + time += Wait(application); + for( int i = 0; i<45; i++ ) + { + pos += Vector2(0.0f, 1.0f); + TestMovePan( application, pos, time ); + time += Wait( application ); + } + pos += Vector2(0.0f, 1.0f); + TestEndPan( application, pos, time ); + time += Wait( application ); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); END_TEST; @@ -1725,22 +1825,52 @@ int UtcDaliToolkitScrollViewRemoveScrollingDirectionP(void) scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); Vector2 START_POSITION = Vector2(10.0f, 10.0f); + uint32_t time = 0; scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL); scrollView.ScrollTo(START_POSITION, 0.0f); - Wait(application); - // Try a vertical swipe. - PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); + + time += Wait(application); + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), START_POSITION, TEST_LOCATION ); + // Try a vertical swipe. + // PerformGestureSwipe not used as a different initial direction was required + Vector2 pos( START_POSITION + Vector2(0.0f, 15.0f) ); + TestStartPan( application, START_POSITION, pos, time ); + time += Wait(application); + for( int i = 0; i<45; i++ ) + { + pos += Vector2(0.0f, 1.0f); + TestMovePan( application, pos, time ); + time += Wait( application ); + } + pos += Vector2(0.0f, 1.0f); + TestEndPan( application, pos, time ); + time += Wait( application ); + + DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); + scrollView.RemoveScrollingDirection(Dali::PanGestureDetector::DIRECTION_VERTICAL); + // When the horizontal direction is removed, there are no directions set and therefore all will work + scrollView.SetScrollingDirection(Dali::PanGestureDetector::DIRECTION_HORIZONTAL); - scrollView.ScrollTo(Vector2(10.0f, 10.0f), 0.0f); - Wait(application); + time += Wait(application); // Try a vertical swipe. - PerformGestureDiagonalSwipe(application, START_POSITION, Vector2(0.0f, 1.0f), 60, true); - // Take into account resampling done when prediction is off. + Vector2 pos2( pos + Vector2(0.0f, 15.0f) ); + TestStartPan( application, pos, pos2, time ); + time += Wait(application); + for( int i = 0; i<45; i++ ) + { + pos2 += Vector2(0.0f, 1.0f); + TestMovePan( application, pos2, time ); + time += Wait( application ); + } + pos2 += Vector2(0.0f, 1.0f); + TestEndPan( application, pos2, time ); + + // The previous scroll should not have had any effect DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition() - Vector2(0.0f, 0.5f), Vector2(10.0f, -50.0f), 0.25f, TEST_LOCATION ); END_TEST; @@ -2642,19 +2772,20 @@ int UtcDaliToolkitScrollViewGesturePageLimit(void) // Force starting position. scrollView.ScrollTo( startPos, 0.0f ); - Wait( application ); + uint32_t time = 0; + time += Wait( application ); // Deliberately skip the "Finished" part of the gesture, so we can read the coordinates before the snap begins. - Vector2 currentPos( PerformGestureDiagonalSwipe( application, startPos, direction, frames - 1, false ) ); + Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) ); // Confirm the final X coord has not moved more than one page from the start X position. DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION ); // Finish the gesture and wait for the snap. currentPos += direction; - SendPan( application, Gesture::Finished, currentPos ); + TestEndPan(application, currentPos, time); // We add RENDER_FRAME_INTERVAL on to wait for an extra frame (for the last "finished" gesture to complete first. - Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); + time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL ); // Confirm the final X coord has snapped to exactly one page ahead of the start page. DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp index 438a496..f15a256 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * 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. @@ -25,7 +25,6 @@ #include #include #include -#include using namespace Dali; using namespace Toolkit; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp index 9cd92ca..d7adf0e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -20,7 +20,6 @@ #include #include #include -#include using namespace Dali; using namespace Dali::Toolkit; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 251b339..f56c3c1 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -23,9 +23,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -159,51 +156,6 @@ static void TestInputStyleChangedCallback( TextEditor control, TextEditor::Input gInputStyleMask = mask; } -// Generate a TapGestureEvent to send to Core. -Integration::TapGestureEvent GenerateTap( - Gesture::State state, - unsigned int numberOfTaps, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::TapGestureEvent tap( state ); - - tap.numberOfTaps = numberOfTaps; - tap.numberOfTouches = numberOfTouches; - tap.point = point; - - return tap; -} - -Integration::LongPressGestureEvent GenerateLongPress( - Gesture::State state, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::LongPressGestureEvent longPress( state ); - - longPress.numberOfTouches = numberOfTouches; - longPress.point = point; - return longPress; -} - -// Generate a PanGestureEvent to send to Core -Integration::PanGestureEvent GeneratePan( Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1u ) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - // Generate a KeyEvent to send to Core. Integration::KeyEvent GenerateKey( const std::string& keyName, const std::string& logicalKey, @@ -230,53 +182,6 @@ Integration::KeyEvent GenerateKey( const std::string& keyName, deviceSubclass ); } -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent( GeneratePan( state, last, pos, 16 ) ); - - last.x = pos.x; - last.y = pos.y; -} - -/* - * Simulate time passed by. - * - * @note this will always process at least 1 frame (1/60 sec) - * - * @param application Test application instance - * @param duration Time to pass in milliseconds. - * @return The actual time passed in milliseconds - */ -static int Wait(ToolkitTestApplication& application, int duration = 0) -{ - int time = 0; - - for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) - { - application.SendNotification(); - application.Render(RENDER_FRAME_INTERVAL); - time += RENDER_FRAME_INTERVAL; - } - - return time; -} - Dali::Integration::Point GetPointDownInside( Vector2& pos ) { Dali::Integration::Point point; @@ -1072,8 +977,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) ); + TestGenerateTap( application, 18.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1100,8 +1004,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) ); + TestGenerateTap( application, 30.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1118,8 +1021,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) ); + TestGenerateTap( application, 43.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1143,8 +1045,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) ); + TestGenerateTap( application, 88.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1177,8 +1078,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) ); + TestGenerateTap( application, 115.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1195,8 +1095,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) ); + TestGenerateTap( application, 164.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1224,8 +1123,7 @@ int utcDaliTextEditorInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) ); + TestGenerateTap( application, 191.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1295,10 +1193,8 @@ int utcDaliTextEditorInputStyleChanged02(void) inputStyleChangedSignal = false; // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) ); + TestGenerateTap( application, 53.0f, 25.0f, 100 ); + TestGenerateTap( application, 53.0f, 25.0f, 200 ); // Render and notify application.SendNotification(); @@ -1426,8 +1322,7 @@ int utcDaliTextEditorInputStyleChanged02(void) DALI_TEST_CHECK( !inputStyleChangedSignal ); // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) ); + TestGenerateTap( application, 63.0f, 25.0f, 900 ); // Render and notify application.SendNotification(); @@ -1469,8 +1364,7 @@ int utcDaliTextEditorInputStyleChanged02(void) editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet ); // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) ); + TestGenerateTap( application, 30.0f, 25.0f, 1500 ); // Render and notify application.SendNotification(); @@ -1530,8 +1424,7 @@ int utcDaliTextEditorEvent01(void) DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::TEXT ), std::string(""), TEST_LOCATION ); // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1562,8 +1455,7 @@ int utcDaliTextEditorEvent01(void) application.Render(); // Create a tap event on the second text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) ); + TestGenerateTap( application, 150.0f, 125.0f ); // Render and notify application.SendNotification(); @@ -1613,8 +1505,7 @@ int utcDaliTextEditorEvent02(void) Actor stencil = editor.GetChildAt( 0u ); // Create a tap event to touch the text editor. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f, 100 ); // Render and notify application.SendNotification(); @@ -1677,8 +1568,7 @@ int utcDaliTextEditorEvent02(void) // Send some taps and check the cursor positions. // Try to tap at the beginning. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f, 700 ); // Render and notify application.SendNotification(); @@ -1690,8 +1580,7 @@ int utcDaliTextEditorEvent02(void) DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2. // Tap away from the start position. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) ); + TestGenerateTap( application, 16.0f, 25.0f, 1400 ); // Render and notify application.SendNotification(); @@ -1749,8 +1638,7 @@ int utcDaliTextEditorEvent03(void) // Send some taps and check text controller with clipboard window Dali::Clipboard clipboard = Clipboard::Get(); clipboard.ShowClipboard(); - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 100 ); clipboard.HideClipboard(); // Render and notify @@ -1758,16 +1646,14 @@ int utcDaliTextEditorEvent03(void) application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 1000 ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 1100 ); // Render and notify application.SendNotification(); @@ -1789,8 +1675,8 @@ int utcDaliTextEditorEvent03(void) } // Double tap out of bounds - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 29.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 29.f, 25.0f ) ) ); + TestGenerateTap( application, 29.0f, 25.0f, 1700 ); + TestGenerateTap( application, 29.0f, 25.0f, 1800 ); // Render and notify application.SendNotification(); @@ -1808,8 +1694,7 @@ int utcDaliTextEditorEvent03(void) } // Long Press - application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateLongPress(application, 1.0f, 25.0f); // Render and notify application.SendNotification(); @@ -1844,8 +1729,7 @@ int utcDaliTextEditorEvent04(void) application.Render(); // Tap on the text editor - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1939,8 +1823,7 @@ int utcDaliTextEditorEvent05(void) application.Render(); // Tap on the text editor - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2017,8 +1900,7 @@ int utcDaliTextEditorEvent06(void) application.Render(); // Tap on the text editor - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2108,8 +1990,7 @@ int utcDaliTextEditorEvent07(void) application.Render(); // Tap on the text editor - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2253,8 +2134,7 @@ int utcDaliTextEditorEvent08(void) application.Render(); // Tap on the text editor - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2461,16 +2341,14 @@ int utcDaliTextEditorHandles(void) application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 100 ); // Render and notify application.SendNotification(); application.Render(); // Tap to create the grab handle. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 700 ); // Render and notify application.SendNotification(); @@ -2498,22 +2376,6 @@ int utcDaliTextEditorHandles(void) application.SendNotification(); application.Render(); - // drag grab handle right - SendPan(application, Gesture::Possible, touchPos); - SendPan(application, Gesture::Started, touchPos); - touchPos.x += 5.0f; - Wait(application, 100); - - for(int i = 0;i<20;i++) - { - SendPan(application, Gesture::Continuing, touchPos); - touchPos.x += 5.0f; - Wait(application); - } - - SendPan(application, Gesture::Finished, touchPos); - Wait(application); - // Release the grab handle. event = Dali::Integration::TouchEvent(); event.AddPoint( GetPointUpInside( touchPos ) ); @@ -2524,16 +2386,14 @@ int utcDaliTextEditorHandles(void) application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 1400 ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word and create the selection handles. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f, 1500 ); // Render and notify application.SendNotification(); @@ -2550,22 +2410,6 @@ int utcDaliTextEditorHandles(void) application.SendNotification(); application.Render(); - // drag the left selection handle right - SendPan(application, Gesture::Possible, touchPos); - SendPan(application, Gesture::Started, touchPos); - touchPos.x += 5.0f; - Wait(application, 100); - - for(int i = 0;i<20;i++) - { - SendPan(application, Gesture::Continuing, touchPos); - touchPos.x += 5.0f; - Wait(application); - } - - SendPan(application, Gesture::Finished, touchPos); - Wait(application); - // Release the left selection handle. event = Dali::Integration::TouchEvent(); event.AddPoint( GetPointUpInside( touchPos ) ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 4c126be..9ff0f65 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -21,10 +21,8 @@ #include #include -#include #include -#include -#include + #include #include #include @@ -150,48 +148,6 @@ static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField) textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap ); } -// Generate a PanGestureEvent to send to Core -static Integration::PanGestureEvent GeneratePan( - Gesture::State state, - const Vector2& previousPosition, - const Vector2& currentPosition, - unsigned long timeDelta, - unsigned int numberOfTouches = 1) -{ - Integration::PanGestureEvent pan(state); - - pan.previousPosition = previousPosition; - pan.currentPosition = currentPosition; - pan.timeDelta = timeDelta; - pan.numberOfTouches = numberOfTouches; - - return pan; -} - -/** - * Helper to generate PanGestureEvent - * - * @param[in] application Application instance - * @param[in] state The Gesture State - * @param[in] pos The current position of touch. - */ -static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos) -{ - static Vector2 last; - - if( (state == Gesture::Started) || - (state == Gesture::Possible) ) - { - last.x = pos.x; - last.y = pos.y; - } - - application.ProcessEvent(GeneratePan(state, last, pos, 16)); - - last.x = pos.x; - last.y = pos.y; -} - /* * Simulate time passed by. * @@ -267,34 +223,6 @@ static void TestInputStyleChangedCallback( TextField control, TextField::InputSt gInputStyleMask = mask; } -// Generate a TapGestureEvent to send to Core. -Integration::TapGestureEvent GenerateTap( - Gesture::State state, - unsigned int numberOfTaps, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::TapGestureEvent tap( state ); - - tap.numberOfTaps = numberOfTaps; - tap.numberOfTouches = numberOfTouches; - tap.point = point; - - return tap; -} - -Integration::LongPressGestureEvent GenerateLongPress( - Gesture::State state, - unsigned int numberOfTouches, - Vector2 point) -{ - Integration::LongPressGestureEvent longPress( state ); - - longPress.numberOfTouches = numberOfTouches; - longPress.point = point; - return longPress; -} - // Generate a KeyEvent to send to Core. Integration::KeyEvent GenerateKey( const std::string& keyName, const std::string& logicalKey, @@ -1216,8 +1144,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) ); + TestGenerateTap( application, 18.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1244,8 +1171,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) ); + TestGenerateTap( application, 30.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1262,8 +1188,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) ); + TestGenerateTap( application, 43.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1287,8 +1212,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) ); + TestGenerateTap( application, 88.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1320,8 +1244,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) ); + TestGenerateTap( application, 115.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1338,8 +1261,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) ); + TestGenerateTap( application, 164.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1363,8 +1285,7 @@ int utcDaliTextFieldInputStyleChanged01(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) ); + TestGenerateTap( application, 191.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1406,7 +1327,6 @@ int utcDaliTextFieldInputStyleChanged02(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -1434,10 +1354,8 @@ int utcDaliTextFieldInputStyleChanged02(void) inputStyleChangedSignal = false; // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) ); + TestGenerateTap( application, 53.0f, 25.0f, 100 ); + TestGenerateTap( application, 53.0f, 25.0f, 200 ); // Render and notify application.SendNotification(); @@ -1562,8 +1480,7 @@ int utcDaliTextFieldInputStyleChanged02(void) DALI_TEST_CHECK( !inputStyleChangedSignal ); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) ); + TestGenerateTap( application, 63.0f, 25.0f, 300 ); // Render and notify application.SendNotification(); @@ -1610,6 +1527,10 @@ int utcDaliTextFieldEvent01(void) field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + // Render and notify + application.SendNotification(); + application.Render(); + // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); @@ -1627,8 +1548,7 @@ int utcDaliTextFieldEvent01(void) DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string(""), TEST_LOCATION ); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1655,8 +1575,8 @@ int utcDaliTextFieldEvent01(void) field2.SetParentOrigin( ParentOrigin::TOP_LEFT ); field2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - field2.SetSize( 100.f, 100.f ); - field2.SetPosition( 100.f, 100.f ); + field2.SetSize( 100.f, 100.0f ); + field2.SetPosition( 100.0f, 100.0f ); Stage::GetCurrent().Add( field2 ); @@ -1665,8 +1585,7 @@ int utcDaliTextFieldEvent01(void) application.Render(); // Create a tap event on the second text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) ); + TestGenerateTap( application, 150.0f, 125.0f ); // Render and notify application.SendNotification(); @@ -1700,7 +1619,7 @@ int utcDaliTextFieldEvent02(void) Stage::GetCurrent().Add( field ); - field.SetSize( 300.f, 50.f ); + field.SetSize( 300.0f, 50.0f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -1718,8 +1637,7 @@ int utcDaliTextFieldEvent02(void) DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION ); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f, 300 ); // Render and notify application.SendNotification(); @@ -1788,8 +1706,7 @@ int utcDaliTextFieldEvent02(void) // Send some taps and check the cursor positions. // Try to tap at the beginning. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f, 900 ); // Render and notify application.SendNotification(); @@ -1801,8 +1718,7 @@ int utcDaliTextFieldEvent02(void) DALI_TEST_EQUALS( position4, position5, TEST_LOCATION ); // Should be in the same position2. // Tap away from the start position. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) ); + TestGenerateTap( application, 16.0f, 25.0f, 1500 ); // Render and notify application.SendNotification(); @@ -1869,16 +1785,14 @@ int utcDaliTextFieldEvent03(void) application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) ); + TestGenerateTap( application, 3.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -1930,32 +1844,28 @@ int utcDaliTextFieldEvent04(void) application.Render(); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap grab handle - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 0.f, 40.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 0.f, 40.0f ) ) ); + TestGenerateTap( application, 0.0f, 40.0f ); END_TEST; } @@ -1987,45 +1897,25 @@ int utcDaliTextFieldEvent05(void) application.Render(); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); - // drag grab handle right - Vector2 pos(0.0f, 40.0f); - SendPan(application, Gesture::Possible, pos); - SendPan(application, Gesture::Started, pos); - pos.x += 5.0f; - Wait(application, 100); - - for(int i = 0;i<20;i++) - { - SendPan(application, Gesture::Continuing, pos); - pos.x += 5.0f; - Wait(application); - } - - SendPan(application, Gesture::Finished, pos); - Wait(application, RENDER_FRAME_INTERVAL); - Actor stencil = field.GetChildAt( 1u ); END_TEST; } @@ -2058,24 +1948,21 @@ int utcDaliTextFieldEvent06(void) application.Render(); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Long Press - application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateLongPress(application, 1.0f, 25.0f); // Render and notify application.SendNotification(); @@ -2115,8 +2002,7 @@ int utcDaliTextFieldEvent07(void) application.Render(); // Long Press - application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateLongPress(application, 1.0f, 25.0f); // Render and notify application.SendNotification(); @@ -2156,8 +2042,7 @@ int utcDaliTextFieldEvent08(void) application.Render(); // Long Press - application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateLongPress( application, 1.0f, 25.0f, 20 ); // Render and notify application.SendNotification(); @@ -2165,12 +2050,12 @@ int utcDaliTextFieldEvent08(void) Wait(application, 500); + TestEndLongPress( application, 1.0f, 25.0f, 520 ); + // Long Press - application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateLongPress( application, 1.0f, 25.0f, 600 ); // Render and notify - application.SendNotification(); application.Render(); Wait(application, 500); @@ -2222,8 +2107,7 @@ int utcDaliTextFieldEvent09(void) application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); application.SendNotification(); application.Render(); @@ -2313,24 +2197,21 @@ int utcDaliTextFieldStyleWhilstSelected(void) application.Render(); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2429,8 +2310,7 @@ int utcDaliTextFieldEscKeyLoseFocus(void) DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string(""), TEST_LOCATION ); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2501,24 +2381,21 @@ int utcDaliTextFieldSomeSpecialKeys(void) application.Render(); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Tap first to get the focus. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); application.Render(); // Double tap to select a word. - application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) ); + TestGenerateTap( application, 1.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2772,7 +2649,7 @@ int UtcDaliTextFieldEnableShiftSelectionProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); + field.SetSize( 300.0f, 50.0f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); Stage::GetCurrent().Add( field ); @@ -2800,7 +2677,7 @@ int UtcDaliTextFieldEnableGrabHandleProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); + field.SetSize( 300.0f, 50.0f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); Stage::GetCurrent().Add( field ); @@ -2828,7 +2705,7 @@ int UtcDaliTextFieldMatchSystemLanguageDirectionProperty(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - field.SetSize( 300.f, 50.f ); + field.SetSize( 300.0f, 50.0f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); Stage::GetCurrent().Add( field ); @@ -2861,7 +2738,7 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) Stage::GetCurrent().Add( field ); - field.SetSize( 300.f, 50.f ); + field.SetSize( 300.0f, 50.0f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -2877,8 +2754,7 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END"); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2892,8 +2768,7 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN"); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2903,8 +2778,7 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER"); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); @@ -2914,8 +2788,7 @@ int utcDaliTextFieldLayoutDirectionCoverage(void) field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END"); // Create a tap event to touch the text field. - application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); - application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + TestGenerateTap( application, 150.0f, 25.0f ); // Render and notify application.SendNotification(); diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index aee1bc0..9eeab0e 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -1298,11 +1298,11 @@ bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent return handled; } -bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent) +bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& panEvent) { bool handled = false; - if( panEvent.state == Gesture::Started ) + if( panEvent.state == AccessibilityGestureEvent::Started ) { // Find the focusable actor at the event position Dali::HitTestAlgorithm::Results results; @@ -1319,7 +1319,7 @@ bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& // Gesture::Finished (Up) events are delivered with previous (Motion) event position // Use the real previous position; otherwise we may incorrectly get a ZERO velocity - if ( Gesture::Finished != panEvent.state ) + if ( AccessibilityGestureEvent::Finished != panEvent.state ) { // Store the previous position for next Gesture::Finished iteration. mPreviousPosition = panEvent.previousPosition; @@ -1327,7 +1327,8 @@ bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& Actor rootActor = Stage::GetCurrent().GetRootLayer(); - Dali::PanGesture pan(panEvent.state); + Dali::PanGesture pan( static_cast(panEvent.state) ); + pan.time = panEvent.time; pan.numberOfTouches = panEvent.numberOfTouches; pan.screenPosition = panEvent.currentPosition; diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h index f794170..d51d753 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ -#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ +#ifndef DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H +#define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include // INTERNAL INCLUDES #include @@ -498,7 +498,7 @@ private: * @param[in] panEvent The pan event to be handled. * @return whether the gesture is handled successfully or not. */ - virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent); + virtual bool HandlePanGesture(const AccessibilityGestureEvent& panEvent); /** * Change the accessibility status when Accessibility feature(screen-reader) turned on or off. @@ -765,4 +765,4 @@ inline const Internal::AccessibilityManager& GetImpl(const Dali::Toolkit::Access } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ +#endif // DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H -- 2.7.4