• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SWIPE_VIEW_H
17 #define UI_TEST_UI_SWIPE_VIEW_H
18 
19 #include "components/ui_label_button.h"
20 #include "components/ui_scroll_view.h"
21 #include "components/ui_swipe_view.h"
22 #include "ui_test.h"
23 
24 namespace OHOS {
25 class UITestUISwipeView : public UITest, UIView::OnClickListener {
26 public:
UITestUISwipeView()27     UITestUISwipeView() {}
~UITestUISwipeView()28     ~UITestUISwipeView() {}
29     void SetUp() override;
30     void TearDown() override;
31     const UIView* GetTestView() override;
32     bool OnClick(UIView& view, const ClickEvent& event) override;
33 
34     void UIKit_Swipe_View_Test_Horizontal_001();
35     void UIKit_Swipe_View_Test_Horizontal_002();
36     void UIKit_Swipe_View_Test_Horizontal_003();
37     void UIKit_Swipe_View_Test_Ver_001();
38     void UIKit_Swipe_View_Test_Ver_002();
39     void UIKit_Swipe_View_Test_Remove_001();
40     void UIKit_Swipe_View_Test_Align_001(UISwipeView::AlignMode alignMode);
41     void UIKit_Swipe_View_Test_SetCurrentPage();
42 
43 private:
44     void SetUpButton(UILabelButton* btn, const char* title);
45     void SetLastPos(UIView* view);
46     UIScrollView* container_ = nullptr;
47     UISwipeView* currentSwipe_ = nullptr;
48     UILabelButton* addBtnInHead_ = nullptr;
49     UILabelButton* addBtnInTail_ = nullptr;
50     UILabelButton* addBtnInMid_ = nullptr;
51     UILabelButton* removeHeadBtn_ = nullptr;
52     UILabelButton* removeMidBtn_ = nullptr;
53     UILabelButton* removeAllBtn_ = nullptr;
54     UILabelButton* loopBtn_ = nullptr;
55     UILabelButton* changePageBtn_ = nullptr;
56     bool loop_ = false;
57     int16_t lastX_ = 0;
58     int16_t lastY_ = 0;
59     int16_t btnNum_ = 0;
60 };
61 } // namespace OHOS
62 #endif // UI_TEST_UI_SWIPE_VIEW_H
63