diff options
Diffstat (limited to 'tests/benchmarks/declarative/creation/tst_creation.cpp')
-rw-r--r-- | tests/benchmarks/declarative/creation/tst_creation.cpp | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 23c820c..9c0fd27 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -40,15 +40,21 @@ ****************************************************************************/ #include <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QmlMetaType> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDeclarativeMetaType> #include <QDebug> #include <QGraphicsScene> #include <QGraphicsItem> -#include <QmlGraphicsItem> +#include <QDeclarativeItem> #include <private/qobject_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_creation : public QObject { Q_OBJECT @@ -77,7 +83,7 @@ private slots: void itemtree_scene_cpp(); private: - QmlEngine engine; + QDeclarativeEngine engine; }; inline QUrl TEST_FILE(const QString &filename) @@ -95,7 +101,7 @@ void tst_creation::qobject_cpp() void tst_creation::qobject_qml() { - QmlComponent component(&engine, TEST_FILE("qobject.qml")); + QDeclarativeComponent component(&engine, TEST_FILE("qobject.qml")); QObject *obj = component.create(); delete obj; @@ -107,7 +113,7 @@ void tst_creation::qobject_qml() void tst_creation::qobject_qmltype() { - QmlType *t = QmlMetaType::qmlType("Qt/QtObject", 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 6); QBENCHMARK { QObject *obj = t->create(); @@ -148,7 +154,7 @@ void tst_creation::objects_qmltype_data() { QTest::addColumn<QByteArray>("type"); - QList<QByteArray> types = QmlMetaType::qmlTypeNames(); + QList<QByteArray> types = QDeclarativeMetaType::qmlTypeNames(); foreach (QByteArray type, types) QTest::newRow(type.constData()) << type; } @@ -156,7 +162,7 @@ void tst_creation::objects_qmltype_data() void tst_creation::objects_qmltype() { QFETCH(QByteArray, type); - QmlType *t = QmlMetaType::qmlType(type, 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6); QBENCHMARK { QObject *obj = t->create(); @@ -275,7 +281,7 @@ void tst_creation::qgraphicsitem_tree14() } } -struct QmlGraphics_DerivedObject : public QObject +struct QDeclarativeGraphics_DerivedObject : public QObject { void setParent_noEvent(QObject *parent) { bool sce = d_ptr->sendChildEvents; @@ -285,17 +291,17 @@ struct QmlGraphics_DerivedObject : public QObject } }; -inline void QmlGraphics_setParent_noEvent(QObject *object, QObject *parent) +inline void QDeclarativeGraphics_setParent_noEvent(QObject *object, QObject *parent) { - static_cast<QmlGraphics_DerivedObject *>(object)->setParent_noEvent(parent); + static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent); } void tst_creation::itemtree_notree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; + QDeclarativeItem *child = new QDeclarativeItem; } delete item; } @@ -304,10 +310,10 @@ void tst_creation::itemtree_notree_cpp() void tst_creation::itemtree_objtree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); } delete item; } @@ -316,10 +322,10 @@ void tst_creation::itemtree_objtree_cpp() void tst_creation::itemtree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); child->setParentItem(item); } delete item; @@ -329,10 +335,10 @@ void tst_creation::itemtree_cpp() void tst_creation::itemtree_data_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); item->data()->append(child); } delete item; @@ -341,7 +347,7 @@ void tst_creation::itemtree_data_cpp() void tst_creation::itemtree_qml() { - QmlComponent component(&engine, TEST_FILE("item.qml")); + QDeclarativeComponent component(&engine, TEST_FILE("item.qml")); QObject *obj = component.create(); delete obj; @@ -354,13 +360,13 @@ void tst_creation::itemtree_qml() void tst_creation::itemtree_scene_cpp() { QGraphicsScene scene; - QmlGraphicsItem *root = new QmlGraphicsItem; + QDeclarativeItem *root = new QDeclarativeItem; scene.addItem(root); QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); child->setParentItem(item); } item->setParentItem(root); |