1# Copyright (c) 2024 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_surface/graphic_surface_config.gni") 16 17if (graphic_2d_ext_delegator && graphic_2d_ext_delegator_gni != "") { 18 import("${graphic_2d_ext_delegator_gni}") 19} 20 21module_out_path = "graphic_surface/surface" 22 23group("unittest") { 24 testonly = true 25 26 deps = [ 27 ":buffer_client_producer_remote_test", 28 ":buffer_queue_consumer_test", 29 ":buffer_queue_producer_remote_test", 30 ":buffer_queue_producer_test", 31 ":buffer_utils_test", 32 ":metadata_helper_test", 33 ":native_buffer_test", 34 ":producer_surface_delegator_test", 35 ":producer_surface_test", 36 ] 37} 38 39## UnitTest producer_surface_delegator_test {{{ 40ohos_unittest("producer_surface_delegator_test") { 41 module_out_path = module_out_path 42 43 sources = [] 44 if (graphic_2d_ext_delegator && 45 defined(libsurface_ext_test_producer_delegator_src)) { 46 sources += libsurface_ext_test_producer_delegator_src 47 } else { 48 sources += [ "producer_surface_delegator_test.cpp" ] 49 } 50 51 deps = [ ":surface_test_common" ] 52 external_deps = [ "bounds_checking_function:libsec_shared" ] 53} 54 55## UnitTest producer_surface_delegator_test }}} 56 57## UnitTest buffer_client_producer_remote_test {{{ 58ohos_unittest("buffer_client_producer_remote_test") { 59 module_out_path = module_out_path 60 61 sources = [ "buffer_client_producer_remote_test.cpp" ] 62 63 deps = [ ":surface_test_common" ] 64} 65 66## UnitTest buffer_client_producer_remote_test }}} 67 68## UnitTest buffer_queue_consumer_test {{{ 69ohos_unittest("buffer_queue_consumer_test") { 70 module_out_path = module_out_path 71 72 sources = [ "buffer_queue_consumer_test.cpp" ] 73 74 deps = [ ":surface_test_common" ] 75} 76 77## UnitTest buffer_queue_consumer_test }}} 78 79## UnitTest buffer_queue_producer_remote_test {{{ 80ohos_unittest("buffer_queue_producer_remote_test") { 81 module_out_path = module_out_path 82 83 sources = [ "buffer_queue_producer_remote_test.cpp" ] 84 85 deps = [ ":surface_test_common" ] 86} 87 88## UnitTest buffer_queue_producer_remote_test }}} 89 90## UnitTest buffer_queue_producer_test {{{ 91ohos_unittest("buffer_queue_producer_test") { 92 module_out_path = module_out_path 93 94 sources = [ "buffer_queue_producer_test.cpp" ] 95 96 deps = [ ":surface_test_common" ] 97} 98 99## UnitTest buffer_queue_producer_test }}} 100 101## UnitTest producer_surface_test {{{ 102ohos_unittest("producer_surface_test") { 103 module_out_path = module_out_path 104 105 sources = [ "producer_surface_test.cpp" ] 106 107 deps = [ ":surface_test_common" ] 108 external_deps = [ 109 "bounds_checking_function:libsec_shared", 110 "drivers_interface_display:display_commontype_idl_headers_1.1", 111 ] 112} 113 114## UnitTest producer_surface_test }}} 115 116## UnitTest metadata_helper_test {{{ 117ohos_unittest("metadata_helper_test") { 118 module_out_path = module_out_path 119 120 sources = [ "metadata_helper_test.cpp" ] 121 122 deps = [ ":surface_test_common" ] 123 124 external_deps = [ 125 "c_utils:utils", 126 "drivers_interface_display:display_commontype_idl_headers", 127 "hilog:libhilog", 128 ] 129} 130 131## UnitTest metadata_helper_test }}} 132 133## UnitTest native_buffer_test {{{ 134ohos_unittest("native_buffer_test") { 135 module_out_path = module_out_path 136 137 sources = [ "native_buffer_test.cpp" ] 138 139 deps = [ ":surface_test_common" ] 140 141 external_deps = [ 142 "c_utils:utils", 143 "hilog:libhilog", 144 ] 145} 146 147## UnitTest native_buffer_test }}} 148 149## UnitTest buffer_utils_test {{{ 150ohos_unittest("buffer_utils_test") { 151 module_out_path = module_out_path 152 153 sources = [ "buffer_utils_test.cpp" ] 154 155 deps = [ ":surface_test_common" ] 156} 157 158## UnitTest buffer_utils_test }}} 159 160## Build surface_test_common.a {{{ 161config("surface_test_common_public_config") { 162 include_dirs = [ "../../include" ] 163 164 cflags = [ 165 "-Wall", 166 "-Werror", 167 "-g3", 168 "-Dprivate=public", 169 "-Dprotected=public", 170 ] 171} 172 173ohos_static_library("surface_test_common") { 174 visibility = [ ":*" ] 175 testonly = true 176 177 public_configs = [ ":surface_test_common_public_config" ] 178 179 public_deps = [ 180 "$graphic_surface_root/buffer_handle:buffer_handle", 181 "$graphic_surface_root/surface:surface", 182 "$graphic_surface_root/sync_fence:sync_fence", 183 "$graphic_surface_root/test_header:test_header", 184 ] 185 186 public_external_deps = [ 187 "access_token:libaccesstoken_sdk", 188 "access_token:libnativetoken", 189 "access_token:libtoken_setproc", 190 "c_utils:utils", 191 "hilog:libhilog", 192 "ipc:ipc_single", 193 "samgr:samgr_proxy", 194 ] 195 196 subsystem_name = "graphic" 197 part_name = "graphic_surface" 198} 199## Build surface_test_common.a }}} 200