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 "graphic_config.h"
17
18 #if ENABLE_DEBUG
19 #include "ui_test_dump_dom.h"
20
21 #include "common/screen.h"
22 #include "components/ui_arc_label.h"
23 #include "components/ui_box_progress.h"
24 #include "components/ui_checkbox.h"
25 #include "components/ui_circle_progress.h"
26 #include "components/ui_image_view.h"
27 #include "components/ui_label.h"
28 #include "components/ui_label_button.h"
29 #include "components/ui_radio_button.h"
30 #include "components/ui_slider.h"
31 #include "components/ui_toggle_button.h"
32 #include "dfx/ui_dump_dom_tree.h"
33 #include "imgdecode/cache_manager.h"
34 #include "test_resource_config.h"
35 #include "gfx_utils/graphic_log.h"
36
37 namespace OHOS {
SetUp()38 void UITestDumpDomTree::SetUp()
39 {
40 if (container_ == nullptr) {
41 container_ = new UIScrollView();
42 container_->Resize(Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight() - BACK_BUTTON_HEIGHT);
43 container_->SetViewId("dump_scroll_view");
44 }
45 }
46
TearDown()47 void UITestDumpDomTree::TearDown()
48 {
49 if (clickDumpDomListener1_ != nullptr) {
50 delete clickDumpDomListener1_;
51 clickDumpDomListener1_ = nullptr;
52 }
53 if (clickDumpDomListener2_ != nullptr) {
54 delete clickDumpDomListener2_;
55 clickDumpDomListener2_ = nullptr;
56 }
57 if (clickDumpDomListener3_ != nullptr) {
58 delete clickDumpDomListener3_;
59 clickDumpDomListener3_ = nullptr;
60 }
61 if (clickDumpDomListener4_ != nullptr) {
62 delete clickDumpDomListener4_;
63 clickDumpDomListener4_ = nullptr;
64 }
65 if (clickDumpDomListener5_ != nullptr) {
66 delete clickDumpDomListener5_;
67 clickDumpDomListener5_ = nullptr;
68 }
69 if (clickDumpDomListener6_ != nullptr) {
70 delete clickDumpDomListener6_;
71 clickDumpDomListener6_ = nullptr;
72 }
73 if (clickDumpDomListener7_ != nullptr) {
74 delete clickDumpDomListener7_;
75 clickDumpDomListener7_ = nullptr;
76 }
77 if (clickDumpDomListener8_ != nullptr) {
78 delete clickDumpDomListener8_;
79 clickDumpDomListener8_ = nullptr;
80 }
81 if (clickDumpDomListener9_ != nullptr) {
82 delete clickDumpDomListener9_;
83 clickDumpDomListener9_ = nullptr;
84 }
85 if (clickDumpDomListener10_ != nullptr) {
86 delete clickDumpDomListener10_;
87 clickDumpDomListener10_ = nullptr;
88 }
89 if (clickDumpDomListener11_ != nullptr) {
90 delete clickDumpDomListener11_;
91 clickDumpDomListener11_ = nullptr;
92 }
93 if (clickDumpDomListener12_ != nullptr) {
94 delete clickDumpDomListener12_;
95 clickDumpDomListener12_ = nullptr;
96 }
97 positionY_ = 0;
98 DeleteChildren(container_);
99 container_ = nullptr;
100 }
101
GetTestView()102 const UIView* UITestDumpDomTree::GetTestView()
103 {
104 positionY_ = 0;
105 UIKitTestDumpDom001();
106 UIKitTestDumpDom002();
107 UIKitTestDumpDom003();
108 UIKitTestDumpDom004();
109 UIKitTestDumpDom005();
110 UIKitTestDumpDom006();
111 return container_;
112 }
113
114 class TestBtnOnClickDumpDomListener : public UIView::OnClickListener {
115 public:
TestBtnOnClickDumpDomListener(UIView * uiView,const char * id)116 TestBtnOnClickDumpDomListener(UIView* uiView, const char* id) : uiView_(uiView), id_(id) {}
~TestBtnOnClickDumpDomListener()117 ~TestBtnOnClickDumpDomListener() {}
OnClick(UIView & view,const ClickEvent & event)118 bool OnClick(UIView& view, const ClickEvent& event) override
119 {
120 char* tmpPtr = UIDumpDomTree::GetInstance()->DumpDomNode(id_);
121 if (tmpPtr != nullptr) {
122 cJSON_free(tmpPtr);
123 }
124 uiView_->Invalidate();
125 return true;
126 }
127
128 private:
129 UIView* uiView_;
130 const char* id_;
131 };
132
133 class TestBtnOnClickDumpDomTreeListener : public UIView::OnClickListener {
134 public:
TestBtnOnClickDumpDomTreeListener(UIView * uiView,const char * id)135 TestBtnOnClickDumpDomTreeListener(UIView* uiView, const char* id) : uiView_(uiView), id_(id) {}
~TestBtnOnClickDumpDomTreeListener()136 ~TestBtnOnClickDumpDomTreeListener() {}
OnClick(UIView & view,const ClickEvent & event)137 bool OnClick(UIView& view, const ClickEvent& event) override
138 {
139 if (UIDumpDomTree::GetInstance()->DumpDomTree(id_)) {
140 if (id_ == nullptr) {
141 GRAPHIC_LOGI("dump tree from rootView success\n");
142 } else {
143 GRAPHIC_LOGI("dump tree from id success\n");
144 }
145 } else {
146 GRAPHIC_LOGI("dump tree failed\n");
147 }
148 uiView_->Invalidate();
149 return true;
150 }
151
152 private:
153 UIView* uiView_;
154 const char* id_;
155 };
156
UIKitTestDumpDom001()157 void UITestDumpDomTree::UIKitTestDumpDom001()
158 {
159 if (container_ != nullptr) {
160 UILabel* label = GetTitleLabel("dump checkbox");
161 container_->Add(label);
162 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
163 positionY_ += label->GetHeight();
164
165 GridLayout* layout = new GridLayout();
166 layout->SetPosition(VIEW_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE,
167 // 2: half of screen width; 88: decrease screen width; 180: height
168 Screen::GetInstance().GetWidth() / 2 - 88, 180);
169 layout->SetViewId("dump_group");
170 container_->Add(layout);
171 positionY_ += layout->GetHeight();
172 layout->SetRows(3); // 3: row
173 layout->SetCols(3); // 3: col
174 CreateButtons(layout);
175 layout->LayoutChildren();
176 }
177 }
178
CreateButtons(GridLayout * layout)179 void UITestDumpDomTree::CreateButtons(GridLayout* layout)
180 {
181 if (layout == nullptr) {
182 return;
183 }
184 UICheckBox* checkBox = new UICheckBox();
185 layout->Add(checkBox);
186 checkBox->SetState(UICheckBox::SELECTED);
187 checkBox->SetViewId("dump_checkbox");
188
189 UIRadioButton* radioButton = new UIRadioButton("aaa");
190 layout->Add(radioButton);
191 radioButton->SetState(UICheckBox::UNSELECTED);
192 radioButton->SetViewId("dump_radiobutton");
193
194 UIToggleButton* toggleButton = new UIToggleButton();
195 layout->Add(toggleButton);
196 toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0);
197 toggleButton->SetViewId("dump_togglebutton");
198
199 UILabelButton* dumpButton1 = GetLabelButton("dump");
200 layout->Add(dumpButton1);
201 /* dump node here */
202 if (clickDumpDomListener1_ == nullptr) {
203 clickDumpDomListener1_ = static_cast<UIView::OnClickListener*>(
204 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton1), "dump_checkbox"));
205 }
206 dumpButton1->SetOnClickListener(clickDumpDomListener1_);
207
208 UILabelButton* dumpButton2 = GetLabelButton("dump");
209 layout->Add(dumpButton2);
210 /* dump node here */
211 if (clickDumpDomListener2_ == nullptr) {
212 clickDumpDomListener2_ = static_cast<UIView::OnClickListener*>(
213 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton2), "dump_radiobutton"));
214 }
215 dumpButton2->SetOnClickListener(clickDumpDomListener2_);
216
217 UILabelButton* dumpButton3 = GetLabelButton("dump");
218 layout->Add(dumpButton3);
219 /* dump node here */
220 if (clickDumpDomListener3_ == nullptr) {
221 clickDumpDomListener3_ = static_cast<UIView::OnClickListener*>(
222 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton3), "dump_togglebutton"));
223 }
224 dumpButton3->SetOnClickListener(clickDumpDomListener3_);
225
226 UILabelButton* dumpButton4 = GetLabelButton("dump_all ");
227 layout->Add(dumpButton4);
228
229 if (clickDumpDomListener4_ == nullptr) {
230 clickDumpDomListener4_ = static_cast<UIView::OnClickListener*>(
231 new TestBtnOnClickDumpDomTreeListener(static_cast<UIView*>(dumpButton4), nullptr));
232 }
233 dumpButton4->SetOnClickListener(clickDumpDomListener4_);
234
235 UILabelButton* dumpButton5 = GetLabelButton("dump_group");
236 layout->Add(dumpButton5);
237 if (clickDumpDomListener5_ == nullptr) {
238 clickDumpDomListener5_ = static_cast<UIView::OnClickListener*>(
239 new TestBtnOnClickDumpDomTreeListener(static_cast<UIView*>(dumpButton5), "dump_group"));
240 }
241 dumpButton5->SetOnClickListener(clickDumpDomListener5_);
242 }
243
UIKitTestDumpDom002()244 void UITestDumpDomTree::UIKitTestDumpDom002()
245 {
246 if (container_ != nullptr) {
247 UIViewGroup* group2 = new UIViewGroup();
248 group2->SetPosition(Screen::GetInstance().GetWidth() / 2, 0); // 2: half of screen width
249 group2->SetWidth(Screen::GetInstance().GetWidth() / 2); // 2: half of screen width
250 group2->SetHeight(200); // 200: height
251 group2->SetViewId("dump_group2");
252 container_->Add(group2);
253 positionY_ += group2->GetHeight();
254
255 UILabel* label = GetTitleLabel("dump image");
256 group2->Add(label);
257 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
258
259 UIImageView* imageView = new UIImageView();
260 imageView->SetPosition(VIEW_DISTANCE_TO_TOP_SIDE, TEXT_DISTANCE_TO_LEFT_SIDE);
261 imageView->SetWidth(50); // 50: width
262 imageView->SetHeight(50); // 50: height
263 imageView->SetSrc(BLUE_RGB888_IMAGE_PATH);
264 imageView->SetViewId("dump_image");
265 group2->Add(imageView);
266
267 UILabelButton* dumpButton1 = GetLabelButton("dump");
268 dumpButton1->SetPosition(160, 73); // 160: x-coordinate, 73: y-coordinate
269 group2->Add(dumpButton1);
270 dumpButton1->SetText("dump");
271 /* dump node here */
272 if (clickDumpDomListener6_ == nullptr) {
273 clickDumpDomListener6_ = static_cast<UIView::OnClickListener*>(
274 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton1), "dump_image"));
275 }
276 dumpButton1->SetOnClickListener(clickDumpDomListener6_);
277 }
278 }
279
UIKitTestDumpDom003()280 void UITestDumpDomTree::UIKitTestDumpDom003()
281 {
282 if (container_ != nullptr) {
283 UIViewGroup* group5 = new UIViewGroup();
284 group5->SetPosition(0, 260); // 260: y-coordinate
285 group5->SetWidth(Screen::GetInstance().GetWidth() / 2); // 2: half of screen width
286 group5->SetHeight(200); // 200: height
287 group5->SetViewId("dump_group5");
288 container_->Add(group5);
289 positionY_ += group5->GetHeight();
290
291 UILabel* label = GetTitleLabel("dump slider progress");
292 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
293 group5->Add(label);
294
295 UISlider* slider = new UISlider();
296 // 50: new width, 100: new height
297 slider->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, VIEW_DISTANCE_TO_TOP_SIDE, 50, 100);
298 slider->SetValidHeight(250); // 250: valid height
299 slider->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP);
300 slider->SetRange(100, 0); // 100: max
301 slider->SetValue(50); // 50: value of progress bar
302 slider->SetStep(0);
303 slider->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0, 182, 191).full); // 182, 191: color
304 slider->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(255, 152, 0).full); // 255, 152: color
305 slider->SetKnobWidth(50); // 50: knob width
306 slider->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
307 slider->SetImage(static_cast<ImageInfo*>(nullptr), static_cast<ImageInfo*>(nullptr));
308 slider->EnableBackground(true);
309 slider->SetViewId("dump_slider");
310 group5->Add(slider);
311
312 UILabelButton* dumpButton = GetLabelButton("dump");
313 dumpButton->SetPosition(120, 73); // 120: x-coordinate, 73: y-coordinate
314 /* dump node here */
315 if (clickDumpDomListener7_ == nullptr) {
316 clickDumpDomListener7_ = static_cast<UIView::OnClickListener*>(
317 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton), "dump_slider"));
318 }
319 dumpButton->SetOnClickListener(clickDumpDomListener7_);
320 group5->Add(dumpButton);
321 }
322 }
323
UIKitTestDumpDom004()324 void UITestDumpDomTree::UIKitTestDumpDom004()
325 {
326 if (container_ != nullptr) {
327 UIViewGroup* group4 = new UIViewGroup();
328 group4->SetPosition(Screen::GetInstance().GetWidth() / 2, 260); // 2: half of screen width; 260: y-coordinate
329 group4->SetWidth(Screen::GetInstance().GetWidth() / 2); // 2: half of screen width
330 group4->SetHeight(100); // 100: height
331 group4->SetViewId("dump_group4");
332 container_->Add(group4);
333 positionY_ += group4->GetHeight();
334
335 UILabel* label = GetTitleLabel("dump box progress");
336 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
337 group4->Add(label);
338
339 UIBoxProgress* boxProgress = new UIBoxProgress();
340 // 48: x-coordinate, 68: y-coordinate, 90: new width, 10: new height
341 boxProgress->SetPosition(48, 68, 90, 10);
342 boxProgress->SetDirection(UIBoxProgress::Direction::DIR_LEFT_TO_RIGHT);
343 boxProgress->SetValidHeight(10); // 10: valid height
344 boxProgress->SetValidWidth(100); // 100: valid width
345 boxProgress->SetRange(100, 0); // 100: max
346 boxProgress->SetValue(20); // 20 : value of progress bar
347 boxProgress->SetStep(0);
348 // 182, 191: color
349 boxProgress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0, 182, 191).full);
350 // 255, 152: color
351 boxProgress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(255, 152, 0).full);
352 boxProgress->SetImage(static_cast<char*>(nullptr));
353 boxProgress->EnableBackground(true);
354 boxProgress->SetViewId("dump_boxprogress");
355 group4->Add(boxProgress);
356 UILabelButton* dumpButton = GetLabelButton("dump");
357 dumpButton->SetPosition(160, 48); // 160: x-coordinate, 48: y-coordinate
358 /* dump node here */
359 if (clickDumpDomListener8_ == nullptr) {
360 clickDumpDomListener8_ = static_cast<UIView::OnClickListener*>(
361 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton), "dump_boxprogress"));
362 }
363 dumpButton->SetOnClickListener(clickDumpDomListener8_);
364 group4->Add(dumpButton);
365 }
366 }
367
UIKitTestDumpDom005()368 void UITestDumpDomTree::UIKitTestDumpDom005()
369 {
370 if (container_ != nullptr) {
371 UIViewGroup* group3 = new UIViewGroup();
372 group3->SetPosition(0, 450); // 450: y-coordinate
373 group3->SetWidth(Screen::GetInstance().GetWidth() / 2 - VIEW_DISTANCE_TO_LEFT_SIDE); // 2: half of screen width
374 group3->SetHeight(500); // 500: height
375 group3->SetViewId("dump_group3");
376 container_->Add(group3);
377
378 UILabel* label = GetTitleLabel("dump label");
379 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
380 group3->Add(label);
381
382 UILabel* label2 = GetTitleLabel("UILabel");
383 label2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BUTTON_LABEL_SIZE);
384 label2->SetPosition(48, 58, 90, 29); // 48: x position, 58: y position, 90: width, 29: height
385 label2->SetViewId("dump_label");
386 group3->Add(label2);
387
388 UILabelButton* labelButton = GetLabelButton("LabelButton");
389 labelButton->SetPosition(48, 108); // 48: x position, 108: y position
390 labelButton->SetViewId("dump_label_button");
391 group3->Add(labelButton);
392
393 UIArcLabel* label3 = new UIArcLabel();
394 label3->SetArcTextCenter(70, 330); // 70: x position, 330: y position
395 label3->SetArcTextRadius(150); // 150: radius
396 label3->SetArcTextAngle(0, 270); // 0: start angle, 270: end angle
397 label3->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
398 label3->SetText("012345678ABCDEF");
399 label3->SetStyle(STYLE_LETTER_SPACE, 30); // 30: letter space
400 label3->SetViewId("dump_arc_label");
401 group3->Add(label3);
402
403 UILabelButton* dumpButton1 = GetLabelButton("dump");
404 dumpButton1->SetPosition(230, 48); // 230: x-coordinate, 48: y-coordinate
405 /* dump node here */
406 if (clickDumpDomListener9_ == nullptr) {
407 clickDumpDomListener9_ = static_cast<UIView::OnClickListener*>(
408 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton1), "dump_label"));
409 }
410 dumpButton1->SetOnClickListener(clickDumpDomListener9_);
411 group3->Add(dumpButton1);
412
413 UILabelButton* dumpButton2 = GetLabelButton("dump");
414 dumpButton2->SetPosition(230, 108); // 230: x-coordinate, 108: y-coordinate
415 /* dump node here */
416 if (clickDumpDomListener10_ == nullptr) {
417 clickDumpDomListener10_ = static_cast<UIView::OnClickListener*>(
418 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton2), "dump_label_button"));
419 }
420 dumpButton2->SetOnClickListener(clickDumpDomListener10_);
421 group3->Add(dumpButton2);
422
423 UILabelButton* dumpButton3 = GetLabelButton("dump");
424 dumpButton3->SetPosition(230, 310); // 230: x position, 310: y position
425 /* dump node here */
426 if (clickDumpDomListener11_ == nullptr) {
427 clickDumpDomListener11_ = static_cast<UIView::OnClickListener*>(
428 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton3), "dump_arc_label"));
429 }
430 dumpButton3->SetOnClickListener(clickDumpDomListener11_);
431 group3->Add(dumpButton3);
432 }
433 }
434
UIKitTestDumpDom006()435 void UITestDumpDomTree::UIKitTestDumpDom006()
436 {
437 if (container_ != nullptr) {
438 UIViewGroup* group6 = new UIViewGroup();
439 // 2: half of screen width; 450: screen height
440 group6->SetPosition(Screen::GetInstance().GetWidth() / 2, 450);
441 group6->SetWidth(Screen::GetInstance().GetWidth() / 2); // 2: half of screen width
442 group6->SetHeight(250); // 250: height
443 group6->SetViewId("dump_group6");
444 container_->Add(group6);
445 positionY_ += group6->GetHeight();
446
447 UILabel* label = GetTitleLabel("dump circle progress");
448 label->SetPosition(TEXT_DISTANCE_TO_LEFT_SIDE, TEXT_DISTANCE_TO_TOP_SIDE);
449 group6->Add(label);
450
451 UICircleProgress* circleProgress = new UICircleProgress();
452 // 40: y-coordinate, 48: y-coordinate, 150: new width, 150: new height
453 circleProgress->SetPosition(40, 48, 150, 150);
454 circleProgress->SetCenterPosition(50, 50); // 50: x-coordinate, 50: y-coordinate
455 circleProgress->SetRadius(50); // 50: radius
456 circleProgress->SetValue(20); // 20: value of progress bar
457 circleProgress->SetStyle(STYLE_PADDING_LEFT, 10); // 10: padding left
458 circleProgress->SetStyle(STYLE_PADDING_TOP, 5); // 5: padding top
459 circleProgress->SetRange(100, 0); // 100: max
460 circleProgress->SetValue(50); // 50: value of progress bar
461 circleProgress->SetStartAngle(0);
462 circleProgress->SetEndAngle(360); // 360: end angle
463 circleProgress->SetStep(0);
464 circleProgress->SetBackgroundStyle(StyleDefault::GetProgressBackgroundStyle());
465 circleProgress->SetForegroundStyle(StyleDefault::GetProgressForegroundStyle());
466 circleProgress->SetLineColor(Color::White());
467 circleProgress->EnableBackground(true);
468 circleProgress->SetViewId("dump_circle_progress");
469 group6->Add(circleProgress);
470
471 UILabelButton* dumpButton = GetLabelButton("dump");
472 dumpButton->SetPosition(170, 73); // 170: x-coordinate, 73: y-coordinate
473 /* dump node here */
474 if (clickDumpDomListener12_ == nullptr) {
475 clickDumpDomListener12_ = static_cast<UIView::OnClickListener*>(
476 new TestBtnOnClickDumpDomListener(static_cast<UIView*>(dumpButton), "dump_circle_progress"));
477 }
478 dumpButton->SetOnClickListener(clickDumpDomListener12_);
479 group6->Add(dumpButton);
480 }
481 }
482
GetLabelButton(const char * buttonname)483 UILabelButton* UITestDumpDomTree::GetLabelButton(const char* buttonname)
484 {
485 const int16_t labelButtonWidth = 120;
486 const int16_t labelButtonHeight = 40;
487 if (buttonname == nullptr) {
488 return nullptr;
489 }
490 UILabelButton* labelButton = new UILabelButton();
491 if (labelButton == nullptr) {
492 return nullptr;
493 }
494 labelButton->SetPosition(0, 0);
495 labelButton->Resize(labelButtonWidth, labelButtonHeight);
496 labelButton->SetText(buttonname);
497 labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BUTTON_LABEL_SIZE);
498 labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::RELEASED);
499 labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::PRESSED);
500 labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::INACTIVE);
501 labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, BUTTON_STYLE_BACKGROUND_COLOR_VALUE, UIButton::RELEASED);
502 labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, BUTTON_STYLE_BACKGROUND_COLOR_VALUE, UIButton::PRESSED);
503 labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, BUTTON_STYLE_BACKGROUND_COLOR_VALUE, UIButton::INACTIVE);
504 return labelButton;
505 }
506 } // namespace OHOS
507 #endif // ENABLE_DEBUG
508