1 /*
2  * Copyright (c) 2020-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 UI_TEST_VIEW_BOUNDS_H
17 #define UI_TEST_VIEW_BOUNDS_H
18 
19 #include "graphic_config.h"
20 
21 #if defined(ENABLE_DEBUG) && ENABLE_DEBUG
22 #include "components/ui_scroll_view.h"
23 #include "components/ui_toggle_button.h"
24 #include "components/ui_label.h"
25 #include "ui_test.h"
26 
27 namespace OHOS {
28 constexpr char* UI_TEST_SHOW_VIEW_BOUNDS = "show_view_bounds";
29 class UITestViewBounds : public UITest {
30 public:
UITestViewBounds()31     UITestViewBounds() {}
32     ~UITestViewBounds();
33     void SetUp() override;
34     void TearDown() override;
35     const UIView* GetTestView() override;
36 
37     /**
38      * @brief test show or hide view bounds
39      *
40      */
41     void UIKitViewBoundsSetState001();
42 
43     /**
44      * @brief test view bounds with margin
45      *
46      */
47     void UIKitViewBoundsMargin001();
48 
49     /**
50      * @brief test view bounds with padding
51      *
52      */
53     void UIKitViewBoundsPadding001();
54 
55     /**
56      * @brief test view bounds with border
57      *
58      */
59     void UIKitViewBoundsBorder001();
60 
61     /**
62      * @brief test view bounds with margin/padding/border
63      *
64      */
65     void UIKitViewBounds001();
66 
67     /**
68      * @brief test small view which width or height small than 20px
69      *
70      */
71     void UIKitViewBoundsSmallView001();
72 
73     /**
74      * @brief test view which is invisible
75      *
76      */
77     void UIKitViewBoundsInvisible001();
78 
79     /**
80      * @brief test child view override OnPostDraw
81      *
82      */
83     void UIKitViewBoundsPostDraw001();
84 
85 private:
86     UILabel* CreateTitleLabel() const;
87     UIScrollView* container_ = nullptr;
88     UICheckBox::OnChangeListener* viewBoundsChangeListener_ = nullptr;
89 };
90 } // namespace OHOS
91 #endif // ENABLE_DEBUG
92 #endif // UI_TEST_VIEW_BOUNDS_H
93