• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PIPELINE_CONTEXT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_PIPELINE_CONTEXT_H
18 
19 #include "gmock/gmock.h"
20 
21 #include "core/pipeline_ng/pipeline_context.h"
22 
23 namespace OHOS::Ace::NG {
24 class MockPipelineContext : public PipelineContext {
25     DECLARE_ACE_TYPE(MockPipelineContext, PipelineContext);
26 
27 public:
28     MockPipelineContext() = default;
29     ~MockPipelineContext() override = default;
30 
31     static void SetUp();
32     static void TearDown();
33     static RefPtr<MockPipelineContext> GetCurrent();
34     void SetRootSize(double rootWidth, double rootHeight);
35     MOCK_CONST_METHOD0(GetSafeArea, SafeAreaInsets());
36 
GetIsDeclarative()37     bool GetIsDeclarative() const override
38     {
39         return isDeclarative_;
40     }
41 
42     static RefPtr<MockPipelineContext> pipeline_;
43 
44 protected:
45     bool isDeclarative_ = false;
46     double dipScale_ = 1.0;
47     RefPtr<TaskExecutor> taskExecutor_;
48 };
49 } // namespace OHOS::Ace::NG
50 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_PIPELINE_CONTEXT_H
51