diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp index 67e70af7..3436401d 100644 --- a/tests/FilesT.cpp +++ b/tests/FilesT.cpp @@ -322,7 +322,7 @@ TEST_CASE("[Files] Specific bug: relative path with backslashes") sfz::Synth synth; synth.loadSfzFile(fs::current_path() / "tests/TestFiles/SpecificBugs/win_backslashes.sfz"); REQUIRE(synth.getNumRegions() == 1); - REQUIRE(synth.getRegionView(0)->sample == R"(closedhat.wav)"); + REQUIRE(synth.getRegionView(0)->sample == R"(Xylo/Subfolder/closedhat.wav)"); } TEST_CASE("[Synth] Testing channel 1") @@ -360,3 +360,14 @@ TEST_CASE("[Synth] Testing channel 16") REQUIRE( region != nullptr ); REQUIRE( region->sample == "dummy16.wav" ); } + +TEST_CASE("[Files] Default path") +{ + sfz::Synth synth; + synth.loadSfzFile(fs::current_path() / "tests/TestFiles/default_path.sfz"); + REQUIRE(synth.getNumRegions() == 4); + REQUIRE(synth.getRegionView(0)->sample == R"(DefaultPath/SubPath1/sample1.wav)"); + REQUIRE(synth.getRegionView(1)->sample == R"(DefaultPath/SubPath2/sample2.wav)"); + REQUIRE(synth.getRegionView(2)->sample == R"(DefaultPath/SubPath1/sample1.wav)"); + REQUIRE(synth.getRegionView(3)->sample == R"(DefaultPath/SubPath2/sample2.wav)"); +} \ No newline at end of file diff --git a/tests/TestFiles/DefaultPath/SubPath1/sample1.wav b/tests/TestFiles/DefaultPath/SubPath1/sample1.wav new file mode 100755 index 00000000..d31835e5 Binary files /dev/null and b/tests/TestFiles/DefaultPath/SubPath1/sample1.wav differ diff --git a/tests/TestFiles/DefaultPath/SubPath2/sample2.wav b/tests/TestFiles/DefaultPath/SubPath2/sample2.wav new file mode 100755 index 00000000..703d521d Binary files /dev/null and b/tests/TestFiles/DefaultPath/SubPath2/sample2.wav differ diff --git a/tests/TestFiles/default_path.sfz b/tests/TestFiles/default_path.sfz new file mode 100644 index 00000000..87a400b7 --- /dev/null +++ b/tests/TestFiles/default_path.sfz @@ -0,0 +1,10 @@ + sample=DefaultPath/SubPath1/sample1.wav + + default_path=DefaultPath\SubPath2 + sample=sample2.wav + + default_path=DefaultPath/SubPath1 + sample=sample1.wav + + default_path=DefaultPath/SubPath2/ + sample=sample2.wav \ No newline at end of file