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