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_TOUCH_GUIDER_H
17 #define MOCK_ACCESSIBILITY_TOUCH_GUIDER_H
18 
19 #include <gmock/gmock.h>
20 #include "accessibility_touch_guider.h"
21 
22 namespace OHOS {
23 namespace Accessibility {
24 class MockTGEventHandler : public TGEventHandler {
25 public:
26     MockTGEventHandler(const std::shared_ptr<AppExecFwk::EventRunner>& runner, TouchGuider& tgServer);
27     virtual ~MockTGEventHandler() = default;
28 
29     MOCK_METHOD1(ProcessEvent, void(const AppExecFwk::InnerEvent::Pointer& event));
30 };
31 
32 class MockTouchGuider : public TouchGuider {
33 public:
34     MockTouchGuider();
~MockTouchGuider()35     ~MockTouchGuider()
36     {}
37 
38     MOCK_METHOD0(StartUp, void());
39     MOCK_METHOD1(OnPointerEvent, void(MMI::PointerEvent& event));
40     MOCK_METHOD0(DestroyEvents, void());
41     MOCK_METHOD2(SendEventToMultimodal, void(MMI::PointerEvent& event, int32_t action));
42     MOCK_METHOD1(SendAccessibilityEventToAA, void(EventType eventType));
43     MOCK_METHOD0(getHoverEnterAndMoveEvent, std::list<MMI::PointerEvent>());
44     MOCK_METHOD0(ClearHoverEnterAndMoveEvent, void());
45     MOCK_METHOD0(getLastReceivedEvent, std::shared_ptr<MMI::PointerEvent>());
46 
47     /* For TouchGuide */
OnTouchInteractionStart()48     inline void OnTouchInteractionStart()
49     {
50         isTouchStart_ = true;
51     }
52 
OnTouchInteractionEnd()53     inline void OnTouchInteractionEnd()
54     {
55         isTouchStart_ = false;
56     }
57 };
58 } // namespace Accessibility
59 } // namespace OHOS
60 #endif // MOCK_ACCESSIBILITY_TOUCH_GUIDER_H