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 DRAG_CLIENT_TEST_H 17 #define DRAG_CLIENT_TEST_H 18 19 #include <gtest/gtest.h> 20 21 #include "delegate_tasks.h" 22 #include "device_manager.h" 23 #include "devicestatus_define.h" 24 #include "drag_client.h" 25 #include "i_context.h" 26 #include "socket_session_manager.h" 27 #include "timer_manager.h" 28 29 namespace OHOS { 30 namespace Msdp { 31 namespace DeviceStatus { 32 class ContextService final : public IContext { 33 ContextService(); 34 ~ContextService(); 35 DISALLOW_COPY_AND_MOVE(ContextService); 36 public: 37 IDelegateTasks& GetDelegateTasks() override; 38 IDeviceManager& GetDeviceManager() override; 39 ITimerManager& GetTimerManager() override; 40 IDragManager& GetDragManager() override; 41 IDDMAdapter& GetDDM() override; 42 IPluginManager& GetPluginManager() override; 43 ISocketSessionManager& GetSocketSessionManager() override; 44 IInputAdapter& GetInput() override; 45 IDSoftbusAdapter& GetDSoftbus() override; 46 static ContextService* GetInstance(); 47 48 private: 49 std::unique_ptr<IDDMAdapter> ddm_; 50 }; 51 52 class DragClientTest : public testing::Test { 53 public: 54 static void SetUpTestCase(); 55 void SetUp(); 56 void TearDown(); 57 static std::shared_ptr<Media::PixelMap> CreatePixelMap(int32_t width, int32_t height); 58 static std::optional<DragData> CreateDragData(int32_t sourceType, int32_t pointerId, int32_t dragNum, 59 bool hasCoordinateCorrected, int32_t shadowNum); 60 void AssignToAnimation(PreviewAnimation &animation); 61 }; 62 } // namespace DeviceStatus 63 } // namespace Msdp 64 } // namespace OHOS 65 #endif // DRAG_CLIENT_TEST_H 66