summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-09 04:58:11 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-12-09 04:58:11 (GMT)
commit4bad9d6661f6b63c6ce9b9a29e9f5cf7aa032e37 (patch)
treea45390e141a2855353cd383dbbcb876c494060cf /tests/benchmarks
parent366abae3466f4a8d91f88caafb87f10f3031c355 (diff)
downloadQt-4bad9d6661f6b63c6ce9b9a29e9f5cf7aa032e37.zip
Qt-4bad9d6661f6b63c6ce9b9a29e9f5cf7aa032e37.tar.gz
Qt-4bad9d6661f6b63c6ce9b9a29e9f5cf7aa032e37.tar.bz2
Another creation benchmark.
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index a73de41..61033e2 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -44,6 +44,7 @@
#include <QmlComponent>
#include <QmlMetaType>
#include <QDebug>
+#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QmlGraphicsItem>
#include <private/qobject_p.h>
@@ -71,6 +72,7 @@ private slots:
void itemtree_cpp();
void itemtree_data_cpp();
void itemtree_qml();
+ void itemtree_scene_cpp();
private:
QmlEngine engine;
@@ -324,6 +326,24 @@ void tst_creation::itemtree_qml()
}
}
+void tst_creation::itemtree_scene_cpp()
+{
+ QGraphicsScene scene;
+ QmlGraphicsItem *root = new QmlGraphicsItem;
+ scene.addItem(root);
+ QBENCHMARK {
+ QmlGraphicsItem *item = new QmlGraphicsItem;
+ for (int i = 0; i < 30; ++i) {
+ QmlGraphicsItem *child = new QmlGraphicsItem;
+ QmlGraphics_setParent_noEvent(child,item);
+ child->setParentItem(item);
+ }
+ item->setParentItem(root);
+ delete item;
+ }
+ delete root;
+}
+
QTEST_MAIN(tst_creation)