diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index edbfeeb8..5dbcf456 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -99,6 +99,7 @@ private slots: void assignLiteralToVariant(); void customParserTypes(); void rootAsQmlComponent(); + void qmlComponentType(); void inlineQmlComponents(); void idProperty(); void autoNotifyConnection(); @@ -628,6 +629,16 @@ void tst_qdeclarativelanguage::rootAsQmlComponent() QCOMPARE(object->getChildren()->count(), 2); } +// Tests that types can be specified from a QML only component +void tst_qdeclarativelanguage::qmlComponentType() +{ + QDeclarativeComponent component(&engine, testFileUrl("qmlComponentType.qml")); + VERIFY_ERRORS(0); + QObject *object = qobject_cast<QObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->property("test"), QVariant(11)); +} + // Tests that components can be specified inline void tst_qdeclarativelanguage::inlineQmlComponents() { @@ -1965,6 +1976,8 @@ void tst_qdeclarativelanguage::initTestCase() { QDeclarativeDataTest::initTestCase(); registerTypes(); + // Registered here because it uses testFileUrl + qmlRegisterType(testFileUrl("MyComponentType.qml"), "Test", 1, 0, "MyComponentType"); // Registering the TestType class in other modules should have no adverse effects qmlRegisterType<TestType>("com.nokia.TestPre", 1, 0, "Test"); |