• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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/player_framework/config.gni")
16
17module_output_path = "$MODULE_OUTPUT_PATH/avcodec"
18
19avcodec_unittest_native_include_dirs = [
20  "../../../../../../foundation/window/window_manager/interfaces/innerkits/wm",
21  "../../../interfaces/inner_api/native",
22  "../../../test/unittest/avcodec_test/native/audiodecoder/",
23  "../../../test/unittest/avcodec_test/native/audioencoder/",
24  "../../../test/unittest/avcodec_test/native/avcodec_info/",
25  "../../../test/unittest/avcodec_test/native/avcodec_list/",
26  "../../../test/unittest/avcodec_test/native/avformat/",
27  "../../../test/unittest/avcodec_test/native/avmemory/",
28  "../../../test/unittest/avcodec_test/native/enum/",
29  "../../../test/unittest/avcodec_test/native/surface/",
30  "../../../test/unittest/avcodec_test/native/videodecoder/",
31  "../../../test/unittest/avcodec_test/native/videoencoder/",
32  "../../../test/unittest/common/include/",
33]
34
35avcodec_unittest_cflags = [
36  "-std=c++17",
37  "-fno-rtti",
38  "-fno-exceptions",
39  "-Wall",
40  "-fno-common",
41  "-fstack-protector-strong",
42  "-Wshadow",
43  "-FPIC",
44  "-FS",
45  "-O2",
46  "-D_FORTIFY_SOURCE=2",
47  "-fvisibility=hidden",
48  "-Wformat=2",
49  "-Wdate-time",
50  "-Werror",
51  "-Wextra",
52  "-Wimplicit-fallthrough",
53  "-Wsign-compare",
54  "-Wunused-parameter",
55]
56
57##################################################################################################################
58ohos_unittest("vcodec_native_unit_test") {
59  module_out_path = module_output_path
60  include_dirs = avcodec_unittest_native_include_dirs
61  include_dirs += [
62    "./",
63    "./vcodec_test",
64  ]
65
66  cflags = avcodec_unittest_cflags
67
68  if (multimedia_player_framework_support_codec) {
69    sources = [
70      "./native/avcodec_info/avcodec_info_native_mock.cpp",
71      "./native/avcodec_list/avcodec_list_native_mock.cpp",
72      "./native/avcodec_mock_factory.cpp",
73      "./native/avformat/avformat_native_mock.cpp",
74      "./native/avmemory/avmemory_native_mock.cpp",
75      "./native/enum/enum_native_mock.cpp",
76      "./native/surface/surface_native_mock.cpp",
77      "./native/videodecoder/videodec_native_mock.cpp",
78      "./native/videoencoder/videoenc_native_mock.cpp",
79      "./vcodec_test/vcodec_unit_test.cpp",
80      "./vcodec_test/vdec_mock.cpp",
81      "./vcodec_test/venc_mock.cpp",
82    ]
83  }
84
85  deps = [
86    "../../../../../../foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
87    "../../../../../../foundation/window/window_manager/wm:libwm",
88  ]
89
90  external_deps = [
91    "c_utils:utils",
92    "graphic_surface:surface",
93    "hilog:libhilog",
94    "player_framework:media_client",
95  ]
96  resource_config_file = "../resources/ohos_test.xml"
97}
98
99##################################################################################################################
100ohos_unittest("acodec_native_unit_test") {
101  module_out_path = module_output_path
102  include_dirs = avcodec_unittest_native_include_dirs
103  include_dirs += [
104    "./",
105    "./acodec_test",
106  ]
107
108  cflags = avcodec_unittest_cflags
109
110  if (multimedia_player_framework_support_codec) {
111    sources = [
112      "./acodec_test/acodec_mock.cpp",
113      "./acodec_test/acodec_unit_test.cpp",
114      "./native/audiodecoder/audiodec_native_mock.cpp",
115      "./native/audioencoder/audioenc_native_mock.cpp",
116      "./native/avcodec_info/avcodec_info_native_mock.cpp",
117      "./native/avcodec_list/avcodec_list_native_mock.cpp",
118      "./native/avcodec_mock_factory.cpp",
119      "./native/avformat/avformat_native_mock.cpp",
120      "./native/avmemory/avmemory_native_mock.cpp",
121      "./native/enum/enum_native_mock.cpp",
122      "./native/surface/surface_native_mock.cpp",
123    ]
124  }
125
126  deps = [
127    "../../../../../../foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
128    "../../../../../../foundation/window/window_manager/wm:libwm",
129  ]
130
131  external_deps = [
132    "c_utils:utils",
133    "graphic_surface:surface",
134    "hilog:libhilog",
135    "player_framework:media_client",
136  ]
137  resource_config_file = "../resources/ohos_test.xml"
138}
139
140##################################################################################################################
141ohos_unittest("avcodec_list_native_unit_test") {
142  module_out_path = module_output_path
143  include_dirs = avcodec_unittest_native_include_dirs
144  include_dirs += [
145    "./",
146    "./avcodec_list_test",
147  ]
148
149  cflags = avcodec_unittest_cflags
150
151  if (multimedia_player_framework_support_codec) {
152    sources = [
153      "./avcodec_list_test/avcodec_list_unit_test.cpp",
154      "./native/avcodec_info/avcodec_info_native_mock.cpp",
155      "./native/avcodec_list/avcodec_list_native_mock.cpp",
156      "./native/avcodec_mock_factory.cpp",
157      "./native/avformat/avformat_native_mock.cpp",
158      "./native/enum/enum_native_mock.cpp",
159    ]
160  }
161
162  deps = [
163    "../../../../../../foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
164    "../../../../../../foundation/window/window_manager/wm:libwm",
165  ]
166
167  external_deps = [
168    "c_utils:utils",
169    "graphic_surface:surface",
170    "hilog:libhilog",
171    "player_framework:media_client",
172  ]
173  resource_config_file = "../resources/ohos_test.xml"
174}
175
176##################################################################################################################
177ohos_unittest("format_native_unit_test") {
178  module_out_path = module_output_path
179  include_dirs = avcodec_unittest_native_include_dirs
180  include_dirs += [
181    "./",
182    "./format_test",
183  ]
184  cflags = avcodec_unittest_cflags
185
186  if (multimedia_player_framework_support_codec) {
187    sources = [
188      "./format_test/format_unit_test.cpp",
189      "./native/avcodec_mock_factory.cpp",
190      "./native/avformat/avformat_native_mock.cpp",
191    ]
192  }
193
194  deps = [
195    "../../../../../../foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
196    "../../../../../../foundation/window/window_manager/wm:libwm",
197    "../../../../../../third_party/bounds_checking_function:libsec_shared",
198  ]
199
200  external_deps = [
201    "c_utils:utils",
202    "graphic_surface:surface",
203    "hilog:libhilog",
204    "player_framework:media_client",
205  ]
206}
207