1# Copyright (c) 2021 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")
15
16module_out_path = "graphic_2d/composer"
17
18group("unittest") {
19  testonly = true
20
21  deps = [
22    ":native_vsync_test",
23    ":vsync_connection_test",
24    ":vsync_controller_test",
25    ":vsync_distributor_test",
26    ":vsync_generator_test",
27    ":vsync_receiver_test",
28    ":vsync_sampler_test",
29  ]
30}
31
32## UnitTest vsync_connection_test {{{
33ohos_unittest("vsync_connection_test") {
34  module_out_path = module_out_path
35
36  sources = [ "vsync_connection_test.cpp" ]
37
38  deps = [
39    ":vsync_test_common",
40    "//foundation/graphic/graphic_2d/utils:socketpair",
41  ]
42}
43
44## UnitTest vsync_connection_test }}}
45
46## UnitTest vsync_controller_test {{{
47ohos_unittest("vsync_controller_test") {
48  module_out_path = module_out_path
49
50  sources = [ "vsync_controller_test.cpp" ]
51
52  deps = [ ":vsync_test_common" ]
53}
54
55## UnitTest vsync_controller_test }}}
56
57## UnitTest vsync_distributor_test {{{
58ohos_unittest("vsync_distributor_test") {
59  module_out_path = module_out_path
60
61  sources = [ "vsync_distributor_test.cpp" ]
62
63  deps = [
64    ":vsync_test_common",
65    "//foundation/graphic/graphic_2d/utils:socketpair",
66  ]
67}
68
69## UnitTest vsync_distributor_test }}}
70
71## UnitTest vsync_generator_test {{{
72ohos_unittest("vsync_generator_test") {
73  module_out_path = module_out_path
74
75  sources = [ "vsync_generator_test.cpp" ]
76
77  deps = [ ":vsync_test_common" ]
78
79  external_deps = [
80    "eventhandler:libeventhandler",
81    "ipc:ipc_core",
82  ]
83}
84
85## UnitTest vsync_generator_test }}}
86
87## UnitTest vsync_receiver_test {{{
88ohos_unittest("vsync_receiver_test") {
89  module_out_path = module_out_path
90
91  sources = [ "vsync_receiver_test.cpp" ]
92
93  deps = [
94    ":vsync_test_common",
95    "../../../../../modules/platform:eventhandler",
96    "../../../../../modules/render_service_client:librender_service_client",
97    "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
98    "//foundation/graphic/graphic_2d/utils:socketpair",
99  ]
100}
101
102## UnitTest vsync_receiver_test }}}
103
104## UnitTest vsync_sampler_test {{{
105ohos_unittest("vsync_sampler_test") {
106  module_out_path = module_out_path
107
108  sources = [ "vsync_sampler_test.cpp" ]
109
110  deps = [ ":vsync_test_common" ]
111}
112
113## UnitTest vsync_sampler_test }}}
114
115## UnitTest native {{{
116ohos_unittest("native_vsync_test") {
117  module_out_path = module_out_path
118
119  sources = [ "native_vsync_test.cpp" ]
120
121  deps = [ ":vsync_test_common" ]
122}
123
124## UnitTest vsync_connection_test }}}
125
126## Build vsync_test_common.a {{{
127config("vsync_test_common_public_config") {
128  include_dirs = [
129    "//foundation/graphic/graphic_2d/interfaces/inner_api/common",
130    "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync/include",
131  ]
132
133  cflags = [
134    "-Wall",
135    "-Werror",
136    "-g3",
137    "-Dprivate=public",
138    "-Dprotected=public",
139  ]
140}
141
142ohos_static_library("vsync_test_common") {
143  visibility = [ ":*" ]
144  testonly = true
145
146  public_configs = [ ":vsync_test_common_public_config" ]
147
148  public_deps = [
149    "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync",
150    "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync:libvsync",
151    "//third_party/googletest:gmock_main",
152    "//third_party/googletest:gtest_main",
153  ]
154
155  public_external_deps = [
156    "c_utils:utils",
157    "graphic_surface:surface",
158  ]
159
160  subsystem_name = "graphic"
161  part_name = "graphic_2d"
162}
163## Build vsync_test_common.a }}}
164