1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-03 17:19:46 +02:00
openrw/tests/test_AudioLoading.cpp
Filip Gawin 88b1c9e509 Replicate extra scenerio in audio loading test
(hazardous for streaming)
2019-05-23 15:24:01 +02:00

58 lines
1.4 KiB
C++

#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
BOOST_AUTO_TEST_CASE(testBufferIsPlaying) {
SoundManager manager{Global::get().e};
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);
sound.play();
BOOST_REQUIRE(sound.isPlaying() == true);
sound.pause();
BOOST_REQUIRE(sound.isPaused() == true);
sound.stop();
BOOST_REQUIRE(sound.isStopped() == true);
}
BOOST_AUTO_TEST_CASE(testDecodingFramesOfMusic) {
SoundManager manager{Global::get().e};
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_AUTO_TEST_CASE(testDecodingFramesOfSfx) {
SoundManager manager{Global::get().e};
manager.createSfxInstance(157); // Callahan Bridge fire
auto& sound = manager.getSfxSourceRef(157);
BOOST_REQUIRE(sound.source->decodedFrames > 0);
}
BOOST_AUTO_TEST_SUITE_END()