Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/engraving/dom/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,15 @@ PropertyValue Chord::propertyDefault(Pid propertyId) const
}
}

bool Chord::isUserModified() const
{
if (showStemSlash() != propertyDefault(Pid::SHOW_STEM_SLASH).toBool()) {
return true;
}

return EngravingItem::isUserModified();
}

//---------------------------------------------------------
// setProperty
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/chord.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class Chord final : public ChordRest
PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const PropertyValue&) override;
PropertyValue propertyDefault(Pid) const override;
bool isUserModified() const override;

void reset() override;

Expand Down
207 changes: 207 additions & 0 deletions src/engraving/tests/note_data/graceAfterSlashSave-ref.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="4.60">
<Score>
<eid>B_B</eid>
<Division>480</Division>
<Style>
<maskBarlinesForText>0</maskBarlinesForText>
<scaleRythmicSpacingForSmallNotes>0</scaleRythmicSpacingForSmallNotes>
<pageNumberFontSize>9</pageNumberFontSize>
<pageNumberFontStyle>0</pageNumberFontStyle>
<changesBeforeBarlineRepeats>0</changesBeforeBarlineRepeats>
<changesBeforeBarlineOtherJumps>0</changesBeforeBarlineOtherJumps>
<showCourtesiesRepeats>0</showCourtesiesRepeats>
<showCourtesiesOtherJumps>0</showCourtesiesOtherJumps>
<showCourtesiesAfterCancellingRepeats>0</showCourtesiesAfterCancellingRepeats>
<showCourtesiesAfterCancellingOtherJumps>0</showCourtesiesAfterCancellingOtherJumps>
<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="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<Part id="1">
<Staff>
<eid>C_C</eid>
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="1" span="2" col="0" visible="1"/>
<barLineSpan>1</barLineSpan>
</Staff>
<Staff>
<eid>D_D</eid>
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<defaultClef>F</defaultClef>
</Staff>
<trackName>Piano</trackName>
<Instrument id="piano">
<longName>Piano</longName>
<shortName>Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</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="0"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure>
<eid>E_E</eid>
<voice>
<TimeSig>
<eid>F_F</eid>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Chord>
<eid>G_G</eid>
<durationType>eighth</durationType>
<grace8after/>
<showStemSlash>1</showStemSlash>
<Note>
<eid>H_H</eid>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<eid>I_I</eid>
<durationType>half</durationType>
<Note>
<eid>J_J</eid>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Rest>
<eid>K_K</eid>
<durationType>half</durationType>
</Rest>
</voice>
</Measure>
<Measure>
<eid>L_L</eid>
<voice>
<Rest>
<eid>M_M</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<eid>N_N</eid>
<voice>
<Rest>
<eid>O_O</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<eid>P_P</eid>
<voice>
<Rest>
<eid>Q_Q</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
<BarLine>
<subtype>end</subtype>
<eid>R_R</eid>
</BarLine>
</voice>
</Measure>
</Staff>
<Staff id="2">
<Measure>
<voice>
<TimeSig>
<eid>S_S</eid>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Rest>
<eid>T_T</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Rest>
<eid>U_U</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Rest>
<eid>V_V</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Rest>
<eid>W_W</eid>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
</Staff>
</Score>
</museScore>
22 changes: 22 additions & 0 deletions src/engraving/tests/note_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,28 @@ TEST_F(Engraving_NoteTests, grace)
EXPECT_TRUE(ScoreComp::saveCompareScore(score, u"grace-test.mscx", NOTE_DATA_DIR + u"grace-ref.mscx"));
}

//---------------------------------------------------------
/// graceSlashSave
/// read/write test of grace notes
//---------------------------------------------------------

TEST_F(Engraving_NoteTests, graceAfterSlashSave)
{
MasterScore* score = ScoreRW::readScore(NOTE_DATA_DIR + u"grace.mscx");
score->doLayout();
Chord* chord = score->firstMeasure()->findChord(Fraction(0, 1), 0);
Note* note = chord->upNote();

// create
score->setGraceNote(chord, note->pitch(), NoteType::GRACE8_AFTER, Constants::DIVISION / 2);
Chord* gc = chord->graceNotes().front();
gc->undoChangeProperty(Pid::SHOW_STEM_SLASH, true);

EXPECT_TRUE(gc->showStemSlash());

EXPECT_TRUE(ScoreComp::saveCompareScore(score, u"graceAfterSlashSave-test.mscx", NOTE_DATA_DIR + u"graceAfterSlashSave-ref.mscx"));
}

//---------------------------------------------------------
/// tpc
/// test of note tpc values
Expand Down
Loading