• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 TEST_UNITTEST_CORE_EVENT_FOCUS_WINDOW_TEST_H
17 #define TEST_UNITTEST_CORE_EVENT_FOCUS_WINDOW_TEST_H
18 #include <cstddef>
19 #include <cstdint>
20 
21 #include "gtest/gtest.h"
22 #include "test/mock/core/common/mock_theme_manager.h"
23 #include "test/mock/core/pipeline/mock_pipeline_context.h"
24 #include "test/unittest/core/event/focus_core/focus_test_base.h"
25 #include "test/unittest/core/event/frame_node_on_tree.h"
26 
27 #include "base/geometry/ng/offset_t.h"
28 #include "base/geometry/ng/size_t.h"
29 #include "base/log/log_wrapper.h"
30 #include "base/memory/ace_type.h"
31 #include "base/memory/referenced.h"
32 #include "core/components/container_modal/container_modal_constants.h"
33 #include "core/components/theme/app_theme.h"
34 #include "core/components/theme/theme_constants.h"
35 #include "core/components_ng/base/frame_node.h"
36 #include "core/components_ng/base/ui_node.h"
37 #include "core/components_ng/base/view_stack_processor.h"
38 #include "core/components_ng/event/focus_box.h"
39 #include "core/components_ng/event/focus_event_handler.h"
40 #include "core/components_ng/event/focus_hub.h"
41 #include "core/components_ng/event/focus_state.h"
42 #include "core/components_ng/event/touch_event.h"
43 #include "core/components_ng/manager/focus/focus_manager.h"
44 #include "core/components_ng/manager/focus/focus_view.h"
45 #include "core/components_ng/pattern/button/button_pattern.h"
46 #include "core/components_ng/pattern/container_modal/container_modal_pattern.h"
47 #include "core/components_ng/pattern/container_modal/container_modal_theme.h"
48 #include "core/components_ng/pattern/container_modal/container_modal_view.h"
49 #include "core/components_ng/pattern/image/image_layout_property.h"
50 #include "core/components_ng/pattern/image/image_pattern.h"
51 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
52 #include "core/components_ng/pattern/menu/menu_pattern.h"
53 #include "core/components_ng/pattern/navigation/navigation_pattern.h"
54 #include "core/components_ng/pattern/pattern.h"
55 #include "core/components_ng/pattern/root/root_pattern.h"
56 #include "core/components_ng/pattern/stack/stack_pattern.h"
57 #include "core/components_ng/pattern/swiper/swiper_pattern.h"
58 #include "core/components_ng/pattern/text/text_pattern.h"
59 #include "core/components_v2/inspector/inspector_constants.h"
60 #include "core/event/key_event.h"
61 #include "core/pipeline_ng/pipeline_context.h"
62 
63 namespace OHOS::Ace::NG {
64 
65 class FocusHierarchicalPageTestNG : public FocusTestBaseNg, public testing::Test {
66 public:
67  static void SetUpTestSuite();
68  static void TearDownTestSuite();
69 };
70 enum class FocusHierarchicalCase { NODEC = 0, NODEE = 1, NONE = 2 };
71 
72 void SetDefaultFocus(bool isDefaultFocus, bool isDefaultFocusAble, const RefPtr<FocusHub>& focusHub);
73 void IsCAlreadyFocus(bool isCAlreadyFocus, const RefPtr<FocusHub>& focusHub);
74 void IsCFirstFocus(bool isCFirstFocus, const RefPtr<FocusHub>& focusHub);
75 void IsDependence(bool isDependence, const RefPtr<FocusHub>& focusHub);
76 void JudgMentDefaultFocus(
77  bool isDependenceC, RefPtr<FocusHub>& focusHub1, RefPtr<FocusHub>& focusHub2, RefPtr<FocusView>& focusView);
78 } // namespace OHOS::Ace::NG
79 
80 #endif // TEST_UNITTEST_CORE_EVENT_FOCUS_WINDOW_TEST_H
81