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/test.gni")
15import("//foundation/graphic/graphic_2d/graphic_config.gni")
16
17module_out_path = "graphic_2d/render_service_client"
18
19group("unittest") {
20  testonly = true
21
22  deps = [
23    ":RSDisplayModeTest",
24    ":RSDropframeTest",
25    ":RSEventTest",
26    ":RSInterfacesTest",
27    ":RSJankDetectorTest",
28    ":RSRegionTest",
29    ":RSScreenSkipFrameTest",
30    ":RSTransactionsTest",
31    ":RSTunnelHandleTest",
32    ":RSVirtualScreenRefreshRateTest",
33    "animation:RSAnimationTest",
34    "animation:RSAnimationTest1",
35    "animation:RSAnimationTest2",
36    "animation:RSAnimationTest3",
37  ]
38}
39
40## Build RSVirtualScreenRefreshRateTest
41ohos_unittest("RSVirtualScreenRefreshRateTest") {
42  module_out_path = module_out_path
43  sources = [ "rs_virtual_screen_refresh_rate_test.cpp" ]
44  deps = [ ":rs_client_test_common" ]
45  external_deps = [
46    "c_utils:utils",
47    "hilog:libhilog",
48  ]
49}
50
51## Build RSScreenSkipFrameTest
52ohos_unittest("RSScreenSkipFrameTest") {
53  module_out_path = module_out_path
54  sources = [ "rs_screen_skipframe_test.cpp" ]
55  deps = [ ":rs_client_test_common" ]
56  external_deps = [
57    "c_utils:utils",
58    "hilog:libhilog",
59  ]
60}
61
62## Build RSJankDetectorTest
63ohos_unittest("RSJankDetectorTest") {
64  module_out_path = module_out_path
65  sources = [
66    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client/core/jank_detector/rs_jank_detector.cpp",
67    "rs_jank_detector_test.cpp",
68  ]
69  deps = [ ":rs_client_test_common" ]
70  external_deps = [ "hisysevent:libhisysevent" ]
71}
72
73## Build RSInterfacesTest
74ohos_unittest("RSInterfacesTest") {
75  module_out_path = module_out_path
76  sources = [ "rs_interfaces_test.cpp" ]
77  if (defined(input_ext_feature_magiccursor) && input_ext_feature_magiccursor) {
78    defines = [ "OHOS_BUILD_ENABLE_MAGICCURSOR" ]
79  }
80  deps = [ ":rs_client_test_common" ]
81  external_deps = [ "graphic_surface:surface" ]
82}
83
84## Build RSTransactionsTest
85ohos_unittest("RSTransactionsTest") {
86  module_out_path = module_out_path
87  sources = [ "rs_transaction_controller_test.cpp" ]
88  deps = [
89    ":rs_client_test_common",
90    "../../../render_service_base:render_service_base_src",
91  ]
92}
93
94## Build RSDropframeTest
95ohos_unittest("RSDropframeTest") {
96  module_out_path = module_out_path
97  sources = [ "rs_dropframe_test.cpp" ]
98  deps = [ ":rs_client_test_common" ]
99}
100
101## Build RSDisplayModeTest
102ohos_unittest("RSDisplayModeTest") {
103  module_out_path = module_out_path
104  sources = [ "rs_display_mode_test.cpp" ]
105  deps = [ ":rs_client_test_common" ]
106}
107
108## Build TunnelHandleTest
109ohos_unittest("RSTunnelHandleTest") {
110  module_out_path = module_out_path
111  sources = [ "rs_tunnel_handle_test.cpp" ]
112  deps = [ ":rs_client_test_common" ]
113}
114
115## Build RSEventTest
116ohos_unittest("RSEventTest") {
117  module_out_path = module_out_path
118  sources = [ "rs_event_test.cpp" ]
119  deps = [ ":rs_client_test_common" ]
120}
121
122## Build RSRegionTest
123ohos_unittest("RSRegionTest") {
124  module_out_path = module_out_path
125  sources = [ "rs_region_test.cpp" ]
126  deps = [
127    ":rs_client_test_common",
128    "../../../render_service_base:render_service_base_src",
129  ]
130}
131
132## Build rs_client_test_common.a {{{
133config("rs_client_test_common_public_config") {
134  include_dirs = [ "$graphic_2d_root/rosen/modules/render_service_client/core" ]
135
136  cflags = [
137    "-Wall",
138    "-Werror",
139    "-g3",
140    "-Dprivate=public",
141    "-Dprotected=public",
142  ]
143}
144
145ohos_static_library("rs_client_test_common") {
146  visibility = [ ":*" ]
147  testonly = true
148
149  public_configs = [ ":rs_client_test_common_public_config" ]
150
151  public_deps = [
152    "//commonlibrary/c_utils/base:utils",
153    "//foundation/graphic/graphic_2d/rosen/modules/render_service_base:librender_service_base",
154    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
155    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
156    "//third_party/googletest:gtest_main",
157  ]
158
159  public_external_deps = [
160    "c_utils:utils",
161    "hilog:libhilog",
162  ]
163
164  subsystem_name = "graphic"
165  part_name = "graphic_2d"
166}
167## Build rs_client_test_common.a }}}
168