1# Copyright (c) 2023 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/multimedia/av_codec/config.gni") 16 17module_output_path = "av_codec/unittest" 18 19av_codec_unittest_include_dirs = [ 20 "$av_codec_root_dir/interfaces/inner_api/native", 21 "$av_codec_root_dir/interfaces/interfaces/inner_api/native", 22] 23 24av_codec_unittest_cflags = [ 25 "-std=c++17", 26 "-fno-rtti", 27 "-fno-exceptions", 28 "-Wall", 29 "-fno-common", 30 "-fstack-protector-strong", 31 "-Wshadow", 32 "-FPIC", 33 "-FS", 34 "-O2", 35 "-D_FORTIFY_SOURCE=2", 36 "-fvisibility=hidden", 37 "-Wformat=2", 38 "-Wdate-time", 39 "-Werror", 40 "-Wextra", 41 "-Wimplicit-fallthrough", 42 "-Wsign-compare", 43 "-Wunused-parameter", 44] 45 46################################################################################################################## 47ohos_unittest("av_video_capi_unit_test") { 48 module_out_path = module_output_path 49 include_dirs = av_codec_unittest_include_dirs 50 include_dirs += [ 51 "./", 52 "//third_party/ffmpeg", 53 "$av_codec_root_dir/interfaces/kits/c", 54 "$av_codec_root_dir/services/engine/common/include", 55 "$av_codec_root_dir/services/engine/base/include", 56 "$av_codec_root_dir/services/utils/include", 57 "$av_codec_root_dir/services/engine/codec/include/audio", 58 "$av_codec_root_dir/services/engine/factory", 59 "$av_codec_root_dir/test/unittest/common", 60 "$av_codec_root_dir/../../graphic/graphic_2d/interfaces/inner_api", 61 ] 62 63 cflags = av_codec_unittest_cflags 64 65 cflags_cc = cflags 66 67 public_configs = [] 68 69 if (av_codec_support_test) { 70 sources = [ "./video_test/video_decoder_capi_unit_test.cpp" ] 71 } 72 73 deps = [ 74 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 75 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 76 "$av_codec_root_dir/services/engine/codec/video:av_codec_video_ffmpeg_codec", 77 "$av_codec_root_dir/services/services:av_codec_service", 78 "$av_codec_root_dir/services/utils:av_codec_format", 79 ] 80 81 external_deps = [ 82 "c_utils:utils", 83 "graphic_2d:libgraphic_utils", 84 "graphic_2d:surface", 85 "graphic_2d:sync_fence", 86 "hilog:libhilog", 87 "ipc:ipc_core", 88 ] 89 90 resource_config_file = 91 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 92} 93 94################################################################################################################## 95ohos_unittest("av_audio_capi_unit_test") { 96 module_out_path = module_output_path 97 include_dirs = av_codec_unittest_include_dirs 98 include_dirs += [ 99 "./", 100 "//third_party/ffmpeg", 101 "$av_codec_root_dir/interfaces/kits/c", 102 "$av_codec_root_dir/services/engine/common/include", 103 "$av_codec_root_dir/services/engine/base/include", 104 "$av_codec_root_dir/services/utils/include", 105 "$av_codec_root_dir/services/engine/codec/include/audio", 106 "$av_codec_root_dir/services/engine/factory", 107 ] 108 109 cflags = av_codec_unittest_cflags 110 111 cflags_cc = cflags 112 113 public_configs = [] 114 115 if (av_codec_support_test) { 116 sources = [ "./audio_test/audio_decoder_capi_unit_test.cpp" ] 117 } 118 119 deps = [ 120 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 121 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 122 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 123 "$av_codec_root_dir/services/services:av_codec_service", 124 "$av_codec_root_dir/services/services:av_codec_service", 125 "$av_codec_root_dir/services/utils:av_codec_format", 126 ] 127 128 external_deps = [ "graphic_2d:surface" ] 129 130 resource_config_file = 131 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 132} 133 134################################################################################################################## 135ohos_unittest("av_audio_codecbase_unit_test") { 136 module_out_path = module_output_path 137 include_dirs = av_codec_unittest_include_dirs 138 include_dirs += [ 139 "./", 140 "//third_party/ffmpeg", 141 "$av_codec_root_dir/interfaces/kits/c", 142 "$av_codec_root_dir/services/engine/common/include", 143 "$av_codec_root_dir/services/engine/base/include", 144 "$av_codec_root_dir/services/utils/include", 145 "$av_codec_root_dir/services/engine/codec/include/audio", 146 "$av_codec_root_dir/services/engine/factory", 147 ] 148 149 cflags = av_codec_unittest_cflags 150 151 cflags_cc = cflags 152 153 public_configs = [] 154 155 if (av_codec_support_test) { 156 sources = [ "./audio_test/audio_decoder_codecbase_unit_test.cpp" ] 157 } 158 159 deps = [ 160 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 161 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 162 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 163 "$av_codec_root_dir/services/services:av_codec_service", 164 "$av_codec_root_dir/services/services:av_codec_service", 165 "$av_codec_root_dir/services/utils:av_codec_format", 166 ] 167 168 external_deps = [ "graphic_2d:surface" ] 169 170 resource_config_file = 171 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 172} 173 174################################################################################################################## 175ohos_unittest("av_audio_decode_ability_unit_test") { 176 module_out_path = module_output_path 177 include_dirs = av_codec_unittest_include_dirs 178 include_dirs += [ 179 "./", 180 "//third_party/ffmpeg", 181 "$av_codec_root_dir/interfaces/kits/c", 182 "$av_codec_root_dir/services/engine/common/include", 183 "$av_codec_root_dir/services/engine/base/include", 184 "$av_codec_root_dir/services/utils/include", 185 "$av_codec_root_dir/services/engine/codec/include/audio", 186 "$av_codec_root_dir/services/engine/factory", 187 ] 188 189 cflags = av_codec_unittest_cflags 190 191 cflags_cc = cflags 192 193 public_configs = [] 194 195 if (av_codec_support_test) { 196 sources = [ "./audio_test/audio_decoder_ability_unit_test.cpp" ] 197 } 198 199 deps = [ 200 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 201 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 202 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 203 "$av_codec_root_dir/services/services:av_codec_service", 204 "$av_codec_root_dir/services/services:av_codec_service", 205 "$av_codec_root_dir/services/utils:av_codec_format", 206 ] 207 208 external_deps = [ "graphic_2d:surface" ] 209 210 resource_config_file = 211 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 212} 213 214################################################################################################################## 215ohos_unittest("av_audio_inner_unit_test") { 216 module_out_path = module_output_path 217 include_dirs = av_codec_unittest_include_dirs 218 include_dirs += [ 219 "./", 220 "//third_party/ffmpeg", 221 "$av_codec_root_dir/interfaces/kits/c", 222 "$av_codec_root_dir/services/engine/common/include", 223 "$av_codec_root_dir/services/engine/base/include", 224 "$av_codec_root_dir/services/utils/include", 225 "$av_codec_root_dir/services/engine/codec/include/audio", 226 "$av_codec_root_dir/services/engine/factory", 227 ] 228 229 cflags = av_codec_unittest_cflags 230 231 cflags_cc = cflags 232 233 public_configs = [] 234 235 if (av_codec_support_test) { 236 sources = [ "./audio_test/audio_decoder_inner_unit_test.cpp" ] 237 } 238 239 deps = [ 240 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 241 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 242 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 243 "$av_codec_root_dir/services/services:av_codec_service", 244 "$av_codec_root_dir/services/services:av_codec_service", 245 "$av_codec_root_dir/services/utils:av_codec_format", 246 ] 247 248 external_deps = [ "graphic_2d:surface" ] 249 250 resource_config_file = 251 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 252} 253 254################################################################################################################## 255ohos_unittest("av_audio_encoder_capi_unit_test") { 256 module_out_path = module_output_path 257 include_dirs = av_codec_unittest_include_dirs 258 include_dirs += [ 259 "./", 260 "//third_party/ffmpeg", 261 "$av_codec_root_dir/interfaces/kits/c", 262 "$av_codec_root_dir/services/engine/common/include", 263 "$av_codec_root_dir/services/engine/base/include", 264 "$av_codec_root_dir/services/utils/include", 265 "$av_codec_root_dir/services/engine/codec/include/audio", 266 "$av_codec_root_dir/services/engine/factory", 267 ] 268 269 cflags = av_codec_unittest_cflags 270 271 cflags_cc = cflags 272 273 public_configs = [] 274 275 if (av_codec_support_test) { 276 sources = [ "./audio_test/audio_encoder_capi_unit_test.cpp" ] 277 } 278 279 deps = [ 280 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 281 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 282 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 283 "$av_codec_root_dir/services/services:av_codec_service", 284 "$av_codec_root_dir/services/services:av_codec_service", 285 "$av_codec_root_dir/services/utils:av_codec_format", 286 ] 287 288 external_deps = [ "graphic_2d:surface" ] 289 290 resource_config_file = 291 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 292} 293