• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_OPERATOR_H
17 #define WINDOW_OPERATOR_H
18 
19 #include "ui_driver.h"
20 
21 namespace OHOS::uitest {
22     enum ResizeDirection : uint8_t {
23         LEFT,
24         RIGHT,
25         D_UP,
26         D_DOWN,
27         LEFT_UP,
28         LEFT_DOWN,
29         RIGHT_UP,
30         RIGHT_DOWN
31     };
32 
33     class WindowOperator {
34     public:
35        WindowOperator(UiDriver &driver, const Window &window, UiOpArgs &options);
36 
37        /**Focus the window.*/
38        void Focus(ApiReplyInfo &out);
39 
40        /**Move this Window to the specified points.*/
41        void MoveTo(uint32_t endX, uint32_t endY, ApiReplyInfo &out);
42 
43        /**Resize this Window to the specified size for the specified direction.*/
44        void Resize(int32_t width, int32_t highth, ResizeDirection direction, ApiReplyInfo &out);
45 
46        /**Change this Window into split screen mode*/
47        void Split(ApiReplyInfo &out);
48 
49        /**Maximize this window.*/
50        void Maximize(ApiReplyInfo &out);
51 
52        /**Resume this window.*/
53        void Resume(ApiReplyInfo &out);
54 
55        /**Minimize this window.*/
56        void Minimize(ApiReplyInfo &out);
57 
58        /**Close this window.*/
59        void Close(ApiReplyInfo &out);
60 
61     private:
62         UiDriver &driver_;
63         const Window &window_;
64         UiOpArgs &options_;
65 
66         /**Exhale the decoration bar of the current window.*/
67         void CallBar(ApiReplyInfo &out);
68 
69         /**Click on the decoration bar of this window.*/
70         void BarAction(size_t index, ApiReplyInfo &out);
71     };
72 } // namespace OHOS::uitest
73 
74 #endif