Ejemplo n.º 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;
}
Ejemplo n.º 2
0
void TestNote::grace()
      {
      Score* 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().first();
//      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(score);
      ar->setArticulationType(ArticulationType::Sforzatoaccent);
      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"));

      }
Ejemplo n.º 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;
}