diff options
author | Martin Smith <msmith@trolltech.com> | 2010-01-08 11:50:06 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-01-08 11:50:06 (GMT) |
commit | 2530a32d5e02f2cde0cdf3d6d4e42a0079d669fd (patch) | |
tree | 479a98d12ffb6df51965c8355f4f0dae4226c38b /tests/benchmarks | |
parent | 3aa77d64608f944592939c5d673f1b7dabec730f (diff) | |
parent | 4ba439f78aec1caef268dba0f229b8a0242e4c8d (diff) | |
download | Qt-2530a32d5e02f2cde0cdf3d6d4e42a0079d669fd.zip Qt-2530a32d5e02f2cde0cdf3d6d4e42a0079d669fd.tar.gz Qt-2530a32d5e02f2cde0cdf3d6d4e42a0079d669fd.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp index d2f8090..5bd07f9 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" |