diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp
index f257c410..e5a7c77f 100644
--- a/tests/FilesT.cpp
+++ b/tests/FilesT.cpp
@@ -591,11 +591,9 @@ TEST_CASE("[Files] Labels")
REQUIRE( keyLabels[0].second == "Cymbals" );
REQUIRE( keyLabels[1].first == 65 );
REQUIRE( keyLabels[1].second == "Crash" );
- REQUIRE( ccLabels.size() == 2);
- REQUIRE( ccLabels[0].first == 54 );
- REQUIRE( ccLabels[0].second == "Gain" );
- REQUIRE( ccLabels[1].first == 2 );
- REQUIRE( ccLabels[1].second == "Other" );
+ REQUIRE( ccLabels.size() >= 2);
+ REQUIRE( absl::c_find(ccLabels, CCNamePair { 54, "Gain" }) != ccLabels.end() );
+ REQUIRE( absl::c_find(ccLabels, CCNamePair { 2, "Other" }) != ccLabels.end() );
const std::string xmlMidnam = synth.exportMidnam();
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
@@ -612,3 +610,24 @@ TEST_CASE("[Files] Switch labels")
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
}
+
+TEST_CASE("[Files] Duplicate labels")
+{
+ sfz::Synth synth;
+ synth.loadSfzString(
+ fs::current_path() / "tests/TestFiles/labels.sfz",
+ R"( label_key60=Baz label_key60=Quux
+ label_cc20=Foo label_cc20=Bar
+ 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("") != xmlMidnam.npos);
+ REQUIRE(xmlMidnam.find("") != xmlMidnam.npos);
+}