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 26 #include "base/geometry/ng/offset_t.h" 27 #include "base/geometry/ng/size_t.h" 28 #include "base/memory/ace_type.h" 29 #include "base/memory/referenced.h" 30 #include "core/components/theme/app_theme.h" 31 #include "core/components_ng/base/frame_node.h" 32 #include "core/components_ng/event/focus_hub.h" 33 #include "core/components_ng/event/state_style_manager.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/linear_layout/linear_layout_pattern.h" 37 #include "core/components_ng/pattern/pattern.h" 38 #include "core/components_v2/inspector/inspector_constants.h" 39 #include "core/event/key_event.h" 40 #include "core/pipeline_ng/pipeline_context.h" 41 42 namespace OHOS::Ace::NG { 43 struct FocusBoxPolyMorPhismStyle { 44 bool isAFocusBoxStyle; 45 bool isBFocusBoxStyle; 46 bool isCFocusBoxStyle; 47 }; 48 struct FocusBoxDependence { 49 bool isADependence; 50 bool isBDependence; 51 }; 52 struct FocusBoxStyleType { 53 FocusStyleType focusAStyleType; 54 FocusStyleType focusBStyleType; 55 FocusStyleType focusCStyleType; 56 }; 57 struct FocusCreatBoxTestCase { 58 FocusBoxPolyMorPhismStyle style; 59 FocusBoxStyleType focusStyleType; 60 FocusBoxDependence isDependence; FocusCreatBoxTestCaseFocusCreatBoxTestCase61 FocusCreatBoxTestCase( 62 FocusBoxPolyMorPhismStyle style, FocusBoxStyleType focusStyleType, FocusBoxDependence isDependence) 63 : style { style.isAFocusBoxStyle, style.isBFocusBoxStyle, style.isCFocusBoxStyle }, 64 focusStyleType { focusStyleType.focusAStyleType, focusStyleType.focusBStyleType, 65 focusStyleType.focusCStyleType }, 66 isDependence { isDependence.isADependence, isDependence.isBDependence } 67 {} 68 }; 69 class FocusCreatBoxTestNG : public FocusTestBaseNg, public testing::Test { 70 public: 71 static void SetUpTestSuite(); 72 static void TearDownTestSuite(); 73 static RefPtr<FrameNode> CreatNode(); 74 void FocusPolyMorPhismStyle(bool testCase, const RefPtr<FocusHub>& focusHub); 75 void InitFocusCreatBox(); 76 void SetDependence(bool testCase, const RefPtr<FocusHub>& focusHub); 77 }; 78 79 } // namespace OHOS::Ace::NG 80 81 #endif // TEST_UNITTEST_CORE_EVENT_FOCUS_WINDOW_TEST_H