Added a test case for the overlapping define bug

This commit is contained in:
paulfd 2019-09-10 21:16:44 +02:00
parent 31bc146a9a
commit 19759d041a
2 changed files with 22 additions and 0 deletions

View file

@ -300,4 +300,19 @@ TEST_CASE("[Files] sw_default and playing with switches")
REQUIRE( synth.getRegionView(1)->isSwitchedOn() );
REQUIRE( !synth.getRegionView(2)->isSwitchedOn() );
REQUIRE( synth.getRegionView(3)->isSwitchedOn() );
}
TEST_CASE("[Files] wrong (overlapping) replacement for defines")
{
sfz::Synth synth;
synth.loadSfzFile(std::filesystem::current_path() / "tests/TestFiles/SpecificBugs/wrong-replacements.sfz");
REQUIRE( synth.getNumRegions() == 3 );
REQUIRE( synth.getRegionView(0)->keyRange.getStart() == 52 );
REQUIRE( synth.getRegionView(0)->keyRange.getEnd() == 52 );
REQUIRE( synth.getRegionView(1)->keyRange.getStart() == 57 );
REQUIRE( synth.getRegionView(1)->keyRange.getEnd() == 57 );
REQUIRE( synth.getRegionView(2)->amplitudeCC );
REQUIRE( synth.getRegionView(2)->amplitudeCC->first == 10 );
REQUIRE( synth.getRegionView(2)->amplitudeCC->second == 34.0f );
}

View file

@ -0,0 +1,7 @@
#define $KeyCrash2Edge 52 // Crash Cymbal 2 (Edge)
#define $KeyCrash2 57 // Crash Cymbal 2 (Bow)
#define $Param 10 // Opcode parameter replacement
<region> key=$KeyCrash2Edge sample=../mono_sample.wav
<region> key=$KeyCrash2 sample=../mono_sample.wav
<region> amplitude_oncc$Param=34 sample=../mono_sample.wav