From 822bc4bf421984183b0009a50b8109a8fff62da0 Mon Sep 17 00:00:00 2001 From: fanzexuan Date: Mon, 25 Aug 2025 21:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=BE=E5=A4=A7=E6=89=8B?= =?UTF-8?q?=E5=8A=BFDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fanzexuan --- services/aams/test/BUILD.gn | 66 ++ .../mock/include/accessibility_ut_helper.h | 65 ++ .../src/mock_magnification_menu_manager.cpp | 4 +- .../src/mock_window_magnification_manager.cpp | 7 +- .../window_magnification_gesture_test.cpp | 1030 +++++++++++++++++ 5 files changed, 1168 insertions(+), 4 deletions(-) create mode 100644 services/aams/test/unittest/window_magnification_gesture_test.cpp diff --git a/services/aams/test/BUILD.gn b/services/aams/test/BUILD.gn index 9af2a848..4682c9ac 100644 --- a/services/aams/test/BUILD.gn +++ b/services/aams/test/BUILD.gn @@ -1274,6 +1274,71 @@ ohos_unittest("accessibility_zoom_gesture_test") { external_deps = test_external_deps } +################################################################################ +ohos_unittest("window_magnification_gesture_test") { + module_out_path = module_output_path + sources = [ + "../../test/mock/mock_common_event_data.cpp", + "../../test/mock/mock_common_event_manager.cpp", + "../../test/mock/mock_common_event_subscribe_info.cpp", + "../../test/mock/mock_common_event_subscriber.cpp", + "../../test/mock/mock_matching_skill.cpp", + "../src/accessibility_account_data.cpp", + "../src/accessibility_circle_drawing_manager.cpp", + "../src/accessibility_datashare_helper.cpp", + "../src/accessibility_dumper.cpp", + "../src/accessibility_input_interceptor.cpp", + "../src/accessibility_keyevent_filter.cpp", + "../src/accessibility_mouse_autoclick.cpp", + "../src/accessibility_mouse_key.cpp", + "../src/accessibility_power_manager.cpp", + "../src/accessibility_resource_bundle_manager.cpp", + "../src/accessibility_screen_touch.cpp", + "../src/accessibility_setting_observer.cpp", + "../src/accessibility_setting_provider.cpp", + "../src/accessibility_settings.cpp", + "../src/accessibility_settings_config.cpp", + "../src/accessibility_notification_helper.cpp", + "../src/accessibility_short_key.cpp", + "../src/accessibility_short_key_dialog.cpp", + "../src/accessibility_touchEvent_injector.cpp", + "../src/accessibility_window_connection.cpp", + "../src/accessibility_window_manager.cpp", + "../src/accessibility_zoom_gesture.cpp", + "../src/accessible_ability_channel.cpp", + "../src/accessible_ability_connection.cpp", + "../src/accessible_ability_manager_service_event_handler.cpp", + "../src/touch_exploration_multi_finger_gesture.cpp", + "../src/touch_exploration_single_finger_gesture.cpp", + "../src/utils.cpp", + "../src/magnification_manager.cpp", + "../src/window_magnification_gesture.cpp", + "../src/magnification_window_proxy.cpp", + "mock/src/mock_accessibility_common_event.cpp", + "mock/src/mock_accessibility_display_manager.cpp", + "mock/src/mock_accessibility_event_transmission.cpp", + "mock/src/mock_accessible_ability_client_stub_impl.cpp", + "mock/src/mock_accessible_ability_manager_service.cpp", + "mock/src/mock_window_magnification_manager.cpp", + "mock/src/mock_magnification_menu_manager.cpp", + "mock/src/mock_system_ability.cpp", + "unittest/window_magnification_gesture_test.cpp", + ] + sources += aams_mock_distributeddatamgr_src + + configs = [ + ":module_private_config", + "../../../resources/config/build:coverage_flags", + ] + + deps = [ + "../../../common/interface:accessibility_interface", + "../../../interfaces/innerkits/common:accessibility_common", + ] + + external_deps = test_external_deps +} + ################################################################################ group("unittest") { testonly = true @@ -1298,5 +1363,6 @@ group("unittest") { ":accessible_ability_channel_test", ":accessible_ability_connection_test", ":accessible_ability_manager_service_test", + ":window_magnification_gesture_test", ] } \ No newline at end of file diff --git a/services/aams/test/mock/include/accessibility_ut_helper.h b/services/aams/test/mock/include/accessibility_ut_helper.h index 86314d4a..335482c0 100644 --- a/services/aams/test/mock/include/accessibility_ut_helper.h +++ b/services/aams/test/mock/include/accessibility_ut_helper.h @@ -422,6 +422,66 @@ public: { return executeAction_; } + + void ClearZoom() + { + zoomState_ = false; + tapOnMagnificationWindow_ = false; + tapOnMenu_ = false; + tapOnHotArea_ = false; + isMove_ = false; + isMenuMove_ = false; + } + + void SetTapOnMagnificationWindow(bool tapOnMagnificationWindow) + { + tapOnMagnificationWindow_ = tapOnMagnificationWindow; + } + + bool GetTapOnMagnificationWindow() + { + return tapOnMagnificationWindow_; + } + + void SetTapOnMenu(bool tapOnMenu) + { + tapOnMenu_ = tapOnMenu; + } + + bool GetTapOnMenu() + { + return tapOnMenu_; + } + + void SetTapOnHotArea(bool tapOnHotArea) + { + tapOnHotArea_ = tapOnHotArea; + } + + bool GetTapOnHotArea() + { + return tapOnHotArea_; + } + + void SetZoomMove(bool isMove) + { + isMove_ = isMove; + } + + bool GetZoomMoveState() + { + return isMove_; + } + + void SetMenuMove(bool isMenuMove) + { + isMenuMove_ = isMenuMove; + } + + bool GetMenuMoveState() + { + return isMenuMove_; + } public: static const int32_t accountId_ = 100; @@ -459,6 +519,11 @@ private: WindowUpdateType eventWindowChangeType_ = WINDOW_UPDATE_INVALID; int32_t realId_ = 0; int32_t executeAction_ = ACCESSIBILITY_ACTION_INVALID; + bool tapOnMagnificationWindow_ = false; + bool tapOnMenu_ = false; + bool tapOnHotArea_ = false; + bool isMove_ = false; + bool isMenuMove_ = false; }; } // namespace Accessibility } // namespace OHOS diff --git a/services/aams/test/mock/src/mock_magnification_menu_manager.cpp b/services/aams/test/mock/src/mock_magnification_menu_manager.cpp index 5bd75768..22d2717d 100644 --- a/services/aams/test/mock/src/mock_magnification_menu_manager.cpp +++ b/services/aams/test/mock/src/mock_magnification_menu_manager.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include "accessibility_ut_helper.h" #include "magnification_menu_manager.h" namespace OHOS { @@ -35,6 +36,7 @@ void MagnificationMenuManager::MoveMenuWindow(int32_t deltaX, int32_t deltaY) { (void)deltaX; (void)deltaY; + Accessibility::AccessibilityAbilityHelper::GetInstance().SetMenuMove(true); } void MagnificationMenuManager::AttachToEdge() @@ -50,7 +52,7 @@ bool MagnificationMenuManager::IsTapOnMenu(int32_t posX, int32_t posY) { (void)posX; (void)posY; - return false; + return Accessibility::AccessibilityAbilityHelper::GetInstance().GetTapOnMenu(); } void MagnificationMenuManager::OnMenuTap() diff --git a/services/aams/test/mock/src/mock_window_magnification_manager.cpp b/services/aams/test/mock/src/mock_window_magnification_manager.cpp index c3940685..4eb8a937 100644 --- a/services/aams/test/mock/src/mock_window_magnification_manager.cpp +++ b/services/aams/test/mock/src/mock_window_magnification_manager.cpp @@ -57,13 +57,14 @@ void WindowMagnificationManager::MoveMagnificationWindow(int32_t deltaX, int32_t { (void)deltaX; (void)deltaY; + Accessibility::AccessibilityAbilityHelper::GetInstance().SetZoomMove(true); } bool WindowMagnificationManager::IsTapOnHotArea(int32_t posX, int32_t posY) { (void)posX; (void)posY; - return false; + return Accessibility::AccessibilityAbilityHelper::GetInstance().GetTapOnHotArea(); } void WindowMagnificationManager::RefreshWindowParam(RotationType type) @@ -75,7 +76,7 @@ bool WindowMagnificationManager::IsTapOnMagnificationWindow(int32_t posX, int32_ { (void)posX; (void)posY; - return false; + return Accessibility::AccessibilityAbilityHelper::GetInstance().GetTapOnMagnificationWindow(); } PointerPos WindowMagnificationManager::ConvertCoordinates(int32_t posX, int32_t posY) @@ -109,7 +110,7 @@ void WindowMagnificationManager::FollowFocuseElement(int32_t centerX, int32_t ce bool WindowMagnificationManager::IsMagnificationWindowShow() { - return false; + return Accessibility::AccessibilityAbilityHelper::GetInstance().GetZoomState(); } float WindowMagnificationManager::GetScale() diff --git a/services/aams/test/unittest/window_magnification_gesture_test.cpp b/services/aams/test/unittest/window_magnification_gesture_test.cpp new file mode 100644 index 00000000..b0184cd9 --- /dev/null +++ b/services/aams/test/unittest/window_magnification_gesture_test.cpp @@ -0,0 +1,1030 @@ +/* + * Copyright (C) 2025 Huawei Device 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 +#include +#include +#include "accessibility_ut_helper.h" +#include "window_magnification_gesture.h" +#include "accessible_ability_manager_service.h" +#include "window_magnification_manager.h" +#include "magnification_menu_manager.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Accessibility { +namespace { + constexpr int32_t SLEEP_MS_2 = 2; + constexpr int32_t SLEEP_MS_100 = 100; + constexpr int32_t MOCK_STATE_ACTION = -3; + constexpr int32_t POINT_ID_0 = 0; + constexpr int32_t POINT_ID_1 = 1; + constexpr uint32_t ONE_TAP_COUNT = 1; + constexpr uint32_t TRIPLE_TAP_COUNT = 3; +} +class WindowMagnificationGestureTest : public testing::Test { +public: + WindowMagnificationGestureTest() + {} + ~WindowMagnificationGestureTest() + {} + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; + std::shared_ptr CreatePointerEvent(int32_t sourceType, + int32_t pointerAction, int32_t displayX, int32_t displayY); + std::shared_ptr CreatePointerEvent(int32_t pointerAction, + std::vector &points, int32_t pointerId); + void SetPointerItem(MMI::PointerEvent::PointerItem &point, + int32_t id, int32_t x, int32_t y); + void MultiTaps(uint32_t tapCount); + std::shared_ptr magnificationGesture_ = nullptr; + std::shared_ptr manager_ = nullptr; +}; + +void WindowMagnificationGestureTest::SetUpTestCase() +{ + GTEST_LOG_(INFO) << "###################### WindowMagnificationGestureTest Start ######################"; + Singleton::GetInstance().OnStart(); +} + +void WindowMagnificationGestureTest::TearDownTestCase() +{ + GTEST_LOG_(INFO) << "###################### WindowMagnificationGestureTest End ######################"; + Singleton::GetInstance().OnStop(); +} + +void WindowMagnificationGestureTest::SetUp() +{ + GTEST_LOG_(INFO) << "SetUp"; + manager_ = std::make_shared(); + std::shared_ptr menuManager = std::make_shared(); + magnificationGesture_ = std::make_shared(manager_, menuManager); +} + +void WindowMagnificationGestureTest::TearDown() +{ + GTEST_LOG_(INFO) << "TearDown"; + AccessibilityAbilityHelper::GetInstance().ClearEventTypeActionVector(); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + AccessibilityAbilityHelper::GetInstance().ClearZoom(); + magnificationGesture_ = nullptr; +} + +std::shared_ptr WindowMagnificationGestureTest::CreatePointerEvent(int32_t sourceType, + int32_t pointerAction, int32_t displayX, int32_t displayY) +{ + std::shared_ptr event = MMI::PointerEvent::Create(); + if (!event) { + return nullptr; + } + event->SetSourceType(sourceType); + event->SetPointerAction(pointerAction); + MMI::PointerEvent::PointerItem item = {}; + item.SetDisplayX(displayX); + item.SetDisplayY(displayY); + event->AddPointerItem(item); + return event; +} + +std::shared_ptr WindowMagnificationGestureTest::CreatePointerEvent(int32_t pointerAction, + std::vector &points, int32_t pointerId) +{ + std::shared_ptr event = MMI::PointerEvent::Create(); + if (!event) { + return nullptr; + } + + for (auto &point : points) { + event->AddPointerItem(point); + } + event->SetPointerId(pointerId); + event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN); + event->SetPointerAction(pointerAction); + return event; +} + +void WindowMagnificationGestureTest::SetPointerItem(MMI::PointerEvent::PointerItem &point, + int32_t id, int32_t x, int32_t y) +{ + point.SetPointerId(id); + point.SetDisplayX(x); + point.SetDisplayY(y); +} + +void WindowMagnificationGestureTest::MultiTaps(uint32_t tapCount) +{ + EXPECT_TRUE(magnificationGesture_ != nullptr); + for (uint32_t count = 0; count < tapCount; count++) { + // Pointer down + std::shared_ptr eventDown = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + EXPECT_TRUE(eventDown != nullptr); + magnificationGesture_->OnPointerEvent(*eventDown); + // Pointer up + std::shared_ptr eventUp = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + EXPECT_TRUE(eventUp != nullptr); + magnificationGesture_->OnPointerEvent(*eventUp); + } +} + +/** + * @tc.number: HandleReadyStateDown_001 + * @tc.name: HandleReadyStateDown + * @tc.desc: Test fun HandleReadyStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_001 end"; +} + +/** + * @tc.number: HandleReadyStateDown_002 + * @tc.name: HandleReadyStateDown + * @tc.desc: Test fun HandleReadyStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateDown_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_001 end"; +} + +/** + * @tc.number: HandleReadyStateDown_003 + * @tc.name: HandleReadyStateDown + * @tc.desc: Test fun HandleReadyStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateDown_003, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_003 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateDown_003 end"; +} + +/** + * @tc.number: HandleReadyStateUp_001 + * @tc.name: HandleReadyStateUp + * @tc.desc: Test fun HandleReadyStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateUp_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateUp_001 end"; +} + +/** + * @tc.number: HandleReadyStateUp_002 + * @tc.name: HandleReadyStateUp + * @tc.desc: Test fun HandleReadyStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateUp_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateUp_002 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, POINT_ID_1); + EXPECT_TRUE(event != nullptr); + + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateUp_002 end"; +} + +/** + * @tc.number: HandleReadyStateMove_001 + * @tc.name: HandleReadyStateMove + * @tc.desc: Test fun HandleReadyStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateMove_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateMove_001 end"; +} + +/** + * @tc.number: HandleReadyStateCancel_001 + * @tc.name: HandleReadyStateCancel + * @tc.desc: Test fun HandleReadyStateCancel + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateCancel_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateCancel_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_CANCEL, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_CANCEL); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateCancel_001 end"; +} + +/** + * @tc.number: HandleReadyStateCancel_002 + * @tc.name: HandleReadyStateCancel + * @tc.desc: Test fun HandleReadyStateCancel + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateCancel_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateCancel_002 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_CANCEL, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + manager_->ShowWindowMagnification(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_CANCEL); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateCancel_002 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStateDown_001 + * @tc.name: HandleReadyStateOneFingerDownStateDown + * @tc.desc: Test fun HandleReadyStateOneFingerDownStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_001 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStateDown_002 + * @tc.name: HandleReadyStateOneFingerDownStateDown + * @tc.desc: Test fun HandleReadyStateOneFingerDownStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_002 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN, MOCK_STATE_ACTION); + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateDown_002 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStateUp_001 + * @tc.name: HandleReadyStateOneFingerDownStateUp + * @tc.desc: Test fun HandleReadyStateOneFingerDownStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_001 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStateUp_002 + * @tc.name: HandleReadyStateOneFingerDownStateUp + * @tc.desc: Test fun HandleReadyStateOneFingerDownStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_002 start"; + MultiTaps(TRIPLE_TAP_COUNT); + bool state = AccessibilityAbilityHelper::GetInstance().GetZoomState(); + EXPECT_TRUE(state); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + sleep(SLEEP_MS_2); + MultiTaps(TRIPLE_TAP_COUNT); + state = AccessibilityAbilityHelper::GetInstance().GetZoomState(); + EXPECT_FALSE(state); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateUp_002 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStateMove_001 + * @tc.name: HandleReadyStateOneFingerDownStateMove + * @tc.desc: Test fun HandleReadyStateOneFingerDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateMove_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 100, 100); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStateMove_001 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStatCancel_001 + * @tc.name: HandleReadyStateOneFingerDownStatCancel + * @tc.desc: Test fun HandleReadyStateOneFingerDownStatCance + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_CANCEL, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_CANCEL); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_001 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerDownStatCancel_002 + * @tc.name: HandleReadyStateOneFingerDownStatCancel + * @tc.desc: Test fun HandleReadyStateOneFingerDownStatCance + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_002 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::READY_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_CANCEL, 10, 10); + EXPECT_TRUE(event != nullptr); + AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector(); + manager_->ShowWindowMagnification(); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + sleep(SLEEP_MS_2); + int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0); + EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_CANCEL); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerDownStatCancel_002 end"; +} + +/** + * @tc.number: HandleReadyStateOneFingerTapDown_001 + * @tc.name: HandleReadyStateOneFingerTapDown + * @tc.desc: Test fun HandleReadyStateOneFingerTapDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerTapDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerTapDown_001 start"; + MultiTaps(ONE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_TAP)); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleReadyStateOneFingerTapDown_001 end"; +} + +/** + * @tc.number: HandleZoomInStateDown_001 + * @tc.name: HandleZoomInStateDown + * @tc.desc: Test fun HandleZoomInStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateDown_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateDown_001 end"; +} + +/** + * @tc.number: HandleZoomInStateUp_001 + * @tc.name: HandleZoomInStateUp + * @tc.desc: Test fun HandleZoomInStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateUp_001 end"; +} + +/** + * @tc.number: HandleZoomInStateMove_001 + * @tc.name: HandleZoomInStateMove + * @tc.desc: Test fun HandleZoomInStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateMove_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 10, 10); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateMove_001 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateDown_001 + * @tc.name: HandleZoomInStateOneFingerDownStateDown + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event1 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event1); // down event 1 + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr event2 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event2); // down event 2 + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_001 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateDown_002 + * @tc.name: HandleZoomInStateOneFingerDownStateDown + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event1 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event1); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMagnificationWindow(true); + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event2 = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + magnificationGesture_->OnPointerEvent(*event2); // two fingers down + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_TWO_FINGERS_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateDown_002 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateUp_001 + * @tc.name: HandleZoomInStateOneFingerDownStateUp + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + bool state = AccessibilityAbilityHelper::GetInstance().GetZoomState(); + EXPECT_TRUE(state); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + sleep(SLEEP_MS_2); + MultiTaps(TRIPLE_TAP_COUNT); + state = AccessibilityAbilityHelper::GetInstance().GetZoomState(); + EXPECT_FALSE(state); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateUp_001 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateMove_001 + * @tc.name: HandleZoomInStateOneFingerDownStateMove + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::PASSING_THROUGH)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_001 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateMove_002 + * @tc.name: HandleZoomInStateOneFingerDownStateMove + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_002 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMenu(true); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::MENU_SLIDING_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_002 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerDownStateMove_003 + * @tc.name: HandleZoomInStateOneFingerDownStateMove + * @tc.desc: Test fun HandleZoomInStateOneFingerDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_003, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_003 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + AccessibilityAbilityHelper::GetInstance().SetTapOnHotArea(true); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::SLIDING_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerDownStateMove_003 end"; +} + +/** + * @tc.number: HandleZoomInStateOneFingerTapDown_001 + * @tc.name: HandleZoomInStateOneFingerTapDown + * @tc.desc: Test fun HandleZoomInStateOneFingerTapDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerTapDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerTapDown_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + sleep(SLEEP_MS_2); + MultiTaps(ONE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_TAP)); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleZoomInStateOneFingerTapDown_001 end"; +} + +/** + * @tc.number: HandleTwoFingersDownStateUp_001 + * @tc.name: HandleTwoFingersDownStateUp + * @tc.desc: Test fun HandleTwoFingersDownStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event1 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event1); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMagnificationWindow(true); + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event2 = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + magnificationGesture_->OnPointerEvent(*event2); // two fingers down + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_TWO_FINGERS_DOWN)); + std::shared_ptr upEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + magnificationGesture_->OnPointerEvent(*upEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateUp_001 end"; +} + +/** + * @tc.number: HandleTwoFingersDownStateMove_001 + * @tc.name: HandleTwoFingersDownStateMove + * @tc.desc: Test fun HandleTwoFingersDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event1 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event1); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMagnificationWindow(true); + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event2 = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + magnificationGesture_->OnPointerEvent(*event2); // two fingers down + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_TWO_FINGERS_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::SLIDING_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateMove_001 end"; +} + +/** + * @tc.number: HandleTwoFingersDownStateMove_002 + * @tc.name: HandleTwoFingersDownStateMove + * @tc.desc: Test fun HandleTwoFingersDownStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateMove_002, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + std::shared_ptr event1 = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*event1); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMagnificationWindow(true); + std::vector points = {}; + MMI::PointerEvent::PointerItem point1 = {}; + SetPointerItem(point1, POINT_ID_0, 10, 10); + MMI::PointerEvent::PointerItem point2 = {}; + SetPointerItem(point2, POINT_ID_1, 20, 20); + points.emplace_back(point1); + points.emplace_back(point2); + std::shared_ptr event2 = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, POINT_ID_1); + magnificationGesture_->OnPointerEvent(*event2); // two fingers down + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_TWO_FINGERS_DOWN)); + points = {}; + SetPointerItem(point1, POINT_ID_0, 100, 100); + SetPointerItem(point2, POINT_ID_1, 110, 110); + points.emplace_back(point1); + points.emplace_back(point2); + event2 = CreatePointerEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, POINT_ID_1); + magnificationGesture_->OnPointerEvent(*event2); // two fingers down + EXPECT_TRUE(AccessibilityAbilityHelper::GetInstance().GetZoomMoveState()); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleTwoFingersDownStateMove_002 end"; +} + +/** + * @tc.number: HandleSlidingStateDown_001 + * @tc.name: HandleSlidingStateDown + * @tc.desc: Test fun HandleSlidingStateDown + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleSlidingStateDown_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateDown_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::SLIDING_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + EXPECT_TRUE(event != nullptr); + magnificationGesture_->OnPointerEvent(*event); + sleep(SLEEP_MS_2); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::SLIDING_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateDown_001 end"; +} + +/** + * @tc.number: HandleSlidingStateUp_001 + * @tc.name: HandleSlidingStateUp + * @tc.desc: Test fun HandleSlidingStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleSlidingStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateUp_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::SLIDING_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + EXPECT_TRUE(event != nullptr); + magnificationGesture_->OnPointerEvent(*event); + sleep(SLEEP_MS_2); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateUp_001 end"; +} + +/** + * @tc.number: HandleSlidingStateMove_001 + * @tc.name: HandleSlidingStateMove + * @tc.desc: Test fun HandleSlidingStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleSlidingStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateMove_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::SLIDING_STATE, MOCK_STATE_ACTION); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 10, 10); + EXPECT_TRUE(event != nullptr); + magnificationGesture_->OnPointerEvent(*event); + sleep(SLEEP_MS_2); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::SLIDING_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleSlidingStateMove_001 end"; +} + +/** + * @tc.number: HandleMenuSlidingStateUp_001 + * @tc.name: HandleMenuSlidingStateUp + * @tc.desc: Test fun HandleMenuSlidingStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleMenuSlidingStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleMenuSlidingStateUp_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMenu(true); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::MENU_SLIDING_STATE)); + std::shared_ptr upEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 200, 200); + magnificationGesture_->OnPointerEvent(*upEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleMenuSlidingStateUp_001 end"; +} + +/** + * @tc.number: HandleMenuSlidingStateMove_001 + * @tc.name: HandleMenuSlidingStateMove + * @tc.desc: Test fun HandleMenuSlidingStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleMenuSlidingStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleMenuSlidingStateMove_001 start"; + MultiTaps(TRIPLE_TAP_COUNT); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE)); + AccessibilityAbilityHelper::GetInstance().SetTapOnMenu(true); + std::shared_ptr downEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_DOWN, 10, 10); + magnificationGesture_->OnPointerEvent(*downEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::ZOOMIN_STATE_ONE_FINGER_DOWN)); + std::shared_ptr moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 200, 200); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::MENU_SLIDING_STATE)); + moveEvent = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 250, 250); + magnificationGesture_->OnPointerEvent(*moveEvent); + EXPECT_TRUE(AccessibilityAbilityHelper::GetInstance().GetMenuMoveState()); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleMenuSlidingStateMove_001 end"; +} + +/** + * @tc.number: HandleDraggingStateUp_001 + * @tc.name: HandleDraggingStateUp + * @tc.desc: Test fun HandleDraggingStateUp + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleDraggingStateUp_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleDraggingStateUp_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::DRAGGING_STATE, MOCK_STATE_ACTION); + manager_->ShowWindowMagnification(); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_UP, 10, 10); + event->SetPointerId(POINT_ID_0); + EXPECT_TRUE(event != nullptr); + magnificationGesture_->OnPointerEvent(*event); + sleep(SLEEP_MS_2); + EXPECT_EQ(static_cast(magnificationGesture_->GetGestureState()), + static_cast(MagnificationGestureState::READY_STATE)); + EXPECT_FALSE(AccessibilityAbilityHelper::GetInstance().GetZoomState()); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleDraggingStateUp_001 end"; +} + +/** + * @tc.number: HandleDraggingStateMove_001 + * @tc.name: HandleDraggingStateMove + * @tc.desc: Test fun HandleDraggingStateMove + */ +HWTEST_F(WindowMagnificationGestureTest, WindowMagnificationGesture_Unittest_HandleDraggingStateMove_001, TestSize.Level1) +{ + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleDraggingStateMove_001 start"; + EXPECT_TRUE(magnificationGesture_ != nullptr); + magnificationGesture_->SetGestureState(MagnificationGestureState::DRAGGING_STATE, MOCK_STATE_ACTION); + manager_->ShowWindowMagnification(); + std::shared_ptr event = CreatePointerEvent(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, + MMI::PointerEvent::POINTER_ACTION_MOVE, 100, 100); + EXPECT_TRUE(event != nullptr); + magnificationGesture_->OnPointerEvent(*event); + EXPECT_FALSE(AccessibilityAbilityHelper::GetInstance().GetZoomMoveState()); + GTEST_LOG_(INFO) << "WindowMagnificationGesture_Unittest_HandleDraggingStateMove_001 end"; +} +} // namespace Accessibility +} // namespace OHOS \ No newline at end of file -- Gitee