diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-06 06:38:11 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-06 07:18:48 (GMT) |
commit | 55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a (patch) | |
tree | 99c01d7a4e0941f415e9a48f51faac94787b6cb0 /tests/benchmarks | |
parent | 57ceb11ecf95032418712a686418116cf2398e7a (diff) | |
parent | b008dfbd67176948f6fdf830dc99d23a538a6b9c (diff) | |
download | Qt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.zip Qt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.tar.gz Qt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
doc/src/classes/qnamespace.qdoc
examples/examples.pro
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qobject.cpp
src/gui/kernel/qapplication.cpp
src/gui/kernel/qstandardgestures.h
src/gui/kernel/qwidget.cpp
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qgraphicsitem/qgraphicsitem.pro | 1 | ||||
-rw-r--r-- | tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp | 51 |
2 files changed, 38 insertions, 14 deletions
diff --git a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro index c8fc07b..726bb96 100644 --- a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro +++ b/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro @@ -3,4 +3,3 @@ TEMPLATE = app TARGET = tst_qgraphicsitem SOURCES += tst_qgraphicsitem.cpp - diff --git a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp index d072d08..ee27ebe 100644 --- a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp @@ -25,6 +25,9 @@ public slots: void cleanup(); private slots: + void setParentItem(); + void setParentItem_deep(); + void deleteItemWithManyChildren(); void setPos_data(); void setPos(); void setTransform_data(); @@ -34,7 +37,6 @@ private slots: void shear(); void translate(); void setRotation(); - void setRotationXYZ(); }; tst_QGraphicsItem::tst_QGraphicsItem() @@ -53,6 +55,40 @@ void tst_QGraphicsItem::cleanup() { } +void tst_QGraphicsItem::setParentItem() +{ + QBENCHMARK { + QGraphicsRectItem rect; + QGraphicsRectItem *childRect = new QGraphicsRectItem; + childRect->setParentItem(&rect); + } +} + +void tst_QGraphicsItem::setParentItem_deep() +{ + QBENCHMARK { + QGraphicsRectItem rect; + QGraphicsRectItem *lastRect = ▭ + for (int i = 0; i < 10; ++i) { + QGraphicsRectItem *childRect = new QGraphicsRectItem; + childRect->setParentItem(lastRect); + lastRect = childRect; + } + QGraphicsItem *first = rect.children().first(); + first->setParentItem(0); + } +} + +void tst_QGraphicsItem::deleteItemWithManyChildren() +{ + QBENCHMARK { + QGraphicsRectItem *rect = new QGraphicsRectItem; + for (int i = 0; i < 1000; ++i) + new QGraphicsRectItem(rect); + delete rect; + } +} + void tst_QGraphicsItem::setPos_data() { QTest::addColumn<QPointF>("pos"); @@ -150,18 +186,7 @@ void tst_QGraphicsItem::setRotation() QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); QBENCHMARK { - item->setXRotation(45); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::setRotationXYZ() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->setRotation(45, 45, 45); + item->setRotation(45); item->transform(); // prevent lazy optimizing } } |