• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "ui_test_draw_rect.h"
17 #include "common/screen.h"
18 #include "components/ui_button.h"
19 #include "components/ui_label.h"
20 #include "components/ui_view_group.h"
21 
22 namespace OHOS {
SetUp()23 void UITestDrawRect::SetUp()
24 {
25     if (container_ == nullptr) {
26         container_ = new UIScrollView();
27         container_->Resize(Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight() - BACK_BUTTON_HEIGHT);
28         container_->SetHorizontalScrollState(false);
29     }
30 }
31 
TearDown()32 void UITestDrawRect::TearDown()
33 {
34     DeleteChildren(container_);
35     container_ = nullptr;
36 }
37 
GetTestView()38 const UIView* UITestDrawRect::GetTestView()
39 {
40     UIKit_DrawRect_Test_RectNoBorder_001();
41     UIKit_DrawRect_Test_RectNoBorder_002();
42     UIKit_DrawRect_Test_RectNoBorder_003();
43     UIKit_DrawRect_Test_RectNoBorder_004();
44     UIKit_DrawRect_Test_RectNoBorder_005();
45     UIKit_DrawRect_Test_RectNoBorder_006();
46     UIKit_DrawRect_Test_RectNoBorder_007();
47     UIKit_DrawRect_Test_RectNoBorder_008();
48     UIKit_DrawRect_Test_RectNoBorder_009();
49     UIKit_DrawRect_Test_RectNoBorder_0010();
50     UIKit_DrawRect_Test_RectBorderNoRadius_001();
51     UIKit_DrawRect_Test_RectBorderNoRadius_002();
52     UIKit_DrawRect_Test_RectBorderRadius_001();
53     UIKit_DrawRect_Test_RectBorderRadius_002();
54     UIKit_DrawRect_Test_RectBorderRadius_003();
55     UIKit_DrawRect_Test_RectBorderRadius_004();
56     UIKit_DrawRect_Test_RectBorderRadius_005();
57     UIKit_DrawRect_Test_RectBorderRadius_006();
58     UIKit_DrawRect_Test_RectBorderRadius_007();
59     UIKit_DrawRect_Test_RectBorderRadius_008();
60     UIKit_DrawRect_Test_RectBorderRadius_009();
61     UIKit_DrawRect_Test_RectBorderRadius_010();
62     UIKit_DrawRect_Test_RectBorderRadius_011();
63 
64     UIKit_DrawRect_Test_Rect_001();
65     UIKit_DrawRect_Test_RectColor_001();
66     UIKit_DrawRect_Test_RectRadius_001();
67     UIKit_DrawRect_Test_RectRadius_002();
68     UIKit_DrawRect_Test_RectRadius_003();
69     UIKit_DrawRect_Test_RectRadius_004();
70     UIKit_DrawRect_Test_RectOpacity_001();
71     UIKit_DrawRect_Test_RectOpacity_002();
72     UIKit_DrawRect_Test_RectOpacity_003();
73     UIKit_DrawRect_Test_RectBorderColor_001();
74     UIKit_DrawRect_Test_RectBorderWidth_001();
75     UIKit_DrawRect_Test_RectBorderWidth_002();
76     UIKit_DrawRect_Test_RectBorderOpacity_001();
77     UIKit_DrawRect_Test_RectBorderOpacity_002();
78     UIKit_DrawRect_Test_RectBorderOpacity_003();
79     UIKit_DrawRect_Test_RectPadding_001();
80     UIKit_DrawRect_Test_RectPadding_002();
81     UIKit_DrawRect_Test_RectMargin_001();
82     UIKit_DrawRect_Test_RectMargin_002();
83     UIKit_DrawRect_Test_RectPaddingMargin_001();
84     UIKit_DrawRect_Test_RectPaddingMargin_002();
85     UIKit_DrawRect_Test_RectWidthAndHeight_001();
86     UIKit_DrawRect_Test_RectWidthAndHeight_002();
87     UIKit_DrawRect_Test_RectWidthAndHeight_003();
88     return container_;
89 }
90 
CreateTestCaseGroup() const91 UIViewGroup* UITestDrawRect::CreateTestCaseGroup() const
92 {
93     UIViewGroup* group = new UIViewGroup();
94     group->Resize(Screen::GetInstance().GetWidth(), 180); // 180 : value
95     return group;
96 }
97 
CreateTitleLabel() const98 UILabel* UITestDrawRect::CreateTitleLabel() const
99 {
100     UILabel* label = new UILabel();
101     label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE,
102         Screen::GetInstance().GetWidth() - VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
103     label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
104     return label;
105 }
106 
CreateUIView() const107 UIView* UITestDrawRect::CreateUIView() const
108 {
109     UIView* view = new UIView();
110     view->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full);
111     view->SetStyle(STYLE_BACKGROUND_OPA, 127); // 127 : background opacity
112     view->SetStyle(STYLE_BORDER_RADIUS, 5); // 5 : radius value
113     view->SetStyle(STYLE_BORDER_COLOR, Color::Gray().full);
114     view->SetStyle(STYLE_BORDER_OPA, 127); // 127 : border opacity
115     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : border width
116     view->SetStyle(STYLE_PADDING_LEFT, 0);
117     view->SetStyle(STYLE_PADDING_RIGHT, 0);
118     view->SetStyle(STYLE_PADDING_TOP, 0);
119     view->SetStyle(STYLE_PADDING_BOTTOM, 0);
120     view->SetStyle(STYLE_MARGIN_LEFT, 0);
121     view->SetStyle(STYLE_MARGIN_RIGHT, 0);
122     view->SetStyle(STYLE_MARGIN_TOP, 0);
123     view->SetStyle(STYLE_MARGIN_BOTTOM, 0);
124     return view;
125 }
126 
UIKit_DrawRect_Test_RectNoBorder_001()127 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_001()
128 {
129     if (container_ == nullptr) {
130         return;
131     }
132 
133     UIViewGroup* group = CreateTestCaseGroup();
134     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_001");
135     group->SetPosition(0, 0);
136 
137     UILabel* label = CreateTitleLabel();
138     label->SetText("矩形无border, radius=0");
139     group->Add(label);
140 
141     UIView* view = CreateUIView();
142     int16_t width = 120; // 120 : width
143     int16_t height = 50; // 50 : height
144     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
145     view->SetStyle(STYLE_BORDER_WIDTH, 0);
146     view->SetStyle(STYLE_BORDER_RADIUS, 0);
147     view->Resize(width, height);
148     group->Add(view);
149 
150     container_->Add(group);
151 }
152 
UIKit_DrawRect_Test_RectNoBorder_002()153 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_002()
154 {
155     if (container_ == nullptr) {
156         return;
157     }
158 
159     UIViewGroup* group = CreateTestCaseGroup();
160     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_002");
161     group->SetPosition(0, 0);
162 
163     UILabel* label = CreateTitleLabel();
164     label->SetText("矩形无border, radius>0, width > height, radius > height/2");
165     group->Add(label);
166 
167     UIView* view = CreateUIView();
168     int16_t width = 120; // 120 : width
169     int16_t height = 50; // 50 : height
170     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
171     view->SetStyle(STYLE_BORDER_WIDTH, 0);
172     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 + 10); // 2 : half height 10 : offset
173     view->Resize(width, height);
174     group->Add(view);
175 
176     container_->Add(group);
177     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_001", 10); // 10 : offset size
178 }
179 
UIKit_DrawRect_Test_RectNoBorder_003()180 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_003()
181 {
182     if (container_ == nullptr) {
183         return;
184     }
185 
186     UIViewGroup* group = CreateTestCaseGroup();
187     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_003");
188     group->SetPosition(0, 0);
189 
190     UILabel* label = CreateTitleLabel();
191     label->SetText("矩形无border, radius>0, width > height, radius = height/2 ");
192     group->Add(label);
193 
194     UIView* view = CreateUIView();
195     int16_t width = 120; // 120 : width size
196     int16_t height = 50; // 50 : height size
197     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
198     view->SetStyle(STYLE_BORDER_WIDTH, 0);
199     view->SetStyle(STYLE_BORDER_RADIUS, height / 2); // 2 : half height
200     view->Resize(width, height);
201     group->Add(view);
202 
203     container_->Add(group);
204     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_002", 10); // 10 : offset size
205 }
206 
UIKit_DrawRect_Test_RectNoBorder_004()207 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_004()
208 {
209     if (container_ == nullptr) {
210         return;
211     }
212 
213     UIViewGroup* group = CreateTestCaseGroup();
214     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_004");
215     group->SetPosition(0, 0);
216 
217     UILabel* label = CreateTitleLabel();
218     label->SetText("矩形无border, radius>0, width > height, radius < height/2 ");
219     group->Add(label);
220 
221     UIView* view = CreateUIView();
222     int16_t width = 120; // 120 : width size
223     int16_t height = 50; // 50 : height size
224     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
225     view->SetStyle(STYLE_BORDER_WIDTH, 0);
226     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 - 10); // 2 : half height 10 : offset
227     view->Resize(width, height);
228     group->Add(view);
229 
230     container_->Add(group);
231     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_003", 10); // 10 : offset size
232 }
233 
UIKit_DrawRect_Test_RectNoBorder_005()234 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_005()
235 {
236     if (container_ == nullptr) {
237         return;
238     }
239 
240     UIViewGroup* group = CreateTestCaseGroup();
241     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_005");
242     group->SetPosition(0, 0);
243 
244     UILabel* label = CreateTitleLabel();
245     label->SetText("矩形无border, radius>0, width = height, radius > height/2 ");
246     group->Add(label);
247 
248     UIView* view = CreateUIView();
249     int16_t width = 50; // 50 : width
250     int16_t height = width;
251     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
252     view->SetStyle(STYLE_BORDER_WIDTH, 0);
253     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 + 10); // 2 : half height 10 : offset
254     view->Resize(width, height);
255     group->Add(view);
256 
257     container_->Add(group);
258     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_004", 10); // 10 : offset size
259 }
260 
UIKit_DrawRect_Test_RectNoBorder_006()261 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_006()
262 {
263     if (container_ == nullptr) {
264         return;
265     }
266 
267     UIViewGroup* group = CreateTestCaseGroup();
268     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_006");
269     group->SetPosition(0, 0);
270 
271     UILabel* label = CreateTitleLabel();
272     label->SetText("矩形无border, radius>0, width = height, radius = height/2 ");
273     group->Add(label);
274 
275     UIView* view = CreateUIView();
276     int16_t width = 50; // 50 : width
277     int16_t height = width;
278     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
279     view->SetStyle(STYLE_BORDER_WIDTH, 0);
280     view->SetStyle(STYLE_BORDER_RADIUS, height / 2); // 2 : half
281     view->Resize(width, height);
282     group->Add(view);
283 
284     container_->Add(group);
285     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_005", 10); // 10 : offset size
286 }
287 
UIKit_DrawRect_Test_RectNoBorder_007()288 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_007()
289 {
290     if (container_ == nullptr) {
291         return;
292     }
293 
294     UIViewGroup* group = CreateTestCaseGroup();
295     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_007");
296     group->SetPosition(0, 0);
297 
298     UILabel* label = CreateTitleLabel();
299     label->SetText("矩形无border, radius>0, width = height, radius < height/2 ");
300     group->Add(label);
301 
302     UIView* view = CreateUIView();
303     int16_t width = 50; // 50 : width
304     int16_t height = width;
305     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
306     view->SetStyle(STYLE_BORDER_WIDTH, 0);
307     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 - 10); // 2 : half height 10 : offset
308     view->Resize(width, height);
309     group->Add(view);
310 
311     container_->Add(group);
312     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_006", 10); // 10 : offset size
313 }
314 
UIKit_DrawRect_Test_RectNoBorder_008()315 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_008()
316 {
317     if (container_ == nullptr) {
318         return;
319     }
320 
321     UIViewGroup* group = CreateTestCaseGroup();
322     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_008");
323     group->SetPosition(0, 0);
324 
325     UILabel* label = CreateTitleLabel();
326     label->SetText("矩形无border, radius>0, width < height, radius > width/2 ");
327     group->Add(label);
328 
329     UIView* view = CreateUIView();
330     int16_t width = 50; // 50 : width
331     int16_t height = 120; // 120 : height
332     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
333     view->SetStyle(STYLE_BORDER_WIDTH, 0);
334     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + 10); // 2 : half width 10 : offset
335     view->Resize(width, height);
336     group->Add(view);
337 
338     container_->Add(group);
339     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_007", 10); // 10 : offset size
340 }
341 
UIKit_DrawRect_Test_RectNoBorder_009()342 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_009()
343 {
344     if (container_ == nullptr) {
345         return;
346     }
347 
348     UIViewGroup* group = CreateTestCaseGroup();
349     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_009");
350     group->SetPosition(0, 0);
351 
352     UILabel* label = CreateTitleLabel();
353     label->SetText("矩形无border, radius>0, width < height, radius = width/2 ");
354     group->Add(label);
355 
356     UIView* view = CreateUIView();
357     int16_t width = 51; // 51 : width
358     int16_t height = 120; // 120 : height
359     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
360     view->SetStyle(STYLE_BORDER_WIDTH, 0);
361     view->SetStyle(STYLE_BORDER_RADIUS, width / 2); // 2 : half width
362     view->Resize(width, height);
363     group->Add(view);
364 
365     container_->Add(group);
366     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_008", 10); // 10 : offset size
367 }
368 
UIKit_DrawRect_Test_RectNoBorder_0010()369 void UITestDrawRect::UIKit_DrawRect_Test_RectNoBorder_0010()
370 {
371     if (container_ == nullptr) {
372         return;
373     }
374 
375     UIViewGroup* group = CreateTestCaseGroup();
376     group->SetViewId("UIKit_DrawRect_Test_RectNoBorder_0010");
377     group->SetPosition(0, 0);
378 
379     UILabel* label = CreateTitleLabel();
380     label->SetText("矩形无border, radius>0, width < height, radius < width/2 ");
381     group->Add(label);
382 
383     UIView* view = CreateUIView();
384     int16_t width = 50; // 50 : width
385     int16_t height = 120; // 120 : height
386     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
387     view->SetStyle(STYLE_BORDER_WIDTH, 0);
388     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 - 10); // 2 : half width 10 : offset
389     view->Resize(width, height);
390     group->Add(view);
391 
392     container_->Add(group);
393     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_009", 10); // 10 : offset size
394 }
395 
UIKit_DrawRect_Test_RectBorderNoRadius_001()396 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderNoRadius_001()
397 {
398     if (container_ == nullptr) {
399         return;
400     }
401 
402     UIViewGroup* group = CreateTestCaseGroup();
403     group->SetViewId("UIKit_DrawRect_Test_RectBorderNoRadius_001");
404     group->SetPosition(0, 0);
405 
406     UILabel* label = CreateTitleLabel();
407     label->SetText("矩形有border, radius=0");
408     group->Add(label);
409 
410     UIView* view = CreateUIView();
411     int16_t width = 120; // 120 : width
412     int16_t height = 50; // 50 : height
413     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
414     view->SetStyle(STYLE_BORDER_WIDTH, 10); // 10 : value
415     view->SetStyle(STYLE_BORDER_RADIUS, 0);
416     view->Resize(width, height);
417     group->Add(view);
418 
419     container_->Add(group);
420     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectNoBorder_0010", 10); // 10 : offset size
421 }
422 
UIKit_DrawRect_Test_RectBorderNoRadius_002()423 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderNoRadius_002()
424 {
425     if (container_ == nullptr) {
426         return;
427     }
428 
429     UIViewGroup* group = CreateTestCaseGroup();
430     group->SetViewId("UIKit_DrawRect_Test_RectBorderNoRadius_002");
431     group->SetPosition(0, 0);
432 
433     UILabel* label = CreateTitleLabel();
434     label->SetText("矩形有border = 1, radius=0");
435     group->Add(label);
436 
437     UIView* view = CreateUIView();
438     int16_t width = 120; // 120 : width
439     int16_t height = 50; // 50 : height
440     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
441     view->SetStyle(STYLE_BORDER_WIDTH, 1); // 1 : value
442     view->SetStyle(STYLE_BORDER_RADIUS, 0);
443     view->Resize(width, height);
444     group->Add(view);
445 
446     container_->Add(group);
447     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderNoRadius_001", 10); // 10 : offset size
448 }
449 
UIKit_DrawRect_Test_RectBorderRadius_001()450 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_001()
451 {
452     if (container_ == nullptr) {
453         return;
454     }
455 
456     UIViewGroup* group = CreateTestCaseGroup();
457     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_001");
458     group->SetPosition(0, 0);
459 
460     UILabel* label = CreateTitleLabel();
461     label->SetText("矩形有border, radius<border.width");
462     group->Add(label);
463 
464     UIView* view = CreateUIView();
465     int16_t width = 120; // 120 : width
466     int16_t height = 50; // 50 : height
467     int16_t borderWidth = 10; // 10 : borderWidth
468     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
469     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
470     view->SetStyle(STYLE_BORDER_RADIUS, borderWidth - 5); // 5 : math_num
471     view->Resize(width, height);
472     group->Add(view);
473 
474     container_->Add(group);
475     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderNoRadius_001", 10); // 10 : offset size
476 }
477 
UIKit_DrawRect_Test_RectBorderRadius_002()478 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_002()
479 {
480     if (container_ == nullptr) {
481         return;
482     }
483 
484     UIViewGroup* group = CreateTestCaseGroup();
485     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_002");
486     group->SetPosition(0, 0);
487 
488     UILabel* label = CreateTitleLabel();
489     label->SetText("border场景,radius>border.width,宽度 >高度,radius > 高度/2 + border.width");
490     group->Add(label);
491 
492     UIView* view = CreateUIView();
493     int16_t width = 120; // 120 : width
494     int16_t height = 50; // 50 : height
495     int16_t borderWidth = 10; // 10 : borderWidth
496     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
497     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
498     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 + borderWidth + 5); // 2 : half height 5 : offset
499     view->Resize(width, height);
500     group->Add(view);
501 
502     container_->Add(group);
503     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_001", 10); // 10 : offset size
504 }
505 
UIKit_DrawRect_Test_RectBorderRadius_003()506 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_003()
507 {
508     if (container_ == nullptr) {
509         return;
510     }
511 
512     UIViewGroup* group = CreateTestCaseGroup();
513     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_003");
514     group->SetPosition(0, 0);
515 
516     UILabel* label = CreateTitleLabel();
517     label->SetText("border场景,radius>border.width,宽度>高度,radius = 高度/2 + border.width");
518     group->Add(label);
519 
520     UIView* view = CreateUIView();
521     int16_t width = 120; // 120 : width
522     int16_t height = 50; // 50 : height
523     int16_t borderWidth = 10; // 10 : borderWidth
524     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
525     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
526     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 + borderWidth); // 2 : half height
527     view->Resize(width, height);
528     group->Add(view);
529 
530     container_->Add(group);
531     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_002", 10); // 10 : offset size
532 }
533 
UIKit_DrawRect_Test_RectBorderRadius_004()534 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_004()
535 {
536     if (container_ == nullptr) {
537         return;
538     }
539 
540     UIViewGroup* group = CreateTestCaseGroup();
541     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_004");
542     group->SetPosition(0, 0);
543 
544     UILabel* label = CreateTitleLabel();
545     label->SetText("border场景,radius>border.width,宽度>高度,radius < 高度/2 + border.width");
546     group->Add(label);
547 
548     UIView* view = CreateUIView();
549     int16_t width = 120; // 120 : width
550     int16_t height = 50; // 50 : height
551     int16_t borderWidth = 10; // 10 : borderWidth
552     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
553     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
554     view->SetStyle(STYLE_BORDER_RADIUS, height / 2 + borderWidth - 5); // 2 : half height 5 : offset
555     view->Resize(width, height);
556     group->Add(view);
557 
558     container_->Add(group);
559     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_003", 10); // 10 : offset size
560 }
561 
UIKit_DrawRect_Test_RectBorderRadius_005()562 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_005()
563 {
564     if (container_ == nullptr) {
565         return;
566     }
567 
568     UIViewGroup* group = CreateTestCaseGroup();
569     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_005");
570     group->SetPosition(0, 0);
571 
572     UILabel* label = CreateTitleLabel();
573     label->SetText("border场景,radius>border.width,宽度=高度,radius > 宽度/2 + border.width");
574     group->Add(label);
575 
576     UIView* view = CreateUIView();
577     int16_t width = 50; // 50 : width
578     int16_t height = 50; // 50 : height
579     int16_t borderWidth = 10; // 10 : borderWidth
580     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
581     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
582     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth + 5); // 2 : half width 5 : offset
583     view->Resize(width, height);
584     group->Add(view);
585 
586     container_->Add(group);
587     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_004", 10); // 10 : offset size
588 }
589 
UIKit_DrawRect_Test_RectBorderRadius_006()590 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_006()
591 {
592     if (container_ == nullptr) {
593         return;
594     }
595 
596     UIViewGroup* group = CreateTestCaseGroup();
597     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_006");
598     group->SetPosition(0, 0);
599 
600     UILabel* label = CreateTitleLabel();
601     label->SetText("border场景,radius>border.width,宽度=高度,radius = 宽度/2 + border.width");
602     group->Add(label);
603 
604     UIView* view = CreateUIView();
605     int16_t width = 50; // 50 : width
606     int16_t height = 50; // 50 : height
607     int16_t borderWidth = 10; // 10 : borderWidth
608     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
609     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
610     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth); // 2 : half width
611     view->Resize(width, height);
612     group->Add(view);
613 
614     container_->Add(group);
615     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_005", 10); // 10 : offset size
616 }
617 
UIKit_DrawRect_Test_RectBorderRadius_007()618 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_007()
619 {
620     if (container_ == nullptr) {
621         return;
622     }
623 
624     UIViewGroup* group = CreateTestCaseGroup();
625     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_007");
626     group->SetPosition(0, 0);
627 
628     UILabel* label = CreateTitleLabel();
629     label->SetText("border场景,radius>border.width,宽度=高度,radius < 宽度/2 + border.width");
630     group->Add(label);
631 
632     UIView* view = CreateUIView();
633     int16_t width = 50; // 50 : width
634     int16_t height = 50; // 50 : height
635     int16_t borderWidth = 10; // 10 : borderWidth
636     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
637     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
638     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth - 5); // 2 : half width 5 : offset
639     view->Resize(width, height);
640     group->Add(view);
641 
642     container_->Add(group);
643     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_006", 10); // 10 : offset size
644 }
645 
UIKit_DrawRect_Test_RectBorderRadius_008()646 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_008()
647 {
648     if (container_ == nullptr) {
649         return;
650     }
651 
652     UIViewGroup* group = CreateTestCaseGroup();
653     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_008");
654     group->SetPosition(0, 0);
655 
656     UILabel* label = CreateTitleLabel();
657     label->SetText("border场景,radius>border.width,宽度<高度,radius > 宽度/2 + border.width");
658     group->Add(label);
659 
660     UIView* view = CreateUIView();
661     int16_t width = 50; // 50 : width
662     int16_t height = 100; // 100 : height
663     int16_t borderWidth = 10; // 10 : borderWidth
664     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
665     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
666     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth + 5); // 2 : half width 5 : math_num
667     view->Resize(width, height);
668     group->Add(view);
669 
670     container_->Add(group);
671     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_007", 10); // 10 : value
672 }
673 
UIKit_DrawRect_Test_RectBorderRadius_009()674 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_009()
675 {
676     if (container_ == nullptr) {
677         return;
678     }
679 
680     UIViewGroup* group = CreateTestCaseGroup();
681     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_009");
682     group->SetPosition(0, 0);
683 
684     UILabel* label = CreateTitleLabel();
685     label->SetText("border场景,radius>border.width,宽度<高度,radius = 宽度/2 + border.width");
686     group->Add(label);
687 
688     UIView* view = CreateUIView();
689     int16_t width = 50; // 50 : width
690     int16_t height = 100; // 100 : height
691     int16_t borderWidth = 10; // 10 : value
692     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
693     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
694     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth); // 2 : math_num
695     view->Resize(width, height);
696     group->Add(view);
697 
698     container_->Add(group);
699     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_008", 10); // 10 : value
700 }
701 
UIKit_DrawRect_Test_RectBorderRadius_010()702 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_010()
703 {
704     if (container_ == nullptr) {
705         return;
706     }
707 
708     UIViewGroup* group = CreateTestCaseGroup();
709     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_010");
710     group->SetPosition(0, 0);
711 
712     UILabel* label = CreateTitleLabel();
713     label->SetText("border场景,radius>border.width,宽度<高度,radius < 宽度/2 + border.width");
714     group->Add(label);
715 
716     UIView* view = CreateUIView();
717     int16_t width = 50; // 50 : width
718     int16_t height = 100; // 100 : height
719     int16_t borderWidth = 10;   // 10 : borderWidth
720     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
721     view->SetStyle(STYLE_BORDER_WIDTH, borderWidth);
722     view->SetStyle(STYLE_BORDER_RADIUS, width / 2 + borderWidth - 5); // 2 : math_num 5 : math_num
723     view->Resize(width, height);
724     group->Add(view);
725 
726     container_->Add(group);
727     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_009", 10); // 10 : value
728 }
729 
UIKit_DrawRect_Test_RectBorderRadius_011()730 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderRadius_011()
731 {
732     if (container_ == nullptr) {
733         return;
734     }
735 
736     UIViewGroup* group = CreateTestCaseGroup();
737     group->SetViewId("UIKit_DrawRect_Test_RectBorderRadius_011");
738     group->SetPosition(0, 0);
739 
740     UILabel* label = CreateTitleLabel();
741     label->SetText("矩形有border = 2, radius = 1");
742     group->Add(label);
743 
744     UIView* view = CreateUIView();
745     int16_t width = 120; // 120 : width
746     int16_t height = 50; // 50 : height
747     int16_t borderWidth = 10; // 10 : borderWidth
748     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
749     view->SetStyle(STYLE_BORDER_WIDTH, 2); // 2: borderWidth
750     view->SetStyle(STYLE_BORDER_RADIUS, 1); // 1 : math_num
751     view->Resize(width, height);
752     group->Add(view);
753 
754     container_->Add(group);
755     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_010", 10); // 10 : offset size
756 }
757 
UIKit_DrawRect_Test_Rect_001()758 void UITestDrawRect::UIKit_DrawRect_Test_Rect_001()
759 {
760     if (container_ == nullptr) {
761         return;
762     }
763 
764     UIViewGroup* group = CreateTestCaseGroup();
765     group->SetViewId("UIKit_DrawRect_Test_Rect_001");
766     group->SetPosition(0, 0);
767 
768     UILabel* label = CreateTitleLabel();
769     label->SetText("矩形绘制: ");
770     group->Add(label);
771 
772     UIView* view = CreateUIView();
773     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
774     view->SetStyle(STYLE_BORDER_WIDTH, 15); // 15 : value
775     view->SetStyle(STYLE_BORDER_OPA, OPA_OPAQUE);
776     view->SetStyle(STYLE_BORDER_RADIUS, 10); // 10 : offset size
777     view->Resize(120, 50);   // 120 : width 50 : weight
778     group->Add(view);
779 
780     container_->Add(group);
781     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderRadius_009", 10); // 10 : offset size
782 }
783 
UIKit_DrawRect_Test_RectColor_001()784 void UITestDrawRect::UIKit_DrawRect_Test_RectColor_001()
785 {
786     if (container_ == nullptr) {
787         return;
788     }
789 
790     UIViewGroup* group = CreateTestCaseGroup();
791     group->SetViewId("UIKit_DrawRect_Test_RectColor_001");
792 
793     UILabel* label = CreateTitleLabel();
794     label->SetText("设置不同颜色的矩形绘制 ");
795     group->Add(label);
796 
797     UIView* view = CreateUIView();
798     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
799     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : value
800     view->SetStyle(STYLE_BORDER_RADIUS, 30); // 30 : value
801     view->Resize(120, 50); // 120 : width 50 : height
802     group->Add(view);
803 
804     UIView* view1 = CreateUIView();
805     view1->SetPosition(250, 50); // 250 : start x 50 : start y
806     view1->SetStyle(STYLE_BORDER_WIDTH, 3); // 3 : value
807     view1->SetStyle(STYLE_BORDER_RADIUS, 3); // 3 : value
808     view1->Resize(120, 50); // 120 : width 50 : height
809     group->Add(view1);
810 
811     container_->Add(group);
812     group->LayoutBottomToSibling("UIKit_DrawRect_Test_Rect_001", 10); // 10 : offset size
813 }
814 
UIKit_DrawRect_Test_RectRadius_001()815 void UITestDrawRect::UIKit_DrawRect_Test_RectRadius_001()
816 {
817     if (container_ == nullptr) {
818         return;
819     }
820 
821     UIViewGroup* group = CreateTestCaseGroup();
822     group->SetViewId("UIKit_DrawRect_Test_RectRadius_001");
823 
824     UILabel* label = CreateTitleLabel();
825     label->SetText("设置圆角为零的矩形绘制 ");
826     group->Add(label);
827 
828     UIView* view = CreateUIView();
829     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
830     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : value
831     view->SetStyle(STYLE_BORDER_RADIUS, 10); // 10 : value
832     view->Resize(120, 50); // 120 : width 50 : height
833     group->Add(view);
834 
835     container_->Add(group);
836     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectColor_001", 10); // 10 : offset size
837 }
838 
UIKit_DrawRect_Test_RectRadius_002()839 void UITestDrawRect::UIKit_DrawRect_Test_RectRadius_002()
840 {
841     if (container_ == nullptr) {
842         return;
843     }
844 
845     UIViewGroup* group = CreateTestCaseGroup();
846     group->SetViewId("UIKit_DrawRect_Test_RectRadius_002");
847 
848     UILabel* label = CreateTitleLabel();
849     label->SetText("设置圆角等于宽度的矩形绘制 ");
850     group->Add(label);
851 
852     UIView* view = CreateUIView();
853     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
854     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : value
855     view->SetStyle(STYLE_BORDER_RADIUS, 50); // 50 : value
856     view->Resize(120, 50); // 120 : width 50 : height
857     group->Add(view);
858 
859     container_->Add(group);
860     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectRadius_001", 10); // 10 : offset size
861 }
862 
UIKit_DrawRect_Test_RectRadius_003()863 void UITestDrawRect::UIKit_DrawRect_Test_RectRadius_003()
864 {
865     if (container_ == nullptr) {
866         return;
867     }
868 
869     UIViewGroup* group = CreateTestCaseGroup();
870     group->SetViewId("UIKit_DrawRect_Test_RectRadius_003");
871 
872     UILabel* label = CreateTitleLabel();
873     label->SetText("设置圆角等于宽度的正方形绘制:");
874     group->Add(label);
875 
876     UIView* view = CreateUIView();
877     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
878     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : value
879     view->SetStyle(STYLE_BORDER_RADIUS, 50); // 50 : value
880     view->Resize(50, 50); // 50 : value 50 : value
881     group->Add(view);
882 
883     container_->Add(group);
884     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectRadius_002", 10); // 10 : offset size
885 }
886 
UIKit_DrawRect_Test_RectRadius_004()887 void UITestDrawRect::UIKit_DrawRect_Test_RectRadius_004()
888 {
889     if (container_ == nullptr) {
890         return;
891     }
892 
893     UIViewGroup* group = CreateTestCaseGroup();
894     group->SetViewId("UIKit_DrawRect_Test_RectRadius_004");
895 
896     UILabel* label = CreateTitleLabel();
897     label->SetText("设置不同圆角大小的矩形绘制 ");
898     group->Add(label);
899 
900     UIView* view = CreateUIView();
901     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
902     view->SetStyle(STYLE_BORDER_WIDTH, 20); // 20 : value
903     view->SetStyle(STYLE_BORDER_RADIUS, 10); // 10 : value
904     view->Resize(120, 50); // 120 : width 50 : height
905     group->Add(view);
906 
907     UIView* view1 = CreateUIView();
908     view1->SetPosition(250, 50); // 250 : offset 50 : offset
909     view1->SetStyle(STYLE_BORDER_WIDTH, 3); // 3 : value
910     view1->SetStyle(STYLE_BORDER_RADIUS, 5); // 5 : value
911     view1->Resize(120, 50); // 120 : width 50 : height
912     group->Add(view1);
913 
914     container_->Add(group);
915     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectRadius_003", 10); // 10 : offset size
916 }
917 
UIKit_DrawRect_Test_RectOpacity_001()918 void UITestDrawRect::UIKit_DrawRect_Test_RectOpacity_001()
919 {
920     if (container_ == nullptr) {
921         return;
922     }
923 
924     UIViewGroup* group = CreateTestCaseGroup();
925     group->SetViewId("UIKit_DrawRect_Test_RectOpacity_001");
926 
927     UILabel* label = CreateTitleLabel();
928     label->SetText("设置不透明背景矩形绘制: ");
929     group->Add(label);
930 
931     UIView* view = CreateUIView();
932     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
933     view->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
934     view->Resize(120, 50); // 120 : width 50 : height
935     group->Add(view);
936 
937     container_->Add(group);
938     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectRadius_004", 10); // 10 : offset size
939 }
940 
UIKit_DrawRect_Test_RectOpacity_002()941 void UITestDrawRect::UIKit_DrawRect_Test_RectOpacity_002()
942 {
943     if (container_ == nullptr) {
944         return;
945     }
946 
947     UIViewGroup* group = CreateTestCaseGroup();
948     group->SetViewId("UIKit_DrawRect_Test_RectOpacity_002");
949 
950     UILabel* label = CreateTitleLabel();
951     label->SetText("设置全透明背景矩形绘制:");
952     group->Add(label);
953 
954     UIView* view = CreateUIView();
955     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
956     view->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
957     view->Resize(120, 50); // 120 : width 50 : height
958     group->Add(view);
959 
960     container_->Add(group);
961     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectOpacity_001", 10); // 10 : offset size
962 }
963 
UIKit_DrawRect_Test_RectOpacity_003()964 void UITestDrawRect::UIKit_DrawRect_Test_RectOpacity_003()
965 {
966     if (container_ == nullptr) {
967         return;
968     }
969 
970     UIViewGroup* group = CreateTestCaseGroup();
971     group->SetViewId("UIKit_DrawRect_Test_RectOpacity_003");
972 
973     UILabel* label = CreateTitleLabel();
974     label->SetText("设置不同透明度矩形绘制 ");
975     group->Add(label);
976 
977     UIView* view = CreateUIView();
978     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
979     view->SetStyle(STYLE_BACKGROUND_OPA, 102); // 102 : value
980     view->Resize(120, 50); // 120 : width 50 : height
981     group->Add(view);
982 
983     UIView* view1 = CreateUIView();
984     view1->SetPosition(250, 50); // 250 : start x 50 : start y
985     view1->SetStyle(STYLE_BACKGROUND_OPA, 204); // 204 : value
986     view1->Resize(120, 50); // 120 : width 50 : height
987     group->Add(view1);
988 
989     container_->Add(group);
990     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectOpacity_002", 10); // 10 : offset size
991 }
992 
UIKit_DrawRect_Test_RectBorderColor_001()993 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderColor_001()
994 {
995     if (container_ == nullptr) {
996         return;
997     }
998 
999     UIViewGroup* group = CreateTestCaseGroup();
1000     group->SetViewId("UIKit_DrawRect_Test_RectBorderColor_001");
1001 
1002     UILabel* label = CreateTitleLabel();
1003     label->SetText("设置不同边框颜色的矩形绘制 ");
1004     group->Add(label);
1005 
1006     UIView* view = CreateUIView();
1007     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1008     view->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().full);
1009     view->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1010 
1011     view->Resize(120, 50); // 120 : width 50 : height
1012     group->Add(view);
1013 
1014     UIView* view1 = CreateUIView();
1015     view1->SetPosition(250, 50); // 250 : start x 50 : start y
1016     view1->SetStyle(STYLE_BORDER_COLOR, Color::Red().full);
1017     view1->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1018     view1->Resize(120, 50); // 120 : width 50 : height
1019     group->Add(view1);
1020 
1021     container_->Add(group);
1022     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectOpacity_003", 10); // 10 : offset size
1023 }
1024 
UIKit_DrawRect_Test_RectBorderWidth_001()1025 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderWidth_001()
1026 {
1027     if (container_ == nullptr) {
1028         return;
1029     }
1030 
1031     UIViewGroup* group = CreateTestCaseGroup();
1032     group->SetViewId("UIKit_DrawRect_Test_RectBorderWidth_001");
1033 
1034     UILabel* label = CreateTitleLabel();
1035     label->SetText("设置边框宽度为零的矩形绘制 ");
1036     group->Add(label);
1037 
1038     UIView* view = CreateUIView();
1039     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1040     view->SetStyle(STYLE_BORDER_WIDTH, 0);
1041     view->Resize(120, 50); // 120 : width 50 : height
1042     group->Add(view);
1043 
1044     container_->Add(group);
1045     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderColor_001", 10); // 10 : offset size
1046 }
1047 
UIKit_DrawRect_Test_RectBorderWidth_002()1048 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderWidth_002()
1049 {
1050     if (container_ == nullptr) {
1051         return;
1052     }
1053 
1054     UIViewGroup* group = CreateTestCaseGroup();
1055     group->SetViewId("UIKit_DrawRect_Test_RectBorderWidth_002");
1056 
1057     UILabel* label = CreateTitleLabel();
1058     label->SetText("设置不同宽度边框大小的矩形绘制 ");
1059     group->Add(label);
1060 
1061     UIView* view = CreateUIView();
1062     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1063     view->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1064     view->Resize(120, 50); // 120 : width 50 : height
1065     group->Add(view);
1066 
1067     UIView* view1 = CreateUIView();
1068     view1->SetPosition(250, 50); // 250 : offset 50 : offset
1069     view1->SetStyle(STYLE_BORDER_WIDTH, 10); // 10 : value
1070     view1->Resize(120, 50); // 120 : width 50 : height
1071     group->Add(view1);
1072 
1073     container_->Add(group);
1074     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderWidth_001", 10); // 10 : offset size
1075 }
1076 
UIKit_DrawRect_Test_RectBorderOpacity_001()1077 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderOpacity_001()
1078 {
1079     if (container_ == nullptr) {
1080         return;
1081     }
1082 
1083     UIViewGroup* group = CreateTestCaseGroup();
1084     group->SetViewId("UIKit_DrawRect_Test_RectBorderOpacity_001");
1085 
1086     UILabel* label = CreateTitleLabel();
1087     label->SetText("设置不透明边框矩形绘制:");
1088     group->Add(label);
1089 
1090     UIView* view = CreateUIView();
1091     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1092     view->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1093     view->SetStyle(STYLE_BORDER_OPA, OPA_OPAQUE);
1094     view->Resize(120, 50); // 120 : width 50 : height
1095     group->Add(view);
1096 
1097     container_->Add(group);
1098     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderWidth_002", 10); // 10 : offset size
1099 }
1100 
UIKit_DrawRect_Test_RectBorderOpacity_002()1101 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderOpacity_002()
1102 {
1103     if (container_ == nullptr) {
1104         return;
1105     }
1106 
1107     UIViewGroup* group = CreateTestCaseGroup();
1108     group->SetViewId("UIKit_DrawRect_Test_RectBorderOpacity_002");
1109 
1110     UILabel* label = CreateTitleLabel();
1111     label->SetText("设置全透明边框矩形绘制:");
1112     group->Add(label);
1113 
1114     UIView* view = CreateUIView();
1115     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1116     view->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1117     view->SetStyle(STYLE_BORDER_OPA, OPA_TRANSPARENT);
1118     view->Resize(120, 50); // 120 : width 50 : height
1119     group->Add(view);
1120 
1121     container_->Add(group);
1122     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderOpacity_001", 10); // 10 : offset size
1123 }
1124 
UIKit_DrawRect_Test_RectBorderOpacity_003()1125 void UITestDrawRect::UIKit_DrawRect_Test_RectBorderOpacity_003()
1126 {
1127     if (container_ == nullptr) {
1128         return;
1129     }
1130 
1131     UIViewGroup* group = CreateTestCaseGroup();
1132     group->SetViewId("UIKit_DrawRect_Test_RectBorderOpacity_003");
1133 
1134     UILabel* label = CreateTitleLabel();
1135     label->SetText("设置不同透明度边框矩形绘制 ");
1136     group->Add(label);
1137 
1138     UIView* view = CreateUIView();
1139     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1140     view->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1141     view->SetStyle(STYLE_BORDER_OPA, 153); // 153 : value
1142     view->Resize(120, 50); // 120 : width 50 : height
1143     group->Add(view);
1144 
1145     UIView* view1 = CreateUIView();
1146     view1->SetPosition(250, 50); // 250 : start x 50 : start y
1147     view1->SetStyle(STYLE_BORDER_WIDTH, 5); // 5 : value
1148     view1->SetStyle(STYLE_BORDER_OPA, 204); // 204 : value
1149     view1->Resize(120, 50); // 120 : width 50 : height
1150     group->Add(view1);
1151 
1152     container_->Add(group);
1153     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderOpacity_002", 10); // 10 : offset size
1154 }
1155 
UIKit_DrawRect_Test_RectPadding_001()1156 void UITestDrawRect::UIKit_DrawRect_Test_RectPadding_001()
1157 {
1158     if (container_ == nullptr) {
1159         return;
1160     }
1161 
1162     UIViewGroup* group = CreateTestCaseGroup();
1163     group->SetViewId("UIKit_DrawRect_Test_RectPadding_001");
1164 
1165     UILabel* label = CreateTitleLabel();
1166     label->SetText("设置padding为零的矩形绘制 ");
1167     group->Add(label);
1168 
1169     UIView* view = CreateUIView();
1170     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1171     view->SetStyle(STYLE_PADDING_LEFT, 0);
1172     view->SetStyle(STYLE_PADDING_RIGHT, 0);
1173     view->SetStyle(STYLE_PADDING_TOP, 0);
1174     view->SetStyle(STYLE_PADDING_BOTTOM, 0);
1175     view->Resize(120, 50); // 120 : width 50 : height
1176     group->Add(view);
1177 
1178     container_->Add(group);
1179     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectBorderOpacity_003", 10); // 10 : offset size
1180 }
1181 
UIKit_DrawRect_Test_RectPadding_002()1182 void UITestDrawRect::UIKit_DrawRect_Test_RectPadding_002()
1183 {
1184     if (container_ == nullptr) {
1185         return;
1186     }
1187 
1188     UIViewGroup* group = CreateTestCaseGroup();
1189     group->SetViewId("UIKit_DrawRect_Test_RectPadding_002");
1190 
1191     UILabel* label = CreateTitleLabel();
1192     label->SetText("设置padding不为零的矩形绘制:");
1193     group->Add(label);
1194 
1195     UIView* view = CreateUIView();
1196     view->SetPosition(0, 50); // 0 : start x 50 : start y
1197     view->Resize(100, 50); // 100 : width 50 : height
1198     group->Add(view);
1199 
1200     UIView* view1 = CreateUIView();
1201     view1->SetPosition(120, 50); // 120 : start x 50 : start y
1202     view1->SetStyle(STYLE_PADDING_LEFT, 10); // 10 : value
1203     view1->SetStyle(STYLE_PADDING_RIGHT, 10); // 10 : value
1204     view1->SetStyle(STYLE_PADDING_TOP, 10); // 10 : value
1205     view1->SetStyle(STYLE_PADDING_BOTTOM, 10); // 10 : value
1206     view1->Resize(120, 50); // 120 : width 50 : height
1207     group->Add(view1);
1208 
1209     UIView* view2 = CreateUIView();
1210     view2->SetPosition(280, 50); // 280 : start x 50 : start y
1211     view2->SetStyle(STYLE_PADDING_LEFT, 20); // 20 : value
1212     view2->SetStyle(STYLE_PADDING_RIGHT, 10); // 10 : value
1213     view2->SetStyle(STYLE_PADDING_TOP, 20); // 20 : value
1214     view2->SetStyle(STYLE_PADDING_BOTTOM, 10); // 10 : value
1215     view2->Resize(120, 50); // 120 : width 50 : height
1216     group->Add(view2);
1217 
1218     container_->Add(group);
1219     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectPadding_001", 10); // 10 : offset size
1220 }
1221 
UIKit_DrawRect_Test_RectMargin_001()1222 void UITestDrawRect::UIKit_DrawRect_Test_RectMargin_001()
1223 {
1224     if (container_ == nullptr) {
1225         return;
1226     }
1227 
1228     UIViewGroup* group = CreateTestCaseGroup();
1229     group->SetViewId("UIKit_DrawRect_Test_RectMargin_001");
1230 
1231     UILabel* label = CreateTitleLabel();
1232     label->SetText("设置margin为零的矩形绘制 ");
1233     group->Add(label);
1234 
1235     UIView* view = CreateUIView();
1236     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1237     view->SetStyle(STYLE_MARGIN_LEFT, 0);
1238     view->SetStyle(STYLE_MARGIN_RIGHT, 0);
1239     view->SetStyle(STYLE_MARGIN_TOP, 0);
1240     view->SetStyle(STYLE_MARGIN_BOTTOM, 0);
1241     view->Resize(120, 50); // 120 : width 50 : height
1242     group->Add(view);
1243 
1244     container_->Add(group);
1245     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectPadding_002", 10); // 10 : offset size
1246 }
1247 
UIKit_DrawRect_Test_RectMargin_002()1248 void UITestDrawRect::UIKit_DrawRect_Test_RectMargin_002()
1249 {
1250     if (container_ == nullptr) {
1251         return;
1252     }
1253 
1254     UIViewGroup* group = CreateTestCaseGroup();
1255     group->SetViewId("UIKit_DrawRect_Test_RectMargin_002");
1256 
1257     UILabel* label = CreateTitleLabel();
1258     label->SetText("设置margin不为零的矩形绘制:");
1259     group->Add(label);
1260 
1261     UIView* view = CreateUIView();
1262     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1263     view->SetStyle(STYLE_MARGIN_LEFT, 10); // 10 : margin left
1264     view->SetStyle(STYLE_MARGIN_RIGHT, 10); // 10 : margin right
1265     view->SetStyle(STYLE_MARGIN_TOP, 10); // 10 : margin top
1266     view->SetStyle(STYLE_MARGIN_BOTTOM, 10); // 10 : margin bottom
1267     view->Resize(120, 50); // 120 : width 50 : height
1268     group->Add(view);
1269 
1270     UIView* view1 = CreateUIView();
1271     view1->SetPosition(250, 50); // 250 : start x 50 : start y
1272     view1->SetStyle(STYLE_MARGIN_LEFT, 20); // 20 : margin left
1273     view1->SetStyle(STYLE_MARGIN_RIGHT, 10); // 10 : margin right
1274     view1->SetStyle(STYLE_MARGIN_TOP, 20); // 20 : margin top
1275     view1->SetStyle(STYLE_MARGIN_BOTTOM, 10); // 10 : margin bottom
1276     view1->Resize(120, 50); // 120 : width 50 : height
1277     group->Add(view1);
1278 
1279     container_->Add(group);
1280     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectMargin_001", 10); // 10 : offset size
1281 }
1282 
UIKit_DrawRect_Test_RectPaddingMargin_001()1283 void UITestDrawRect::UIKit_DrawRect_Test_RectPaddingMargin_001()
1284 {
1285     if (container_ == nullptr) {
1286         return;
1287     }
1288 
1289     UIViewGroup* group = CreateTestCaseGroup();
1290     group->SetViewId("UIKit_DrawRect_Test_RectPaddingMargin_001");
1291 
1292     UILabel* label = CreateTitleLabel();
1293     label->SetText("设置 padding/margin 均为零的矩形绘制:");
1294     group->Add(label);
1295 
1296     UIView* view = CreateUIView();
1297     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1298     view->SetStyle(STYLE_MARGIN_LEFT, 0);
1299     view->SetStyle(STYLE_MARGIN_RIGHT, 0);
1300     view->SetStyle(STYLE_MARGIN_TOP, 0);
1301     view->SetStyle(STYLE_MARGIN_BOTTOM, 0);
1302     view->SetStyle(STYLE_PADDING_LEFT, 0);
1303     view->SetStyle(STYLE_PADDING_RIGHT, 0);
1304     view->SetStyle(STYLE_PADDING_TOP, 0);
1305     view->SetStyle(STYLE_PADDING_BOTTOM, 0);
1306     view->Resize(120, 50); // 120 : width 50 : height
1307     group->Add(view);
1308 
1309     container_->Add(group);
1310     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectMargin_002", 10); // 10 : offset size
1311 }
1312 
UIKit_DrawRect_Test_RectPaddingMargin_002()1313 void UITestDrawRect::UIKit_DrawRect_Test_RectPaddingMargin_002()
1314 {
1315     if (container_ == nullptr) {
1316         return;
1317     }
1318 
1319     UIViewGroup* group = CreateTestCaseGroup();
1320     group->SetViewId("UIKit_DrawRect_Test_RectPaddingMargin_002");
1321 
1322     UILabel* label = CreateTitleLabel();
1323     label->SetText("设置padding/margin均不为零的矩形绘制 ");
1324     group->Add(label);
1325 
1326     UIView* view = CreateUIView();
1327     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1328     view->SetStyle(STYLE_MARGIN_LEFT, 0);
1329     view->SetStyle(STYLE_MARGIN_RIGHT, 0);
1330     view->SetStyle(STYLE_MARGIN_TOP, 0);
1331     view->SetStyle(STYLE_MARGIN_BOTTOM, 0);
1332     view->SetStyle(STYLE_PADDING_LEFT, 0);
1333     view->SetStyle(STYLE_PADDING_RIGHT, 0);
1334     view->SetStyle(STYLE_PADDING_TOP, 0);
1335     view->SetStyle(STYLE_PADDING_BOTTOM, 0);
1336     view->Resize(120, 50); // 120 : width 50 : height
1337     group->Add(view);
1338 
1339     UIView* view1 = CreateUIView();
1340     view1->SetPosition(250, 50); // 250 : start 50 : start
1341     view1->SetStyle(STYLE_MARGIN_LEFT, 10); // 10 : margin left
1342     view1->SetStyle(STYLE_MARGIN_RIGHT, 10); // 10 : margin right
1343     view1->SetStyle(STYLE_MARGIN_TOP, 10); // 10 : margin top
1344     view1->SetStyle(STYLE_MARGIN_BOTTOM, 10); // 10 : margin bottom
1345     view1->SetStyle(STYLE_PADDING_LEFT, 10); // 10 : padding left
1346     view1->SetStyle(STYLE_PADDING_RIGHT, 10); // 10 : padding right
1347     view1->SetStyle(STYLE_PADDING_TOP, 10); // 10 : padding top
1348     view1->SetStyle(STYLE_PADDING_BOTTOM, 10); // 10 : padding bottom
1349     view1->Resize(120, 50); // 120 : width 50 : height
1350     group->Add(view1);
1351 
1352     container_->Add(group);
1353     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectPaddingMargin_001", 10); // 10 : offset size
1354 }
1355 
UIKit_DrawRect_Test_RectWidthAndHeight_001()1356 void UITestDrawRect::UIKit_DrawRect_Test_RectWidthAndHeight_001()
1357 {
1358     if (container_ == nullptr) {
1359         return;
1360     }
1361 
1362     UIViewGroup* group = CreateTestCaseGroup();
1363     group->SetViewId("UIKit_DrawRect_Test_RectWidthAndHeight_001");
1364 
1365     UILabel* label = CreateTitleLabel();
1366     label->SetText("设置宽度为零的矩形绘制 ");
1367     group->Add(label);
1368 
1369     UIView* view = CreateUIView();
1370     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1371     view->SetStyle(STYLE_BORDER_WIDTH, 0);
1372     view->SetStyle(STYLE_BORDER_RADIUS, 10); // 10 : border radius
1373     view->Resize(0, 50); // 0 : width 50 : height
1374     container_->Add(view);
1375 
1376     container_->Add(group);
1377     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectPaddingMargin_002", 20); // 20 : offset size
1378 }
1379 
UIKit_DrawRect_Test_RectWidthAndHeight_002()1380 void UITestDrawRect::UIKit_DrawRect_Test_RectWidthAndHeight_002()
1381 {
1382     if (container_ == nullptr) {
1383         return;
1384     }
1385 
1386     UIViewGroup* group = CreateTestCaseGroup();
1387     group->SetViewId("UIKit_DrawRect_Test_RectWidthAndHeight_002");
1388 
1389     UILabel* label = CreateTitleLabel();
1390     label->SetText("设置高度为零的矩形绘制 ");
1391     group->Add(label);
1392 
1393     UIView* view = CreateUIView();
1394     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1395     view->SetStyle(STYLE_BORDER_WIDTH, 0); // 10 : value
1396     view->SetStyle(STYLE_BORDER_RADIUS, 0); // 10 : value
1397     view->Resize(120, 0); // 120 : width 0 : height
1398     group->Add(view);
1399 
1400     container_->Add(group);
1401     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectWidthAndHeight_001", 20); // 20 : offset size
1402 }
1403 
UIKit_DrawRect_Test_RectWidthAndHeight_003()1404 void UITestDrawRect::UIKit_DrawRect_Test_RectWidthAndHeight_003()
1405 {
1406     if (container_ == nullptr) {
1407         return;
1408     }
1409 
1410     UIViewGroup* group = CreateTestCaseGroup();
1411     group->SetViewId("UIKit_DrawRect_Test_RectWidthAndHeight_003");
1412 
1413     UILabel* label = CreateTitleLabel();
1414     label->SetText("设置宽度和高度都为零的矩形绘制 ");
1415     group->Add(label);
1416 
1417     UIView* view = CreateUIView();
1418     view->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE);
1419     view->SetStyle(STYLE_BORDER_WIDTH, 0);
1420     view->SetStyle(STYLE_BORDER_RADIUS, 10); // 10 : border radius
1421     view->Resize(0, 0);  // 0 : width 0 : height
1422     group->Add(view);
1423 
1424     container_->Add(group);
1425     group->LayoutBottomToSibling("UIKit_DrawRect_Test_RectWidthAndHeight_002", 20); // 20 : offset size
1426 }
1427 } // namespace OHOS
1428