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