1 /* 2 * Copyright (C) 2021 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 MOCK_ACCESSIBILITY_GESTURE_RECOGNIZER_H 17 #define MOCK_ACCESSIBILITY_GESTURE_RECOGNIZER_H 18 19 #include <gmock/gmock.h> 20 #include "accessibility_gesture_recognizer.h" 21 22 namespace OHOS { 23 namespace Accessibility { 24 class MockGestureHandler : public GestureHandler { 25 public: 26 MockGestureHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner, AccessibilityGestureRecognizer& server); 27 virtual ~MockGestureHandler() = default; 28 29 MOCK_METHOD1(ProcessEvent, void(const AppExecFwk::InnerEvent::Pointer& event)); 30 }; 31 32 class MockAccessibilityGestureRecognizeListener : public AccessibilityGestureRecognizeListener { 33 public: 34 virtual ~MockAccessibilityGestureRecognizeListener() = default; 35 36 MOCK_METHOD1(OnDoubleTap, bool(MMI::PointerEvent& event)); 37 MOCK_METHOD0(OnStarted, bool()); 38 MOCK_METHOD1(OnCompleted, bool(GestureType gestureId)); 39 MOCK_METHOD1(OnCancelled, bool(MMI::PointerEvent& event)); 40 }; 41 42 class MockAccessibilityGestureRecognizer : public AccessibilityGestureRecognizer { 43 public: 44 MockAccessibilityGestureRecognizer(); ~MockAccessibilityGestureRecognizer()45 ~MockAccessibilityGestureRecognizer() 46 {} 47 48 MOCK_METHOD1(RegisterListener, void(AccessibilityGestureRecognizeListener& listener)); 49 MOCK_METHOD0(UnregisterListener, void()); 50 MOCK_METHOD0(IsfirstTap, bool()); 51 MOCK_METHOD1(OnPointerEvent, bool(MMI::PointerEvent& event)); 52 MOCK_METHOD0(Clear, void()); 53 MOCK_METHOD1(MaybeRecognizeLongPress, void(MMI::PointerEvent& event)); 54 MOCK_METHOD0(SingleTapDetected, void()); 55 MOCK_METHOD1(SetIsLongpress, void(bool value)); 56 MOCK_METHOD0(GetCurDown, std::shared_ptr<MMI::PointerEvent>()); 57 MOCK_METHOD0(GetContinueDown, bool()); 58 }; 59 } // namespace Accessibility 60 } // namespace OHOS 61 #endif // MOCK_ACCESSIBILITY_GESTURE_RECOGNIZER_H