123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include "gmock/gmock.h" 2023b3eb3cSopenharmony_ci 2123b3eb3cSopenharmony_ci#include "base/subwindow/subwindow.h" 2223b3eb3cSopenharmony_ci 2323b3eb3cSopenharmony_cinamespace OHOS::Ace { 2423b3eb3cSopenharmony_ciclass ACE_EXPORT MockSubwindow : public Subwindow { 2523b3eb3cSopenharmony_ci DECLARE_ACE_TYPE(MockSubwindow, Subwindow) 2623b3eb3cSopenharmony_ci 2723b3eb3cSopenharmony_cipublic: 2823b3eb3cSopenharmony_ci MOCK_METHOD0(InitContainer, bool()); 2923b3eb3cSopenharmony_ci MOCK_METHOD0(ResizeWindow, void()); 3023b3eb3cSopenharmony_ci MOCK_METHOD0(GetRect, NG::RectF()); 3123b3eb3cSopenharmony_ci MOCK_METHOD0(UpdatePreviewPosition, void()); 3223b3eb3cSopenharmony_ci MOCK_METHOD1(GetMenuPreviewCenter, bool(NG::OffsetF& offset)); 3323b3eb3cSopenharmony_ci MOCK_METHOD1(ShowMenu, void(const RefPtr<Component>& newComponent)); 3423b3eb3cSopenharmony_ci MOCK_METHOD4(ShowMenuNG, void(const RefPtr<NG::FrameNode> menuNode, const NG::MenuParam& menuParam, 3523b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset)); 3623b3eb3cSopenharmony_ci MOCK_METHOD5(ShowMenuNG, 3723b3eb3cSopenharmony_ci void(std::function<void()>&& buildFunc, std::function<void()>&& previewBuildFunc, 3823b3eb3cSopenharmony_ci const NG::MenuParam& menuParam, const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset)); 3923b3eb3cSopenharmony_ci MOCK_METHOD1(ShowPreviewNG, bool(bool isStartDraggingFromSubWindow)); 4023b3eb3cSopenharmony_ci MOCK_METHOD0(HidePreviewNG, void()); 4123b3eb3cSopenharmony_ci MOCK_METHOD2(HideMenuNG, void(const RefPtr<NG::FrameNode>& menu, int32_t targetId)); 4223b3eb3cSopenharmony_ci MOCK_METHOD2(HideMenuNG, void(bool showPreviewAnimation, bool startDrag)); 4323b3eb3cSopenharmony_ci MOCK_METHOD4(UpdateHideMenuOffsetNG, 4423b3eb3cSopenharmony_ci void(const NG::OffsetF& offset, float meunuScale, bool isRedragStart, int32_t menuWrapperId)); 4523b3eb3cSopenharmony_ci MOCK_METHOD2(ContextMenuSwitchDragPreviewAnimationtNG, void(const RefPtr<NG::FrameNode>& dragPreviewNode, 4623b3eb3cSopenharmony_ci const NG::OffsetF& offset)); 4723b3eb3cSopenharmony_ci MOCK_METHOD2(ShowPopup, void(const RefPtr<Component>& newComponent, bool disableTouchEvent)); 4823b3eb3cSopenharmony_ci MOCK_METHOD4(ShowPopupNG, void(int32_t targetId, const NG::PopupInfo& popupInfo, 4923b3eb3cSopenharmony_ci const std::function<void(int32_t)>&& onWillDismiss, bool interactiveDismiss)); 5023b3eb3cSopenharmony_ci MOCK_METHOD1(HidePopupNG, void(int32_t targetId)); 5123b3eb3cSopenharmony_ci MOCK_METHOD0(ClearPopupNG, void()); 5223b3eb3cSopenharmony_ci MOCK_METHOD2(GetPopupInfoNG, void(int32_t targetId, NG::PopupInfo& popupInfo)); 5323b3eb3cSopenharmony_ci MOCK_METHOD1(CancelPopup, bool(const std::string& id)); 5423b3eb3cSopenharmony_ci MOCK_METHOD0(CloseMenu, void()); 5523b3eb3cSopenharmony_ci MOCK_METHOD0(ClearMenu, void()); 5623b3eb3cSopenharmony_ci MOCK_METHOD3(ClearMenuNG, void(int32_t targetId, bool inWindow, bool showAnimation)); 5723b3eb3cSopenharmony_ci MOCK_METHOD2( 5823b3eb3cSopenharmony_ci ShowDialogNG, RefPtr<NG::FrameNode>(const DialogProperties& dialogProps, std::function<void()>&& buildFunc)); 5923b3eb3cSopenharmony_ci MOCK_METHOD2(ShowDialogNGWithNode, RefPtr<NG::FrameNode>(const DialogProperties&, const RefPtr<NG::UINode>&)); 6023b3eb3cSopenharmony_ci MOCK_METHOD1(CloseDialogNG, void(const RefPtr<NG::FrameNode>& dialogNode)); 6123b3eb3cSopenharmony_ci MOCK_METHOD0(HideSubWindowNG, void()); 6223b3eb3cSopenharmony_ci MOCK_CONST_METHOD0(GetChildContainerId, int32_t()); 6323b3eb3cSopenharmony_ci MOCK_METHOD0(GetShown, bool()); 6423b3eb3cSopenharmony_ci MOCK_METHOD2(SetHotAreas, void(const std::vector<Rect>& rects, int32_t overlayId)); 6523b3eb3cSopenharmony_ci MOCK_CONST_METHOD0(GetParentWindowRect, Rect()); 6623b3eb3cSopenharmony_ci MOCK_CONST_METHOD0(GetUIExtensionHostWindowRect, Rect()); 6723b3eb3cSopenharmony_ci MOCK_METHOD0(ClearToast, void()); 6823b3eb3cSopenharmony_ci MOCK_METHOD2(ShowToast, void(const NG::ToastInfo& toastInfo, std::function<void(int32_t)>&& callback)); 6923b3eb3cSopenharmony_ci MOCK_METHOD2(CloseToast, void(int32_t toastId, std::function<void(int32_t)>&& callback)); 7023b3eb3cSopenharmony_ci MOCK_METHOD6(ShowDialog, 7123b3eb3cSopenharmony_ci void(const std::string& title, const std::string& message, const std::vector<ButtonInfo>& buttons, 7223b3eb3cSopenharmony_ci bool autoCancel, std::function<void(int32_t, int32_t)>&& callback, const std::set<std::string>& callbacks)); 7323b3eb3cSopenharmony_ci MOCK_METHOD4(ShowDialog, 7423b3eb3cSopenharmony_ci void(const PromptDialogAttr& dialogAttr, const std::vector<ButtonInfo>& buttons, 7523b3eb3cSopenharmony_ci std::function<void(int32_t, int32_t)>&& callback, const std::set<std::string>& callbacks)); 7623b3eb3cSopenharmony_ci MOCK_METHOD3(ShowActionMenu, void(const std::string& title, const std::vector<ButtonInfo>& button, 7723b3eb3cSopenharmony_ci std::function<void(int32_t, int32_t)>&& callback)); 7823b3eb3cSopenharmony_ci MOCK_METHOD1(CloseDialog, void(int32_t instanceId)); 7923b3eb3cSopenharmony_ci MOCK_METHOD0(GetOverlayManager, const RefPtr<NG::OverlayManager>()); 8023b3eb3cSopenharmony_ci MOCK_METHOD0(RequestFocus, void()); 8123b3eb3cSopenharmony_ci MOCK_METHOD0(IsFocused, bool()); 8223b3eb3cSopenharmony_ci MOCK_METHOD2(OpenCustomDialog, void(const PromptDialogAttr& dialogAttr, std::function<void(int32_t)>&& callback)); 8323b3eb3cSopenharmony_ci MOCK_METHOD1(CloseCustomDialog, void(const int32_t dialogId)); 8423b3eb3cSopenharmony_ci MOCK_METHOD2(CloseCustomDialog, void(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)> &&callback)); 8523b3eb3cSopenharmony_ci MOCK_METHOD2( 8623b3eb3cSopenharmony_ci OpenCustomDialogNG, void(const DialogProperties& dialogProps, std::function<void(int32_t)>&& callback)); 8723b3eb3cSopenharmony_ci MOCK_METHOD1(CloseCustomDialogNG, void(int32_t dialogId)); 8823b3eb3cSopenharmony_ci MOCK_METHOD2(CloseCustomDialogNG, void(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)>&& callback)); 8923b3eb3cSopenharmony_ci MOCK_METHOD3(UpdateCustomDialogNG, void(const WeakPtr<NG::UINode>& node, const DialogProperties& dialogProps, 9023b3eb3cSopenharmony_ci std::function<void(int32_t)>&& callback)); 9123b3eb3cSopenharmony_ci MOCK_METHOD0(ResizeWindowForFoldStatus, void()); 9223b3eb3cSopenharmony_ci MOCK_METHOD1(ResizeWindowForFoldStatus, void(int32_t parentContainerId)); 9323b3eb3cSopenharmony_ci MOCK_METHOD0(MarkDirtyDialogSafeArea, void()); 9423b3eb3cSopenharmony_ci MOCK_METHOD0(Close, bool()); 9523b3eb3cSopenharmony_ci MOCK_CONST_METHOD0(IsFreeMultiWindow, bool()); 9623b3eb3cSopenharmony_ci MOCK_METHOD1(OnFreeMultiWindowSwitch, void(bool enable)); 9723b3eb3cSopenharmony_ci MOCK_METHOD1(RegisterFreeMultiWindowSwitchCallback, int32_t(std::function<void(bool)>&& callback)); 9823b3eb3cSopenharmony_ci MOCK_METHOD1(UnRegisterFreeMultiWindowSwitchCallback, void(int32_t callbackId)); 9923b3eb3cSopenharmony_ci MOCK_METHOD1(SetRect, void(const NG::RectF& rect)); 10023b3eb3cSopenharmony_ci MOCK_METHOD0(IsToastSubWindow, bool()); 10123b3eb3cSopenharmony_ci MOCK_METHOD0(DestroyWindow, void()); 10223b3eb3cSopenharmony_ci}; 10323b3eb3cSopenharmony_ci} // namespace OHOS::Ace 10423b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H 105