Use the SoundSource derived type specific status

This commit is contained in:
Lukas Dürrenberger 2024-05-16 20:57:40 +02:00 committed by Chris Thrasher
parent 9722fb3724
commit 6766268f36
3 changed files with 19 additions and 19 deletions

View File

@ -43,7 +43,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::Time::Zero); CHECK(length == sf::Time::Zero);
CHECK(music.getChannelCount() == 0); CHECK(music.getChannelCount() == 0);
CHECK(music.getSampleRate() == 0); CHECK(music.getSampleRate() == 0);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -61,7 +61,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::Time::Zero); CHECK(length == sf::Time::Zero);
CHECK(music.getChannelCount() == 0); CHECK(music.getChannelCount() == 0);
CHECK(music.getSampleRate() == 0); CHECK(music.getSampleRate() == 0);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -75,7 +75,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::microseconds(1990884)); CHECK(length == sf::microseconds(1990884));
CHECK(music.getChannelCount() == 1); CHECK(music.getChannelCount() == 1);
CHECK(music.getSampleRate() == 44100); CHECK(music.getSampleRate() == 44100);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -95,7 +95,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::Time::Zero); CHECK(length == sf::Time::Zero);
CHECK(music.getChannelCount() == 0); CHECK(music.getChannelCount() == 0);
CHECK(music.getSampleRate() == 0); CHECK(music.getSampleRate() == 0);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -110,7 +110,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::microseconds(1990884)); CHECK(length == sf::microseconds(1990884));
CHECK(music.getChannelCount() == 1); CHECK(music.getChannelCount() == 1);
CHECK(music.getSampleRate() == 44100); CHECK(music.getSampleRate() == 44100);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -130,7 +130,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::Time::Zero); CHECK(length == sf::Time::Zero);
CHECK(music.getChannelCount() == 0); CHECK(music.getChannelCount() == 0);
CHECK(music.getSampleRate() == 0); CHECK(music.getSampleRate() == 0);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -145,7 +145,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::microseconds(24002176)); CHECK(length == sf::microseconds(24002176));
CHECK(music.getChannelCount() == 2); CHECK(music.getChannelCount() == 2);
CHECK(music.getSampleRate() == 44100); CHECK(music.getSampleRate() == 44100);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -158,21 +158,21 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
// Wait for background thread to start // Wait for background thread to start
music.play(); music.play();
while (music.getStatus() == sf::SoundSource::Status::Stopped) while (music.getStatus() == sf::Music::Status::Stopped)
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
CHECK(music.getStatus() == sf::SoundSource::Status::Playing); CHECK(music.getStatus() == sf::Music::Status::Playing);
// Wait for background thread to pause // Wait for background thread to pause
music.pause(); music.pause();
while (music.getStatus() == sf::SoundSource::Status::Playing) while (music.getStatus() == sf::Music::Status::Playing)
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
CHECK(music.getStatus() == sf::SoundSource::Status::Paused); CHECK(music.getStatus() == sf::Music::Status::Paused);
// Wait for background thread to stop // Wait for background thread to stop
music.stop(); music.stop();
while (music.getStatus() == sf::SoundSource::Status::Paused) while (music.getStatus() == sf::Music::Status::Paused)
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
} }
SECTION("setLoopPoints()") SECTION("setLoopPoints()")
@ -187,7 +187,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::Time::Zero); CHECK(length == sf::Time::Zero);
CHECK(music.getChannelCount() == 0); CHECK(music.getChannelCount() == 0);
CHECK(music.getSampleRate() == 0); CHECK(music.getSampleRate() == 0);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }
@ -201,7 +201,7 @@ TEST_CASE("[Audio] sf::Music", runAudioDeviceTests())
CHECK(length == sf::seconds(2)); CHECK(length == sf::seconds(2));
CHECK(music.getChannelCount() == 1); CHECK(music.getChannelCount() == 1);
CHECK(music.getSampleRate() == 22050); CHECK(music.getSampleRate() == 22050);
CHECK(music.getStatus() == sf::SoundSource::Status::Stopped); CHECK(music.getStatus() == sf::Music::Status::Stopped);
CHECK(music.getPlayingOffset() == sf::Time::Zero); CHECK(music.getPlayingOffset() == sf::Time::Zero);
CHECK(!music.getLoop()); CHECK(!music.getLoop());
} }

View File

@ -34,7 +34,7 @@ TEST_CASE("[Audio] sf::Sound", runAudioDeviceTests())
CHECK(&sound.getBuffer() == &soundBuffer); CHECK(&sound.getBuffer() == &soundBuffer);
CHECK(!sound.getLoop()); CHECK(!sound.getLoop());
CHECK(sound.getPlayingOffset() == sf::Time::Zero); CHECK(sound.getPlayingOffset() == sf::Time::Zero);
CHECK(sound.getStatus() == sf::SoundSource::Status::Stopped); CHECK(sound.getStatus() == sf::Sound::Status::Stopped);
} }
SECTION("Copy semantics") SECTION("Copy semantics")
@ -47,7 +47,7 @@ TEST_CASE("[Audio] sf::Sound", runAudioDeviceTests())
CHECK(&soundCopy.getBuffer() == &soundBuffer); CHECK(&soundCopy.getBuffer() == &soundBuffer);
CHECK(!soundCopy.getLoop()); CHECK(!soundCopy.getLoop());
CHECK(soundCopy.getPlayingOffset() == sf::Time::Zero); CHECK(soundCopy.getPlayingOffset() == sf::Time::Zero);
CHECK(soundCopy.getStatus() == sf::SoundSource::Status::Stopped); CHECK(soundCopy.getStatus() == sf::Sound::Status::Stopped);
} }
SECTION("Assignment") SECTION("Assignment")
@ -58,7 +58,7 @@ TEST_CASE("[Audio] sf::Sound", runAudioDeviceTests())
CHECK(&soundCopy.getBuffer() == &soundBuffer); CHECK(&soundCopy.getBuffer() == &soundBuffer);
CHECK(!soundCopy.getLoop()); CHECK(!soundCopy.getLoop());
CHECK(soundCopy.getPlayingOffset() == sf::Time::Zero); CHECK(soundCopy.getPlayingOffset() == sf::Time::Zero);
CHECK(soundCopy.getStatus() == sf::SoundSource::Status::Stopped); CHECK(soundCopy.getStatus() == sf::Sound::Status::Stopped);
} }
} }

View File

@ -45,7 +45,7 @@ TEST_CASE("[Audio] sf::SoundStream", runAudioDeviceTests())
const SoundStream soundStream; const SoundStream soundStream;
CHECK(soundStream.getChannelCount() == 0); CHECK(soundStream.getChannelCount() == 0);
CHECK(soundStream.getSampleRate() == 0); CHECK(soundStream.getSampleRate() == 0);
CHECK(soundStream.getStatus() == sf::SoundSource::Status::Stopped); CHECK(soundStream.getStatus() == sf::SoundStream::Status::Stopped);
CHECK(soundStream.getPlayingOffset() == sf::Time::Zero); CHECK(soundStream.getPlayingOffset() == sf::Time::Zero);
CHECK(!soundStream.getLoop()); CHECK(!soundStream.getLoop());
} }