summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp')
-rw-r--r--tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp
index 1944219..53fd9b6 100644
--- a/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -64,6 +64,7 @@ private slots:
void addItem();
void itemAt_data();
void itemAt();
+ void initialShow();
};
tst_QGraphicsScene::tst_QGraphicsScene()
@@ -227,5 +228,21 @@ void tst_QGraphicsScene::itemAt()
qApp->processEvents();
}
+void tst_QGraphicsScene::initialShow()
+{
+ QGraphicsScene scene;
+
+ QBENCHMARK {
+ for (int y = 0; y < 30000; ++y) {
+ QGraphicsRectItem *item = new QGraphicsRectItem(0, 0, 50, 50);
+ item->setPos((y/2) * item->rect().width(), (y/2) * item->rect().height());
+ scene.addItem(item);
+ }
+ scene.itemAt(0, 0); // triggers indexing
+ //This call polish the items so we bench their processing too.
+ qApp->processEvents();
+ }
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"