diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/aliasPropertyToIC.qml | 11 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 19 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasPropertyToIC.qml b/tests/auto/qml/qqmlecmascript/data/aliasPropertyToIC.qml new file mode 100644 index 0000000000..17116bb091 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/aliasPropertyToIC.qml @@ -0,0 +1,11 @@ +import QtQml + + +QtObject { + id: root + + component Test : QtObject {} + + property alias myalias: other + property var direct: Test { id: other } +} diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 63cf12a5a2..10dd2ec823 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -96,6 +96,7 @@ private slots: void outerBindingOverridesInnerBinding(); void aliasPropertyAndBinding(); void aliasPropertyReset(); + void aliasPropertyToIC(); void nonExistentAttachedObject(); void scope(); void importScope(); @@ -1913,6 +1914,24 @@ void tst_qqmlecmascript::aliasPropertyReset() QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false)); } +void tst_qqmlecmascript::aliasPropertyToIC() +{ + QQmlEngine engine; + std::unique_ptr<QObject> root; + + // test that a manual write (of undefined) to a resettable aliased property succeeds + QQmlComponent c(&engine, testFileUrl("aliasPropertyToIC.qml")); + root.reset(c.create()); + QVERIFY(root); + auto mo = root->metaObject(); + int aliasIndex = mo->indexOfProperty("myalias"); + auto prop = mo->property(aliasIndex); + QVERIFY(prop.isAlias()); + auto fromAlias = prop.read(root.get()).value<QObject *>(); + auto direct = root->property("direct").value<QObject *>(); + QCOMPARE(fromAlias, direct); +} + void tst_qqmlecmascript::componentCreation_data() { QTest::addColumn<QString>("method"); |