diff --git a/test/Audio/Music.test.cpp b/test/Audio/Music.test.cpp index c40a42c00..43348f77e 100644 --- a/test/Audio/Music.test.cpp +++ b/test/Audio/Music.test.cpp @@ -10,8 +10,34 @@ #include #include +namespace +{ +template +struct Singleton +{ + static T& getInstance() + { + static T instance; + return instance; + } +}; +} // namespace + TEST_CASE("[Audio] sf::Music", runAudioDeviceTests()) { + // Section must be placed first within this TEST_CASE or else it will always pass + SECTION("Construction/destruction order") + { + struct MusicSingleton : Singleton + { + std::optional music; + }; + + MusicSingleton::getInstance(); + MusicSingleton::getInstance().music = sf::Music::openFromFile("Audio/ding.flac").value(); + CHECK(true); // Lack of a crash due to assertion failure signals success + } + SECTION("Type traits") { STATIC_CHECK(!std::is_copy_constructible_v);