Skip to content

Commit

Permalink
Fix #329608: [MusicXML export] custom ending text not exported
Browse files Browse the repository at this point in the history
Export the volta text to the MusicXML ending element, allowing custom text such as "1-3".

Backport of #10623, plus 2 more mtest fixes
  • Loading branch information
lvinken authored and Jojo-Schmitz committed Feb 21, 2022
1 parent 8000c6a commit a24083a
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 9 deletions.
5 changes: 4 additions & 1 deletion importexport/musicxml/exportxml.cpp
Expand Up @@ -1603,7 +1603,10 @@ static void ending(XmlWriter& xml, Volta* v, bool left)
voltaXml += positioningAttributes(v, left);
if (!v->visible())
voltaXml += " print-object=\"no\"";
xml.tagE(voltaXml);
if (left)
xml.tag(voltaXml, v->text().toHtmlEscaped());
else
xml.tagE(voltaXml);
}

//---------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions mtest/musicxml/io/testTextLines_ref.xml
Expand Up @@ -165,7 +165,7 @@
</measure>
<measure number="7">
<barline location="left">
<ending number="1" type="start"/>
<ending number="1" type="start">1.</ending>
</barline>
<note>
<pitch>
Expand All @@ -184,7 +184,7 @@
</measure>
<measure number="8">
<barline location="left">
<ending number="2" type="start"/>
<ending number="2" type="start">2.</ending>
</barline>
<note>
<pitch>
Expand Down
8 changes: 4 additions & 4 deletions mtest/musicxml/io/testVolta1.xml
Expand Up @@ -56,7 +56,7 @@
</measure>
<measure number="2">
<barline location="left">
<ending number="1" type="start"/>
<ending number="1" type="start">1</ending>
</barline>
<note>
<pitch>
Expand All @@ -75,7 +75,7 @@
</measure>
<measure number="3">
<barline location="left">
<ending number="2" type="start"/>
<ending number="2" type="start">2</ending>
</barline>
<note>
<pitch>
Expand Down Expand Up @@ -115,7 +115,7 @@
</measure>
<measure number="6">
<barline location="left">
<ending number="1" type="start"/>
<ending number="1" type="start">1</ending>
</barline>
<note>
<pitch>
Expand Down Expand Up @@ -145,7 +145,7 @@
</measure>
<measure number="8">
<barline location="left">
<ending number="2" type="start"/>
<ending number="2" type="start">2</ending>
</barline>
<note>
<pitch>
Expand Down
108 changes: 108 additions & 0 deletions mtest/musicxml/io/testVolta2.xml
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
<work>
<work-number>MuseScore testfile</work-number>
<work-title>Volta 2</work-title>
</work>
<identification>
<creator type="composer">Leon Vinken</creator>
<encoding>
<software>MuseScore 0.7.0</software>
<encoding-date>2007-09-10</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="no"/>
<supports element="print" attribute="new-system" type="no"/>
<supports element="stem" type="yes"/>
</encoding>
</identification>
<part-list>
<score-part id="P1">
<part-name>Guitar</part-name>
<score-instrument id="P1-I1">
<instrument-name>Guitar</instrument-name>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>1</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
</measure>
<measure number="2">
<barline location="left">
<ending number="1, 2, 3" type="start">1-3</ending>
</barline>
<note>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
<ending number="1, 2, 3" type="stop"/>
<repeat direction="backward"/>
</barline>
</measure>
<measure number="3">
<barline location="left">
<ending number="4" type="start">4</ending>
</barline>
<note>
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
<barline location="right">
<ending number="4" type="discontinue"/>
</barline>
</measure>
<measure number="4">
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
4 changes: 2 additions & 2 deletions mtest/musicxml/io/testVoltaHiding_ref.xml
Expand Up @@ -415,7 +415,7 @@
</measure>
<measure number="14">
<barline location="left">
<ending number="1" type="start"/>
<ending number="1" type="start">1</ending>
</barline>
<note>
<rest measure="yes"/>
Expand Down Expand Up @@ -506,7 +506,7 @@
</measure>
<measure number="21">
<barline location="left">
<ending number="2" type="start"/>
<ending number="2" type="start">2</ending>
</barline>
<note>
<rest measure="yes"/>
Expand Down
1 change: 1 addition & 0 deletions mtest/musicxml/io/tst_mxml_io.cpp
Expand Up @@ -272,6 +272,7 @@ private slots:
void voiceMapper3() { mxmlIoTestRef("testVoiceMapper3"); }
void voicePiano1() { mxmlIoTest("testVoicePiano1"); }
void volta1() { mxmlIoTest("testVolta1"); }
void volta2() { mxmlIoTest("testVolta2"); }
void voltaHiding1() { mxmlImportTestRef("testVoltaHiding"); }
void voltaHiding2() { mxmlIoTestRef("testVoltaHiding"); }
void wedgeOffset() { mxmlImportTestRef("testWedgeOffset"); }
Expand Down

7 comments on commit a24083a

@lvinken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testVoltaHiding is not something I recognise, don't know why it is in your test/musicxml/io but not in 3.x in test/musicxml/io or in master in src/importexport/musicxml/tests/data. Perhaps part of some unmerged PR ?

@Jojo-Schmitz
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz commented on a24083a Feb 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well possible that is from those backend fixes. It is in PR #9000, but no worries, just look at the other one.

Edit: Indeed, it stems from #8622

@lvinken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "other one" (testTextLines) was introduced in 3.x by commit a2f4f1b, which solves issue 303027. Pull request #5965.

The code change is present in master, as is the testfile. The test does work correctly in master.

@lvinken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync to master in commit 93bfbf3

@Jojo-Schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know it is disabled, and doesn't work, that's why I left it disabled in e414499

@lvinken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testTextLines must be called using mxmlMscxExportTestRef

@Jojo-Schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've enabled it in #10586 now.

Please sign in to comment.