• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_ACE_TEST_MOCK_CORE_COMMON_MOCK_INTERACTION_H
17 #define FOUNDATION_ACE_TEST_MOCK_CORE_COMMON_MOCK_INTERACTION_H
18 
19 #include "gmock/gmock-function-mocker.h"
20 #include "gmock/gmock.h"
21 
22 #include "base/memory/ace_type.h"
23 #include "core/common/interaction/interaction_interface.h"
24 
25 namespace OHOS::Ace {
26 class MockInteractionInterface : public InteractionInterface {
27     DECLARE_ACE_TYPE(MockInteractionInterface, InteractionInterface);
28 
29 public:
30     MOCK_METHOD(int32_t, UpdateShadowPic, (const ShadowInfoCore& shadowInfo), (override));
31 
32     MOCK_METHOD(int32_t, SetDragWindowVisible,
33         (bool visible, const std::shared_ptr<Rosen::RSTransaction>& rSTransaction), (override));
34 
35     MOCK_METHOD(int32_t, SetMouseDragMonitorState, (bool state), (override));
36 
37     MOCK_METHOD(int32_t, UpdateDragStyle, (DragCursorStyleCore style, const int32_t eventId), (override));
38 
39     MOCK_METHOD(int32_t, UpdatePreviewStyle, (const PreviewStyle& previewStyle), (override));
40 
41     MOCK_METHOD(int32_t, UpdatePreviewStyleWithAnimation, (const PreviewStyle& previewStyle,
42         const PreviewAnimation& animation), (override));
43 
44     MOCK_METHOD(int32_t, StopDrag, (DragDropRet result), (override));
45 
46     MOCK_METHOD(int32_t, GetUdKey, (std::string& udKey), (override));
47 
48     MOCK_METHOD(int32_t, GetShadowOffset, (ShadowOffsetData& shadowOffsetData), (override));
49 
50     MOCK_METHOD(int32_t, GetDragState, (DragState& dragState), (const, override));
51 
52     MOCK_METHOD(int32_t, GetDragSummary, (
53         (std::map<std::string, int64_t>& summary), (std::map<std::string, int64_t>& detailedSummary),
54         (std::map<std::string, std::vector<int32_t>>& summaryFormat), (int32_t& version), (int64_t& totalSize)),
55         (override));
56 
57     MOCK_METHOD(int32_t, GetDragExtraInfo, (std::string& extraInfo), (override));
58 
59     MOCK_METHOD(int32_t, EnterTextEditorArea, (bool enable), (override));
60 
61     MOCK_METHOD(int32_t, AddPrivilege, (), (override));
62 
RegisterCoordinationListener(std::function<void ()> dragOutCallback)63     int32_t RegisterCoordinationListener(std::function<void()> dragOutCallback) override
64     {
65         gDragOutCallback = dragOutCallback;
66         return 1;
67     }
68 
StartDrag(const DragDataCore & dragData,std::function<void (const OHOS::Ace::DragNotifyMsg &)> callback)69     int32_t StartDrag(const DragDataCore& dragData, std::function<void(const OHOS::Ace::DragNotifyMsg&)> callback)
70     {
71         gDragData_ = dragData;
72         return gStartDrag;
73     }
74 
75     MOCK_METHOD(int32_t, UnRegisterCoordinationListener, (), (override));
76 
77     MOCK_METHOD(int32_t, SetDraggableState, (bool state), (override));
78 
79     MOCK_METHOD(int32_t, GetAppDragSwitchState, (bool& state), (override));
80 
81     MOCK_METHOD(void, SetDraggableStateAsync, (bool state, int64_t downTime), (override));
82 
83     MOCK_METHOD(int32_t, GetDragBundleInfo, (DragBundleInfo& dragBundleInfo), (override));
84 
85     MOCK_METHOD(int32_t, EnableInternalDropAnimation, (const std::string& animationInfo), (override));
86 
87     MOCK_METHOD(bool, IsDragStart, (), (const override));
88 private:
89     std::function<void()> gDragOutCallback = nullptr;
90     int gStartDrag = 0;
91     DragDataCore gDragData_;
92 };
93 } // namespace OHOS::Ace
94 #endif // FOUNDATION_ACE_TEST_MOCK_CORE_COMMON_MOCK_INTERACTION_H