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>bb10
parent
29bb28d523
commit
98f7eba6cf
|
|
@ -3,8 +3,8 @@ SUBDIRS = \
|
|||
functional \
|
||||
qgraphicsanchorlayout \
|
||||
qgraphicsitem \
|
||||
#qgraphicslayout \ # FIXME: broken
|
||||
#qgraphicslinearlayout \ # FIXME: broken?
|
||||
qgraphicslayout \
|
||||
qgraphicslinearlayout \
|
||||
qgraphicsscene \
|
||||
qgraphicsview \
|
||||
qgraphicswidget
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
TEMPLATE = app
|
||||
TARGET = tst_bench_qgraphicslayout
|
||||
QT += testlib
|
||||
QT += testlib widgets
|
||||
SOURCES += 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)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
TEMPLATE = app
|
||||
TARGET = tst_bench_qgraphicslinearlayout
|
||||
QT += testlib
|
||||
QT += testlib widgets
|
||||
SOURCES += 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue