summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gui')
-rw-r--r--tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp7
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp6
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp6
-rw-r--r--tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp297
-rw-r--r--tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp9
6 files changed, 139 insertions, 188 deletions
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp
index b904f40..2c1274c 100644
--- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp
+++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp
@@ -751,7 +751,7 @@ int main(int argc, char *argv[])
aargv[aargc++] = argv[i];
}
- QApplication app(argc, argv);
+ QApplication app(aargc, aargv);
int returnValue = 0;
if (settings.options() & Settings::ManualTest) {
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
index 1028f42..6c4ca08 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
@@ -42,7 +42,14 @@
#include "view.h"
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
+
#ifndef QT_NO_OPENGL
#include <QtOpenGL>
#endif
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
index 527713f..63b0da9 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
@@ -39,7 +39,13 @@
**
****************************************************************************/
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
#ifdef Q_WS_X11
extern void qt_x11_wait_for_window_manager(QWidget *);
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
index 7419206..3f30393 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
@@ -39,7 +39,13 @@
**
****************************************************************************/
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
class ItemMover : public QObject
{
diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
index f21bd44..8c30be4 100644
--- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
@@ -42,33 +42,35 @@
#include <qtest.h>
#include <QtGui>
-class tst_QWidget : public QObject
+static void processEvents()
{
- Q_OBJECT
-
-
-private slots:
- void update_data();
- void updateOpaque_data();
- void updateOpaque();
- void updateTransparent_data();
- void updateTransparent();
- void updatePartial_data();
- void updatePartial();
- void updateComplex_data();
- void updateComplex();
-
- void complexToplevelResize();
-};
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
class UpdateWidget : public QWidget
{
public:
- UpdateWidget(int rows, int columns) : QWidget(0)
+ UpdateWidget(int rows, int columns)
+ : QWidget(0), rowCount(0), columnCount(0), opaqueChildren(false)
{
+ fill(rows, columns);
+ }
+
+ UpdateWidget(QWidget *parent = 0)
+ : QWidget(parent), rowCount(0), columnCount(0), opaqueChildren(false) {}
+
+ void fill(int rows, int columns)
+ {
+ if (rows == rowCount && columns == columnCount)
+ return;
+ delete layout();
QGridLayout *layout = new QGridLayout;
- for (int row = 0; row < rows; ++row) {
- for (int column = 0; column < columns; ++column) {
+ rowCount = rows;
+ columnCount = columns;
+ for (int row = 0; row < rowCount; ++row) {
+ for (int column = 0; column < columnCount; ++column) {
UpdateWidget *widget = new UpdateWidget;
widget->setFixedSize(20, 20);
layout->addWidget(widget, row, column);
@@ -76,9 +78,20 @@ public:
}
}
setLayout(layout);
+ adjustSize();
+ QTest::qWait(250);
+ processEvents();
}
- UpdateWidget(QWidget *parent = 0) : QWidget(parent) {}
+ void setOpaqueChildren(bool enable)
+ {
+ if (opaqueChildren != enable) {
+ foreach (QWidget *w, children)
+ w->setAttribute(Qt::WA_OpaquePaintEvent, enable);
+ opaqueChildren = enable;
+ processEvents();
+ }
+ }
void paintEvent(QPaintEvent *)
{
@@ -93,75 +106,86 @@ public:
QRegion updateRegion;
QList<UpdateWidget*> children;
+ int rowCount;
+ int columnCount;
+ bool opaqueChildren;
};
-void tst_QWidget::update_data()
+class tst_QWidget : public QObject
{
- QTest::addColumn<int>("rows");
- QTest::addColumn<int>("columns");
- QTest::addColumn<int>("numUpdates");
-
- QTest::newRow("10x10x1") << 10 << 10 << 1;
- QTest::newRow("10x10x10") << 10 << 10 << 10;
- QTest::newRow("25x25x1") << 25 << 25 << 1;
- QTest::newRow("25x25x10") << 25 << 25 << 10;
- QTest::newRow("25x25x100") << 25 << 25 << 100;
-}
+ Q_OBJECT
-void tst_QWidget::updateOpaque_data()
-{
- update_data();
-}
+public slots:
+ void initTestCase();
+ void init();
-void tst_QWidget::updateOpaque()
-{
- QFETCH(int, rows);
- QFETCH(int, columns);
- QFETCH(int, numUpdates);
+private slots:
+ void update_data();
+ void update();
+ void updatePartial_data();
+ void updatePartial();
+ void updateComplex_data();
+ void updateComplex();
- UpdateWidget widget(rows, columns);
- foreach (QWidget *w, widget.children) {
- w->setAttribute(Qt::WA_OpaquePaintEvent);
- }
+private:
+ UpdateWidget widget;
+};
+void tst_QWidget::initTestCase()
+{
widget.show();
- QApplication::processEvents();
+ QTest::qWaitForWindowShown(&widget);
+ QTest::qWait(300);
+ processEvents();
+}
- int i = 0;
- const int n = widget.children.size();
- QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
- widget.children[i]->update();
- QApplication::processEvents();
- i = (i + 1) % n;
- }
- }
+void tst_QWidget::init()
+{
+ QVERIFY(widget.isVisible());
+ for (int i = 0; i < 3; ++i)
+ processEvents();
}
-void tst_QWidget::updateTransparent_data()
+void tst_QWidget::update_data()
{
- update_data();
+ QTest::addColumn<int>("rows");
+ QTest::addColumn<int>("columns");
+ QTest::addColumn<int>("numUpdates");
+ QTest::addColumn<bool>("opaque");
+
+ QTest::newRow("10x10x1 transparent") << 10 << 10 << 1 << false;
+ QTest::newRow("10x10x10 transparent") << 10 << 10 << 10 << false;
+ QTest::newRow("10x10x100 transparent") << 10 << 10 << 100 << false;
+ QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true;
+ QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true;
+ QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true;
+ QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false;
+ QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false;
+ QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false;
+ QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true;
+ QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true;
+ QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true;
}
-void tst_QWidget::updateTransparent()
+void tst_QWidget::update()
{
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
- widget.children[i]->update();
+ for (int i = 0; i < widget.children.size(); ++i) {
+ for (int j = 0; j < numUpdates; ++j)
+ widget.children.at(i)->update();
QApplication::processEvents();
- i = (i + 1) % n;
}
}
+
+ QApplication::flush();
}
void tst_QWidget::updatePartial_data()
@@ -174,24 +198,23 @@ void tst_QWidget::updatePartial()
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
+ for (int i = 0; i < widget.children.size(); ++i) {
QWidget *w = widget.children[i];
const int x = w->width() / 2;
const int y = w->height() / 2;
- w->update(0, 0, x, y);
- w->update(x, 0, x, y);
- w->update(0, y, x, y);
- w->update(x, y, x, y);
+ for (int j = 0; j < numUpdates; ++j) {
+ w->update(0, 0, x, y);
+ w->update(x, 0, x, y);
+ w->update(0, y, x, y);
+ w->update(x, y, x, y);
+ }
QApplication::processEvents();
- i = (i + 1) % n;
}
}
}
@@ -206,127 +229,27 @@ void tst_QWidget::updateComplex()
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
+ for (int i = 0; i < widget.children.size(); ++i) {
QWidget *w = widget.children[i];
const int x = w->width() / 2;
const int y = w->height() / 2;
- w->update(QRegion(0, 0, x, y, QRegion::Ellipse));
- w->update(QRegion(x, y, x, y, QRegion::Ellipse));
+ QRegion r1(0, 0, x, y, QRegion::Ellipse);
+ QRegion r2(x, y, x, y, QRegion::Ellipse);
+ for (int j = 0; j < numUpdates; ++j) {
+ w->update(r1);
+ w->update(r2);
+ }
QApplication::processEvents();
- i = (i + 1) % n;
}
}
}
-class ResizeWidget : public QWidget
-{
-public:
- ResizeWidget();
-};
-
-ResizeWidget::ResizeWidget() : QWidget(0)
-{
- QBoxLayout *topLayout = new QVBoxLayout;
-
- QMenuBar *menubar = new QMenuBar;
- QMenu* popup = menubar->addMenu("&File");
- popup->addAction("&Quit", qApp, SLOT(quit()));
- topLayout->setMenuBar(menubar);
-
- QBoxLayout *buttons = new QHBoxLayout;
- buttons->setMargin(5);
- buttons->addStretch(10);
- for (int i = 1; i <= 4; i++ ) {
- QPushButton* button = new QPushButton;
- button->setText(QString("Button %1").arg(i));
- buttons->addWidget(button);
- }
- topLayout->addLayout(buttons);
-
- buttons = new QHBoxLayout;
- buttons->addStretch(10);
- for (int i = 11; i <= 16; i++) {
- QPushButton* button = new QPushButton;
- button->setText(QString("Button %1").arg(i));
- buttons->addWidget(button);
- }
- topLayout->addLayout(buttons);
-
- QBoxLayout *buttons2 = new QHBoxLayout;
- buttons2->addStretch(10);
- topLayout->addLayout(buttons2);
-
- QPushButton *button = new QPushButton;
- button->setText("Button five");
- buttons2->addWidget(button);
-
- button = new QPushButton;
- button->setText("Button 6");
- buttons2->addWidget(button);
-
- QTextEdit *bigWidget = new QTextEdit;
- bigWidget->setText("This widget will get all the remaining space");
- bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain);
- topLayout->addWidget(bigWidget);
-
- const int numRows = 6;
- const int labelCol = 0;
- const int linedCol = 1;
- const int multiCol = 2;
-
- QGridLayout *grid = new QGridLayout;
- for (int row = 0; row < numRows; row++) {
- QLineEdit *lineEdit = new QLineEdit;
- grid->addWidget(lineEdit, row, linedCol);
- QLabel *label = new QLabel(QString("Line &%1").arg(row + 1));
- grid->addWidget(label, row, labelCol);
- }
- topLayout->addLayout(grid);
-
- QTextEdit *multiLineEdit = new QTextEdit;
- grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol);
-
- grid->setColumnStretch(linedCol, 10);
- grid->setColumnStretch(multiCol, 20);
-
- QLabel* statusBar = new QLabel;
- statusBar->setText("Let's pretend this is a status bar");
- statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
- statusBar->setFixedHeight(statusBar->sizeHint().height());
- statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
- topLayout->addWidget(statusBar);
-
- topLayout->activate();
- setLayout(topLayout);
-}
-
-void tst_QWidget::complexToplevelResize()
-{
- ResizeWidget w;
- w.show();
-
- QApplication::processEvents();
-
- const int minSize = 100;
- const int maxSize = 800;
- int size = minSize;
-
- QBENCHMARK {
- w.resize(size, size);
- size = qMax(minSize, (size + 10) % maxSize);
- QApplication::processEvents();
- QApplication::processEvents();
- }
-}
-
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
index 226b661..d051b12 100644
--- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
@@ -82,6 +82,7 @@ void tst_qstylesheetstyle::empty()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet("/*" + QString::number(i) + "*/");
@@ -94,6 +95,7 @@ void tst_qstylesheetstyle::empty_events()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet("/*" + QString::number(i) + "*/");
@@ -112,6 +114,7 @@ void tst_qstylesheetstyle::simple()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/");
@@ -124,6 +127,7 @@ void tst_qstylesheetstyle::simple_events()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/");
@@ -175,8 +179,13 @@ void tst_qstylesheetstyle::grid()
w->setStyleSheet("/* */");
if(show) {
w->show();
+ QTest::qWaitForWindowShown(w);
+ QApplication::flush();
+ QApplication::processEvents();
QTest::qWait(30);
+ QApplication::processEvents();
}
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/");