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_DRAG_EVENT_COMMON_TEST_NG_H 17 #define TEST_UNITTEST_CORE_EVENT_DRAG_EVENT_COMMON_TEST_NG_H 18 #include "gtest/gtest.h" 19 #include <string> 20 21 #define private public 22 #define protected public 23 24 #include "test/mock/base/mock_pixel_map.h" 25 #include "test/mock/core/common/mock_container.h" 26 #include "test/mock/core/common/mock_interaction_interface.h" 27 #include "test/mock/core/common/mock_theme_manager.h" 28 #include "test/mock/core/pipeline/mock_pipeline_context.h" 29 #include "test/mock/core/render/mock_render_context.h" 30 31 #include "base/memory/ace_type.h" 32 #include "base/memory/referenced.h" 33 #include "core/components/theme/blur_style_theme.h" 34 #include "core/components/theme/shadow_theme.h" 35 #include "core/components_ng/event/drag_event.h" 36 #include "core/components_ng/event/event_hub.h" 37 #include "core/components_ng/manager/drag_drop/drag_drop_global_controller.h" 38 #include "core/components_ng/pattern/text/text_pattern.h" 39 #include "core/components_ng/pattern/stack/stack_pattern.h" 40 #include "core/components_ng/pattern/grid/grid_item_pattern.h" 41 #include "core/components_ng/pattern/list/list_item_pattern.h" 42 #include "core/components_ng/pattern/grid/grid_pattern.h" 43 #include "core/components_ng/pattern/list/list_pattern.h" 44 #include "core/components_ng/pattern/text_drag/text_drag_pattern.h" 45 #include "core/event/touch_event.h" 46 47 namespace OHOS::Ace::NG { 48 namespace { 49 constexpr float DISTANCE = 10.5f; 50 constexpr float WIDTH = 400.0f; 51 constexpr float HEIGHT = 400.0f; 52 constexpr int32_t FINGERS_NUMBER = 1; 53 const OffsetF COORDINATE_OFFSET(WIDTH, HEIGHT); 54 const PanDirection DRAG_DIRECTION = { PanDirection::LEFT }; 55 const TouchRestrict DRAG_TOUCH_RESTRICT = { TouchRestrict::CLICK }; 56 } // namespace 57 58 struct DragInfo { 59 bool isDragForbidden = false; 60 bool isDraggable = false; 61 bool isCustomerSet = false; 62 bool textIsSelected = false; DragInfoDragInfo63 DragInfo(bool isDragForbidden, bool isDraggable, bool isCustomerSet, bool textIsSelected) 64 : isDragForbidden(isDragForbidden), isDraggable(isDraggable), isCustomerSet(isCustomerSet), 65 textIsSelected(textIsSelected) 66 {} 67 }; 68 69 struct GlobalDraggingInfo { 70 bool isDragging = false; 71 bool isMSDPDragging = false; GlobalDraggingInfoGlobalDraggingInfo72 GlobalDraggingInfo(bool isDragging, bool isMSDPDragging) : isDragging(isDragging), isMSDPDragging(isMSDPDragging) {} 73 }; 74 75 struct MultiDragInfo { 76 bool isMultiSelectionEnabled = false; 77 bool isAllowDrag = false; 78 bool isFrameNodeAcceptedMultiDrag = false; MultiDragInfoMultiDragInfo79 MultiDragInfo(bool isMultiSelectionEnabled, bool isAllowDrag, bool isFrameNodeAcceptedMultiDrag) 80 : isMultiSelectionEnabled(isMultiSelectionEnabled), isAllowDrag(isAllowDrag), 81 isFrameNodeAcceptedMultiDrag(isFrameNodeAcceptedMultiDrag) 82 {} 83 }; 84 85 86 class DragEventCommonTestNg : public testing::Test { 87 }; 88 } // namespace OHOS::Ace::NG 89 90 #endif //TEST_UNITTEST_CORE_EVENT_DRAG_EVENT_COMMON_TEST_NG_H