From 069073de6191fa8273ed639835504141683cf42e Mon Sep 17 00:00:00 2001 From: Peter Jonas Date: Mon, 26 Sep 2022 06:15:16 +0100 Subject: [PATCH] Fix #269926 MusicXML export: don't duplicate fermatas near grace notes Previously, if a note had both a fermata and a grace note then the grace note would gain a fermata during export. --- .../musicxml/internal/musicxml/exportxml.cpp | 12 ++- .../musicxml/tests/data/testGraceFermata.xml | 102 ++++++++++++++++++ .../musicxml/tests/musicxml_tests.cpp | 3 + 3 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 src/importexport/musicxml/tests/data/testGraceFermata.xml diff --git a/src/importexport/musicxml/internal/musicxml/exportxml.cpp b/src/importexport/musicxml/internal/musicxml/exportxml.cpp index 2a17a95502be..0cb23e23711f 100644 --- a/src/importexport/musicxml/internal/musicxml/exportxml.cpp +++ b/src/importexport/musicxml/internal/musicxml/exportxml.cpp @@ -2948,13 +2948,15 @@ static void writeChordLines(const Chord* const chord, XmlWriter& xml, Notations& void ExportMusicXml::chordAttributes(Chord* chord, Notations& notations, Technical& technical, TrillHash& trillStart, TrillHash& trillStop) { - QVector fl; - for (EngravingItem* e : chord->segment()->annotations()) { - if (e->track() == chord->track() && e->isFermata()) { - fl.push_back(e); + if (!chord->isGrace()) { + QVector fl; + for (EngravingItem* e : chord->segment()->annotations()) { + if (e->track() == chord->track() && e->isFermata()) { + fl.push_back(e); + } } + fermatas(fl, _xml, notations); } - fermatas(fl, _xml, notations); const std::vector na = chord->articulations(); // first the attributes whose elements are children of diff --git a/src/importexport/musicxml/tests/data/testGraceFermata.xml b/src/importexport/musicxml/tests/data/testGraceFermata.xml new file mode 100644 index 000000000000..7deb267e9562 --- /dev/null +++ b/src/importexport/musicxml/tests/data/testGraceFermata.xml @@ -0,0 +1,102 @@ + + + + + testGraceFermata + + + shoogle + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + Piano + Pno. + + Piano + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + + + + G + 2 + + + + + + A + 4 + + 1 + eighth + up + + + + G + 4 + + 2 + 1 + half + up + + + + + + + A + 4 + + 2 + 1 + half + up + + + + + + + + G + 4 + + 1 + eighth + up + + + light-heavy + + + + diff --git a/src/importexport/musicxml/tests/musicxml_tests.cpp b/src/importexport/musicxml/tests/musicxml_tests.cpp index 2b653fca1196..fa325156d062 100644 --- a/src/importexport/musicxml/tests/musicxml_tests.cpp +++ b/src/importexport/musicxml/tests/musicxml_tests.cpp @@ -550,6 +550,9 @@ TEST_F(Musicxml_Tests, graceAfter3) { TEST_F(Musicxml_Tests, DISABLED_graceAfter4) { mxmlIoTest("testGraceAfter4"); } +TEST_F(Musicxml_Tests, graceFermata) { + mxmlIoTest("testGraceFermata"); +} TEST_F(Musicxml_Tests, hairpinDynamics) { mxmlMscxExportTestRef("testHairpinDynamics"); }