1 /* 2 * Copyright (c) 2024 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_HUB_TEST_NG_H 17 #define TEST_UNITTEST_CORE_EVENT_FOCUS_HUB_TEST_NG_H 18 #include <cstddef> 19 #include <cstdint> 20 21 #include "gtest/gtest.h" 22 23 // Add the following two macro definitions to test the private and protected method. 24 #define private public 25 #define protected public 26 27 #include "base/geometry/ng/offset_t.h" 28 #include "base/geometry/ng/size_t.h" 29 #include "base/memory/ace_type.h" 30 #include "base/memory/referenced.h" 31 #include "core/components/theme/app_theme.h" 32 #include "core/components_ng/base/frame_node.h" 33 #include "core/components_ng/event/focus_hub.h" 34 #include "core/components_ng/event/touch_event.h" 35 #include "core/components_ng/manager/focus/focus_view.h" 36 #include "core/components_ng/pattern/button/button_pattern.h" 37 #include "core/components_ng/pattern/flex/flex_layout_pattern.h" 38 #include "core/components_ng/pattern/list/list_pattern.h" 39 #include "core/components_ng/pattern/pattern.h" 40 #include "core/components_ng/pattern/text_field/text_field_pattern.h" 41 #include "test/mock/core/common/mock_theme_manager.h" 42 #include "core/components_v2/inspector/inspector_constants.h" 43 #include "core/event/key_event.h" 44 #include "core/pipeline_ng/pipeline_context.h" 45 #include "test/mock/core/pipeline/mock_pipeline_context.h" 46 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h" 47 #include "test/unittest/core/event/frame_node_on_tree.h" 48 49 namespace OHOS::Ace::NG { 50 namespace { 51 constexpr int32_t FOCUS_NODE_SIZE = 2; 52 constexpr int32_t NODE_SIZE = 0; 53 const BlurReason BLUR_REASON_FOCUS_SWITCH = BlurReason::FOCUS_SWITCH; 54 const BlurReason BLUR_REASON_WINDOW_BLUR = BlurReason::WINDOW_BLUR; 55 const std::string RESULT_SUCCESS_ONE = "sucess1"; 56 const std::string RESULT_SUCCESS_TWO = "sucess2"; 57 } // namespace 58 59 class FocusHubTestNg : public testing::Test { 60 public: 61 static void SetUpTestSuite(); 62 static void TearDownTestSuite(); 63 void SetUp() override; 64 void TearDown() override; 65 }; 66 } // namespace OHOS::Ace::NG 67 68 #endif //TEST_UNITTEST_CORE_EVENT_FOCUS_HUB_TEST_NG_H