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_ROTATE_INPUT_H
17 #define UI_TEST_ROTATE_INPUT_H
18 
19 #include "components/ui_list.h"
20 #include "components/ui_scroll_view.h"
21 #include "components/ui_slider.h"
22 #include "components/ui_swipe_view.h"
23 #include "components/ui_time_picker.h"
24 #include "ui_test.h"
25 
26 #if ENABLE_ROTATE_INPUT
27 namespace OHOS {
28 class UITestRotateInput : public UITest, UIView::OnTouchListener {
29 public:
UITestRotateInput()30     UITestRotateInput() {}
~UITestRotateInput()31     ~UITestRotateInput() {}
32     void SetUp() override;
33     void TearDown() override;
34     const UIView* GetTestView() override;
35     void UIKitRotateEventList001();
36     void UIKitRotateEventScrollView002();
37     void UIKitRotateEventSwipeView003();
38     void UIKitRotateEventSlider004();
39     void UIKitRotateEventTimePicker005();
40     void UIKitRotateEventPicker006();
41     bool OnPress(UIView& view, const PressEvent& event) override;
42 
43 private:
44     void SetLastPos(UIView* view);
45     void CreateLabelButton(int16_t x, int16_t y, UIView::OnClickListener* listener, const char* text);
46     void SetTestLabelButton(UILabel* label, UIView* view);
47     UIScrollView* container_ = nullptr;
48     UIList* list_ = nullptr;
49     UIScrollView* scroll_ = nullptr;
50     UISwipeView* swipe_ = nullptr;
51     UITimePicker* timePicker_ = nullptr;
52     UISlider* slider_ = nullptr;
53     List<const char*>* adapterData_  = nullptr;
54     TextAdapter* adapter_ = nullptr;
55     int16_t lastX_ = 0;
56     int16_t lastY_ = 0;
57     UIPicker* picker_ = nullptr;
58     UIView::OnClickListener* listener1_ = nullptr;
59     UIView::OnClickListener* listener2_ = nullptr;
60     UIView::OnClickListener* listener3_ = nullptr;
61     UIView::OnClickListener* listener4_ = nullptr;
62     UIView::OnClickListener* listener5_ = nullptr;
63 };
64 } // namespace OHOS
65 #endif // UI_TEST_ROTATE_INPUT_H
66 #endif
67