aboutsummaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTomas Junnonen <tomas.junnonen@nokia.com>2010-06-22 16:30:53 +0300
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-06-22 16:30:53 +0300
commit0ae3158c994e4454bf01f2cf739bba6d71dd505b (patch)
tree785def2c65c2c72b7d7c611e920d15010831cc0f /benchmarks
parent86ab03725343758ba61bf171c04f27e08412a6c9 (diff)
Changes: Revert static text in simple LabelView
Details: The static text is still causing various problems and needs to be refined a bit. Reverts commits: 669807a0dd9601c8c0df4601529bf77ea8e5e17d dcc8c92ef7079612f98bc8f5fd09b98060c2f8ad 322ef78cb936a4b79f7e7e8e478710b94cf464bc e055c69b26217ce9af9b0e173c70bfe8b31a3b7f 0c42a3b29d28dc2400ce9c803cf86c29ece21fcc
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks.pro1
-rw-r--r--benchmarks/pt_mlabel/pt_mlabel.cpp61
-rw-r--r--benchmarks/pt_mlabel/pt_mlabel.h7
-rw-r--r--benchmarks/pt_mlabel/pt_mlabel.pro2
4 files changed, 51 insertions, 20 deletions
diff --git a/benchmarks/benchmarks.pro b/benchmarks/benchmarks.pro
index c1594bfd..600e7dc6 100644
--- a/benchmarks/benchmarks.pro
+++ b/benchmarks/benchmarks.pro
@@ -18,7 +18,6 @@ SUBDIRS = \
pt_minimalqtapplication \
pt_mprogressindicator \
pt_qapplication \
- pt_mlabel \
pt_mslider \
pt_mtheme \
pt_mtoolbar \
diff --git a/benchmarks/pt_mlabel/pt_mlabel.cpp b/benchmarks/pt_mlabel/pt_mlabel.cpp
index 9f00b459..edf5396b 100644
--- a/benchmarks/pt_mlabel/pt_mlabel.cpp
+++ b/benchmarks/pt_mlabel/pt_mlabel.cpp
@@ -31,9 +31,12 @@ void Pt_MLabel::initTestCase()
{
int argc = 1;
const char *argv[argc];
- char appName[] = "./pt_mlabel";
+ char appName[] = "./eternia";
argv[0] = appName;
app = new MApplication(argc, (char **)argv);
+ MTheme::instance()->changeTheme("common");
+
+ currentViewIndex = 0;
}
void Pt_MLabel::cleanupTestCase()
@@ -43,20 +46,34 @@ void Pt_MLabel::cleanupTestCase()
void Pt_MLabel::init()
{
+ // get size dimensions for test
QFETCH(QString, text);
+ QFETCH(qint32, viewIndex);
+
+ this->currentViewIndex = viewIndex;
// create widget, set size
- subject = new MLabel(text);
- subject->setMaximumWidth(864);
- currentView = new MLabelView(subject);
- subject->setView(currentView); // transfers ownership to controller
-
- // wait for the resource loading to finish
- while (MTheme::instance()->hasPendingRequests()) {
- usleep(100);
- QCoreApplication::processEvents();
+ m_subject = new MLabel(text);
+
+ m_subject->setMaximumWidth(864);
+
+ switch (this->currentViewIndex) {
+ case View:
+ this->currentView = new MLabelView(m_subject);
+ break;
}
+ this->currentView->updateStyle();
+ //this->currentView->styleUpdated();
+
+ // There is no MLabel::setView() so this is the one from
+ // MWidgetController, which is private, so need to be friends
+ m_subject->setView(this->currentView); // transfers ownership to controller
+
+ // wait for the image loading
+ usleep(1000000);
+ QCoreApplication::processEvents();
+
// create pixmap paintdevice
pixmap = new QPixmap(846, 480);
pixmap->fill(QColor(0, 0, 0, 0));
@@ -71,6 +88,11 @@ void Pt_MLabel::cleanup()
QString kuva;
QTextStream(&kuva)
<< "view_"
+ << this->currentViewIndex
+ << "_"
+ << m_subject->size().width()
+ << "x"
+ << m_subject->size().height()
<< ".png";
if (!written.contains(kuva)) {
pixmap->save(kuva, "png", -1);
@@ -78,28 +100,35 @@ void Pt_MLabel::cleanup()
}
#endif
- delete subject;
- subject = 0;
+ delete m_subject;
+ m_subject = 0;
+
delete painter;
painter = 0;
delete pixmap;
pixmap = 0;
+
}
void Pt_MLabel::paintPerformance()
{
+ // actual benchmark
QBENCHMARK {
- currentView->paint(painter, NULL);
+ this->currentView->paint(painter, NULL);
}
}
void Pt_MLabel::paintPerformance_data()
{
QTest::addColumn<QString>("text");
+ QTest::addColumn<qint32>("viewIndex");
- QTest::newRow("plaintext") << "Silence!";
- QTest::newRow("richtext") << "<span>Silence! I <b>kill</b> you!</span>";
- QTest::newRow("veryrich") << "<h5>Very rich text, multi line label</h5><p>The phrase \"<b>to be, or not to be</b>\" comes from <font color=\"white\">William Shakespeare's <i>Hamlet</i></font> (written about 1600), act three, scene one. It is one of the most famous quotations in <small>world literature</small> and the <u>best-known of this particular play</u>...<h6>And tables...</h6><table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table></p>";
+ for (qint32 viewIndex = 0; viewIndex < NoViews; viewIndex++) {
+ // typical icon sizes
+ QTest::newRow("plaintext") << "Silence!" << viewIndex;
+ QTest::newRow("richtext") << "<span>Silence! I <b>kill</b> you!</span>" << viewIndex;
+ QTest::newRow("veryrich") << "<h5>Very rich text, multi line label</h5><p>The phrase \"<b>to be, or not to be</b>\" comes from <font color=\"white\">William Shakespeare's <i>Hamlet</i></font> (written about 1600), act three, scene one. It is one of the most famous quotations in <small>world literature</small> and the <u>best-known of this particular play</u>...<h6>And tables...</h6><table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table></p>" << viewIndex;
+ }
}
QTEST_APPLESS_MAIN(Pt_MLabel)
diff --git a/benchmarks/pt_mlabel/pt_mlabel.h b/benchmarks/pt_mlabel/pt_mlabel.h
index 660b7701..556c29a7 100644
--- a/benchmarks/pt_mlabel/pt_mlabel.h
+++ b/benchmarks/pt_mlabel/pt_mlabel.h
@@ -42,9 +42,14 @@ private slots:
void paintPerformance_data();
private:
- MLabel *subject;
+ MLabel *m_subject;
+ enum ViewName {
+ View = 0,
+ NoViews
+ };
MWidgetView *currentView;
+ qint32 currentViewIndex;
QPixmap *pixmap;
QPainter *painter;
qint32 width;
diff --git a/benchmarks/pt_mlabel/pt_mlabel.pro b/benchmarks/pt_mlabel/pt_mlabel.pro
index dc83a396..4961c0ec 100644
--- a/benchmarks/pt_mlabel/pt_mlabel.pro
+++ b/benchmarks/pt_mlabel/pt_mlabel.pro
@@ -5,5 +5,3 @@ TARGET = pt_mlabel
SOURCES += pt_mlabel.cpp
HEADERS += pt_mlabel.h
-
-LIBS += -lmeegotouchviews