Add tests and SDK

This commit is contained in:
Jérôme Leclercq
2021-05-17 23:08:37 +02:00
parent 26de5872eb
commit e716b44aa3
52 changed files with 539 additions and 276 deletions

View File

@@ -4,6 +4,8 @@
#include <chrono>
#include <thread>
std::filesystem::path GetResourceDir();
SCENARIO("Music", "[AUDIO][MUSIC]")
{
GIVEN("A music")
@@ -12,7 +14,7 @@ SCENARIO("Music", "[AUDIO][MUSIC]")
WHEN("We load our music")
{
REQUIRE(music.OpenFromFile("resources/Engine/Audio/The_Brabanconne.ogg"));
REQUIRE(music.OpenFromFile(GetResourceDir() / "Engine/Audio/The_Brabanconne.ogg"));
THEN("We can ask the informations of the file")
{

View File

@@ -4,6 +4,8 @@
#include <chrono>
#include <thread>
std::filesystem::path GetResourceDir();
SCENARIO("Sound", "[AUDIO][SOUND]")
{
GIVEN("A sound")
@@ -12,7 +14,7 @@ SCENARIO("Sound", "[AUDIO][SOUND]")
WHEN("We load our sound")
{
REQUIRE(sound.LoadFromFile("resources/Engine/Audio/Cat.flac"));
REQUIRE(sound.LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac"));
THEN("We can ask the informations of the file")
{

View File

@@ -1,13 +1,15 @@
#include <Nazara/Audio/SoundBuffer.hpp>
#include <Catch/catch.hpp>
std::filesystem::path GetResourceDir();
SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
{
GIVEN("A sound buffer")
{
WHEN("We load our sound")
{
Nz::SoundBufferRef soundBuffer = Nz::SoundBuffer::LoadFromFile("resources/Engine/Audio/Cat.flac");
Nz::SoundBufferRef soundBuffer = Nz::SoundBuffer::LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac");
REQUIRE(soundBuffer.IsValid());
THEN("We can ask the informations of the file")

View File

@@ -1,6 +1,8 @@
#include <Nazara/Audio/Sound.hpp>
#include <Catch/catch.hpp>
std::filesystem::path GetResourceDir();
SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]")
{
GIVEN("A sound emitter")
@@ -9,7 +11,7 @@ SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]")
WHEN("We load our sound")
{
REQUIRE(sound.LoadFromFile("resources/Engine/Audio/Cat.flac"));
REQUIRE(sound.LoadFromFile(GetResourceDir() / "Engine/Audio/Cat.flac"));
THEN("We can ask information about position and velocity")
{

View File

@@ -1,6 +1,8 @@
#include <Nazara/Core/File.hpp>
#include <Catch/catch.hpp>
std::filesystem::path GetResourceDir();
SCENARIO("File", "[CORE][FILE]")
{
GIVEN("One file")
@@ -63,9 +65,9 @@ SCENARIO("File", "[CORE][FILE]")
GIVEN("The test file")
{
REQUIRE(std::filesystem::exists("resources/Engine/Core/FileTest.txt"));
REQUIRE(std::filesystem::exists(GetResourceDir() / "Engine/Core/FileTest.txt"));
Nz::File fileTest("resources/Engine/Core/FileTest.txt", Nz::OpenMode_ReadOnly | Nz::OpenMode_Text);
Nz::File fileTest(GetResourceDir() / "Engine/Core/FileTest.txt", Nz::OpenMode_ReadOnly | Nz::OpenMode_Text);
WHEN("We read the first line of the file")
{