extend layout benchmark: first (cold) next (warm)

This commit is contained in:
Werner Schweer 2012-08-01 17:59:48 +02:00
parent 18991e6755
commit 772cb4daba
7 changed files with 25 additions and 7 deletions

View file

@ -58,6 +58,7 @@ void TestBeam::initTestCase()
void TestBeam::beam(const char* path)
{
Score* score = readScore(DIR + path);
score->doLayout();
QVERIFY(score);
QVERIFY(saveCompareScore(score, path, DIR + path));
delete score;

View file

@ -13,6 +13,7 @@
#include <QtTest/QtTest>
#include "mtest/testutils.h"
#include "libmscore/score.h"
#define DIR QString("libmscore/compat/")
@ -70,6 +71,7 @@ void TestCompat::compat()
QString reference(DIR + file + "-ref.mscx");
Score* score = readScore(readFile);
score->doLayout();
QVERIFY(score);
QVERIFY(saveCompareScore(score, writeFile, reference));
}

View file

@ -58,7 +58,7 @@ void TestJoin::initTestCase()
void TestJoin::join(const char* p1, const char* p2)
{
Score* score = readScore(DIR + p1);
QVERIFY(score);
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();
@ -75,7 +75,7 @@ void TestJoin::join(const char* p1, const char* p2)
void TestJoin::join(const char* p1, const char* p2, int index)
{
Score* score = readScore(DIR + p1);
QVERIFY(score);
score->doLayout();
Measure* m1 = score->firstMeasure();
for (int i = 0; i < index; ++i)
m1 = m1->nextMeasure();

View file

@ -25,11 +25,13 @@ class TestBenchmark : public QObject, public MTest
{
Q_OBJECT
Score* score;
void beam(const char* path);
private slots:
void initTestCase();
void benchmark();
void benchmark1();
void benchmark2();
};
//---------------------------------------------------------
@ -45,10 +47,18 @@ void TestBenchmark::initTestCase()
// benchmark
//---------------------------------------------------------
void TestBenchmark::benchmark()
void TestBenchmark::benchmark1()
{
Score* score = readScore(DIR + "goldberg.mscx");
QBENCHMARK {
score = readScore(DIR + "goldberg.mscx");
QBENCHMARK { // cold run
score->doLayout();
}
}
void TestBenchmark::benchmark2()
{
score->doLayout();
QBENCHMARK { // warm run
score->doLayout();
}
}

View file

@ -138,6 +138,7 @@ void TestParts::createParts(Score* score)
void TestParts::testPartCreation(const QString& test)
{
Score* score = readScore(DIR + test + ".mscx");
score->doLayout();
QVERIFY(score);
QVERIFY(saveCompareScore(score, test + "-1.mscx", DIR + test + ".mscx"));
createParts(score);
@ -152,6 +153,8 @@ void TestParts::testPartCreation(const QString& test)
void TestParts::appendMeasure()
{
Score* score = readScore(DIR + "part2.mscx");
score->doLayout();
QVERIFY(score);
createParts(score);
@ -175,6 +178,7 @@ void TestParts::appendMeasure()
void TestParts::insertMeasure()
{
Score* score = readScore(DIR + "part2.mscx");
score->doLayout();
QVERIFY(score);
createParts(score);

View file

@ -52,9 +52,11 @@ void TestNotes::initTestCase()
void TestNotes::omrFileTest(QString file)
{
Score* score = readScore(DIR + file + ".mscx");
score->doLayout();
QVERIFY(score);
savePdf(score, file + ".pdf");
Score* score1 = readCreatedScore(file + ".pdf");
score1->doLayout();
QVERIFY(score1);
QVERIFY(saveCompareScore(score1, file + ".mscx", DIR + file + "-ref.mscx"));
}

View file

@ -121,7 +121,6 @@ Score* MTest::readCreatedScore(const QString& name)
delete score;
return 0;
}
score->doLayout();
return score;
}