Add tests
This commit is contained in:
parent
111af1b648
commit
3ca11652dc
1 changed files with 24 additions and 5 deletions
|
|
@ -591,11 +591,9 @@ TEST_CASE("[Files] Labels")
|
||||||
REQUIRE( keyLabels[0].second == "Cymbals" );
|
REQUIRE( keyLabels[0].second == "Cymbals" );
|
||||||
REQUIRE( keyLabels[1].first == 65 );
|
REQUIRE( keyLabels[1].first == 65 );
|
||||||
REQUIRE( keyLabels[1].second == "Crash" );
|
REQUIRE( keyLabels[1].second == "Crash" );
|
||||||
REQUIRE( ccLabels.size() == 2);
|
REQUIRE( ccLabels.size() >= 2);
|
||||||
REQUIRE( ccLabels[0].first == 54 );
|
REQUIRE( absl::c_find(ccLabels, CCNamePair { 54, "Gain" }) != ccLabels.end() );
|
||||||
REQUIRE( ccLabels[0].second == "Gain" );
|
REQUIRE( absl::c_find(ccLabels, CCNamePair { 2, "Other" }) != ccLabels.end() );
|
||||||
REQUIRE( ccLabels[1].first == 2 );
|
|
||||||
REQUIRE( ccLabels[1].second == "Other" );
|
|
||||||
const std::string xmlMidnam = synth.exportMidnam();
|
const std::string xmlMidnam = synth.exportMidnam();
|
||||||
REQUIRE(xmlMidnam.find("<Note Number=\"12\" Name=\"Cymbals\" />") != xmlMidnam.npos);
|
REQUIRE(xmlMidnam.find("<Note Number=\"12\" Name=\"Cymbals\" />") != xmlMidnam.npos);
|
||||||
REQUIRE(xmlMidnam.find("<Note Number=\"65\" Name=\"Crash\" />") != xmlMidnam.npos);
|
REQUIRE(xmlMidnam.find("<Note Number=\"65\" Name=\"Crash\" />") != xmlMidnam.npos);
|
||||||
|
|
@ -612,3 +610,24 @@ TEST_CASE("[Files] Switch labels")
|
||||||
REQUIRE(xmlMidnam.find("<Note Number=\"38\" Name=\"Triangle\" />") != xmlMidnam.npos);
|
REQUIRE(xmlMidnam.find("<Note Number=\"38\" Name=\"Triangle\" />") != xmlMidnam.npos);
|
||||||
REQUIRE(xmlMidnam.find("<Note Number=\"40\" Name=\"Saw\" />") != xmlMidnam.npos);
|
REQUIRE(xmlMidnam.find("<Note Number=\"40\" Name=\"Saw\" />") != xmlMidnam.npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Files] Duplicate labels")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
synth.loadSfzString(
|
||||||
|
fs::current_path() / "tests/TestFiles/labels.sfz",
|
||||||
|
R"(<control> label_key60=Baz label_key60=Quux
|
||||||
|
<control> label_cc20=Foo label_cc20=Bar
|
||||||
|
<region> sample=*sine)");
|
||||||
|
|
||||||
|
auto keyLabels = synth.getKeyLabels();
|
||||||
|
auto ccLabels = synth.getCCLabels();
|
||||||
|
REQUIRE( keyLabels.size() == 1);
|
||||||
|
REQUIRE( keyLabels[0].first == 60 );
|
||||||
|
REQUIRE( keyLabels[0].second == "Quux" );
|
||||||
|
REQUIRE( ccLabels.size() >= 1);
|
||||||
|
REQUIRE( absl::c_find(ccLabels, CCNamePair { 20, "Bar" }) != ccLabels.end() );
|
||||||
|
const std::string xmlMidnam = synth.exportMidnam();
|
||||||
|
REQUIRE(xmlMidnam.find("<Note Number=\"60\" Name=\"Quux\" />") != xmlMidnam.npos);
|
||||||
|
REQUIRE(xmlMidnam.find("<Control Type=\"7bit\" Number=\"20\" Name=\"Bar\" />") != xmlMidnam.npos);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue