From 54b92f9f9d575b0368cc5409e84feee49c9798c3 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Mon, 13 Apr 2020 17:14:04 +0200 Subject: [PATCH] Try fixing the case-sensitivity test on Mac --- tests/FilesT.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp index 51f5e40f..75941298 100644 --- a/tests/FilesT.cpp +++ b/tests/FilesT.cpp @@ -8,6 +8,9 @@ #include "sfizz/SfzHelpers.h" #include "catch2/catch.hpp" #include "ghc/fs_std.hpp" +#if defined(__APPLE__) +#include // pathconf +#endif using namespace Catch::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") { -#ifndef WIN32 - sfz::Synth synth; - synth.loadSfzFile(fs::current_path() / "tests/TestFiles/case_insensitive.sfz"); - 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"); + const fs::path sfzFilePath = fs::current_path() / + "tests/TestFiles/case_insensitive.sfz"; + +#if defined(_WIN32) + const bool caseSensitiveFs = false; +#elif defined(__APPLE__) + const bool caseSensitiveFs = pathconf(sfzFilePath.string().c_str(), _PC_CASE_SENSITIVE) != 0; +#else + const bool caseSensitiveFs = true; #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")