diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-02-17 15:12:09 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-02-18 15:13:49 (GMT) |
commit | 5c4363a0fa3cd654413ff2637cb70aeec7a590ef (patch) | |
tree | 8eeef02ec2d2da5bf438c6bdfaf89083d5875e2b /tests/benchmarks | |
parent | a6eac63470ad8dd3f1687fcd4039a5312c44a5d2 (diff) | |
download | Qt-5c4363a0fa3cd654413ff2637cb70aeec7a590ef.zip Qt-5c4363a0fa3cd654413ff2637cb70aeec7a590ef.tar.gz Qt-5c4363a0fa3cd654413ff2637cb70aeec7a590ef.tar.bz2 |
Stabilize QGraphicsScene benchmarks.
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp | 14 |
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 |