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 class UITestChartPillar : public UITest, public UIView::OnClickListener { 27 public: UITestChartPillar()28 UITestChartPillar() : dataSerial_() {} ~UITestChartPillar()29 ~UITestChartPillar() {} 30 void SetUp() override; 31 void TearDown() override; 32 const UIView* GetTestView() override; 33 34 void SetUpButton(UILabelButton* btn, const char* title); 35 36 bool OnClick(UIView& view, const ClickEvent& event) override; 37 38 void UIKit_ChartPillar_Test_AddDataSerial_001(); 39 void UIKit_ChartPillar_Test_EnableReverse_002(); 40 void UIKit_ChartPillar_Test_SetAxisLineColor_003(); 41 void UIKit_ChartPillar_Test_SetAxisLineVisible_004(); 42 43 private: 44 void SetLastPos(UIView* view); 45 void InnerDeleteChildren(UIView* view) const; 46 static constexpr uint8_t DATA_NUM = 3; 47 UIChartDataSerial *dataSerial_[DATA_NUM]; 48 uint8_t curDataIndex_ = 0; 49 50 UIScrollView* container_ = nullptr; 51 UIChartPillar* chart_ = nullptr; 52 UILabelButton* addDataSerialBtn_ = nullptr; 53 UILabelButton* deleteDataSerialBtn_ = nullptr; 54 UILabelButton* clearDataSerialBtn_ = nullptr; 55 UILabelButton* reverseBtn_ = nullptr; 56 UILabelButton* setAxisColorBtn_ = nullptr; 57 UILabelButton* setAxisVisibleBtn_ = nullptr; 58 59 int16_t lastX_ = 0; 60 int16_t lastY_ = 0; 61 }; 62 } // namespace OHOS 63 #endif // UI_TEST_CHART_PILLAR_H 64