• 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_BASE_MOCK_SUBWINDOW_H
17 #define FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H
18 
19 #include "gmock/gmock.h"
20 
21 #include "frameworks/base/subwindow/subwindow.h"
22 
23 namespace OHOS::Ace {
24 class ACE_EXPORT MockSubwindow : public Subwindow {
25     DECLARE_ACE_TYPE(MockSubwindow, Subwindow)
26 
27 public:
28     MOCK_METHOD0(InitContainer, void());
29     MOCK_METHOD0(ResizeWindow, void());
30     MOCK_METHOD0(GetRect, NG::RectF());
31     MOCK_METHOD1(ShowMenu, void(const RefPtr<Component>& newComponent));
32     MOCK_METHOD3(ShowMenuNG, void(const RefPtr<NG::FrameNode> menuNode, int32_t targetId, const NG::OffsetF& offset));
33     MOCK_METHOD2(HideMenuNG, void(const RefPtr<NG::FrameNode>& menu, int32_t targetId));
34     MOCK_METHOD0(HideMenuNG, void());
35     MOCK_METHOD2(ShowPopup, void(const RefPtr<Component>& newComponent, bool disableTouchEvent));
36     MOCK_METHOD2(ShowPopupNG, void(int32_t targetId, const NG::PopupInfo& popupInfo));
37     MOCK_METHOD1(HidePopupNG, void(int32_t targetId));
38     MOCK_METHOD2(GetPopupInfoNG, void(int32_t targetId, NG::PopupInfo& popupInfo));
39     MOCK_METHOD1(CancelPopup, bool(const std::string& id));
40     MOCK_METHOD0(CloseMenu, void());
41     MOCK_METHOD0(ClearMenu, void());
42     MOCK_METHOD1(ClearMenuNG, void(bool inWindow));
43     MOCK_METHOD2(
44         ShowDialogNG, RefPtr<NG::FrameNode>(const DialogProperties& dialogProps, std::function<void()>&& buildFunc));
45     MOCK_METHOD0(HideSubWindowNG, void());
46     MOCK_CONST_METHOD0(GetChildContainerId, int32_t());
47     MOCK_METHOD0(GetShown, bool());
48     MOCK_METHOD2(SetHotAreas, void(const std::vector<Rect>& rects, int32_t overlayId));
49     MOCK_CONST_METHOD0(GetParentWindowRect, Rect());
50     MOCK_METHOD3(ShowToast, void(const std::string& message, int32_t duration, const std::string& bottom));
51     MOCK_METHOD6(ShowDialog,
52         void(const std::string& title, const std::string& message, const std::vector<ButtonInfo>& buttons,
53             bool autoCancel, std::function<void(int32_t, int32_t)>&& callback, const std::set<std::string>& callbacks));
54     MOCK_METHOD4(ShowDialog,
55         void(const PromptDialogAttr& dialogAttr, const std::vector<ButtonInfo>& buttons,
56             std::function<void(int32_t, int32_t)>&& callback, const std::set<std::string>& callbacks));
57     MOCK_METHOD3(ShowActionMenu, void(const std::string& title, const std::vector<ButtonInfo>& button,
58                                      std::function<void(int32_t, int32_t)>&& callback));
59     MOCK_METHOD1(CloseDialog, void(int32_t instanceId));
60     MOCK_METHOD0(GetOverlayManager, const RefPtr<NG::OverlayManager>());
61     MOCK_METHOD0(RequestFocus, void());
62 };
63 } // namespace OHOS::Ace
64 #endif // FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H
65