• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 COMMON_DEFINES_H
17 #define COMMON_DEFINES_H
18 
19 namespace OHOS::uitest {
20     constexpr size_t INDEX_ZERO = 0;
21     constexpr size_t INDEX_ONE = 1;
22     constexpr size_t INDEX_TWO = 2;
23     constexpr size_t INDEX_THREE = 3;
24     constexpr size_t INDEX_FOUR = 4;
25 
26     using CStr = const char *;
27 
28     /**Enumerates the supported data types in the uitest API transactions.*/
29     enum TypeId : uint8_t {
30         NONE, INT, FLOAT, BOOL, STRING, BY, COMPONENT, DRIVER, OPTIONS
31     };
32 
33     /**Enumerates the supported string value match rules.*/
34     enum ValueMatchRule : uint8_t {
35         EQ, CONTAINS, STARTS_WITH, ENDS_WITH
36     };
37 
38     /**Enumerates the supported UiComponent attributes.*/
39     enum UiAttr : uint8_t {
40         ID, TEXT, KEY, TYPE, BOUNDS, ENABLED, FOCUSED, SELECTED, CLICKABLE, LONG_CLICKABLE, SCROLLABLE
41     };
42 
43     /**Enumerates the supported By-relative modes.*/
44     enum RelMode : uint8_t {
45         IS_BEFORE, IS_AFTER
46     };
47 
48     /**Supported UiComponent attribute names.*/
49     constexpr CStr ATTR_NAMES[11] = {"id", "text", "key", "type", "bounds", "enabled", "focused",
50                                      "selected", "clickable", "longClickable", "scrollable"};
51 
52     /**Enumerates all the supported widget operations.*/
53     enum WidgetOp : uint8_t {
54         CLICK, LONG_CLICK, DOUBLE_CLICK, SWIPE_L2R, SWIPE_R2L, SWIPE_T2B, SWIPE_B2T
55     };
56 
57     /**Enumerates all the supported coordinate-based operations.*/
58     enum PointerOp : uint8_t {
59         CLICK_P, LONG_CLICK_P, DOUBLE_CLICK_P, SWIPE_P, DRAG_P
60     };
61 
62     /**Enumerates the supported Key actions.*/
63     enum UiKey : uint8_t {
64         BACK, GENERIC
65     };
66 
67     /**Message keys used in the api transactions.*/
68     constexpr auto KEY_UPDATED_CALLER = "updated_caller";
69     constexpr auto KEY_RESULT_VALUES = "result_values";
70     constexpr auto KEY_EXCEPTION = "exception";
71     constexpr auto KEY_CODE = "code";
72     constexpr auto KEY_MESSAGE = "message";
73     constexpr auto KEY_DATA_TYPE = "type";
74     constexpr auto KEY_DATA_VALUE = "value";
75 }
76 
77 #endif