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. 13import("//build/test.gni") 14import("//foundation/multimedia/av_codec/config.gni") 15 16module_output_path = "av_codec/unittest" 17 18av_codec_unittest_include_dirs = [ 19 "$av_codec_root_dir/interfaces/inner_api/native", 20 "$av_codec_root_dir/interfaces/interfaces/inner_api/native", 21] 22 23av_codec_unittest_cflags = [ 24 "-std=c++17", 25 "-fno-rtti", 26 "-fno-exceptions", 27 "-Wall", 28 "-fno-common", 29 "-fstack-protector-strong", 30 "-Wshadow", 31 "-FPIC", 32 "-FS", 33 "-O2", 34 "-D_FORTIFY_SOURCE=2", 35 "-fvisibility=hidden", 36 "-Wformat=2", 37 "-Wdate-time", 38 "-Werror", 39 "-Wextra", 40 "-Wimplicit-fallthrough", 41 "-Wsign-compare", 42 "-Wunused-parameter", 43] 44 45################################################################################################################## 46ohos_unittest("audio_vivid_capi_unit_test") { 47 sanitize = av_codec_test_sanitize 48 module_out_path = module_output_path 49 include_dirs = av_codec_unittest_include_dirs 50 include_dirs += [ 51 "./", 52 "$av_codec_root_dir/interfaces/kits/c", 53 "$av_codec_root_dir/services/engine/common/include", 54 "$av_codec_root_dir/services/engine/base/include", 55 "$av_codec_root_dir/services/utils/include", 56 "$av_codec_root_dir/services/engine/codec/include/audio", 57 "$av_codec_root_dir/services/engine/factory", 58 ] 59 60 cflags = av_codec_unittest_cflags 61 62 cflags_cc = cflags 63 64 public_configs = [] 65 66 if (av_codec_support_test) { 67 sources = [ "./audio_decoder_capi_avbuffer_vivid_unit_test.cpp" ] 68 } 69 70 deps = [ 71 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 72 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 73 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 74 "$av_codec_root_dir/services/services:av_codec_service", 75 "$av_codec_root_dir/services/utils:av_codec_service_utils", 76 ] 77 78 external_deps = [ 79 "ffmpeg:libohosffmpeg", 80 "graphic_surface:surface", 81 "media_foundation:native_media_core", 82 ] 83 84 resource_config_file = 85 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 86} 87 88################################################################################################################## 89ohos_unittest("audio_vivid_inner_unit_test") { 90 sanitize = av_codec_test_sanitize 91 module_out_path = module_output_path 92 include_dirs = av_codec_unittest_include_dirs 93 include_dirs += [ 94 "./", 95 "$av_codec_root_dir/interfaces/kits/c", 96 "$av_codec_root_dir/services/engine/common/include", 97 "$av_codec_root_dir/services/engine/base/include", 98 "$av_codec_root_dir/services/utils/include", 99 "$av_codec_root_dir/services/engine/codec/include/audio", 100 "$av_codec_root_dir/services/engine/factory", 101 ] 102 103 cflags = av_codec_unittest_cflags 104 105 cflags_cc = cflags 106 107 public_configs = [] 108 109 if (av_codec_support_test) { 110 sources = [ "./audio_decoder_avbuffer_vivid_inner_unit_test.cpp" ] 111 } 112 113 deps = [ 114 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 115 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 116 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 117 "$av_codec_root_dir/services/services:av_codec_service", 118 "$av_codec_root_dir/services/utils:av_codec_service_utils", 119 ] 120 121 external_deps = [ 122 "ffmpeg:libohosffmpeg", 123 "graphic_surface:surface", 124 "media_foundation:native_media_core", 125 ] 126 127 resource_config_file = 128 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 129} 130 131################################################################################################################## 132ohos_unittest("audio_vivid_ability_unit_test") { 133 sanitize = av_codec_test_sanitize 134 module_out_path = module_output_path 135 include_dirs = av_codec_unittest_include_dirs 136 include_dirs += [ 137 "./", 138 "$av_codec_root_dir/interfaces/kits/c", 139 "$av_codec_root_dir/services/engine/common/include", 140 "$av_codec_root_dir/services/engine/base/include", 141 "$av_codec_root_dir/services/utils/include", 142 "$av_codec_root_dir/services/engine/codec/include/audio", 143 "$av_codec_root_dir/services/engine/factory", 144 ] 145 146 cflags = av_codec_unittest_cflags 147 148 cflags_cc = cflags 149 150 public_configs = [] 151 152 if (av_codec_support_test) { 153 sources = [ "./audio_decoder_avbuffer_vivid_unit_test.cpp" ] 154 } 155 156 deps = [ 157 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 158 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 159 "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec", 160 "$av_codec_root_dir/services/services:av_codec_service", 161 "$av_codec_root_dir/services/utils:av_codec_service_utils", 162 ] 163 164 external_deps = [ 165 "ffmpeg:libohosffmpeg", 166 "graphic_surface:surface", 167 "media_foundation:native_media_core", 168 ] 169 170 resource_config_file = 171 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 172} 173