From 62588b4c9681352d785d1e13d17f1375bc8145fb Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Thu, 3 Feb 2022 17:53:03 +0100 Subject: [PATCH] Fix #329060, fix #48251: [MusicXML export] decimals in metronome markings get separated --- .../musicxml/internal/musicxml/exportxml.cpp | 3 +- .../musicxml/tests/data/testTempo6.xml | 127 ++++++++++++++++++ .../musicxml/tests/musicxml_tests.cpp | 3 + 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/importexport/musicxml/tests/data/testTempo6.xml diff --git a/src/importexport/musicxml/internal/musicxml/exportxml.cpp b/src/importexport/musicxml/internal/musicxml/exportxml.cpp index 9dc1eca5c234d..988717899fac4 100644 --- a/src/importexport/musicxml/internal/musicxml/exportxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/exportxml.cpp @@ -4183,7 +4183,8 @@ static bool findMetronome(const std::list& list, // now determine what is to the right of the equals sign // must have either a (dotted) note or a number at start of s4 int len3 = 0; - QRegularExpression numberRegEx("\\d+"); + // One or more digits, optionally followed by a single dot or comma and one or more digits + QRegularExpression numberRegEx("\\d+([,\\.]{1}\\d+)?"); int pos3 = TempoText::findTempoDuration(s4, len3, dur); if (pos3 == -1) { // did not find note, try to find a number diff --git a/src/importexport/musicxml/tests/data/testTempo6.xml b/src/importexport/musicxml/tests/data/testTempo6.xml new file mode 100644 index 0000000000000..a9418c419f619 --- /dev/null +++ b/src/importexport/musicxml/tests/data/testTempo6.xml @@ -0,0 +1,127 @@ + + + + + MuseScore testfile + Tempo 6 + + + Leon Vinken + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + Piano + Pno. + + Piano + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + + + + G + 2 + + + + + + quarter + 85 + + + + + + + G + 4 + + 4 + 1 + whole + + single + none + + + + + + + + quarter + 85.10 + + + + + + + G + 4 + + 4 + 1 + whole + + single + dot + + + + + + + + quarter + 85,10 + + + + + + + G + 4 + + 4 + 1 + whole + + single + comma + + + + light-heavy + + + + diff --git a/src/importexport/musicxml/tests/musicxml_tests.cpp b/src/importexport/musicxml/tests/musicxml_tests.cpp index ab01e7b26121e..565b0235d8467 100644 --- a/src/importexport/musicxml/tests/musicxml_tests.cpp +++ b/src/importexport/musicxml/tests/musicxml_tests.cpp @@ -838,6 +838,9 @@ TEST_F(Musicxml_Tests, tempo4) { TEST_F(Musicxml_Tests, tempo5) { mxmlIoTest("testTempo5"); } +TEST_F(Musicxml_Tests, tempo6) { + mxmlIoTest("testTempo6"); +} TEST_F(Musicxml_Tests, tempoOverlap) { mxmlIoTestRef("testTempoOverlap"); }