• 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_PICKER_H
17 #define UI_TEST_UI_PICKER_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_picker.h"
23 #include "components/ui_scroll_view.h"
24 #include "components/ui_time_picker.h"
25 #include "ui_test.h"
26 
27 namespace OHOS {
28 class UITestUIPicker : public UITest, UIView::OnClickListener, UIPicker::SelectedListener,
29     UITimePicker::SelectedListener {
30 public:
UITestUIPicker()31     UITestUIPicker() {}
~UITestUIPicker()32     ~UITestUIPicker() {}
33     void SetUp() override;
34     void TearDown() override;
35     bool OnClick(UIView& view, const ClickEvent& event) override;
36     const UIView* GetTestView() override;
37     void OnPickerStoped(UIPicker& picker) override;
38     void OnTimePickerStoped(UITimePicker& picker) override;
39     void CreatButtons();
40     void UIKit_Picker_Test_Base_001();
41     void UIKit_Picker_Test_Base_002();
42     void UIKit_Picker_Test_Time_Picker_001();
43 
44 private:
45     void SetLastPos(UIView* view);
46     void SetUpButton(UILabelButton* btn, const char* title);
47     UILabelButton* setLoopBtn_ = nullptr;
48     UILabelButton* setLoopOffBtn_ = nullptr;
49     UILabelButton* setSelectBtn_ = nullptr;
50     UILabelButton* setLeftToRightBtn_ = nullptr;
51     UILabelButton* setRightToLeftBtn_ = nullptr;
52     UILabelButton* setMarginBtn_ = nullptr;
53     UILabel* selectIndex_ = nullptr;
54     UILabel* selectTime_ = nullptr;
55     UIScrollView* container_ = nullptr;
56     UIPicker* picker1_ = nullptr;
57     UIPicker* picker3_ = nullptr;
58     UITimePicker* picker2_ = nullptr;
59     int16_t lastX_ = 0;
60     int16_t lastY_ = 0;
61     int16_t margin_ = 0;
62 };
63 } // namespace OHOS
64 #endif // UI_TEST_UI_PICKER_H
65