# Copyright (c) 2022-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.

hdf_audio_path = "./../../../.."

if (defined(ohos_lite)) {
  import("//build/lite/config/test.gni")
  import("$hdf_audio_path/audio.gni")
} else {
  import("//build/test.gni")

  import("$hdf_audio_path/audio.gni")
}

if (defined(ohos_lite)) {
  ###########################LITEOS###########################
  ###########################hdf_audio_lib_render_test###########################
  unittest("hdf_audio_lib_render_test") {
    sources = [ "./src/audio_adm_if_lib_render_test.cpp" ]

    include_dirs = [
      "$hdf_audio_path/hal/hdi_passthrough/include",
      "$hdf_audio_path/interfaces/include",
      "$hdf_audio_path/supportlibs/adm_adapter/include",
      "$hdf_audio_path/supportlibs/interfaces/include",
      "//third_party/googletest/googletest/include/gtest",
    ]

    external_deps = [ "bounds_checking_function:libsec_shared" ]

    public_deps = [
      "$hdf_audio_path/hdi_service/supportlibs:audio_render_adapter",
      "//drivers/hdf_core/adapter/uhdf/manager:hdf_core",
      "//drivers/hdf_core/adapter/uhdf/posix:hdf_posix_osal",
      "//third_party/googletest:gmock_main",
      "//third_party/googletest:gtest_main",
    ]
  }
} else {
  ###########################unittest###########################
  module_output_path = "drivers_peripheral_audio/drivers_peripheral_audio"

  ###########################hdf_audio_lib_render_test###########################
  ohos_unittest("hdf_audio_lib_render_test") {
    module_out_path = module_output_path
    sources = []
    include_dirs = []
    if (drivers_peripheral_audio_feature_alsa_lib) {
      sources += [ "./src/audio_alsa_if_lib_render_test.cpp" ]
      include_dirs += [
        "$hdf_audio_path/supportlibs/alsa_adapter/include",
        "//third_party/alsa-lib/include",
      ]
    } else {
      sources += [ "./src/audio_adm_if_lib_render_test.cpp" ]
      include_dirs += [ "$hdf_audio_path/supportlibs/adm_adapter/include" ]
    }

    include_dirs += [
      "$hdf_audio_path/hal/hdi_passthrough/include",
      "$hdf_audio_path/interfaces/include",
      "$hdf_audio_path/supportlibs/interfaces/include",
    ]

    deps = [ "$hdf_audio_path/hdi_service/supportlibs:audio_render_adapter" ]

    if (is_standard_system) {
      external_deps = [
        "hdf_core:libhdf_utils",
        "hilog:libhilog",
      ]
      if (enable_c_utils) {
        external_deps += [ "c_utils:utils" ]
      }
    } else if (defined(ohos_lite)) {
      external_deps = [ "hilog_lite:hilog_shared" ]
    }
    external_deps += [
      "bounds_checking_function:libsec_shared",
      "googletest:gmock_main",
      "googletest:gtest_main",
    ]
  }
}