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_CHART_PILLAR_H 17 #define UI_TEST_CHART_PILLAR_H 18 19 #include "components/ui_chart.h" 20 #include "components/ui_label.h" 21 #include "components/ui_label_button.h" 22 #include "components/ui_scroll_view.h" 23 #include "ui_test.h" 24 25 namespace OHOS { 26 constexpr char* UI_TEST_ADD_DATA = "add_data"; 27 constexpr char* UI_TEST_DELETE_DATA = "delete_data"; 28 constexpr char* UI_TEST_CLEAR_DATA = "clear_data"; 29 constexpr char* UI_TEST_FLIP = "flip"; 30 constexpr char* UI_TEST_AXIS_COLOR = "axis_color"; 31 constexpr char* UI_TEST_AXIS_NOT_VISIBLE = "axis_not_visible"; 32 33 class UITestChartPillar : public UITest, public UIView::OnClickListener { 34 public: UITestChartPillar()35 UITestChartPillar() : dataSerial_() {} ~UITestChartPillar()36 ~UITestChartPillar() {} 37 void SetUp() override; 38 void TearDown() override; 39 const UIView* GetTestView() override; 40 41 void SetUpButton(UILabelButton* btn, const char* title, const char* id); 42 43 bool OnClick(UIView& view, const ClickEvent& event) override; 44 45 void UIKitChartPillarTestAddDataSerial001(); 46 void UIKitChartPillarTestEnableReverse002(); 47 void UIKitChartPillarTestSetAxisLineColor003(); 48 void UIKitChartPillarTestSetAxisLineVisible004(); 49 50 private: 51 void SetLastPos(UIView* view); 52 void InnerDeleteChildren(UIView* view) const; 53 static constexpr uint8_t DATA_NUM = 3; 54 UIChartDataSerial *dataSerial_[DATA_NUM]; 55 uint8_t curDataIndex_ = 0; 56 57 UIScrollView* container_ = nullptr; 58 UIChartPillar* chart_ = nullptr; 59 UILabelButton* addDataSerialBtn_ = nullptr; 60 UILabelButton* deleteDataSerialBtn_ = nullptr; 61 UILabelButton* clearDataSerialBtn_ = nullptr; 62 UILabelButton* reverseBtn_ = nullptr; 63 UILabelButton* setAxisColorBtn_ = nullptr; 64 UILabelButton* setAxisVisibleBtn_ = nullptr; 65 66 int16_t lastX_ = 0; 67 int16_t lastY_ = 0; 68 }; 69 } // namespace OHOS 70 #endif // UI_TEST_CHART_PILLAR_H 71