1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef TEST_UNITTEST_CORE_EVENT_GESTURE_EVENT_HUB_TEST_NG_H 17 #define TEST_UNITTEST_CORE_EVENT_GESTURE_EVENT_HUB_TEST_NG_H 18 #include "gtest/gtest.h" 19 20 #define private public 21 #define protected public 22 #undef SECURITY_COMPONENT_ENABLE 23 24 #include "test/mock/base/mock_drag_window.h" 25 #include "test/mock/base/mock_task_executor.h" 26 #include "test/mock/core/pipeline/mock_pipeline_context.h" 27 #include "test/mock/core/common/mock_interaction_interface.h" 28 #include "test/mock/core/common/mock_udmf.h" 29 30 #include "base/geometry/axis.h" 31 #include "base/geometry/ng/offset_t.h" 32 #include "base/memory/ace_type.h" 33 #include "base/memory/referenced.h" 34 #include "core/components_ng/base/frame_node.h" 35 #include "core/components_ng/event/gesture_event_hub.h" 36 #include "core/components_ng/event/pan_event.h" 37 #include "core/components_ng/event/touch_event.h" 38 #include "core/components_ng/gestures/long_press_gesture.h" 39 #include "core/components_ng/gestures/pan_gesture.h" 40 #include "core/components_ng/gestures/recognizers/click_recognizer.h" 41 #include "core/components_ng/gestures/tap_gesture.h" 42 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h" 43 #include "core/components_ng/pattern/pattern.h" 44 #include "core/components_v2/inspector/inspector_constants.h" 45 #include "frameworks/core/common/event_manager.h" 46 #include "frameworks/core/components_ng/pattern/text/text_pattern.h" 47 #include "core/components_ng/pattern/grid/grid_item_pattern.h" 48 #include "core/components_ng/pattern/grid/grid_pattern.h" 49 #include "frameworks/core/components_ng/pattern/text_drag/text_drag_base.h" 50 51 namespace OHOS::Ace::NG { 52 namespace { 53 const std::string NODE_TAG("node"); 54 const OffsetF COORDINATE_OFFSET(20.0f, 20.0f); 55 constexpr int32_t TOUCH_ID = 0; 56 const Axis AXIS_VERTICAL = Axis::VERTICAL; 57 const PanDirection PAN_DIRECTION_ALL; 58 constexpr int32_t FINGERS = 1; 59 constexpr int32_t DOUBLE_FINGERS = 2; 60 constexpr int32_t CLICK_COUNTS = 2; 61 constexpr Dimension DISTANCE = 10.0_vp; 62 const std::string CHECK_TAG_1("HELLO"); 63 const std::string CHECK_TAG_2("WORLD"); 64 const PointF GLOBAL_POINT { 20.0f, 20.0f }; 65 const PointF LOCAL_POINT { 15.0f, 15.0f }; 66 RefPtr<DragWindow> MOCK_DRAG_WINDOW; 67 constexpr int32_t GESTURES_COUNTS = 2; 68 RefPtr<MockTaskExecutor> MOCK_TASK_EXECUTOR; 69 constexpr float DRAG_DISTANCE = 10.5f; 70 const PanDirection DRAG_DIRECTION = { PanDirection::LEFT }; 71 constexpr int32_t FINGERS_NUMBER = 2; 72 } // namespace 73 74 class GestureEventHubTestNg : public testing::Test { 75 public: 76 static void SetUpTestSuite(); 77 static void TearDownTestSuite(); 78 }; 79 } // namespace OHOS::Ace::NG 80 81 #endif //TEST_UNITTEST_CORE_EVENT_GESTURE_EVENT_HUB_TEST_NG_H