• 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_INVALIDINPUT     // input invaild event
41 };
42 
43 /**
44  * @brief Input base class, provide the "Random, Next, Report" function for input action.
45  */
46 class InputAction {
47 public:
InputAction()48     InputAction()
49     {
50     }
~InputAction()51     virtual ~InputAction()
52     {
53     }
OrderInput(const std::shared_ptr<SpcialTestObject> & specialTestObject)54     virtual ErrCode OrderInput(const std::shared_ptr<SpcialTestObject>& specialTestObject)
55     {
56         return OHOS::ERR_INVALID_VALUE;
57     }
58     /**
59      * @brief input a touch event in random test.
60      * @return Return ERR_OK on success, others on failure.
61      */
RandomInput()62     virtual ErrCode RandomInput()
63     {
64         return OHOS::ERR_INVALID_VALUE;
65     }
66 
GetInputInfo()67     virtual ErrCode GetInputInfo()
68     {
69         return OHOS::ERR_INVALID_VALUE;
70     }
71 };
72 }  // namespace WuKong
73 }  // namespace OHOS
74 #endif  // TEST_WUKONG_INPUT_ACTION_H
75