Skip to content

Commit 2c943f2

Browse files
committed
Fix grace note after stem slash save
1 parent b64bb94 commit 2c943f2

File tree

3 files changed

+230
-1
lines changed

3 files changed

+230
-1
lines changed

src/engraving/rw/write/twrite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ void TWrite::write(const Chord* item, XmlWriter& xml, WriteContext& ctx)
910910
if (item->hook() && item->hook()->isUserModified()) {
911911
write(item->hook(), xml, ctx);
912912
}
913-
if (item->showStemSlash() && item->isUserModified()) {
913+
if (item->showStemSlash() && item->showStemSlash() != item->propertyDefault(Pid::SHOW_STEM_SLASH).toBool()) {
914914
xml.tag("showStemSlash", item->showStemSlash());
915915
}
916916
if (item->stemSlash() && item->stemSlash()->isUserModified()) {
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<museScore version="4.60">
3+
<Score>
4+
<eid>B_B</eid>
5+
<Division>480</Division>
6+
<Style>
7+
<maskBarlinesForText>0</maskBarlinesForText>
8+
<scaleRythmicSpacingForSmallNotes>0</scaleRythmicSpacingForSmallNotes>
9+
<pageNumberFontSize>9</pageNumberFontSize>
10+
<pageNumberFontStyle>0</pageNumberFontStyle>
11+
<changesBeforeBarlineRepeats>0</changesBeforeBarlineRepeats>
12+
<changesBeforeBarlineOtherJumps>0</changesBeforeBarlineOtherJumps>
13+
<showCourtesiesRepeats>0</showCourtesiesRepeats>
14+
<showCourtesiesOtherJumps>0</showCourtesiesOtherJumps>
15+
<showCourtesiesAfterCancellingRepeats>0</showCourtesiesAfterCancellingRepeats>
16+
<showCourtesiesAfterCancellingOtherJumps>0</showCourtesiesAfterCancellingOtherJumps>
17+
<spatium>1.76389</spatium>
18+
</Style>
19+
<showInvisible>1</showInvisible>
20+
<showUnprintable>1</showUnprintable>
21+
<showFrames>1</showFrames>
22+
<showMargins>0</showMargins>
23+
<metaTag name="arranger"></metaTag>
24+
<metaTag name="composer"></metaTag>
25+
<metaTag name="copyright"></metaTag>
26+
<metaTag name="lyricist"></metaTag>
27+
<metaTag name="movementNumber"></metaTag>
28+
<metaTag name="movementTitle"></metaTag>
29+
<metaTag name="source"></metaTag>
30+
<metaTag name="translator"></metaTag>
31+
<metaTag name="workNumber"></metaTag>
32+
<metaTag name="workTitle"></metaTag>
33+
<Part id="1">
34+
<Staff>
35+
<eid>C_C</eid>
36+
<StaffType group="pitched">
37+
<name>stdNormal</name>
38+
</StaffType>
39+
<bracket type="1" span="2" col="0" visible="1"/>
40+
<barLineSpan>1</barLineSpan>
41+
</Staff>
42+
<Staff>
43+
<eid>D_D</eid>
44+
<StaffType group="pitched">
45+
<name>stdNormal</name>
46+
</StaffType>
47+
<defaultClef>F</defaultClef>
48+
</Staff>
49+
<trackName>Piano</trackName>
50+
<Instrument id="piano">
51+
<longName>Piano</longName>
52+
<shortName>Pno.</shortName>
53+
<trackName>Piano</trackName>
54+
<minPitchP>21</minPitchP>
55+
<maxPitchP>108</maxPitchP>
56+
<minPitchA>21</minPitchA>
57+
<maxPitchA>108</maxPitchA>
58+
<instrumentId>keyboard.piano</instrumentId>
59+
<clef staff="2">F</clef>
60+
<Articulation>
61+
<velocity>100</velocity>
62+
<gateTime>95</gateTime>
63+
</Articulation>
64+
<Articulation name="staccatissimo">
65+
<velocity>100</velocity>
66+
<gateTime>33</gateTime>
67+
</Articulation>
68+
<Articulation name="staccato">
69+
<velocity>100</velocity>
70+
<gateTime>50</gateTime>
71+
</Articulation>
72+
<Articulation name="portato">
73+
<velocity>100</velocity>
74+
<gateTime>67</gateTime>
75+
</Articulation>
76+
<Articulation name="tenuto">
77+
<velocity>100</velocity>
78+
<gateTime>100</gateTime>
79+
</Articulation>
80+
<Articulation name="marcato">
81+
<velocity>120</velocity>
82+
<gateTime>67</gateTime>
83+
</Articulation>
84+
<Articulation name="sforzato">
85+
<velocity>120</velocity>
86+
<gateTime>100</gateTime>
87+
</Articulation>
88+
<Channel>
89+
<program value="0"/>
90+
</Channel>
91+
</Instrument>
92+
</Part>
93+
<Staff id="1">
94+
<Measure>
95+
<eid>E_E</eid>
96+
<voice>
97+
<TimeSig>
98+
<eid>F_F</eid>
99+
<sigN>4</sigN>
100+
<sigD>4</sigD>
101+
</TimeSig>
102+
<Chord>
103+
<eid>G_G</eid>
104+
<durationType>eighth</durationType>
105+
<grace8after/>
106+
<showStemSlash>1</showStemSlash>
107+
<Note>
108+
<eid>H_H</eid>
109+
<pitch>72</pitch>
110+
<tpc>14</tpc>
111+
</Note>
112+
</Chord>
113+
<Chord>
114+
<eid>I_I</eid>
115+
<durationType>half</durationType>
116+
<Note>
117+
<eid>J_J</eid>
118+
<pitch>72</pitch>
119+
<tpc>14</tpc>
120+
</Note>
121+
</Chord>
122+
<Rest>
123+
<eid>K_K</eid>
124+
<durationType>half</durationType>
125+
</Rest>
126+
</voice>
127+
</Measure>
128+
<Measure>
129+
<eid>L_L</eid>
130+
<voice>
131+
<Rest>
132+
<eid>M_M</eid>
133+
<durationType>measure</durationType>
134+
<duration>4/4</duration>
135+
</Rest>
136+
</voice>
137+
</Measure>
138+
<Measure>
139+
<eid>N_N</eid>
140+
<voice>
141+
<Rest>
142+
<eid>O_O</eid>
143+
<durationType>measure</durationType>
144+
<duration>4/4</duration>
145+
</Rest>
146+
</voice>
147+
</Measure>
148+
<Measure>
149+
<eid>P_P</eid>
150+
<voice>
151+
<Rest>
152+
<eid>Q_Q</eid>
153+
<durationType>measure</durationType>
154+
<duration>4/4</duration>
155+
</Rest>
156+
<BarLine>
157+
<subtype>end</subtype>
158+
<eid>R_R</eid>
159+
</BarLine>
160+
</voice>
161+
</Measure>
162+
</Staff>
163+
<Staff id="2">
164+
<Measure>
165+
<voice>
166+
<TimeSig>
167+
<eid>S_S</eid>
168+
<sigN>4</sigN>
169+
<sigD>4</sigD>
170+
</TimeSig>
171+
<Rest>
172+
<eid>T_T</eid>
173+
<durationType>measure</durationType>
174+
<duration>4/4</duration>
175+
</Rest>
176+
</voice>
177+
</Measure>
178+
<Measure>
179+
<voice>
180+
<Rest>
181+
<eid>U_U</eid>
182+
<durationType>measure</durationType>
183+
<duration>4/4</duration>
184+
</Rest>
185+
</voice>
186+
</Measure>
187+
<Measure>
188+
<voice>
189+
<Rest>
190+
<eid>V_V</eid>
191+
<durationType>measure</durationType>
192+
<duration>4/4</duration>
193+
</Rest>
194+
</voice>
195+
</Measure>
196+
<Measure>
197+
<voice>
198+
<Rest>
199+
<eid>W_W</eid>
200+
<durationType>measure</durationType>
201+
<duration>4/4</duration>
202+
</Rest>
203+
</voice>
204+
</Measure>
205+
</Staff>
206+
</Score>
207+
</museScore>

src/engraving/tests/note_tests.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,28 @@ TEST_F(Engraving_NoteTests, grace)
338338
EXPECT_TRUE(ScoreComp::saveCompareScore(score, u"grace-test.mscx", NOTE_DATA_DIR + u"grace-ref.mscx"));
339339
}
340340

341+
//---------------------------------------------------------
342+
/// graceSlashSave
343+
/// read/write test of grace notes
344+
//---------------------------------------------------------
345+
346+
TEST_F(Engraving_NoteTests, graceAfterSlashSave)
347+
{
348+
MasterScore* score = ScoreRW::readScore(NOTE_DATA_DIR + u"grace.mscx");
349+
score->doLayout();
350+
Chord* chord = score->firstMeasure()->findChord(Fraction(0, 1), 0);
351+
Note* note = chord->upNote();
352+
353+
// create
354+
score->setGraceNote(chord, note->pitch(), NoteType::GRACE8_AFTER, Constants::DIVISION / 2);
355+
Chord* gc = chord->graceNotes().front();
356+
gc->undoChangeProperty(Pid::SHOW_STEM_SLASH, true);
357+
358+
EXPECT_TRUE(gc->showStemSlash());
359+
360+
EXPECT_TRUE(ScoreComp::saveCompareScore(score, u"graceAfterSlashSave-test.mscx", NOTE_DATA_DIR + u"graceAfterSlashSave-ref.mscx"));
361+
}
362+
341363
//---------------------------------------------------------
342364
/// tpc
343365
/// test of note tpc values

0 commit comments

Comments
 (0)