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_UI_LIST_H 17 #define UI_TEST_UI_LIST_H 18 19 #include "components/text_adapter.h" 20 #include "components/ui_label.h" 21 #include "components/ui_label_button.h" 22 #include "components/ui_list.h" 23 #include "components/ui_scroll_view.h" 24 #include "ui_test.h" 25 26 namespace OHOS { 27 class UITestUIList : public UITest, UIView::OnClickListener, ListScrollListener { 28 public: UITestUIList()29 UITestUIList() {} ~UITestUIList()30 ~UITestUIList() {} 31 void SetUp() override; 32 void TearDown() override; 33 const UIView* GetTestView() override; 34 35 bool OnClick(UIView& view, const ClickEvent& event) override; 36 void OnScrollStart(int16_t index, UIView* view) override; 37 void OnScrollEnd(int16_t index, UIView* view) override; 38 void OnScrollTop(int16_t index, UIView* view) override; 39 void OnScrollBottom(int16_t index, UIView* view) override; 40 void OnItemSelected(int16_t index, UIView* view) override; 41 void UIKitListInitTestFullScreen001(); 42 void UIKitListInitTesthalhScreen001(); 43 void UIKitListScrollTestBlankSet001(); 44 45 private: 46 static constexpr int16_t ALINE_TIME_CHANGE_VALUE = 100; 47 void SetLastPos(UIView* view); 48 void SetUpButton(UILabelButton* btn, const char* title); 49 void SetControlButton(); 50 void InitAdapter4(); 51 void TearDown001(); 52 void InitButtons(); 53 void SetUpButtons001(); 54 UILabelButton* setBlankBtn_ = nullptr; 55 UILabelButton* setBlankOffBtn_ = nullptr; 56 UILabelButton* setThrowDragBtn_ = nullptr; 57 UILabelButton* setThrowDragOffBtn_ = nullptr; 58 UILabelButton* setRefreshBtn_ = nullptr; 59 UILabelButton* setLoopBtn_ = nullptr; 60 UILabelButton* setLoopOffBtn_ = nullptr; 61 UILabelButton* setListPaddingBtn_ = nullptr; 62 UILabelButton* setListBorderBtn_ = nullptr; 63 UILabelButton* setRebondSizeBtn_ = nullptr; 64 UILabelButton* setSelectBtn_ = nullptr; 65 UILabelButton* setSelectOffBtn_ = nullptr; 66 UILabelButton* setAutoAlignBtn_ = nullptr; 67 UILabelButton* setAutoAlignOffBtn_ = nullptr; 68 UILabelButton* setBackAlignBtn_ = nullptr; 69 UILabelButton* setBackAlignOffBtn_ = nullptr; 70 UILabelButton* setAutoAlignACCIncBtn_ = nullptr; 71 UILabelButton* setAutoAlignACCDncBtn_ = nullptr; 72 UILabelButton* setYScrollBarVisableBtn_ = nullptr; 73 UILabelButton* setYScrollBarInvisableBtn_ = nullptr; 74 UILabelButton* setItemHeightMinBtn_ = nullptr; 75 UILabelButton* setItemHeightMaxBtn_ = nullptr; 76 UILabelButton* setAdapterEmptyBtn_ = nullptr; 77 UILabelButton* setSwitchDirectionBtn_ = nullptr; 78 UILabel* scrollStateLabel_ = nullptr; 79 UILabel* scrollSelectLabel_ = nullptr; 80 UIScrollView* container_ = nullptr; 81 List<const char*>* adapterData1_ = nullptr; 82 List<const char*>* adapterData2_ = nullptr; 83 TextAdapter* adapter1_ = nullptr; 84 TextAdapter* adapter2_ = nullptr; 85 TextAdapter* adapter3_ = nullptr; 86 TextAdapter* adapter4_ = nullptr; 87 UIList* currentList_ = nullptr; 88 int16_t lastX_ = 0; 89 int16_t lastY_ = 0; 90 uint16_t autoAlignTime_ = 100; // 100: default list auto aling ACC 91 }; 92 } // namespace OHOS 93 #endif // UI_TEST_UI_LIST_H 94