Try fixing the case-sensitivity test on Mac

This commit is contained in:
Jean Pierre Cimalando 2020-04-13 17:14:04 +02:00
parent cbc037e055
commit 54b92f9f9d

View file

@ -8,6 +8,9 @@
#include "sfizz/SfzHelpers.h" #include "sfizz/SfzHelpers.h"
#include "catch2/catch.hpp" #include "catch2/catch.hpp"
#include "ghc/fs_std.hpp" #include "ghc/fs_std.hpp"
#if defined(__APPLE__)
#include <unistd.h> // pathconf
#endif
using namespace Catch::literals; using namespace Catch::literals;
using namespace sfz::literals; using namespace sfz::literals;
@ -529,15 +532,26 @@ TEST_CASE("[Files] Looped regions taken from files and possibly overriden")
TEST_CASE("[Files] Case sentitiveness") TEST_CASE("[Files] Case sentitiveness")
{ {
#ifndef WIN32 const fs::path sfzFilePath = fs::current_path() /
sfz::Synth synth; "tests/TestFiles/case_insensitive.sfz";
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/case_insensitive.sfz");
REQUIRE(synth.getNumRegions() == 4); #if defined(_WIN32)
REQUIRE(synth.getRegionView(0)->sample == "dummy1.wav"); const bool caseSensitiveFs = false;
REQUIRE(synth.getRegionView(1)->sample == "Regions/dummy.wav"); #elif defined(__APPLE__)
REQUIRE(synth.getRegionView(2)->sample == "Regions/dummy.wav"); const bool caseSensitiveFs = pathconf(sfzFilePath.string().c_str(), _PC_CASE_SENSITIVE) != 0;
REQUIRE(synth.getRegionView(3)->sample == "Regions/dummy.wav"); #else
const bool caseSensitiveFs = true;
#endif #endif
if (caseSensitiveFs) {
sfz::Synth synth;
synth.loadSfzFile(sfzFilePath);
REQUIRE(synth.getNumRegions() == 4);
REQUIRE(synth.getRegionView(0)->sample == "dummy1.wav");
REQUIRE(synth.getRegionView(1)->sample == "Regions/dummy.wav");
REQUIRE(synth.getRegionView(2)->sample == "Regions/dummy.wav");
REQUIRE(synth.getRegionView(3)->sample == "Regions/dummy.wav");
}
} }
TEST_CASE("[Files] Empty file") TEST_CASE("[Files] Empty file")