1 /* 2 * Copyright (c) 2022 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_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_PATTERN_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_PATTERN_H 18 19 #include "gmock/gmock.h" 20 21 #include "core/components_ng/pattern/pattern.h" 22 23 namespace OHOS::Ace::NG { 24 class MockPattern : public Pattern { 25 DECLARE_ACE_TYPE(MockPattern, Pattern); 26 27 public: 28 MockPattern() = default; 29 ~MockPattern() override = default; 30 31 MOCK_CONST_METHOD0(IsAtomicNode, bool()); 32 MOCK_CONST_METHOD0(GetContextParam, std::optional<RenderContext::ContextParam>()); 33 MOCK_CONST_METHOD0(GetOverridePaintRect, std::optional<RectF>()); 34 MOCK_METHOD0(CreateAccessibilityProperty, RefPtr<AccessibilityProperty>()); 35 MOCK_METHOD0(CreatePaintProperty, RefPtr<PaintProperty>()); 36 MOCK_METHOD0(CreateLayoutProperty, RefPtr<LayoutProperty>()); 37 MOCK_METHOD0(CreateLayoutAlgorithm, RefPtr<LayoutAlgorithm>()); 38 MOCK_METHOD0(CreateNodePaintMethod, RefPtr<NodePaintMethod>()); 39 MOCK_METHOD0(CreateEventHub, RefPtr<EventHub>()); 40 MOCK_METHOD0(OnContextAttached, void()); 41 MOCK_METHOD0(OnModifyDone, void()); 42 MOCK_METHOD0(OnMountToParentDone, void()); 43 MOCK_CONST_METHOD0(IsRootPattern, bool()); 44 MOCK_CONST_METHOD0(IsMeasureBoundary, bool()); 45 MOCK_CONST_METHOD0(IsRenderBoundary, bool()); 46 MOCK_METHOD3(OnDirtyLayoutWrapperSwap, bool(const RefPtr<LayoutWrapper>& dirty, bool skipMeasure, bool skipLayout)); 47 MOCK_METHOD2( 48 OnDirtyLayoutWrapperSwap, bool(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& changeConfig)); 49 MOCK_METHOD0(DumpInfo, void()); 50 MOCK_METHOD0(OnRebuildFrame, void()); 51 MOCK_METHOD0(BeforeCreateLayoutWrapper, void()); 52 MOCK_METHOD0(BeforeCreatePaintWrapper, void()); 53 MOCK_METHOD0(GetScopeFocusAlgorithm, ScopeFocusAlgorithm()); 54 MOCK_METHOD0(OnInActive, void()); 55 MOCK_METHOD0(OnActive, void()); 56 MOCK_METHOD0(OnWindowShow, void()); 57 MOCK_METHOD0(OnWindowHide, void()); 58 MOCK_METHOD0(OnWindowFocused, void()); 59 MOCK_METHOD0(OnWindowUnfocused, void()); 60 MOCK_METHOD1(OnNotifyMemoryLevel, void(int32_t level)); 61 MOCK_METHOD0(OnAttachToFrameNode, void()); 62 MOCK_METHOD1(OnDetachFromFrameNode, void(FrameNode* frameNode)); 63 MOCK_CONST_METHOD2(ToJsonValue, void(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter)); 64 MOCK_METHOD0(ProvideRestoreInfo, std::string()); 65 MOCK_METHOD0(OnAreaChangedInner, void()); 66 MOCK_METHOD3(OnWindowSizeChanged, void(int32_t width, int32_t height, WindowSizeChangeReason type)); 67 }; 68 } // namespace OHOS::Ace::NG 69 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_PATTERN_H 70