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