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_VIEW_GROUP_H 17 #define UI_TEST_VIEW_GROUP_H 18 19 #include "components/ui_label.h" 20 #include "components/ui_label_button.h" 21 #include "components/ui_scroll_view.h" 22 #include "components/ui_view_group.h" 23 #include "ui_test.h" 24 25 namespace OHOS { 26 class UITestViewGroup : public UITest, public UIView::OnClickListener { 27 public: UITestViewGroup()28 UITestViewGroup() : container_(nullptr) {} ~UITestViewGroup()29 ~UITestViewGroup() {} 30 void SetUp() override; 31 void TearDown() override; 32 const UIView* GetTestView() override; 33 bool OnClick(UIView& view, const ClickEvent& event) override; 34 35 /** 36 * @brief Test Add/Rmove Function 37 */ 38 void UIKitViewGroupTestAddRemove001(); 39 40 /** 41 * @brief Test add child multi time 42 */ 43 void UIKitViewGroupTestAddError001(); 44 45 /** 46 * @brief Test insert child multi time 47 */ 48 void UIKitViewGroupTestInsertError001(); 49 50 private: 51 UIViewGroup* CreateTestCaseGroup() const; 52 UILabel* CreateTitleLabel() const; 53 UILabelButton* CreateButton(const char* text, int16_t width, int16_t height) const; 54 void AddView(); 55 void RemoveView(); 56 void RemoveAndAddView(); 57 void AddMultiParent(); 58 void InsertMultiParent(); 59 60 UIScrollView* container_ = nullptr; 61 UILabelButton* addBtn_ = nullptr; 62 UILabelButton* removeBtn_ = nullptr; 63 UILabelButton* removeAddBtn_ = nullptr; 64 UILabelButton* addTwiceBtn_ = nullptr; 65 UILabelButton* addMultiParentBtn_ = nullptr; 66 UILabelButton* addSelfBtn_ = nullptr; 67 UILabelButton* insertTwiceBtn_ = nullptr; 68 UILabelButton* insertSelfBtn_ = nullptr; 69 UILabelButton* insertMultiParentBtn_ = nullptr; 70 }; 71 } // namespace OHOS 72 #endif // UI_TEST_VIEW_GROUP_H 73