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    "//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  ]
60
61  cflags = av_codec_unittest_cflags
62
63  cflags_cc = cflags
64
65  public_configs = []
66
67  if (av_codec_support_test) {
68    sources = [ "./audio_decoder_capi_avbuffer_vivid_unit_test.cpp" ]
69  }
70
71  deps = [
72    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
73    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
74    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
75    "$av_codec_root_dir/services/services:av_codec_service",
76    "$av_codec_root_dir/services/utils:av_codec_service_utils",
77  ]
78
79  external_deps = [
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    "//third_party/ffmpeg",
96    "$av_codec_root_dir/interfaces/kits/c",
97    "$av_codec_root_dir/services/engine/common/include",
98    "$av_codec_root_dir/services/engine/base/include",
99    "$av_codec_root_dir/services/utils/include",
100    "$av_codec_root_dir/services/engine/codec/include/audio",
101    "$av_codec_root_dir/services/engine/factory",
102  ]
103
104  cflags = av_codec_unittest_cflags
105
106  cflags_cc = cflags
107
108  public_configs = []
109
110  if (av_codec_support_test) {
111    sources = [ "./audio_decoder_avbuffer_vivid_inner_unit_test.cpp" ]
112  }
113
114  deps = [
115    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
116    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
117    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
118    "$av_codec_root_dir/services/services:av_codec_service",
119    "$av_codec_root_dir/services/utils:av_codec_service_utils",
120  ]
121
122  external_deps = [
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    "//third_party/ffmpeg",
139    "$av_codec_root_dir/interfaces/kits/c",
140    "$av_codec_root_dir/services/engine/common/include",
141    "$av_codec_root_dir/services/engine/base/include",
142    "$av_codec_root_dir/services/utils/include",
143    "$av_codec_root_dir/services/engine/codec/include/audio",
144    "$av_codec_root_dir/services/engine/factory",
145  ]
146
147  cflags = av_codec_unittest_cflags
148
149  cflags_cc = cflags
150
151  public_configs = []
152
153  if (av_codec_support_test) {
154    sources = [ "./audio_decoder_avbuffer_vivid_unit_test.cpp" ]
155  }
156
157  deps = [
158    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
159    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
160    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
161    "$av_codec_root_dir/services/services:av_codec_service",
162    "$av_codec_root_dir/services/utils:av_codec_service_utils",
163  ]
164
165  external_deps = [
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