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_MANAGER_DRAG_DROP_MANAGER_TEST_NG_H 17 #define TEST_UNITTEST_CORE_MANAGER_DRAG_DROP_MANAGER_TEST_NG_H 18 #include <optional> 19 20 #include "gtest/gtest.h" 21 22 #define private public 23 #include "test/mock/base/mock_drag_window.h" 24 #include "test/mock/core/common/mock_container.h" 25 #include "test/mock/core/common/mock_interaction_interface.h" 26 #include "test/mock/core/pipeline/mock_pipeline_context.h" 27 28 #include "base/geometry/ng/offset_t.h" 29 #include "base/geometry/ng/rect_t.h" 30 #include "base/geometry/ng/size_t.h" 31 #include "base/image/pixel_map.h" 32 #include "base/memory/ace_type.h" 33 #include "base/memory/referenced.h" 34 #include "base/subwindow/subwindow_manager.h" 35 #include "core/common/interaction/interaction_interface.h" 36 #include "core/components/common/layout/grid_system_manager.h" 37 #include "core/components_ng/base/frame_node.h" 38 #include "core/components_ng/base/geometry_node.h" 39 #include "core/components_ng/base/ui_node.h" 40 #include "core/components_ng/event/event_hub.h" 41 #include "core/components_ng/manager/drag_drop/drag_drop_manager.h" 42 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h" 43 #include "core/components_ng/pattern/grid/grid_event_hub.h" 44 #include "core/components_ng/pattern/grid/grid_pattern.h" 45 #include "core/components_ng/pattern/list/list_event_hub.h" 46 #include "core/components_ng/pattern/list/list_pattern.h" 47 #include "core/components_ng/pattern/pattern.h" 48 #include "core/components_ng/pattern/text/text_pattern.h" 49 #include "core/components_v2/inspector/inspector_constants.h" 50 #include "core/pipeline/base/render_node.h" 51 52 namespace OHOS::Ace::NG { 53 namespace { 54 const std::string ROOT_ETS_TAG("root"); 55 const std::string GRID_TAG("grid"); 56 const std::string LIST_TAG("list"); 57 const std::string NODE_TAG("custom_node"); 58 const std::string NODE_TAG_EX("custom_node_ex"); 59 const std::string NODE_TAG_EX2("custom_node_ex2"); 60 constexpr int32_t GLOBAL_X = 10; 61 constexpr int32_t GLOBAL_Y = 20; 62 const std::string EXTRA_INFO("extra info"); 63 const std::string EXTRA_INFO_2("extra info 2"); 64 const std::string EXTRA_INFO_LEAVE("extra info LEAVE"); 65 const std::string EXTRA_INFO_MOVE("extra info MOVE"); 66 const std::string EXTRA_INFO_ENTER("extra info ENTER"); 67 const std::string ITEM_INFO_LEAVE("item info LEAVE"); 68 const std::string ITEM_INFO_MOVE("item info MOVE"); 69 const std::string ITEM_INFO_ENTER("item info ENTER"); 70 constexpr int32_t INVALID_CURRENT_ID = -1; 71 // before testing CheckDragDropProxy, DragWindow has created 6 times 72 constexpr int32_t VALID_CURRENT_ID = 6; 73 const OffsetF FRAME_OFFSET(0.0f, 0.0f); 74 const SizeF FRAME_SIZE(GLOBAL_X * 10.0f, GLOBAL_Y * 10.0f); 75 constexpr int32_t DRAGGED_INDEX = 0; 76 const DragType DRAG_TYPE_GRID = DragType::GRID; 77 const DragType DRAG_TYPE_LIST = DragType::LIST; 78 RefPtr<DragWindow> MOCK_DRAG_WINDOW; 79 } // namespace 80 81 class DragDropManagerTestNg : public testing::Test { 82 public: 83 static void SetUpTestCase(); 84 static void TearDownTestCase(); 85 }; 86 87 class DragDropManagerTestNgNew : public testing::Test { 88 public: 89 static void SetUpTestCase(); 90 static void TearDownTestCase(); 91 }; 92 93 class DragDropManagerTestNgCoverage : public testing::Test { 94 public: 95 static void SetUpTestCase(); 96 static void TearDownTestCase(); 97 }; 98 } // namespace OHOS::Ace::NG 99 100 #endif //TEST_UNITTEST_CORE_MANAGER_DRAG_DROP_MANAGER_TEST_NG_H