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_POLYLINE_H 17 #define UI_TEST_CHART_POLYLINE_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 UITestChartPolyline : public UITest, public UIView::OnClickListener { 27 public: UITestChartPolyline()28 UITestChartPolyline() {} ~UITestChartPolyline()29 ~UITestChartPolyline() {} 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 bool ClickExpand(UIView& view, UIChartDataSerial::PointStyle pointStyle); 38 39 void UIKit_ChartPolyline_Test_AddDataSerial_001(); 40 void UIKit_ChartPolyline_Test_EnableReverse_002(); 41 void UIKit_ChartPolyline_Test_SetGradientBottom_003(); 42 void UIKit_ChartPolyline_Test_AddPoints_004(); 43 44 private: 45 void SetLastPos(UIView* view); 46 void InnerDeleteChildren(UIView* view) const; 47 static constexpr uint8_t DATA_NUM = 3; 48 UIScrollView* container_ = nullptr; 49 UIChartPolyline* chart_ = nullptr; 50 UIChartDataSerial *dataSerial_[DATA_NUM] = {0}; 51 uint8_t curDataIndex_ = 0; 52 53 UIChartPolyline* ECGChart_ = nullptr; 54 UIChartDataSerial* ECGDataSerial_ = nullptr; 55 Animator* ECGAnimator_ = nullptr; 56 57 UILabelButton* addDataSerialBtn_ = nullptr; 58 UILabelButton* deleteDataSerialBtn_ = nullptr; 59 UILabelButton* clearDataSerialBtn_ = nullptr; 60 UILabelButton* reverseBtn_ = nullptr; 61 UILabelButton* topPointBtn_ = nullptr; 62 UILabelButton* bottomPointBtn_ = nullptr; 63 UILabelButton* headPointBtn_ = nullptr; 64 UILabelButton* gradientBottomBtn_ = nullptr; 65 66 UILabelButton* addPointsBtn_ = nullptr; 67 UILabelButton* smoothBtn_ = nullptr; 68 UILabelButton* hidePointsBtn_ = nullptr; 69 70 int16_t lastX_ = 0; 71 int16_t lastY_ = 0; 72 }; 73 } // namespace OHOS 74 #endif // UI_TEST_CHART_POLYLINE_H 75