summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 9531619..10d73d5 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -75,8 +75,16 @@ tst_QGraphicsScene::~tst_QGraphicsScene()
{
}
+static inline void processEvents()
+{
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
void tst_QGraphicsScene::init()
{
+ processEvents();
}
void tst_QGraphicsScene::cleanup()
@@ -148,6 +156,8 @@ void tst_QGraphicsScene::addItem()
if (!sceneRect.isNull())
scene.setSceneRect(sceneRect);
+ processEvents();
+
QBENCHMARK {
QGraphicsItem *item = 0;
for (int y = 0; y < numItems_Y; ++y) {
@@ -218,9 +228,11 @@ void tst_QGraphicsScene::itemAt()
}
scene.itemAt(0, 0); // triggers indexing
+ processEvents();
+ QGraphicsItem *item = 0;
QBENCHMARK {
- scene.itemAt(0, 0);
+ item = scene.itemAt(0, 0);
}
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list