# 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("//build/test.gni")
import("./../../../audio.gni")

ohos_unittest("audio_ut_common_test") {
  module_out_path = "drivers_peripheral_audio/audio"
  sources = [
    "adapter/audio_adapter_common_test.cpp",
    "capture/audio_capture_common_test.cpp",
    "capture/audio_capture_mmap_test.cpp",
    "manager/audio_manager_common_test.cpp",
    "render/audio_render_common_test.cpp",
    "render/audio_render_mmap_test.cpp",
  ]

  if (!drivers_peripheral_audio_feature_community) {
    sources += [
      "adapter/audio_adapter_direct_test.cpp",
      "adapter/audio_adapter_multchannel_test.cpp",
    ]
  }
  if (drivers_peripheral_audio_feature_offload) {
    sources += [ "render/audio_render_offload_test.cpp" ]
  }

  include_dirs =
      [ "./../../../hdi_service/primary_impl/vendor_include/include" ]

  external_deps = [
    "bounds_checking_function:libsec_shared",
    "drivers_interface_audio:libaudio_proxy_4.0",
    "hdf_core:libhdf_utils",
  ]
  if (defined(ohos_lite)) {
    external_deps += [ "hilog_lite:hilog_share" ]
  } else {
    external_deps += [ "hilog:libhilog" ]
  }
  if (enable_c_utils) {
    external_deps += [ "c_utils:utils" ]
  }

  if (drivers_peripheral_audio_feature_alsa_lib) {
    cflags_cc = [ "-DALSA_SUPPORT_FEATURE" ]
  }
}

group("hdi_base_common") {
  if (!defined(ohos_lite)) {
    testonly = true
    deps = [ ":audio_ut_common_test" ]
  }
}