Skip to content

Commit

Permalink
fix #21600 fix #21889 and add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Jul 20, 2013
1 parent c01860d commit 867d647
Show file tree
Hide file tree
Showing 8 changed files with 834 additions and 9 deletions.
14 changes: 9 additions & 5 deletions libmscore/paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,23 @@ void Score::pasteStaff(XmlReader& e, ChordRest* dst)
done = true; // break main loop, nothing more to paste
break;
}
if (!makeGap1(dstTick, dstStaffIdx, Fraction::fromTicks(tickLen))) {
qDebug("cannot make gap in staff %d at tick %d", dstStaffIdx, dstTick);
done = true; // break main loop, cannot make gap
break;
}

e.tuplets().clear();
bool makeGap = true;
while (e.readNextStartElement()) {
pasted = true;
const QStringRef& tag(e.name());

if (tag == "tick") {
int tick = e.readInt();
e.setTick(tick);
int shift = tick - tickStart;
if (makeGap && !makeGap1(dstTick + shift, dstStaffIdx, Fraction::fromTicks(tickLen - shift))) {
qDebug("cannot make gap in staff %d at tick %d", dstStaffIdx, dstTick + shift);
done = true; // break main loop, cannot make gap
break;
}
makeGap = false; // create gap only once per staff
}
else if (tag == "Tuplet") {
Tuplet* tuplet = new Tuplet(this);
Expand Down
238 changes: 238 additions & 0 deletions mtest/libmscore/copypaste/copypaste12-ref.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="1.24">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="Platform">X11</metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle">Test</metaTag>
<PageList>
<Page>
<System>
</System>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<type>0</type>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Voice</trackName>
<Instrument>
<trackName>Voice</trackName>
<minPitchP>36</minPitchP>
<maxPitchP>94</maxPitchP>
<minPitchA>40</minPitchA>
<maxPitchA>79</maxPitchA>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>85</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
<Text>
<style>Title</style>
<text>Test</text>
</Text>
<Text>
<style>Subtitle</style>
<text>Copy-Paste</text>
</Text>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
</Measure>
<Measure number="2">
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>74</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
<tick>1920</tick>
<Chord>
<track>1</track>
<durationType>quarter</durationType>
<Note>
<track>1</track>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Rest>
<track>1</track>
<durationType>quarter</durationType>
</Rest>
<Chord>
<track>1</track>
<durationType>quarter</durationType>
<Note>
<track>1</track>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Rest>
<track>1</track>
<durationType>quarter</durationType>
</Rest>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
<Measure number="4">
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>74</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
<tick>5760</tick>
<Chord>
<track>1</track>
<durationType>quarter</durationType>
<Note>
<track>1</track>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Rest>
<track>1</track>
<durationType>quarter</durationType>
</Rest>
<Chord>
<track>1</track>
<durationType>quarter</durationType>
<Note>
<track>1</track>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Rest>
<track>1</track>
<durationType>quarter</durationType>
</Rest>
</Measure>
</Staff>
</Score>
</museScore>
Loading

0 comments on commit 867d647

Please sign in to comment.