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 LIBINPUT_MOCK_H 17 #define LIBINPUT_MOCK_H 18 19 #include <gmock/gmock.h> 20 21 #include "libinput_interface.h" 22 23 namespace OHOS { 24 namespace MMI { 25 class LibinputInterfaceMock : public LibinputInterface { 26 public: 27 LibinputInterfaceMock() = default; 28 virtual ~LibinputInterfaceMock() = default; 29 30 MOCK_METHOD(enum libinput_event_type, GetEventType, (struct libinput_event *)); 31 MOCK_METHOD(struct libinput_device *, GetDevice, (struct libinput_event *)); 32 MOCK_METHOD(uint64_t, GetSensorTime, (struct libinput_event *)); 33 MOCK_METHOD(struct libinput_event_touch *, GetTouchEvent, (struct libinput_event *)); 34 MOCK_METHOD(struct libinput_event_tablet_tool *, GetTabletToolEvent, (struct libinput_event *)); 35 MOCK_METHOD(struct libinput_event_gesture *, GetGestureEvent, (struct libinput_event *)); 36 MOCK_METHOD(struct libinput_tablet_tool *, TabletToolGetTool, (struct libinput_event_tablet_tool *)); 37 MOCK_METHOD(enum libinput_tablet_tool_tip_state, TabletToolGetTipState, (struct libinput_event_tablet_tool *)); 38 MOCK_METHOD(enum libinput_tablet_tool_type, TabletToolGetType, (struct libinput_tablet_tool *)); 39 MOCK_METHOD(enum libinput_pointer_axis_source, GetAxisSource, (struct libinput_event_pointer *)); 40 MOCK_METHOD(struct libinput_event_pointer*, LibinputGetPointerEvent, (struct libinput_event *)); 41 MOCK_METHOD(int32_t, TabletToolGetToolType, (struct libinput_event_tablet_tool *)); 42 MOCK_METHOD(double, TabletToolGetTiltX, (struct libinput_event_tablet_tool *)); 43 MOCK_METHOD(double, TabletToolGetTiltY, (struct libinput_event_tablet_tool *)); 44 MOCK_METHOD(uint64_t, TabletToolGetTimeUsec, (struct libinput_event_tablet_tool *)); 45 MOCK_METHOD(double, TabletToolGetPressure, (struct libinput_event_tablet_tool *)); 46 MOCK_METHOD(uint64_t, TouchEventGetTime, (struct libinput_event_touch *)); 47 MOCK_METHOD(int32_t, TouchEventGetSeatSlot, (struct libinput_event_touch *)); 48 MOCK_METHOD(double, TouchEventGetPressure, (struct libinput_event_touch *)); 49 MOCK_METHOD(int32_t, TouchEventGetContactLongAxis, (struct libinput_event_touch *)); 50 MOCK_METHOD(int32_t, TouchEventGetContactShortAxis, (struct libinput_event_touch *)); 51 MOCK_METHOD(int32_t, TouchEventGetToolType, (struct libinput_event_touch *)); 52 MOCK_METHOD(int, TouchEventGetBtnToolTypeDown, (struct libinput_device *, int32_t)); 53 MOCK_METHOD(uint32_t, GestureEventGetTime, (struct libinput_event_gesture *)); 54 MOCK_METHOD(int, GestureEventGetFingerCount, (struct libinput_event_gesture *)); 55 MOCK_METHOD(int, GestureEventGetDevCoordsX, (struct libinput_event_gesture *, uint32_t)); 56 MOCK_METHOD(int, GestureEventGetDevCoordsY, (struct libinput_event_gesture *, uint32_t)); 57 MOCK_METHOD(uint32_t, PointerEventGetFingerCount, (struct libinput_event_pointer *)); 58 MOCK_METHOD(double, PointerGetDxUnaccelerated, (struct libinput_event_pointer *)); 59 MOCK_METHOD(double, PointerGetDyUnaccelerated, (struct libinput_event_pointer *)); 60 MOCK_METHOD(uint32_t, PointerGetButton, (struct libinput_event_pointer *)); 61 MOCK_METHOD(int, PointerHasAxis, (struct libinput_event_pointer *, enum libinput_pointer_axis)); 62 MOCK_METHOD(double, PointerGetAxisValue, (struct libinput_event_pointer *, enum libinput_pointer_axis)); 63 MOCK_METHOD(struct libinput_event_touch *, GetTouchpadEvent, (struct libinput_event *)); 64 MOCK_METHOD(int32_t, TouchpadGetTool, (struct libinput_event_touch *)); 65 MOCK_METHOD(char*, DeviceGetName, (struct libinput_device *)); 66 MOCK_METHOD(struct libinput_event_keyboard*, LibinputEventGetKeyboardEvent, (struct libinput_event *)); 67 MOCK_METHOD(uint32_t, LibinputEventKeyboardGetKey, (struct libinput_event_keyboard *)); 68 MOCK_METHOD(enum libinput_key_state, LibinputEventKeyboardGetKeyState, (struct libinput_event_keyboard *)); 69 }; 70 } // namespace MMI 71 } // namespace OHOS 72 #endif // LIBINPUT_MOCK_H 73