• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/test.gni")
16import("../multimodalinput_mini.gni")
17
18defines = input_default_defines
19module_output_path = "multimodalinput/unit_out"
20mmi_service_path = "${mmi_path}/service"
21
22ohos_prebuilt_etc("mmi_device_config.ini") {
23  source = "mmi_device_config.ini"
24  relative_install_dir = "."
25  subsystem_name = "multimodalinput"
26  part_name = "input"
27}
28
29config("libmmi_server_config") {
30  include_dirs = [
31    "device_config/include",
32    "device_manager/include",
33    "device_scalability/include",
34    "delegate_task/include",
35    "display_state_manager/include",
36    "event_dispatch/include",
37    "key_event_normalize/include",
38    "event_handler/include",
39    "event_dump/include",
40    "fingersense_wrapper/include",
41    "monitor/include",
42    "interceptor/include",
43    "dfx/include",
44    "libinput_adapter/include",
45    "message_handle/include",
46    "module_loader/include",
47    "window_manager/include",
48    "touch_event_normalize/include",
49    "key_command/include",
50    "subscriber/include",
51    "timer_manager/include",
52    "permission_helper/include",
53    "${mmi_service_path}/connect_manager/include",
54    "${mmi_service_path}/filter/include",
55    "${mmi_service_path}/module_loader/include",
56    "${mmi_path}/interfaces/native/innerkits/proxy/include",
57    "${mmi_path}/interfaces/native/innerkits/event/include",
58    "mouse_event_normalize/include",
59    "${mmi_path}/interfaces/native/innerkits/common/include",
60    "${mmi_path}/util/common/include",
61    "${mmi_path}/util/socket/include",
62    "${mmi_path}/util/network/include",
63    "${mmi_path}/frameworks/proxy/event_handler/include",
64    "//third_party/cJSON",
65    "${preferences_path}/frameworks/native/include",
66    "${graphics_path}/2d_graphics/include",
67  ]
68
69  if (input_feature_combination_key) {
70    defines += [ "OHOS_BUILD_ENABLE_COMBINATION_KEY" ]
71  }
72
73  if (resource_schedule_service_enabled) {
74    defines += [ "OHOS_RSS_CLIENT" ]
75  }
76
77  if (is_emulator) {
78    defines += [ "OHOS_BUILD_EMULATOR" ]
79  }
80}
81
82ohos_rust_shared_ffi("mmi_rust") {
83  sources = [ "rust/src/lib.rs" ]
84  external_deps = [ "hilog:hilog_rust" ]
85  subsystem_name = "multimodalinput"
86  part_name = "input"
87}
88
89ohos_rust_unittest("rust_mmi_test") {
90  module_out_path = module_output_path
91  sources = [ "rust/src/lib.rs" ]
92  deps = [ ":mmi_rust" ]
93  external_deps = [ "hilog:hilog_rust" ]
94  subsystem_name = "multimodalinput"
95  part_name = "input"
96}
97
98ohos_shared_library("libmmi-server") {
99  sources = libmmi_service_sources
100
101  if (input_feature_keyboard) {
102    sources += [
103      "key_event_normalize/src/key_event_normalize.cpp",
104      "key_event_normalize/src/key_unicode_transformation.cpp",
105      "subscriber/src/key_subscriber_handler.cpp",
106    ]
107    if (input_feature_combination_key) {
108      sources += [ "key_command/src/key_command_handler.cpp" ]
109    }
110  }
111
112  if (input_feature_switch) {
113    sources += [ "subscriber/src/switch_subscriber_handler.cpp" ]
114  }
115
116  if (input_feature_mouse || input_feature_touchscreen) {
117    sources += [ "touch_event_normalize/src/touch_event_normalize.cpp" ]
118    if (input_feature_mouse) {
119      sources += [
120        "mouse_event_normalize/src/mouse_device_state.cpp",
121        "mouse_event_normalize/src/mouse_event_normalize.cpp",
122        "mouse_event_normalize/src/mouse_transform_processor.cpp",
123        "touch_event_normalize/src/gesture_transform_processor.cpp",
124        "touch_event_normalize/src/touchpad_transform_processor.cpp",
125      ]
126      if (input_feature_pointer_drawing) {
127        sources += [ "window_manager/src/pointer_drawing_manager.cpp" ]
128      } else {
129        sources += [ "window_manager/src/i_pointer_drawing_manager.cpp" ]
130      }
131    }
132    if (input_feature_touchscreen) {
133      sources += [
134        "touch_event_normalize/src/tablet_tool_tranform_processor.cpp",
135        "touch_event_normalize/src/touch_transform_processor.cpp",
136      ]
137    }
138  }
139  if (input_feature_joystick) {
140    sources += [ "touch_event_normalize/src/joystick_transform_processor.cpp" ]
141  }
142  if (input_feature_monitor) {
143    sources += [ "monitor/src/event_monitor_handler.cpp" ]
144  }
145  if (input_feature_interceptor) {
146    sources += [ "interceptor/src/event_interceptor_handler.cpp" ]
147  }
148
149  configs = [
150    "${mmi_path}:coverage_flags",
151    ":libmmi_server_config",
152  ]
153
154  deps = [
155    ":mmi_device_config.ini",
156    ":mmi_rust",
157    "${mmi_path}/etc/mouse_icon:input_mouse_icon",
158    "${mmi_path}/patch/diff_libinput_mmi:libinput-third-mmi",
159    "${mmi_path}/service/connect_manager:mmi_connect_manager_service",
160    "${mmi_path}/service/filter:mmi_event_filter_proxy",
161    "${mmi_path}/util:libmmi-util",
162    "//third_party/cJSON:cjson",
163  ]
164
165  external_deps = [ "c_utils:utils" ]
166  if (input_feature_pointer_drawing) {
167    external_deps += [ "window_manager:libwm" ]
168  }
169
170  if (security_component_enable) {
171    external_deps +=
172        [ "security_component_manager:libsecurity_component_enhance_sdk" ]
173  }
174
175  if (resource_schedule_service_enabled) {
176    external_deps += [ "resource_schedule_service:ressched_client" ]
177  }
178
179  external_deps += [
180    "ability_base:want",
181    "ability_runtime:ability_manager",
182    "ability_runtime:abilitykit_native",
183    "access_token:libaccesstoken_sdk",
184    "access_token:libtokenid_sdk",
185    "common_event_service:cesfwk_innerkits",
186    "config_policy:configpolicy_util",
187    "graphic_2d:2d_graphics",
188    "graphic_2d:librender_service_client",
189    "hicollie:libhicollie",
190    "hilog:libhilog",
191    "hisysevent:libhisysevent",
192    "hitrace:hitrace_meter",
193    "image_framework:image_native",
194    "init:libbegetutil",
195    "ipc:ipc_single",
196    "napi:ace_napi",
197    "preferences:native_preferences",
198    "safwk:system_ability_fwk",
199    "window_manager:libwm",
200  ]
201
202  part_name = "input"
203  subsystem_name = "multimodalinput"
204}
205
206import("//build/test.gni")
207module_output_path = "multimodalinput/unit_out"
208
209ohos_unittest("ut-mmi-service-out") {
210  module_out_path = module_output_path
211  include_dirs = [
212    "${mmi_path}/frameworks/proxy/event_handler",
213    "${mmi_path}/frameworks/proxy/event_handler/include",
214    "${mmi_path}/frameworks/proxy/module_loader",
215    "${mmi_path}/frameworks/proxy/module_loader/include",
216    "${mmi_path}/util/common",
217    "${mmi_path}/util/common/include",
218    "${mmi_path}/util/network",
219    "${mmi_path}/util/network/include",
220    "${mmi_path}/util/socket",
221    "${mmi_path}/util/socket/include",
222    "${mmi_path}/frameworks/proxy/event_handle",
223    "${mmi_path}/frameworks/proxy/event_handle/include",
224    "${mmi_path}/frameworks/proxy/module_loader",
225    "${mmi_path}/frameworks/proxy/module_loader/include",
226    "${mmi_path}/interfaces/native/innerkits/common/include",
227    "${mmi_path}/interfaces/native/innerkits/proxy/include",
228    "${mmi_path}/interfaces/native/innerkits/event/include",
229    "${mmi_path}/service/include",
230    "${mmi_path}/service/device_manager/include",
231    "${mmi_path}/service/device_scalability/include",
232    "${mmi_path}/service/dfx/include",
233    "${mmi_path}/service/event_dispatch/include",
234    "${mmi_path}/service/key_event_normalize/include",
235    "${mmi_path}/service/key_command/include",
236    "${mmi_path}/service/event_handler/include",
237    "${mmi_path}/service/event_dump/include",
238    "${mmi_path}/service/libinput_adapter/include",
239    "${mmi_path}/service/message_handle/include",
240    "${mmi_path}/service/module_loader/include",
241    "${mmi_path}/service/monitor/include",
242    "${mmi_path}/service/mouse_event_normalize/include",
243    "${mmi_path}/service/window_manager/include",
244    "${mmi_path}/test/unittest/common/include",
245    "${mmi_path}/uinput",
246    "$root_out_dir/diff_libinput_mmi/export_include",
247    "//third_party/node/src",
248  ]
249
250  sources = [
251    "${mmi_path}/test/unittest/common/src/system_info.cpp",
252    "dfx/test/dfx_hisysevent_test.cpp",
253    "event_dispatch/test/event_dispatch_test.cpp",
254    "event_handler/test/key_event_value_transformation_test.cpp",
255    "key_command/test/key_command_handler_test.cpp",
256    "module_loader/test/uds_server_test.cpp",
257    "monitor/test/event_monitor_handler_test.cpp",
258    "mouse_event_normalize/test/mouse_device_state_test.cpp",
259    "mouse_event_normalize/test/mouse_event_normalize_test.cpp",
260    "mouse_event_normalize/test/mouse_transform_processor_test.cpp",
261    "subscriber/test/key_subscriber_handler_test.cpp",
262    "touch_event_normalize/test/touch_event_normalize_test.cpp",
263    "touch_event_normalize/test/touchpad_transform_processor_test.cpp",
264    "window_manager/test/input_display_bind_helper_test.cpp",
265    "window_manager/test/input_windows_manager_test.cpp",
266  ]
267
268  configs = [
269    "${mmi_path}:coverage_flags",
270    ":libmmi_server_config",
271  ]
272
273  deps = [
274    "${mmi_path}/frameworks/proxy:libmmi-client",
275    "${mmi_path}/patch/diff_libinput_mmi:libinput-third-mmi",
276    "${mmi_path}/service:libmmi-server",
277    "${mmi_path}/util:libmmi-util",
278    "//third_party/googletest:gmock_main",
279    "//third_party/googletest:gtest_main",
280  ]
281
282  external_deps = [
283    "c_utils:utils",
284    "hilog:libhilog",
285    "image_framework:image_native",
286    "window_manager:libwm",
287  ]
288}
289
290ohos_unittest("TransformPointTest") {
291  module_out_path = module_output_path
292
293  configs = [ "${mmi_path}:coverage_flags" ]
294  include_dirs = [
295    "${mmi_path}/interfaces/native/innerkits/common/include",
296    "${mmi_path}/util/common/include",
297    "${mmi_path}/tools/vuinput/include",
298  ]
299
300  sources = [ "touch_event_normalize/test/transform_point_test.cpp" ]
301
302  deps = [
303    "${mmi_path}/tools/vuinput:libmmi-virtual-device",
304    "//third_party/googletest:gmock_main",
305    "//third_party/googletest:gtest_main",
306  ]
307
308  external_deps = [
309    "c_utils:utils",
310    "hilog:libhilog",
311  ]
312}
313
314group("mmi-service-tests") {
315  testonly = true
316  deps = [ "libinput_adapter/test" ]
317}
318