Skip to content

Commit

Permalink
fix #38146
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Nov 25, 2014
1 parent 0a59df0 commit eacac5c
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 7 deletions.
17 changes: 10 additions & 7 deletions libmscore/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,16 @@ bool TrackList::write(Measure* measure) const
else {
Fraction d = qMin(rest, duration);
if (e->type() == Element::Type::REST || e->type() == Element::Type::REPEAT_MEASURE) {
segment = m->getSegment(Segment::Type::ChordRest, m->tick() + pos.ticks());
Rest* r = new Rest(score, TDuration(d));
r->setTrack(_track);
segment->add(r);
duration -= d;
rest -= d;
pos += d;
for (TDuration k : toDurationList(d, false)) {
Rest* r = new Rest(score, k);
Fraction dd(k.fraction());
r->setTrack(_track);
segment = m->getSegment(Segment::Type::ChordRest, m->tick() + pos.ticks());
segment->add(r);
duration -= dd;
rest -= dd;
pos += dd;
}
}
else if (e->type() == Element::Type::CHORD) {
segment = m->getSegment(e, m->tick() + pos.ticks());
Expand Down
149 changes: 149 additions & 0 deletions mtest/libmscore/timesig/timesig-04-ref.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="2.00">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.36</page-height>
<page-width>1190.88</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>57.0217</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>57.0217</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="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle">timesig</metaTag>
<PageList>
<Page>
<System>
</System>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Voice</trackName>
<Instrument>
<longName pos="0">Voice</longName>
<shortName pos="0">Vo.</shortName>
<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="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="52"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
<Text>
<style>Title</style>
<text>timesig</text>
</Text>
</VBox>
<Measure number="1">
<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">
<TimeSig>
<sigN>6</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
<Rest>
<durationType>whole</durationType>
</Rest>
<Rest>
<durationType>quarter</durationType>
</Rest>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="6" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>
154 changes: 154 additions & 0 deletions mtest/libmscore/timesig/timesig-04.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="2.01">
<programVersion>2.0.0</programVersion>
<programRevision>3543170</programRevision>
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Synthesizer>
</Synthesizer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.36</page-height>
<page-width>1190.88</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>57.0217</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>57.0217</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="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="creationDate">2014-11-25</metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="platform">Linux</metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle">timesig</metaTag>
<PageList>
<Page>
<System>
</System>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Voice</trackName>
<Instrument>
<longName pos="0">Voice</longName>
<shortName pos="0">Vo.</shortName>
<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="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="52"/>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
<Text>
<style>Title</style>
<text>timesig</text>
</Text>
</VBox>
<Measure number="1">
<KeySig>
<accidental>0</accidental>
</KeySig>
<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>71</pitch>
<tpc>19</tpc>
</Note>
</Chord>
<Rest>
<durationType>quarter</durationType>
</Rest>
<Rest>
<durationType>half</durationType>
</Rest>
</Measure>
<Measure number="3">
<Rest>
<durationType>measure</durationType>
<duration z="4" n="4"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>
22 changes: 22 additions & 0 deletions mtest/libmscore/timesig/tst_timesig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TestTimesig : public QObject, public MTest
void timesig01();
void timesig02();
void timesig03();
void timesig04();
};

//---------------------------------------------------------
Expand Down Expand Up @@ -102,6 +103,27 @@ void TestTimesig::timesig03()
delete score;
}

//---------------------------------------------------------
/// timesig04
/// add a 6/4 time signature in the second measure
/// which already contains a quarter note
//---------------------------------------------------------

void TestTimesig::timesig04()
{
Score* score = readScore(DIR + "timesig-04.mscx");
QVERIFY(score);
Measure* m = score->firstMeasure()->nextMeasure();
TimeSig* ts = new TimeSig(score);
ts->setSig(Fraction(6, 4), TimeSigType::NORMAL);

score->cmdAddTimeSig(m, 0, ts, false);
score->doLayout();

QVERIFY(saveCompareScore(score, "timesig-04.mscx", DIR + "timesig-04-ref.mscx"));
delete score;
}

QTEST_MAIN(TestTimesig)
#include "tst_timesig.moc"

1 change: 1 addition & 0 deletions mtest/libmscore/timesig/updateReference
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
cp ../../../build.debug/mtest/libmscore/timesig/timesig01.mscx timesig01-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-02a.mscx timesig-02-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-03.mscx timesig-03-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-04.mscx timesig-04-ref.mscx

0 comments on commit eacac5c

Please sign in to comment.