diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-28 08:50:18 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-28 08:50:18 (GMT) |
commit | 746954581f06e0bca98f25eb95dca09c663d47bf (patch) | |
tree | 849d303446cd2771b3927a1066f7886c52bef7c7 /tests/auto | |
parent | 040b01732a37232aad7c6cd53c5d37b10bf5a6dc (diff) | |
download | Qt-746954581f06e0bca98f25eb95dca09c663d47bf.zip Qt-746954581f06e0bca98f25eb95dca09c663d47bf.tar.gz Qt-746954581f06e0bca98f25eb95dca09c663d47bf.tar.bz2 |
If a type is registered under several names, share the attached property object
Task-number: QTBUG-13799
Diffstat (limited to 'tests/auto')
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml new file mode 100644 index 0000000..817391d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml @@ -0,0 +1,16 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + property bool test1: false + property bool test2: false + + MyQmlObject.value2: 7 + + Component.onCompleted: { + test1 = root.MyQmlObject.value2 == 7; + test2 = root.MyQmlObjectAlias.value2 == 7; + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 8a4605a..810a0f7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -102,6 +102,7 @@ public: void registerTypes() { + qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias"); qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject"); qmlRegisterType<MyDeferredObject>("Qt.test", 1,0, "MyDeferredObject"); qmlRegisterType<MyQmlContainer>("Qt.test", 1,0, "MyQmlContainer"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c10a110..4feb630 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -161,6 +161,7 @@ private slots: void nonscriptable(); void deleteLater(); void in(); + void sharedAttachedObject(); void include(); @@ -2583,6 +2584,16 @@ void tst_qdeclarativeecmascript::in() delete o; } +void tst_qdeclarativeecmascript::sharedAttachedObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("sharedAttachedObject.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + delete o; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" |