diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-10-06 01:26:23 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-10-06 01:26:23 (GMT) |
commit | bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337 (patch) | |
tree | 613c4221486656e0fd309afda56d72e46ec89b20 /tests/auto/declarative | |
parent | 47284ca360c1875663207996740bf6ed6e93d364 (diff) | |
download | Qt-bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337.zip Qt-bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337.tar.gz Qt-bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337.tar.bz2 |
Create Loader components in correct context
Task-number: QTBUG-13481
Diffstat (limited to 'tests/auto/declarative')
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml new file mode 100644 index 0000000..bfc9a8d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml @@ -0,0 +1,15 @@ +import QtQuick 1.0 + +Loader { + id: myLoader + property int testProperty: 1912 + sourceComponent: loaderComponent + Component { + id: loaderComponent + Item { + Component.onCompleted: { + test = (myLoader.testProperty == 1912); + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml b/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml new file mode 100644 index 0000000..5297978 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +Item { + property bool test: false + + CreationContextLoader { + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 8d04616..1bde55b 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -89,6 +89,7 @@ private slots: void deleteComponentCrash(); void nonItem(); void vmeErrors(); + void creationContext(); private: QDeclarativeEngine engine; @@ -562,6 +563,19 @@ void tst_QDeclarativeLoader::vmeErrors() delete loader; } +// QTBUG-13481 +void tst_QDeclarativeLoader::creationContext() +{ + QDeclarativeComponent component(&engine, TEST_FILE("creationContext.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toBool(), true); + + delete o; +} + QTEST_MAIN(tst_QDeclarativeLoader) #include "tst_qdeclarativeloader.moc" |