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