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_BORDER_MARGIN_PADDING_H 17 #define UI_TEST_BORDER_MARGIN_PADDING_H 18 19 #include "components/text_adapter.h" 20 #include "components/ui_chart.h" 21 #include "components/ui_label.h" 22 #include "components/ui_picker.h" 23 #include "components/ui_scroll_view.h" 24 #include "components/ui_toggle_button.h" 25 #include "layout/grid_layout.h" 26 #include "layout/list_layout.h" 27 #include "ui_test.h" 28 29 namespace OHOS { 30 class BorderListener; 31 class MarginListener; 32 class PaddingListener; 33 34 constexpr char* UI_TEST_MARGIN_BTN = "margin_btn"; 35 constexpr char* UI_TEST_BORDER_BTN = "border_btn"; 36 constexpr char* UI_TEST_PADDING_BTN = "padding_btn"; 37 38 class UITestBorderMarginPadding : public UITest { 39 public: UITestBorderMarginPadding()40 UITestBorderMarginPadding() 41 { 42 style_ = StyleDefault::GetDefaultStyle(); 43 style_.bgOpa_ = OPA_OPAQUE; 44 style_.bgColor_ = Color::Gray(); 45 } ~UITestBorderMarginPadding()46 virtual ~UITestBorderMarginPadding() {} 47 void SetUp() override; 48 void SetUpButtons(UIToggleButton* marginBtn, 49 UIToggleButton* borderBtn, 50 UIToggleButton* paddingBtn); 51 void SetUpAdapterData(); 52 void TearDown() override; 53 const UIView* GetTestView() override; 54 void ReloadTest(); 55 56 void UIKitUITestBorderMarginPaddingTest001(); 57 void UIKitUITestBorderMarginPaddingTest002(); 58 void UIKitUITestBorderMarginPaddingTest003(); 59 void UIKitUITestBorderMarginPaddingTest004(); 60 void UIKitUITestBorderMarginPaddingTest005(); 61 void UIKitUITestBorderMarginPaddingTest006(); 62 void UIKitUITestBorderMarginPaddingTest007(); 63 void UIKitUITestBorderMarginPaddingTest008(); 64 void UIKitUITestBorderMarginPaddingTest009(); 65 void UIKitUITestBorderMarginPaddingTest010(); 66 void UIKitUITestBorderMarginPaddingTest011(); 67 void UIKitUITestBorderMarginPaddingTest012(); 68 void UIKitUITestBorderMarginPaddingTest013(); 69 void UIKitUITestBorderMarginPaddingTest014(); 70 void UIKitUITestBorderMarginPaddingTest015(); 71 void UIKitUITestBorderMarginPaddingTest016(); 72 void UIKitUITestBorderMarginPaddingTest017(); 73 void UIKitUITestBorderMarginPaddingTest018(); 74 void InitStyle(); 75 Style style_; 76 77 private: 78 const int16_t TITLE_HEIGHT = 29; 79 const int16_t BUTTON_GROUP_WIDTH = 250; 80 UIScrollView* scroll_ = nullptr; 81 GridLayout* layoutButton_ = nullptr; 82 ListLayout* listScroll_ = nullptr; 83 UIViewGroup* container_ = nullptr; 84 MarginListener* marginListener_ = nullptr; 85 BorderListener* borderListener_ = nullptr; 86 PaddingListener* paddingListener_ = nullptr; 87 UIChartPolyline* chart_ = nullptr; 88 UIChartDataSerial* dataSerial_ = nullptr; 89 TextAdapter* adapter_ = nullptr; 90 List<const char*>* adapterData_ = nullptr; 91 UIPicker* picker_ = nullptr; 92 93 void AddTitle(const char* text); 94 }; 95 } // namespace OHOS 96 #endif // UI_TEST_BORDER_MARGIN_PADDING_H 97