1 /*
2  * Copyright (c) 2021 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 ACELITE_JSFWK_TEST_CONTAINER_HOLDER_H
17 #define ACELITE_JSFWK_TEST_CONTAINER_HOLDER_H
18 
19 #include "component.h"
20 #include "stylemgr/app_style_manager.h"
21 
22 namespace OHOS {
23 namespace ACELite {
24 class RootComponentMock final {
25 public:
26     RootComponentMock();
27     ~RootComponentMock();
28 
29     /**
30      * @brief PrepareRootContainer prepare the container
31      */
32     void PrepareRootContainer(int16_t width = DEFAULT_CONTAINER_WIDTH,
33                               int16_t height = DEFAULT_CONTAINER_HEIGHT,
34                               bool flex = true);
35     /**
36      * @brief RenderUnderTestComponent render the given component and build view tree to the container
37      * @param component the under test component
38      */
39     void RenderComponent(Component &component) const;
40 
41 private:
42     static const int16_t DEFAULT_CONTAINER_WIDTH = 454;
43     static const int16_t DEFAULT_CONTAINER_HEIGHT = 454;
44     // used for build view tree flow, no specific meaning
45     Component *rootContainer_;
46     AppStyleManager *containerStyleMgr_;
47     int16_t rootWidth_;
48     int16_t rootHeight_;
49 };
50 } // namespace ACELite
51 } // namespace OHOS
52 #endif // ACELITE_JSFWK_TEST_CONTAINER_HOLDER_H
53