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