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 19avcodec_unittest_cflags = [ 20 "-std=c++17", 21 "-frtti", 22 "-fexceptions", 23 "-Wall", 24 "-fno-common", 25 "-fstack-protector-strong", 26 "-Wshadow", 27 "-FPIC", 28 "-FS", 29 "-O2", 30 "-D_FORTIFY_SOURCE=2", 31 "-fvisibility=hidden", 32 "-Wformat=2", 33 "-Wdate-time", 34 "-Werror", 35 "-Wextra", 36 "-Wimplicit-fallthrough", 37 "-Wsign-compare", 38 "-Wunused-parameter", 39] 40 41################################################################################################################## 42ohos_unittest("avformat_capi_unit_test") { 43 module_out_path = module_output_path 44 include_dirs = [ 45 "./", 46 "./capi", 47 "$av_codec_root_dir/interfaces/inner_api/native", 48 "$av_codec_root_dir/interfaces/kits/c", 49 ] 50 51 cflags = avcodec_unittest_cflags 52 53 if (av_codec_support_test) { 54 sources = [ 55 "./avformat_unit_test.cpp", 56 "./capi/avformat_capi_mock.cpp", 57 "./capi/avformat_capi_mock_factory.cpp", 58 ] 59 } 60 61 deps = [ "$av_codec_root_dir/interfaces/kits/c:capi_packages" ] 62 public_deps = [ "$av_codec_root_dir/services/utils:av_codec_format" ] 63 resource_config_file = 64 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 65} 66 67################################################################################################################## 68ohos_unittest("avformat_inner_unit_test") { 69 module_out_path = module_output_path 70 include_dirs = [ 71 "./", 72 "./inner", 73 "$av_codec_root_dir/interfaces/inner_api/native", 74 "$av_codec_root_dir/interfaces/kits/c", 75 ] 76 cflags = avcodec_unittest_cflags 77 sources = [ 78 "./avformat_unit_test.cpp", 79 "./inner/avformat_inner_mock.cpp", 80 "./inner/avformat_inner_mock_factory.cpp", 81 ] 82 public_deps = [ "$av_codec_root_dir/services/utils:av_codec_format" ] 83 resource_config_file = 84 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 85} 86