From e7a41e864f68401606f72a0a0634a17bbfdce3ef Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 8 Sep 2024 09:55:23 -0600 Subject: [PATCH] Add tests for Audio module --- test/Audio/SoundChannel.test.cpp | 29 +++++++++++++++++++++++++++++ test/CMakeLists.txt | 7 +++++++ 2 files changed, 36 insertions(+) create mode 100644 test/Audio/SoundChannel.test.cpp diff --git a/test/Audio/SoundChannel.test.cpp b/test/Audio/SoundChannel.test.cpp new file mode 100644 index 0000000..59e9635 --- /dev/null +++ b/test/Audio/SoundChannel.test.cpp @@ -0,0 +1,29 @@ +#include + +#include + +#include + +TEST_CASE("[Audio] sfSoundChannel") +{ + STATIC_CHECK(sfSoundChannelUnspecified == static_cast(sf::SoundChannel::Unspecified)); + STATIC_CHECK(sfSoundChannelMono == static_cast(sf::SoundChannel::Mono)); + STATIC_CHECK(sfSoundChannelFrontLeft == static_cast(sf::SoundChannel::FrontLeft)); + STATIC_CHECK(sfSoundChannelFrontRight == static_cast(sf::SoundChannel::FrontRight)); + STATIC_CHECK(sfSoundChannelFrontCenter == static_cast(sf::SoundChannel::FrontCenter)); + STATIC_CHECK(sfSoundChannelFrontLeftOfCenter == static_cast(sf::SoundChannel::FrontLeftOfCenter)); + STATIC_CHECK(sfSoundChannelFrontRightOfCenter == static_cast(sf::SoundChannel::FrontRightOfCenter)); + STATIC_CHECK(sfSoundChannelLowFrequencyEffects == static_cast(sf::SoundChannel::LowFrequencyEffects)); + STATIC_CHECK(sfSoundChannelBackLeft == static_cast(sf::SoundChannel::BackLeft)); + STATIC_CHECK(sfSoundChannelBackRight == static_cast(sf::SoundChannel::BackRight)); + STATIC_CHECK(sfSoundChannelBackCenter == static_cast(sf::SoundChannel::BackCenter)); + STATIC_CHECK(sfSoundChannelSideLeft == static_cast(sf::SoundChannel::SideLeft)); + STATIC_CHECK(sfSoundChannelSideRight == static_cast(sf::SoundChannel::SideRight)); + STATIC_CHECK(sfSoundChannelTopCenter == static_cast(sf::SoundChannel::TopCenter)); + STATIC_CHECK(sfSoundChannelTopFrontLeft == static_cast(sf::SoundChannel::TopFrontLeft)); + STATIC_CHECK(sfSoundChannelTopFrontRight == static_cast(sf::SoundChannel::TopFrontRight)); + STATIC_CHECK(sfSoundChannelTopFrontCenter == static_cast(sf::SoundChannel::TopFrontCenter)); + STATIC_CHECK(sfSoundChannelTopBackLeft == static_cast(sf::SoundChannel::TopBackLeft)); + STATIC_CHECK(sfSoundChannelTopBackRight == static_cast(sf::SoundChannel::TopBackRight)); + STATIC_CHECK(sfSoundChannelTopBackCenter == static_cast(sf::SoundChannel::TopBackCenter)); +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6ae18fd..baf6c1e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -54,6 +54,13 @@ target_link_libraries(test-csfml-network PRIVATE csfml-network Catch2::Catch2Wit set_target_warnings(test-csfml-network) catch_discover_tests(test-csfml-network) +add_executable(test-csfml-audio + Audio/SoundChannel.test.cpp +) +target_link_libraries(test-csfml-audio PRIVATE csfml-audio Catch2::Catch2WithMain SFML::Audio) +set_target_warnings(test-csfml-audio) +catch_discover_tests(test-csfml-audio) + # Copy DLLs into the same directory if(SFML_OS_WINDOWS AND NOT CSFML_LINK_SFML_STATICALLY) foreach(SFML_TARGET SFML::System SFML::Window SFML::Graphics SFML::Audio SFML::Network)