# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("../../../camera.gni")
camera_test_path = "//drivers/peripheral/camera/test/hdi/"

import("//build/ohos.gni")
import("//build/test.gni")

module_output_path = "drivers_peripheral_camera/camera"

config("camhdi_at_test_config") {
  visibility = [ ":*" ]
  cflags_cc = [
    "-DGST_DISABLE_DEPRECATED",
    "-DHAVE_CONFIG_H",
    "-DCOLORSPACE=\"videoconvert\"",
    "--coverage",
  ]
  ldflags = [ "--coverage" ]
}

ohos_unittest("camera_test_hdi_V1_1") {
  testonly = true
  module_out_path = module_output_path
  sources = [
    "$camera_test_path/v1_1/src/camera_hdi_uttest_v1_1.cpp",
    "$camera_test_path/v1_1/src/camera_prelaunch_uttest_v1_1.cpp",
    "$camera_test_path/v1_1/src/hdi_common_v1_1.cpp",
  ]

  UNITTEST_ALN_ENABLE = false
  if (UNITTEST_ALN_ENABLE) {
    sources += [
      "$camera_test_path/v1_1/src/camera_tag_uttest_v1_1.cpp",
      "$camera_test_path/v1_1/src/front_camera_tag_uttest_v1_1.cpp",
    ]
  }

  include_dirs = [
    # common includes
    "$camera_test_path/v1_1/include",
    "$camera_path/../../interfaces/include",
    "$camera_path/include",
  ]

  deps = []

  if (is_standard_system) {
    external_deps = [
      "c_utils:utils",
      "hdf_core:libhdf_host",
      "hdf_core:libhdf_ipc_adapter",
      "hdf_core:libhdf_utils",
      "hdf_core:libhdi",
      "hilog:libhilog",
      "ipc:ipc_single",
    ]
  } else {
    external_deps = [ "hilog:libhilog" ]
  }

  external_deps += [
    "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
    "drivers_interface_camera:libcamera_proxy_1.1",
    "drivers_interface_camera:metadata",
    "googletest:gmock_main",
    "googletest:gtest",
    "googletest:gtest_main",
    "graphic_surface:surface",
    "samgr:samgr_proxy",
  ]
  public_configs = [ ":camhdi_at_test_config" ]
}