Example #1
0
void TestSpanners::spanners07()
{
    DropData    dropData;
    Glissando*  gliss;

    MasterScore* score = readScore(DIR + "glissando-cloning04.mscx");
    QVERIFY(score);
    score->doLayout();

    // DROP A GLISSANDO ON FIRST NOTE
    Measure*    msr   = score->firstMeasure();
    QVERIFY(msr);
    Segment*    seg   = msr->findSegment(Segment::Type::ChordRest, 0);
    QVERIFY(seg);
    Ms::Chord*      chord = static_cast<Ms::Chord*>(seg->element(0));
    QVERIFY(chord && chord->type() == Element::Type::CHORD);
    Note*       note  = chord->upNote();
    QVERIFY(note);
    // drop a glissando on note
    gliss             = new Glissando(score);
    dropData.pos      = note->pagePos();
    dropData.element  = gliss;
    note->drop(dropData);

    QVERIFY(saveCompareScore(score, "glissando-cloning04.mscx", DIR + "glissando-cloning04-ref.mscx"));
    delete score;
}
Example #2
0
void TestSpanners::spanners08()
{
    MasterScore* score = readScore(DIR + "lyricsline01.mscx");
    QVERIFY(score);
    score->doLayout();

    // verify initial LyricsLine setup
    System* sys = score->systems().at(0);
    QVERIFY(sys->spannerSegments().size() == 1);
    QVERIFY(score->unmanagedSpanners().size() == 1);

    // DELETE LYRICS
    Measure*    msr   = score->firstMeasure();
    QVERIFY(msr);
    Segment*    seg   = msr->findSegment(Segment::Type::ChordRest, 0);
    QVERIFY(seg);
    Ms::Chord*      chord = static_cast<Ms::Chord*>(seg->element(0));
    QVERIFY(chord && chord->type() == Element::Type::CHORD);
    QVERIFY(chord->lyrics().size() > 0);
    Lyrics*     lyr   = chord->lyrics(0, Element::Placement::BELOW);
    score->startCmd();
    score->undoRemoveElement(lyr);
    score->endCmd();

    // verify setup after deletion
    QVERIFY(sys->spannerSegments().size() == 0);
    QVERIFY(score->unmanagedSpanners().size() == 0);

    // save and verify score after deletion
    QVERIFY(saveCompareScore(score, "lyricsline01.mscx", DIR + "lyricsline01-ref.mscx"));

    // UNDO
    score->undoStack()->undo();
    score->doLayout();

    // verify setup after undo
    QVERIFY(sys->spannerSegments().size() == 1);
    QVERIFY(score->unmanagedSpanners().size() == 1);

    // save and verify score after undo
    QVERIFY(saveCompareScore(score, "lyricsline01.mscx", DIR + "lyricsline01.mscx"));
    delete score;
}
Example #3
0
void TestSpanners::spanners03()
{
    DropData    dropData;
    Glissando*  gliss;

    MasterScore* score = readScore(DIR + "glissando-graces01.mscx");
    QVERIFY(score);
    score->doLayout();

    // GLISSANDO FROM MAIN NOTE TO AFTER-GRACE
    // go to top note of first chord
    Measure*    msr   = score->firstMeasure();
    QVERIFY(msr);
    Segment*    seg   = msr->findSegment(Segment::Type::ChordRest, 0);
    QVERIFY(seg);
    Ms::Chord*      chord = static_cast<Ms::Chord*>(seg->element(0));
    QVERIFY(chord && chord->type() == Element::Type::CHORD);
    Note*       note  = chord->upNote();
    QVERIFY(note);
    // drop a glissando on note
    gliss             = new Glissando(score); // create a new element each time, as drop() will eventually delete it
    dropData.pos      = note->pagePos();
    dropData.element  = gliss;
    note->drop(dropData);

    // GLISSANDO FROM AFTER-GRACE TO BEFORE-GRACE OF NEXT CHORD
    // go to last after-grace of chord and drop a glissando on it
    Ms::Chord*      grace = chord->graceNotesAfter().last();
    QVERIFY(grace && grace->type() == Element::Type::CHORD);
    note              = grace->upNote();
    QVERIFY(note);
    gliss             = new Glissando(score);
    dropData.pos      = note->pagePos();
    dropData.element  = gliss;
    note->drop(dropData);

    // GLISSANDO FROM MAIN NOTE TO BEFORE-GRACE OF NEXT CHORD
    // go to next chord
    seg               = seg->nextCR(0);
    QVERIFY(seg);
    chord             = static_cast<Ms::Chord*>(seg->element(0));
    QVERIFY(chord && chord->type() == Element::Type::CHORD);
    note              = chord->upNote();
    QVERIFY(note);
    gliss             = new Glissando(score);
    dropData.pos      = note->pagePos();
    dropData.element  = gliss;
    note->drop(dropData);

    // GLISSANDO FROM BEFORE-GRACE TO MAIN NOTE
    // go to next chord
    seg               = seg->nextCR(0);
    QVERIFY(seg);
    chord             = static_cast<Ms::Chord*>(seg->element(0));
    QVERIFY(chord && chord->type() == Element::Type::CHORD);
    // go to its last before-grace note
    grace             = chord->graceNotesBefore().last();
    QVERIFY(grace && grace->type() == Element::Type::CHORD);
    note              = grace->upNote();
    QVERIFY(note);
    gliss             = new Glissando(score);
    dropData.pos      = note->pagePos();
    dropData.element  = gliss;
    note->drop(dropData);

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