void TestMeasure::minWidth() { MasterScore* score = readScore(DIR + "measure-2.mscx"); int n = score->systems().size(); int measuresSystem[n]; for (int i = 0; i < n; ++i) measuresSystem[i] = score->systems().at(i)->measures().size(); score->doLayout(); Measure* m1 = score->systems().at(1)->lastMeasure(); Measure* m2 = score->systems().at(2)->firstMeasure(); qreal mw1 = m1->minWidth1(); qreal mw2 = m2->minWidth1(); score->doLayout(); QCOMPARE(mw1, m1->minWidth1()); QCOMPARE(mw2, m2->minWidth1()); // after second layout nothing should be changed: for (int i = 0; i < n; ++i) { QCOMPARE(measuresSystem[i], int(score->systems().at(i)->measures().size())); } }
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; }
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; }