include(audio)

set(TEST_SOURCES
    TestCICP.cpp
    TestDataProducers.cpp
    TestDecodedAudioProducer.cpp
    TestFFmpegAudioNormalization.cpp
    TestFFmpegDemuxer.cpp
    TestH264Decode.cpp
    TestIncrementallyPopulatedStream.cpp
    TestMatroskaDemuxer.cpp
    TestParseMatroska.cpp
    TestPlaybackStream.cpp
    TestVorbisDecode.cpp
    TestTimeRanges.cpp
    TestVP9Decode.cpp
    TestWav.cpp
)

foreach(source IN LISTS TEST_SOURCES)
    ladybird_test("${source}" LibMedia LIBS LibMedia LibFileSystem LibSync)
endforeach()

target_link_libraries(TestFFmpegDemuxer PRIVATE LibThreading)
target_link_libraries(TestIncrementallyPopulatedStream PRIVATE LibThreading)

if (LADYBIRD_AUDIO_BACKEND STREQUAL "PULSE")
    target_compile_definitions(TestPlaybackStream PRIVATE HAVE_PULSEAUDIO=1)
    target_link_libraries(TestPlaybackStream PRIVATE PkgConfig::PULSEAUDIO)
endif()
