1# Copyright (c) 2021 - 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("../../camera.gni")
15
16if (defined(ohos_lite)) {
17  import("//build/lite/config/test.gni")
18  import("../../../../hdf_core/adapter/uhdf/uhdf.gni")
19
20  config("cameraTest_config") {
21    visibility = [ ":*" ]
22  }
23
24  unittest("camera_case_liteos") {
25    output_extension = "bin"
26    output_dir = "$root_out_dir/test/unittest/hdf"
27    sources = [
28      "$camera_path/../../interfaces/hdi_passthrough/callback/src/camera_device_callback.cpp",
29      "$camera_path/../../interfaces/hdi_passthrough/callback/src/camera_host_callback.cpp",
30      "$camera_path/../../interfaces/hdi_passthrough/callback/src/stream_operator_callback.cpp",
31      "./src/adapter_test.cpp",
32      "./src/buffer_manager_test.cpp",
33      "./src/camera_3a_test.cpp",
34      "./src/capture_test.cpp",
35      "./src/common.cpp",
36      "./src/device_manager_test.cpp",
37      "./src/dfx_test.cpp",
38      "./src/flashlight_test.cpp",
39      "./src/hdi_callback_test.cpp",
40      "./src/hdi_device_test.cpp",
41      "./src/hdi_host_test.cpp",
42      "./src/hdi_stream_test.cpp",
43      "./src/offline_stream_test.cpp",
44      "./src/open_camera_test.cpp",
45      "./src/performance_func_test.cpp",
46      "./src/performance_hdi_test.cpp",
47      "./src/pipeline_test.cpp",
48      "./src/preview_test.cpp",
49      "./src/resolution_test.cpp",
50      "./src/stability_test.cpp",
51      "./src/video_test.cpp",
52    ]
53
54    include_dirs = [
55      "//third_party/googletest/googletest/include/gtest",
56      "./include",
57      "$camera_path/../../interfaces/include",
58      "$camera_path/../../interfaces/hdi_passthrough",
59      "$camera_path/../../interfaces/hdi_passthrough/callback/include",
60      "$camera_path/include",
61      "$camera_path/metadata_lite",
62      "$camera_path/../../hdi_service/v1_0/include",
63      "$camera_path/device_manager/include/",
64      "$camera_path/device_manager/include/mpi",
65      "$camera_path/utils/event",
66      "$camera_path/../../base",
67      "$camera_path/../../display/interfaces/include",
68
69      #producer
70      "$camera_path/pipeline_core/utils",
71      "$camera_path/pipeline_core/include",
72      "$camera_path/pipeline_core/host_stream/include",
73      "$camera_path/pipeline_core/nodes/include",
74      "$camera_path/pipeline_core/nodes/src/node_base",
75      "$camera_path/pipeline_core/nodes/src/dummy_node",
76      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
77      "$camera_path/pipeline_core/pipeline_impl/include",
78      "$camera_path/pipeline_core/pipeline_impl/src",
79      "$camera_path/pipeline_core/pipeline_impl/src/builder",
80      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
81      "$camera_path/pipeline_core/pipeline_impl/src/parser",
82      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
83      "$camera_path/pipeline_core/ipp/include",
84    ]
85
86    public_deps = [
87      "$board_camera_path/device_manager:camera_device_manager",
88      "$board_camera_path/pipeline_core:camera_pipeline_core",
89      "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0",
90      "$camera_path/buffer_manager:camera_buffer_manager",
91      "../../../../hdf_core/adapter/uhdf/manager:hdf_core",
92    ]
93    external_deps = [
94      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
95      "drivers_interface_camera:metadata",
96      "graphic_surface:surface",
97      "hdf_core:hdf_posix_osal",
98      "hilog_lite:hilog_shared",
99      "init:libbegetutil",
100    ]
101  }
102} else {
103  import("//build/ohos.gni")
104  import("//build/test.gni")
105  import("../../../../hdf_core/adapter/uhdf2/uhdf.gni")
106
107  module_output_path = "hdf/camera"
108
109  config("cameraTest_config") {
110    visibility = [ ":*" ]
111  }
112
113  ohos_unittest("camera_case_unittest") {
114    testonly = true
115    module_out_path = module_output_path
116    sources = [
117      "./src/adapter_test.cpp",
118      "./src/buffer_manager_test.cpp",
119      "./src/camera_3a_test.cpp",
120      "./src/capture_test.cpp",
121      "./src/common.cpp",
122      "./src/device_manager_test.cpp",
123      "./src/dfx_test.cpp",
124      "./src/flashlight_test.cpp",
125      "./src/hdi_callback_test.cpp",
126      "./src/hdi_device_test.cpp",
127      "./src/hdi_host_test.cpp",
128      "./src/hdi_stream_test.cpp",
129      "./src/offline_stream_test.cpp",
130      "./src/open_camera_test.cpp",
131      "./src/performance_func_test.cpp",
132      "./src/performance_hdi_test.cpp",
133      "./src/pipeline_test.cpp",
134      "./src/preview_test.cpp",
135      "./src/resolution_test.cpp",
136      "./src/stability_test.cpp",
137      "./src/video_test.cpp",
138    ]
139
140    include_dirs = [
141      "//third_party/googletest/googletest/include/gtest",
142      "./include",
143      "$camera_path/../../interfaces/include",
144      "$camera_path/../../interfaces/hdi_ipc",
145      "$camera_path/../../interfaces/hdi_ipc/server/include",
146      "$camera_path/../../interfaces/hdi_ipc/utils/include",
147      "$camera_path/../../interfaces/hdi_ipc/client/include",
148      "$camera_path/../../interfaces/hdi_ipc/callback/host/include",
149      "$camera_path/../../interfaces/hdi_ipc/callback/device/include",
150      "$camera_path/../../interfaces/hdi_ipc/callback/operator/include",
151      "$camera_path/include",
152      "$camera_path/../../hdi_service/v1_0/include",
153      "$camera_path/device_manager/include/",
154      "$camera_path/device_manager/include/mpi",
155      "$camera_path/utils/event",
156
157      #producer
158      "$camera_path/pipeline_core/utils",
159      "$camera_path/pipeline_core/include",
160      "$camera_path/pipeline_core/host_stream/include",
161      "$camera_path/pipeline_core/nodes/include",
162      "$camera_path/pipeline_core/nodes/src/node_base",
163      "$camera_path/pipeline_core/nodes/src/dummy_node",
164      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
165      "$camera_path/pipeline_core/pipeline_impl/include",
166      "$camera_path/pipeline_core/pipeline_impl/src",
167      "$camera_path/pipeline_core/pipeline_impl/src/builder",
168      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
169      "$camera_path/pipeline_core/pipeline_impl/src/parser",
170      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
171      "$camera_path/pipeline_core/ipp/include",
172    ]
173
174    deps = [
175      "$board_camera_path/device_manager:camera_device_manager",
176      "$board_camera_path/pipeline_core:camera_pipeline_core",
177      "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0_static",
178      "$camera_path/buffer_manager:camera_buffer_manager",
179      "//third_party/googletest:gmock",
180      "//third_party/googletest:gmock_main",
181      "//third_party/googletest:gtest",
182      "//third_party/googletest:gtest_main",
183    ]
184
185    if (is_standard_system) {
186      external_deps = [
187        "c_utils:utils",
188        "hdf_core:libhdf_ipc_adapter",
189        "hdf_core:libhdf_utils",
190        "hdf_core:libhdi",
191        "hilog:libhilog",
192        "ipc:ipc_single",
193      ]
194    } else {
195      external_deps = [ "hilog:libhilog" ]
196    }
197
198    external_deps += [
199      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
200      "drivers_interface_camera:libcamera_proxy_1.0",
201      "drivers_interface_camera:metadata",
202      "graphic_surface:surface",
203      "init:libbegetutil",
204      "ipc:ipc_single",
205      "samgr:samgr_proxy",
206    ]
207
208    public_configs = [ ":cameraTest_config" ]
209  }
210}
211