1 /*
2  * Copyright (c) 2022 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 WINDOW_UTILS_TEST_H
17 #define WINDOW_UTILS_TEST_H
18 
19 #include <iostream>
20 
21 #include "window.h"
22 
23 namespace OHOS {
24 namespace MMI {
25 class WindowUtilsTest {
26 public:
27     WindowUtilsTest() = default;
28     virtual ~WindowUtilsTest();
29     DISALLOW_COPY_AND_MOVE(WindowUtilsTest);
30     static std::shared_ptr<WindowUtilsTest> GetInstance();
31 public:
32     bool DrawTestWindow();
33     void ClearTestWindow();
34     sptr<Rosen::Window>& GetWindow();
35     uint32_t GetWindowId();
36 
37 private:
38     struct TestWindowInfo {
39         std::string name;
40         Rosen::Rect rect;
41         Rosen::WindowType type;
42         Rosen::WindowMode mode;
43         bool needAvoid { false };
44         bool parentLimit { false };
45         uint32_t parentId;
46         bool focusable_ { true };
47         Rosen::Orientation orientation_ { Rosen::Orientation::UNSPECIFIED };
48     };
49     void CreateSmoothWindow();
50     sptr<Rosen::Window> CreateWindow(const TestWindowInfo& info);
51 private:
52     sptr<Rosen::Window> testWindow_ { nullptr };
53     static inline std::shared_ptr<WindowUtilsTest> windowUtils_ { nullptr };
54 };
55 } // namespace MMI
56 } // namespace OHOS
57 #endif // WINDOW_UTILS_TEST_H