Skip to content

Commit

Permalink
Add tests for Audio module
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Dec 22, 2024
1 parent ae540e2 commit e7a41e8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/Audio/SoundChannel.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <CSFML/Audio/SoundChannel.h>

#include <SFML/Audio/SoundChannel.hpp>

#include <catch2/catch_test_macros.hpp>

TEST_CASE("[Audio] sfSoundChannel")
{
STATIC_CHECK(sfSoundChannelUnspecified == static_cast<int>(sf::SoundChannel::Unspecified));
STATIC_CHECK(sfSoundChannelMono == static_cast<int>(sf::SoundChannel::Mono));
STATIC_CHECK(sfSoundChannelFrontLeft == static_cast<int>(sf::SoundChannel::FrontLeft));
STATIC_CHECK(sfSoundChannelFrontRight == static_cast<int>(sf::SoundChannel::FrontRight));
STATIC_CHECK(sfSoundChannelFrontCenter == static_cast<int>(sf::SoundChannel::FrontCenter));
STATIC_CHECK(sfSoundChannelFrontLeftOfCenter == static_cast<int>(sf::SoundChannel::FrontLeftOfCenter));
STATIC_CHECK(sfSoundChannelFrontRightOfCenter == static_cast<int>(sf::SoundChannel::FrontRightOfCenter));
STATIC_CHECK(sfSoundChannelLowFrequencyEffects == static_cast<int>(sf::SoundChannel::LowFrequencyEffects));
STATIC_CHECK(sfSoundChannelBackLeft == static_cast<int>(sf::SoundChannel::BackLeft));
STATIC_CHECK(sfSoundChannelBackRight == static_cast<int>(sf::SoundChannel::BackRight));
STATIC_CHECK(sfSoundChannelBackCenter == static_cast<int>(sf::SoundChannel::BackCenter));
STATIC_CHECK(sfSoundChannelSideLeft == static_cast<int>(sf::SoundChannel::SideLeft));
STATIC_CHECK(sfSoundChannelSideRight == static_cast<int>(sf::SoundChannel::SideRight));
STATIC_CHECK(sfSoundChannelTopCenter == static_cast<int>(sf::SoundChannel::TopCenter));
STATIC_CHECK(sfSoundChannelTopFrontLeft == static_cast<int>(sf::SoundChannel::TopFrontLeft));
STATIC_CHECK(sfSoundChannelTopFrontRight == static_cast<int>(sf::SoundChannel::TopFrontRight));
STATIC_CHECK(sfSoundChannelTopFrontCenter == static_cast<int>(sf::SoundChannel::TopFrontCenter));
STATIC_CHECK(sfSoundChannelTopBackLeft == static_cast<int>(sf::SoundChannel::TopBackLeft));
STATIC_CHECK(sfSoundChannelTopBackRight == static_cast<int>(sf::SoundChannel::TopBackRight));
STATIC_CHECK(sfSoundChannelTopBackCenter == static_cast<int>(sf::SoundChannel::TopBackCenter));
}
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e7a41e8

Please sign in to comment.