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_DRAW_RECT_H
17 #define UI_TEST_DRAW_RECT_H
18 
19 #include "components/ui_button.h"
20 #include "components/ui_label.h"
21 #include "components/ui_scroll_view.h"
22 #include "ui_test.h"
23 
24 namespace OHOS {
25 class UITestDrawRect : public UITest {
26 public:
UITestDrawRect()27     UITestDrawRect() {}
~UITestDrawRect()28     ~UITestDrawRect() {}
29     void SetUp() override;
30     void TearDown() override;
31     const UIView* GetTestView() override;
32 
33     void UIKitDrawRectTestRectNoBorder001();
34     void UIKitDrawRectTestRectNoBorder002();
35     void UIKitDrawRectTestRectNoBorder003();
36     void UIKitDrawRectTestRectNoBorder004();
37     void UIKitDrawRectTestRectNoBorder005();
38     void UIKitDrawRectTestRectNoBorder006();
39     void UIKitDrawRectTestRectNoBorder007();
40     void UIKitDrawRectTestRectNoBorder008();
41     void UIKitDrawRectTestRectNoBorder009();
42     void UIKitDrawRectTestRectNoBorder0010();
43     void UIKitDrawRectTestRectBorderNoRadius001();
44     void UIKitDrawRectTestRectBorderNoRadius002();
45     void UIKitDrawRectTestRectBorderRadius001();
46     void UIKitDrawRectTestRectBorderRadius002();
47     void UIKitDrawRectTestRectBorderRadius003();
48     void UIKitDrawRectTestRectBorderRadius004();
49     void UIKitDrawRectTestRectBorderRadius005();
50     void UIKitDrawRectTestRectBorderRadius006();
51     void UIKitDrawRectTestRectBorderRadius007();
52     void UIKitDrawRectTestRectBorderRadius008();
53     void UIKitDrawRectTestRectBorderRadius009();
54     void UIKitDrawRectTestRectBorderRadius010();
55     void UIKitDrawRectTestRectBorderRadius011();
56 
57     /**
58      * @brief Test draw rect function
59      */
60     void UIKitDrawRectTestRect001();
61 
62     /**
63      * @brief Test draw rect background color
64      */
65     void UIKitDrawRectTestRectColor001();
66 
67     /**
68      * @brief Test draw rect radius is 0
69      */
70     void UIKitDrawRectTestRectRadius001();
71 
72     /**
73      * @brief Test draw rect radius
74      */
75     void UIKitDrawRectTestRectRadius002();
76 
77     /**
78      * @brief Test draw rect radius equal width
79      */
80     void UIKitDrawRectTestRectRadius003();
81 
82     /**
83      * @brief Test draw rect radius equal width and height
84      */
85     void UIKitDrawRectTestRectRadius004();
86 
87     /**
88      * @brief Test draw rect opacity is not transparent
89      */
90     void UIKitDrawRectTestRectOpacity001();
91 
92     /**
93      * @brief Test draw rect opacity is transparent
94      */
95     void UIKitDrawRectTestRectOpacity002();
96 
97     /**
98      * @brief Test draw rect opacity with different value
99      */
100     void UIKitDrawRectTestRectOpacity003();
101 
102     /**
103      * @brief Test draw rect border color with different value
104      */
105     void UIKitDrawRectTestRectBorderColor001();
106 
107     /**
108      * @brief Test draw rect border width is 0
109      */
110     void UIKitDrawRectTestRectBorderWidth001();
111 
112     /**
113      * @brief Test draw rect border with different value
114      */
115     void UIKitDrawRectTestRectBorderWidth002();
116 
117     /**
118      * @brief Test draw rect border opacity is not transparent
119      */
120     void UIKitDrawRectTestRectBorderOpacity001();
121 
122     /**
123      * @brief Test draw rect border opacity is transparent
124      */
125     void UIKitDrawRectTestRectBorderOpacity002();
126 
127     /**
128      * @brief Test draw rect border opacity with different value
129      */
130     void UIKitDrawRectTestRectBorderOpacity003();
131 
132     /**
133      * @brief Test draw rect padding is 0
134      */
135     void UIKitDrawRectTestRectPadding001();
136 
137     /**
138      * @brief Test draw rect padding with different value
139      */
140     void UIKitDrawRectTestRectPadding002();
141 
142     /**
143      * @brief Test draw rect margin is 0
144      */
145     void UIKitDrawRectTestRectMargin001();
146 
147     /**
148      * @brief Test draw rect margin is not 0
149      */
150     void UIKitDrawRectTestRectMargin002();
151 
152     /**
153      * @brief Test draw rect padding and margin is 0
154      */
155     void UIKitDrawRectTestRectPaddingMargin001();
156 
157     /**
158      * @brief Test draw rect padding and margin with different value
159      */
160     void UIKitDrawRectTestRectPaddingMargin002();
161 
162     /**
163      * @brief Test rect width is 0
164      */
165     void UIKitDrawRectTestRectWidthAndHeight001();
166 
167     /**
168      * @brief Test rect height is 0
169      */
170     void UIKitDrawRectTestRectWidthAndHeight002();
171 
172     /**
173      * @brief Test rect width and height is 0
174      */
175     void UIKitDrawRectTestRectWidthAndHeight003();
176 
177 private:
178     UIViewGroup* CreateTestCaseGroup() const;
179     UILabel* CreateTitleLabel() const;
180     UIView* CreateUIView() const;
181     UIScrollView* container_ = nullptr;
182 };
183 } // namespace OHOS
184 #endif // UI_TEST_DRAW_RECT_H
185