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