diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-08 03:49:09 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-08 03:53:03 (GMT) |
commit | 87d71b29a8c4239cb807f13ac9d009cef1ca1a69 (patch) | |
tree | 5889e80b9a96bb8b70f44a67d737e5464d2d72d3 /tests | |
parent | f5ad8f76430b43c0a72c1bf41fae1d279948a0e0 (diff) | |
download | Qt-87d71b29a8c4239cb807f13ac9d009cef1ca1a69.zip Qt-87d71b29a8c4239cb807f13ac9d009cef1ca1a69.tar.gz Qt-87d71b29a8c4239cb807f13ac9d009cef1ca1a69.tar.bz2 |
Allow objects to be shared between QmlEngines
QTBUG-7957
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml b/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml new file mode 100644 index 0000000..7da09e4 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + property string test: thing.stringProperty +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index c41e248..1ba9a52 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -119,6 +119,7 @@ private slots: void jsObject(); void undefinedResetsProperty(); void listToVariant(); + void multiEngineObject(); void bug1(); @@ -1610,7 +1611,30 @@ void tst_qmlecmascript::listToVariant() QCOMPARE(object->property("test"), QVariant::fromValue(container.children())); delete object; +} + +// QTBUG-7957 +void tst_qmlecmascript::multiEngineObject() +{ + MyQmlObject obj; + obj.setStringProperty("Howdy planet"); + + QmlEngine e1; + e1.rootContext()->setContextProperty("thing", &obj); + QmlComponent c1(&e1, TEST_FILE("multiEngineObject.qml")); + + QmlEngine e2; + e2.rootContext()->setContextProperty("thing", &obj); + QmlComponent c2(&e2, TEST_FILE("multiEngineObject.qml")); + + QObject *o1 = c1.create(); + QObject *o2 = c2.create(); + + QCOMPARE(o1->property("test").toString(), QString("Howdy planet")); + QCOMPARE(o2->property("test").toString(), QString("Howdy planet")); + delete o2; + delete o1; } QTEST_MAIN(tst_qmlecmascript) |