• 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_FOCUS_MANAGER_H
17 #define UI_TEST_FOCUS_MANAGER_H
18 
19 #include "graphic_config.h"
20 #if ENABLE_FOCUS_MANAGER
21 #include "components/ui_label_button.h"
22 #include "components/ui_scroll_view.h"
23 #include "dock/focus_manager.h"
24 #include "ui_test.h"
25 
26 namespace OHOS {
27 class UITestFocusManager : public UITest {
28 public:
UITestFocusManager()29     UITestFocusManager() {}
~UITestFocusManager()30     ~UITestFocusManager() {}
31     void SetUp() override;
32     void TearDown() override;
33     const UIView* GetTestView() override;
34 
35     void UIKit_Focus_Manager_Test_001();
36 
37 private:
38     UIView* CreateTestUILabel(UIViewGroup* parent, int16_t x, int16_t y,
39         const char* text, bool focusable);
40     UIViewGroup* CreateTestUIViewGroup(UIViewGroup* parent, bool focusable, bool interceptFocus);
41     UILabelButton* SetUpButton(const char* title, int16_t x, int16_t y, UIViewGroup* viewGroup,
42         UIView::OnClickListener* listener);
43     UIScrollView* container_ = nullptr;
44     UIView::OnFocusListener* testOnFocusListener_ = nullptr;
45     UIView::OnClickListener* requestFocusByDirectionLeftListener_ = nullptr;
46     UIView::OnClickListener* requestFocusByDirectionRightListener_ = nullptr;
47     UIView::OnClickListener* requestFocusByDirectionUpListener_ = nullptr;
48     UIView::OnClickListener* requestFocusByDirectionDownListener_ = nullptr;
49     UIView::OnClickListener* setFocusableViewListener_ = nullptr;
50     UIView::OnClickListener* setFocusableViewListener1_ = nullptr;
51     UIView::OnClickListener* setGroupInterceptListener_ = nullptr;
52     UIView::OnClickListener* setGroupInterceptListener1_ = nullptr;
53     UIView::OnClickListener* resetFocusListener_ = nullptr;
54     UIView::OnClickListener* clearFocusListener_ = nullptr;
55 };
56 } // namespace OHOS
57 #endif
58 #endif // UI_TEST_FOCUS_MANAGER_H