本文整理汇总了C++中MasterScore::startCmd方法的典型用法代码示例。如果您正苦于以下问题:C++ MasterScore::startCmd方法的具体用法?C++ MasterScore::startCmd怎么用?C++ MasterScore::startCmd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterScore
的用法示例。
在下文中一共展示了MasterScore::startCmd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undoSlashRhythm
void TestTools::undoSlashRhythm()
{
QString readFile(DIR + "undoSlashRhythm.mscx");
QString writeFile1("undoSlashRhythm01-test.mscx");
QString reference1(DIR + "undoSlashRhythm01-ref.mscx");
QString writeFile2("undoSlashRhythm02-test.mscx");
QString reference2(DIR + "undoSlashRhythm02-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->cmdSlashRhythm();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo(&ed);
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例2: readFile
void TestImplodeExplode::implode1()
{
QString readFile(DIR + "implode1.mscx");
QString writeFile1("implode1-test1.mscx");
QString writeFile2("implode1-test2.mscx");
QString reference(DIR + "implode1-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->cmdImplode();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, readFile));
delete score;
}
示例3: quarter
void TestMeasure::undoDelInitialVBox_269919()
{
MasterScore* score = readScore(DIR + "undoDelInitialVBox_269919.mscx");
// 1. delete initial VBox
score->startCmd();
MeasureBase* initialVBox = score->measure(0);
score->select(initialVBox);
score->cmdDeleteSelection();
score->endCmd();
// 2. change duration of first chordrest
score->startCmd();
Measure* m = score->firstMeasure();
ChordRest* cr = m->findChordRest(Fraction(0,1), 0);
Fraction quarter(4, 1);
score->changeCRlen(cr, quarter);
score->endCmd();
// 3. Undo to restore first chordrest
score->undoRedo(true, 0);
// 4. Undo to restore initial VBox resulted in assert failure crash
score->undoRedo(true, 0);
QVERIFY(saveCompareScore(score, "undoDelInitialVBox_269919.mscx", DIR + "undoDelInitialVBox_269919-ref.mscx"));
delete score;
}
示例4: insertBfKeyChange
void TestMeasure::insertBfKeyChange()
{
MasterScore* score = readScore(DIR + "measure-insert_bf_key.mscx");
// 4th measure
Measure* m = score->firstMeasure()->nextMeasure();
m = m->nextMeasure()->nextMeasure();
score->startCmd();
score->insertMeasure(ElementType::MEASURE, m);
score->endCmd();
QVERIFY(score->checkKeys());
QVERIFY(saveCompareScore(score, "measure-insert_bf_key.mscx", DIR + "measure-insert_bf_key-ref.mscx"));
score->undoRedo(true);
QVERIFY(score->checkKeys());
QVERIFY(saveCompareScore(score, "measure-insert_bf_key_undo.mscx", DIR + "measure-insert_bf_key.mscx"));
m = score->firstMeasure()->nextMeasure()->nextMeasure()->nextMeasure()->nextMeasure()->nextMeasure();
score->startCmd();
score->insertMeasure(ElementType::MEASURE, m);
score->endCmd();
QVERIFY(score->checkKeys());
QVERIFY(saveCompareScore(score, "measure-insert_bf_key-2.mscx", DIR + "measure-insert_bf_key-2-ref.mscx"));
score->undoRedo(true);
QVERIFY(score->checkKeys());
QVERIFY(saveCompareScore(score, "measure-insert_bf_key_undo.mscx", DIR + "measure-insert_bf_key.mscx"));
delete score;
}
示例5: undoLockLineBreaks
void TestTools::undoLockLineBreaks()
{
QString readFile(DIR + "undoLockLineBreaks.mscx");
QString writeFile1("undoLockLineBreaks01-test.mscx");
QString reference1(DIR + "undoLockLineBreaks01-ref.mscx");
QString writeFile2("undoLockLineBreaks02-test.mscx");
QString reference2(DIR + "undoLockLineBreaks02-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->addRemoveBreaks(0, true);
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例6: gap
void TestMeasure::gap()
{
MasterScore* score = readScore(DIR + "gaps.mscx");
Element* tst = 0;
//Select and delete third quarter rest in first Measure (voice 2)
score->startCmd();
Measure* m = score->firstMeasure();
Segment* s = m->undoGetSegment(SegmentType::ChordRest, Fraction::fromTicks(960));
Element* el = s->element(1);
score->select(el);
score->cmdDeleteSelection();
score->endCmd();
tst = s->element(1);
Q_ASSERT(tst);
QVERIFY(tst->isRest() && toRest(tst)->isGap() /*&& toRest(tst)->durationType() == TDuration::DurationType::V_QUARTER*/);
//Select and delete second quarter rest in third Measure (voice 4)
score->startCmd();
m = m->nextMeasure()->nextMeasure();
s = m->undoGetSegment(SegmentType::ChordRest, Fraction::fromTicks(4320));
el = s->element(3);
score->select(el);
score->cmdDeleteSelection();
score->endCmd();
tst = s->element(3);
Q_ASSERT(tst);
QVERIFY(tst->isRest() && toRest(tst)->isGap() /*&& toRest(tst)->durationType() == TDuration::DurationType::V_QUARTER*/);
//Select and delete first quarter rest in third Measure (voice 4)
score->startCmd();
s = m->undoGetSegment(SegmentType::ChordRest, Fraction::fromTicks(3840));
el = s->element(3);
score->select(el);
score->cmdDeleteSelection();
score->endCmd();
tst = s->element(3);
Q_ASSERT(tst);
QVERIFY(tst->isRest() && toRest(tst)->isGap()
&& toRest(tst)->actualTicks() == Fraction::fromTicks(960)
/*&& toRest(tst)->durationType() == TDuration::DurationType::V_HALF*/
);
delete score;
}
示例7: undoSlashFill
void TestTools::undoSlashFill()
{
QString readFile(DIR + "undoSlashFill.mscx");
QString writeFile1("undoSlashFill01-test.mscx");
QString reference1(DIR + "undoSlashFill01-ref.mscx");
QString writeFile2("undoSlashFill02-test.mscx");
QString reference2(DIR + "undoSlashFill02-ref.mscx");
MasterScore* score = readScore(readFile);
// select
Segment* s = score->firstMeasure()->findSegment(Segment::Type::ChordRest, MScore::division * 2);
score->selection().setRange(s, score->lastSegment(), 0, 2);
// do
score->startCmd();
score->cmdSlashFill();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例8: readScore
void TestSpanners::spanners13()
{
DropData dropData;
LayoutBreak* brk;
MasterScore* score = readScore(DIR + "lyricsline06.mscx");
QVERIFY(score);
score->doLayout();
// DROP A BREAK AT FIRST MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
QVERIFY(msr);
brk = new LayoutBreak(score);
brk->setLayoutBreakType(LayoutBreak::Type::LINE);
dropData.pos = msr->pagePos();
dropData.element = brk;
score->startCmd();
msr->drop(dropData);
score->endCmd();
// VERIFY SEGMENTS IN SYSTEMS AND THEN SCORE
for (System* sys : score->systems())
QVERIFY(sys->spannerSegments().size() == 1);
QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06-ref.mscx"));
// UNDO AND VERIFY
score->undoStack()->undo();
score->doLayout(); // systems need to be re-computed
QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06.mscx"));
delete score;
}
示例9: grace
void TestNote::grace()
{
MasterScore* score = readScore(DIR + "grace.mscx");
score->doLayout();
Ms::Chord* chord = score->firstMeasure()->findChord(0, 0);
Note* note = chord->upNote();
// create
score->setGraceNote(chord, note->pitch(), NoteType::APPOGGIATURA, MScore::division/2);
Ms::Chord* gc = chord->graceNotes().first();
Note* gn = gc->notes().front();
// Note* n = static_cast<Note*>(writeReadElement(gn));
// QCOMPARE(n->noteType(), NoteType::APPOGGIATURA);
// delete n;
// tie
score->select(gn);
score->cmdAddTie();
// n = static_cast<Note*>(writeReadElement(gn));
// QVERIFY(n->tieFor() != 0);
// delete n;
// tremolo
score->startCmd();
Tremolo* tr = new Tremolo(score);
tr->setTremoloType(TremoloType::R16);
tr->setParent(gc);
tr->setTrack(gc->track());
score->undoAddElement(tr);
score->endCmd();
// Ms::Chord* c = static_cast<Ms::Chord*>(writeReadElement(gc));
// QVERIFY(c->tremolo() != 0);
// delete c;
// articulation
score->startCmd();
Articulation* ar = new Articulation(SymId::articAccentAbove, score);
ar->setParent(gc);
ar->setTrack(gc->track());
score->undoAddElement(ar);
score->endCmd();
// c = static_cast<Ms::Chord*>(writeReadElement(gc));
// QVERIFY(c->articulations().size() == 1);
// delete c;
QVERIFY(saveCompareScore(score, "grace-test.mscx", DIR + "grace-ref.mscx"));
}
示例10: testTransposePart
void TestChordSymbol::testTransposePart()
{
MasterScore* score = test_pre("transpose-part");
score->startCmd();
score->cmdSelectAll();
score->transpose(TransposeMode::BY_INTERVAL, TransposeDirection::UP, Key::C, 4, false, true, true);
score->endCmd();
test_post(score, "transpose-part");
}
示例11: spanner_b
void TestMeasure::spanner_b()
{
MasterScore* score = readScore(DIR + "measure-4.mscx");
Measure* m = score->firstMeasure();
score->startCmd();
score->insertMeasure(ElementType::MEASURE, m);
score->endCmd();
QVERIFY(saveCompareScore(score, "measure-5.mscx", DIR + "measure-5-ref.mscx"));
delete score;
}
示例12: insertMeasureEnd
void TestMeasure::insertMeasureEnd()
{
MasterScore* score = readScore(DIR + "measure-1.mscx");
score->startCmd();
score->insertMeasure(ElementType::MEASURE, 0);
score->endCmd();
QVERIFY(saveCompareScore(score, "measure-3.mscx", DIR + "measure-3-ref.mscx"));
delete score;
}
示例13: spanner_A
void TestMeasure::spanner_A()
{
MasterScore* score = readScore(DIR + "measure-6.mscx");
score->select(score->firstMeasure());
score->startCmd();
score->localTimeDelete();
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, "measure-6.mscx", DIR + "measure-6-ref.mscx"));
delete score;
}
示例14: insertMeasureBegin
void TestMeasure::insertMeasureBegin()
{
MasterScore* score = readScore(DIR + "measure-1.mscx");
score->startCmd();
Measure* m = score->firstMeasure();
score->insertMeasure(Element::Type::MEASURE, m);
score->endCmd();
QVERIFY(saveCompareScore(score, "measure-2.mscx", DIR + "measure-2-ref.mscx"));
delete score;
}
示例15: spanner_C
void TestMeasure::spanner_C()
{
MasterScore* score = readScore(DIR + "measure-8.mscx");
Measure* m = score->firstMeasure()->nextMeasure();
score->select(m);
score->startCmd();
score->localTimeDelete();
score->endCmd();
QVERIFY(saveCompareScore(score, "measure-8.mscx", DIR + "measure-8-ref.mscx"));
delete score;
}