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_GESTURES_GESTURES_COMMON_TEST_NG_H
17 #define TEST_UNITTEST_CORE_GESTURES_GESTURES_COMMON_TEST_NG_H
18 #include <optional>
19 #include <vector>
20 
21 #include "gtest/gtest.h"
22 
23 #define private public
24 #define protected public
25 
26 #undef SECURITY_COMPONENT_ENABLE
27 
28 #include "base/memory/ace_type.h"
29 #include "base/memory/referenced.h"
30 #include "core/components_ng/base/view_stack_processor.h"
31 #include "core/components_ng/event/gesture_event_hub.h"
32 #include "core/components_ng/gestures/gesture_group.h"
33 #include "core/components_ng/gestures/gesture_referee.h"
34 #include "core/components_ng/gestures/long_press_gesture.h"
35 #include "core/components_ng/gestures/pan_gesture.h"
36 #include "core/components_ng/gestures/pinch_gesture.h"
37 #include "core/components_ng/gestures/recognizers/click_recognizer.h"
38 #include "core/components_ng/gestures/recognizers/exclusive_recognizer.h"
39 #include "core/components_ng/gestures/recognizers/gesture_recognizer.h"
40 #include "core/components_ng/gestures/recognizers/long_press_recognizer.h"
41 #include "core/components_ng/gestures/recognizers/multi_fingers_recognizer.h"
42 #include "core/components_ng/gestures/recognizers/pinch_recognizer.h"
43 #include "core/components_ng/gestures/recognizers/rotation_recognizer.h"
44 #include "core/components_ng/gestures/recognizers/swipe_recognizer.h"
45 #include "core/components_ng/gestures/rotation_gesture.h"
46 #include "core/components_ng/gestures/swipe_gesture.h"
47 #include "core/components_ng/gestures/tap_gesture.h"
48 #include "core/components_ng/layout/layout_property.h"
49 #include "core/components_ng/pattern/gesture/gesture_model_ng.h"
50 #include "test/mock/core/render/mock_media_player.h"
51 #include "test/mock/core/render/mock_render_context.h"
52 #include "core/event/axis_event.h"
53 #include "core/event/key_event.h"
54 #include "test/mock/core/pipeline/mock_pipeline_context.h"
55 #include "core/components/scroll/scroll_bar_controller.h"
56 
57 namespace OHOS::Ace::NG {
58 namespace {
59 constexpr int32_t DURATION = 100;
60 constexpr int32_t FINGER_NUMBER = 5;
61 constexpr int32_t FINGER_NUMBER_OVER_MAX = 11;
62 constexpr int32_t SINGLE_FINGER_NUMBER = 1;
63 constexpr int32_t COUNT = 2;
64 constexpr int32_t TAPPED_COUNT = 1;
65 constexpr int32_t LONG_PRESS_DURATION = 3000;
66 constexpr double PINCH_GESTURE_DISTANCE = 100.0;
67 constexpr double ROTATION_GESTURE_ANGLE = 1.0;
68 constexpr double CLICK_MULTI_TAP_SLOP = 110.0;
69 constexpr double PI = 360.0;
70 constexpr double COMMON_VALUE_RANGE_CASE = 101.0;
71 constexpr double SPECIAL_VALUE_RANGE_CASE1 = 181.0;
72 constexpr double SPECIAL_VALUE_RANGE_CASE2 = -181.0;
73 constexpr double SWIPE_SPEED = 10.0;
74 constexpr double VERTICAL_ANGLE = 90.0;
75 constexpr double HORIZONTAL_ANGLE = 180.0;
76 constexpr int32_t DEFAULT_PAN_FINGER = 1;
77 constexpr Dimension DEFAULT_PAN_DISTANCE = 5.0_vp;
78 constexpr int32_t DEFAULT_SLIDE_FINGER = DEFAULT_PAN_FINGER;
79 constexpr double DEFAULT_SLIDE_SPEED = 100.0;
80 constexpr double PAN_DISTANCE = 1.0;
81 constexpr int32_t TEST_EVENT_ID = 11;
82 } // namespace
83 
84 class GesturesCommonTestNg : public testing::Test {
85 };
86 } // namespace OHOS::Ace::NG
87 
88 #endif //TEST_UNITTEST_CORE_GESTURES_GESTURES_COMMON_TEST_NG_H