summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/widgets
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-03-22 10:59:38 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-04-04 06:54:39 +0000
commit98f7eba6cffc7676b791ef1e58a837b38d99ffd3 (patch)
tree76babab2f458a2e1cfb6c837cca0cab6f177dfbc /tests/benchmarks/widgets
parent29bb28d52305a7a47759cf9bb8395e2132bf68bc (diff)
Benchmarks/QGraphicsView: re-enable graphicslayout/graphicslinearlayout
The two benchmarks graphicslayout and graphicslinearlayout were disabled for some time. Fixed the compile errors and readded them so there is at least no bitrotting. Task-number: QTBUG-27461 Change-Id: Ib0c878e97693c0ad3bf87e658d493da61f5174ee Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/benchmarks/widgets')
-rw-r--r--tests/benchmarks/widgets/graphicsview/graphicsview.pro4
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro2
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp31
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro2
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp8
5 files changed, 25 insertions, 22 deletions
diff --git a/tests/benchmarks/widgets/graphicsview/graphicsview.pro b/tests/benchmarks/widgets/graphicsview/graphicsview.pro
index 5a4722ca62..8344cd4edf 100644
--- a/tests/benchmarks/widgets/graphicsview/graphicsview.pro
+++ b/tests/benchmarks/widgets/graphicsview/graphicsview.pro
@@ -3,8 +3,8 @@ SUBDIRS = \
functional \
qgraphicsanchorlayout \
qgraphicsitem \
- #qgraphicslayout \ # FIXME: broken
- #qgraphicslinearlayout \ # FIXME: broken?
+ qgraphicslayout \
+ qgraphicslinearlayout \
qgraphicsscene \
qgraphicsview \
qgraphicswidget
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
index 9026fb37d8..a20d9e0921 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
TARGET = tst_bench_qgraphicslayout
-QT += testlib
+QT += testlib widgets
SOURCES += tst_qgraphicslayout.cpp
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
index 1db130203a..5c97d7f738 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
@@ -26,11 +26,11 @@
**
****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtGui/qgraphicslayout.h>
-#include <QtGui/qgraphicslinearlayout.h>
-#include <QtGui/qgraphicswidget.h>
-#include <QtGui/qgraphicsview.h>
+#include <QtTest>
+#include <QGraphicsLayout>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsWidget>
+#include <QGraphicsView>
class tst_QGraphicsLayout : public QObject
{
@@ -84,15 +84,15 @@ public:
void tst_QGraphicsLayout::invalidate()
{
QGraphicsLayout::setInstantInvalidatePropagation(true);
- QGraphicsScene scene;
- QGraphicsView *view = new QGraphicsView(&scene);
- QMap<RectWidget*, QRectF> setGeometryCalls;
+ QGraphicsScene *scene = new QGraphicsScene;
+ QGraphicsView *view = new QGraphicsView(scene);
+ QMap<RectWidget*, QRectF> *setGeometryCalls = new QMap<RectWidget*, QRectF>;
RectWidget *window = new RectWidget(0, Qt::Window);
- window->setGeometryCalls = &setGeometryCalls;
+ window->setGeometryCalls = setGeometryCalls;
window->setData(0, QString(QChar('a')));
- scene.addItem(window);
+ scene->addItem(window);
RectWidget *leaf = 0;
const int depth = 100;
RectWidget *parent = window;
@@ -101,7 +101,7 @@ void tst_QGraphicsLayout::invalidate()
l->setContentsMargins(0,0,0,0);
RectWidget *child = new RectWidget;
child->setData(0, QString(QChar('a' + i)));
- child->setGeometryCalls = &setGeometryCalls;
+ child->setGeometryCalls = setGeometryCalls;
l->addItem(child);
parent = child;
}
@@ -110,7 +110,7 @@ void tst_QGraphicsLayout::invalidate()
view->show();
- QVERIFY(QTest::qWaitForWindowShown(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view));
// ...then measure...
@@ -118,11 +118,11 @@ void tst_QGraphicsLayout::invalidate()
// should be as small as possible, to reduce overhead of painting
QSizeF size(1, 1);
- setGeometryCalls.clear();
+ setGeometryCalls->clear();
QBENCHMARK {
leaf->setMinimumSize(size);
leaf->setMaximumSize(size);
- while (setGeometryCalls.count() < depth) {
+ while (setGeometryCalls->count() < depth) {
QApplication::sendPostedEvents();
}
// force a resize on each widget, this will ensure
@@ -131,8 +131,11 @@ void tst_QGraphicsLayout::invalidate()
w^=2;
size.setWidth(w);
}
+ window->setGeometryCalls = nullptr;
delete view;
+ delete scene;
QGraphicsLayout::setInstantInvalidatePropagation(false);
+ delete setGeometryCalls;
}
QTEST_MAIN(tst_QGraphicsLayout)
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
index 7126c8ecd6..e9a9e9353e 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
TARGET = tst_bench_qgraphicslinearlayout
-QT += testlib
+QT += testlib widgets
SOURCES += tst_qgraphicslinearlayout.cpp
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 325fcfbb09..254d147e52 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -26,10 +26,10 @@
**
****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtGui/qgraphicslinearlayout.h>
-#include <QtGui/qgraphicswidget.h>
-#include <QtGui/qgraphicsview.h>
+#include <QtTest>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsWidget>
+#include <QGraphicsView>
class tst_QGraphicsLinearLayout : public QObject
{