• 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 TEST_WUKONG_INPUT_ACTION_H
17 #define TEST_WUKONG_INPUT_ACTION_H
18 
19 #include <string>
20 #include <unistd.h>
21 
22 #include "app_manager.h"
23 #include "input_manager.h"
24 #include "special_test_object.h"
25 #include "wukong_define.h"
26 #include "wukong_util.h"
27 
28 namespace OHOS {
29 namespace WuKong {
30 enum InputType {
31     INPUTTYPE_TOUCHINPUT,      // input touch event
32     INPUTTYPE_SWAPINPUT,       // input swap event
33     INPUTTYPE_MOUSEINPUT,      // input mouse event
34     INPUTTYPE_KEYBOARDINPUT,   // input keyboard event
35     INPUTTYPE_ELEMENTINPUT,    // input element event
36     INPUTTYPE_APPSWITCHINPUT,  // input appswitch event
37     INPUTTYPE_HARDKEYINPUT,    // input power event
38     INPUTTYPE_RECORDINPUT,     // input record event
39     INPUTTYPE_REPPLAYINPUT,    // input replay event
40     INPUTTYPE_ROTATEINPUT,    // input rotate event
41     INPUTTYPE_INVALIDINPUT     // input invaild event
42 };
43 
44 /**
45  * @brief Input base class, provide the "Random, Next, Report" function for input action.
46  */
47 class InputAction {
48 public:
InputAction()49     InputAction()
50     {
51     }
~InputAction()52     virtual ~InputAction()
53     {
54     }
OrderInput(const std::shared_ptr<SpcialTestObject> & specialTestObject)55     virtual ErrCode OrderInput(const std::shared_ptr<SpcialTestObject>& specialTestObject)
56     {
57         return OHOS::ERR_INVALID_VALUE;
58     }
59     /**
60      * @brief input a touch event in random test.
61      * @return Return ERR_OK on success, others on failure.
62      */
RandomInput()63     virtual ErrCode RandomInput()
64     {
65         return OHOS::ERR_INVALID_VALUE;
66     }
67 
68     /**
69      * @brief input a touch event in focus test for a certain times.
70      * @return Return ERR_OK on success, others on failure.
71      */
FocusInput(bool shouldScreenCap)72     virtual ErrCode FocusInput(bool shouldScreenCap)
73     {
74         return OHOS::ERR_INVALID_VALUE;
75     }
76 
GetInputInfo()77     virtual ErrCode GetInputInfo()
78     {
79         return OHOS::ERR_INVALID_VALUE;
80     }
81 };
82 }  // namespace WuKong
83 }  // namespace OHOS
84 #endif  // TEST_WUKONG_INPUT_ACTION_H
85