#include #include #include #include TEST_CASE("[Audio] sf::OutputSoundFile") { SECTION("Type traits") { STATIC_CHECK(std::is_default_constructible_v); STATIC_CHECK(!std::is_copy_constructible_v); STATIC_CHECK(!std::is_copy_assignable_v); STATIC_CHECK(std::is_nothrow_move_constructible_v); STATIC_CHECK(std::is_nothrow_move_assignable_v); } const std::u32string stem = GENERATE(U"tmp", U"tmp-ń", U"tmp-🐌"); const std::u32string extension = GENERATE(U".wav", U".ogg"); // , U".flac"); FLAC fails to handle Unicode strings const auto filename = std::filesystem::temp_directory_path() / std::filesystem::path(stem + extension); const std::vector channelMap{sf::SoundChannel::FrontLeft, sf::SoundChannel::FrontRight}; INFO("Filename: " << reinterpret_cast(filename.u8string().c_str())); SECTION("Construction") { { const sf::OutputSoundFile outputSoundFile(filename, 44'100, static_cast(channelMap.size()), channelMap); CHECK(std::filesystem::exists(filename)); } CHECK(std::filesystem::remove(filename)); } SECTION("openFromFile()") { sf::OutputSoundFile outputSoundFile; CHECK(outputSoundFile.openFromFile(filename, 44'100, static_cast(channelMap.size()), channelMap)); CHECK(std::filesystem::exists(filename)); outputSoundFile.close(); CHECK(std::filesystem::remove(filename)); } }