2018-12-06 22:49:46 +01:00
|
|
|
#include "test_Globals.hpp"
|
|
|
|
|
|
|
|
#include <engine/GameWorld.hpp>
|
|
|
|
#include <audio/SoundSource.hpp>
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(AudioLoadingTests, DATA_TEST_PREDICATE)
|
|
|
|
|
|
|
|
// @todo Shfil119 implement
|
|
|
|
// This test requires assets
|
2019-05-19 12:23:56 +02:00
|
|
|
struct F {
|
2018-12-06 22:49:46 +01:00
|
|
|
SoundManager manager{Global::get().e};
|
2019-05-19 12:23:56 +02:00
|
|
|
};
|
2018-12-06 22:49:46 +01:00
|
|
|
|
2019-05-19 12:23:56 +02:00
|
|
|
BOOST_FIXTURE_TEST_CASE(testBufferIsPlaying, F) {
|
2018-12-06 22:49:46 +01:00
|
|
|
auto audioPath =
|
|
|
|
Global::get().e->data->index.findFilePath("audio/A1_a.wav");
|
|
|
|
|
|
|
|
manager.loadSound("A1_a", audioPath.string());
|
|
|
|
|
|
|
|
auto& sound = manager.getSoundRef("A1_a");
|
|
|
|
BOOST_REQUIRE(sound.source->decodedFrames > 0);
|
|
|
|
|
|
|
|
BOOST_REQUIRE(sound.isPlaying() == false);
|
|
|
|
|
|
|
|
sound.play();
|
|
|
|
BOOST_REQUIRE(sound.isPlaying() == true);
|
|
|
|
|
2019-05-12 14:30:11 +02:00
|
|
|
sound.play();
|
|
|
|
BOOST_REQUIRE(sound.isPlaying() == true);
|
|
|
|
|
2018-12-06 22:49:46 +01:00
|
|
|
sound.pause();
|
|
|
|
BOOST_REQUIRE(sound.isPaused() == true);
|
|
|
|
|
|
|
|
sound.stop();
|
|
|
|
BOOST_REQUIRE(sound.isStopped() == true);
|
|
|
|
}
|
|
|
|
|
2019-05-19 12:23:56 +02:00
|
|
|
BOOST_FIXTURE_TEST_CASE(testDecodingFramesOfMusic, F) {
|
2018-12-06 22:49:46 +01:00
|
|
|
auto audioPath =
|
|
|
|
Global::get().e->data->index.findFilePath("audio/A1_a.wav");
|
|
|
|
|
|
|
|
manager.loadSound("A1_a", audioPath.string());
|
|
|
|
|
|
|
|
auto& sound = manager.getSoundRef("A1_a");
|
|
|
|
BOOST_REQUIRE(sound.source->decodedFrames > 0);
|
|
|
|
}
|
|
|
|
|
2019-05-19 12:23:56 +02:00
|
|
|
BOOST_FIXTURE_TEST_CASE(testDecodingFramesOfSfx, F) {
|
2018-12-06 22:49:46 +01:00
|
|
|
manager.createSfxInstance(157); // Callahan Bridge fire
|
|
|
|
|
|
|
|
auto& sound = manager.getSfxSourceRef(157);
|
|
|
|
BOOST_REQUIRE(sound.source->decodedFrames > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|