• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_pixel_map.h"
25 #include "test/mock/base/mock_task_executor.h"
26 #include "test/mock/core/common/mock_udmf.h"
27 #include "test/mock/core/pipeline/mock_pipeline_context.h"
28 
29 #include "base/geometry/axis.h"
30 #include "base/geometry/ng/offset_t.h"
31 #include "base/memory/ace_type.h"
32 #include "base/memory/referenced.h"
33 #include "core/components_ng/base/frame_node.h"
34 #include "core/components_ng/event/gesture_event_hub.h"
35 #include "core/components_ng/event/pan_event.h"
36 #include "core/components_ng/event/touch_event.h"
37 #include "core/components_ng/gestures/long_press_gesture.h"
38 #include "core/components_ng/gestures/pan_gesture.h"
39 #include "core/components_ng/gestures/recognizers/click_recognizer.h"
40 #include "core/components_ng/gestures/tap_gesture.h"
41 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h"
42 #include "core/components_ng/pattern/pattern.h"
43 #include "core/components_v2/inspector/inspector_constants.h"
44 #include "frameworks/core/common/event_manager.h"
45 #include "frameworks/core/components_ng/pattern/text_drag/text_drag_base.h"
46 
47 namespace OHOS::Ace::NG {
48 namespace {
49 const std::string NODE_TAG("node");
50 const OffsetF COORDINATE_OFFSET(20.0f, 20.0f);
51 constexpr int32_t TOUCH_ID = 0;
52 const Axis AXIS_VERTICAL = Axis::VERTICAL;
53 const PanDirection PAN_DIRECTION_ALL;
54 constexpr int32_t FINGERS = 1;
55 constexpr int32_t DOUBLE_FINGERS = 2;
56 constexpr int32_t CLICK_COUNTS = 2;
57 constexpr Dimension DISTANCE = 10.0_vp;
58 const std::string CHECK_TAG_1("HELLO");
59 const std::string CHECK_TAG_2("WORLD");
60 const PointF GLOBAL_POINT { 20.0f, 20.0f };
61 const PointF LOCAL_POINT { 15.0f, 15.0f };
62 RefPtr<DragWindow> MOCK_DRAG_WINDOW;
63 constexpr int32_t GESTURES_COUNTS = 2;
64 RefPtr<MockTaskExecutor> MOCK_TASK_EXECUTOR;
65 constexpr float DRAG_DISTANCE = 10.5f;
66 const PanDirection DRAG_DIRECTION = { PanDirection::LEFT };
67 constexpr int32_t FINGERS_NUMBER = 2;
68 } // namespace
69 
70 class GestureEventHubTestNg : public testing::Test {
71 public:
72     static void SetUpTestSuite();
73     static void TearDownTestSuite();
74 };
75 class GestureEventHubTestCoverageNg : public testing::Test {
76 public:
77     static void SetUpTestSuite();
78     static void TearDownTestSuite();
79 };
80 } // namespace OHOS::Ace::NG
81 
82 #endif //TEST_UNITTEST_CORE_EVENT_GESTURE_EVENT_HUB_TEST_NG_H