1 /*
2  * Copyright (c) 2023 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 INPUT_MANAGER_UTIL_H
17 #define INPUT_MANAGER_UTIL_H
18 
19 #include "image_source.h"
20 #include "pixel_map.h"
21 
22 #include "i_input_event_consumer.h"
23 #include "input_event.h"
24 #include "input_handler_type.h"
25 #include "key_event.h"
26 #include "key_option.h"
27 #include "mmi_log.h"
28 #include "pointer_event.h"
29 
30 namespace OHOS {
31 namespace MMI {
32 class InputManagerUtil {
33 public:
34     static std::shared_ptr<KeyOption> InitOption(
35         const std::set<int32_t> &preKeys, int32_t finalKey, bool isFinalKeyDown, int32_t duration);
36     static std::shared_ptr<PointerEvent> SetupPointerEvent001();
37     static std::shared_ptr<PointerEvent> SetupPointerEvent002();
38     static std::shared_ptr<PointerEvent> SetupPointerEvent003();
39     static std::shared_ptr<PointerEvent> SetupPointerEvent005();
40     static std::shared_ptr<PointerEvent> SetupPointerEvent006();
41     static std::shared_ptr<PointerEvent> SetupPointerEvent007();
42     static std::shared_ptr<PointerEvent> SetupPointerEvent009();
43     static std::shared_ptr<PointerEvent> SetupPointerEvent010();
44     static std::shared_ptr<PointerEvent> SetupPointerEvent011();
45     static std::shared_ptr<PointerEvent> SetupPointerEvent012();
46     static std::shared_ptr<PointerEvent> SetupPointerEvent013();
47     static std::shared_ptr<PointerEvent> SetupPointerEvent014();
48     static std::shared_ptr<PointerEvent> SetupPointerEvent015();
49 #ifdef OHOS_BUILD_ENABLE_JOYSTICK
50     static std::shared_ptr<PointerEvent> SetupPointerEvent016();
51 #endif  // OHOS_BUILD_ENABLE_JOYSTICK
52     static std::shared_ptr<PointerEvent> SetupMouseEvent001();
53     static std::shared_ptr<PointerEvent> SetupMouseEvent002();
54     static std::shared_ptr<PointerEvent> SetupTouchScreenEvent001();
55     static std::shared_ptr<PointerEvent> SetupTouchScreenEvent002();
56     static void SetPointerItem(PointerEvent::PointerItem &item, int32_t pointerId);
57     static void PrintPointerEventId(std::shared_ptr<PointerEvent> pointerEvent);
58     static std::shared_ptr<PointerEvent> SetupSimulateEvent001();
59     static std::shared_ptr<PointerEvent> SetupSimulateEvent002();
60     static std::shared_ptr<PointerEvent> SetupSimulateEvent003();
61     static std::shared_ptr<PointerEvent> SetupSimulateEvent004();
62     static std::shared_ptr<PointerEvent> SetupSimulateEvent005();
63     static std::shared_ptr<PointerEvent> SetupSimulateEvent006();
64     static std::shared_ptr<PointerEvent> SetupSimulateEvent007();
65     static std::shared_ptr<PointerEvent> SetupSimulateEvent008();
66     static std::shared_ptr<KeyEvent> SetupKeyEvent001();
67     static std::shared_ptr<KeyEvent> SetupKeyEvent002();
68     static std::shared_ptr<KeyEvent> SetupKeyEvent003();
69     static std::shared_ptr<PointerEvent> TestMarkConsumedStep1();
70     static std::shared_ptr<PointerEvent> TestMarkConsumedStep2();
71     static std::unique_ptr<OHOS::Media::PixelMap> SetMouseIconTest(const std::string iconPath);
72     static void TestMarkConsumedStep3(int32_t monitorId, int32_t eventId);
73     static void TestMarkConsumedStep4();
74     static void TestMarkConsumedStep5();
75     static void TestMarkConsumedStep6();
76     static int32_t TestAddMonitor(std::shared_ptr<IInputEventConsumer> consumer);
77     static void TestRemoveMonitor(int32_t monitorId);
78     static void TestMarkConsumed(int32_t monitorId, int32_t eventId);
79     static void TestMonitor(int32_t monitorId, std::shared_ptr<PointerEvent> pointerEvent);
80     static void TestInterceptorIdAndPointerEvent(int32_t interceptorId, std::shared_ptr<PointerEvent> pointerEvent);
81     static void TestInterceptorId(int32_t interceptorId1, int32_t interceptorId2);
82     static std::shared_ptr<PointerEvent> SetupTabletToolEvent001();
83 };
84 }  // namespace MMI
85 }  // namespace OHOS
86 #endif  // INPUT_MANAGER_UTIL_H