diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-03 05:09:56 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-03 05:09:56 (GMT) |
commit | 953078ed630dd7e3dae568bf003950bda98d8f47 (patch) | |
tree | 4b8300ffeebff96746bf56e6cdcbe4b33b4fc7c8 /tests/benchmarks/declarative/qmlmetaproperty | |
parent | 651b7aa72052faa90b3a268f00f82d56460166d3 (diff) | |
download | Qt-953078ed630dd7e3dae568bf003950bda98d8f47.zip Qt-953078ed630dd7e3dae568bf003950bda98d8f47.tar.gz Qt-953078ed630dd7e3dae568bf003950bda98d8f47.tar.bz2 |
Make QmlMetaProperty reentrant
Diffstat (limited to 'tests/benchmarks/declarative/qmlmetaproperty')
4 files changed, 95 insertions, 0 deletions
diff --git a/tests/benchmarks/declarative/qmlmetaproperty/object.txt b/tests/benchmarks/declarative/qmlmetaproperty/object.txt new file mode 100644 index 0000000..11b95e1 --- /dev/null +++ b/tests/benchmarks/declarative/qmlmetaproperty/object.txt @@ -0,0 +1,3 @@ +import Qt 4.6 + +Item {} diff --git a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro new file mode 100644 index 0000000..b4e83d7 --- /dev/null +++ b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qmlmetaproperty +QT += declarative + +SOURCES += tst_qmlmetaproperty.cpp + diff --git a/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt b/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt new file mode 100644 index 0000000..a923a0a --- /dev/null +++ b/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt @@ -0,0 +1,6 @@ +import Qt 4.6 + +Item { + property int blah +} + diff --git a/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp new file mode 100644 index 0000000..c22af03 --- /dev/null +++ b/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +****************************************************************************/ + +#include <qtest.h> +#include <QmlEngine> +#include <QmlComponent> +#include <QmlMetaProperty> +#include <QFile> +#include <QDebug> + +//TESTED_FILES= + + +class tst_qmlmetaproperty : public QObject +{ + Q_OBJECT + +public: + tst_qmlmetaproperty(); + virtual ~tst_qmlmetaproperty(); + +public slots: + void init(); + void cleanup(); + +private slots: + void lookup_data(); + void lookup(); + +private: + QmlEngine engine; +}; + +tst_qmlmetaproperty::tst_qmlmetaproperty() +{ +} + +tst_qmlmetaproperty::~tst_qmlmetaproperty() +{ +} + +void tst_qmlmetaproperty::init() +{ +} + +void tst_qmlmetaproperty::cleanup() +{ +} + +void tst_qmlmetaproperty::lookup_data() +{ + QTest::addColumn<QString>("file"); + + QTest::newRow("Simple Object") << "object.txt"; + QTest::newRow("Synthesized Object") << "synthesized_object.txt"; +} + +void tst_qmlmetaproperty::lookup() +{ + QFETCH(QString, file); + + QmlComponent c(&engine, file); + QVERIFY(c.isReady()); + + QObject *obj = c.create(); + + QBENCHMARK { + QmlMetaProperty p(obj, "x"); + } + + delete obj; +} + +QTEST_MAIN(tst_qmlmetaproperty) +#include "tst_qmlmetaproperty.moc" |