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
80## UnitTest vsync_generator_test }}}
81
82## UnitTest vsync_receiver_test {{{
83ohos_unittest("vsync_receiver_test") {
84  module_out_path = module_out_path
85
86  sources = [ "vsync_receiver_test.cpp" ]
87
88  deps = [
89    ":vsync_test_common",
90    "../../../../../modules/platform:eventhandler",
91    "../../../../../modules/render_service_client:librender_service_client",
92    "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
93    "//foundation/graphic/graphic_2d/utils:socketpair",
94  ]
95}
96
97## UnitTest vsync_receiver_test }}}
98
99## UnitTest vsync_sampler_test {{{
100ohos_unittest("vsync_sampler_test") {
101  module_out_path = module_out_path
102
103  sources = [ "vsync_sampler_test.cpp" ]
104
105  deps = [ ":vsync_test_common" ]
106}
107
108## UnitTest vsync_sampler_test }}}
109
110## UnitTest native {{{
111ohos_unittest("native_vsync_test") {
112  module_out_path = module_out_path
113
114  sources = [ "native_vsync_test.cpp" ]
115
116  deps = [ ":vsync_test_common" ]
117}
118
119## UnitTest vsync_connection_test }}}
120
121## Build vsync_test_common.a {{{
122config("vsync_test_common_public_config") {
123  include_dirs = [
124    "//foundation/graphic/graphic_2d/interfaces/inner_api/common",
125    "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync/include",
126  ]
127
128  cflags = [
129    "-Wall",
130    "-Werror",
131    "-g3",
132    "-Dprivate=public",
133    "-Dprotected=public",
134  ]
135}
136
137ohos_static_library("vsync_test_common") {
138  visibility = [ ":*" ]
139  testonly = true
140
141  public_configs = [ ":vsync_test_common_public_config" ]
142
143  public_deps = [
144    "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync",
145    "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync:libvsync",
146    "//third_party/googletest:gmock_main",
147    "//third_party/googletest:gtest_main",
148  ]
149
150  public_external_deps = [
151    "c_utils:utils",
152    "graphic_surface:surface",
153  ]
154
155  subsystem_name = "graphic"
156  part_name = "graphic_2d"
157}
158## Build vsync_test_common.a }}}
159