diff options
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml | 23 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 10 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml b/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml new file mode 100644 index 0000000000..22c335b1a7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml @@ -0,0 +1,23 @@ +import QtQuick 2.0 + +Item { + visible: false + property bool success: false + property bool loading: true + + Item { + visible: someOtherItem.someProperty + onVisibleChanged: { + if (!visible) { + success = loading + } + } + } + + Item { + id: someOtherItem + property bool someProperty: true + } + + Component.onCompleted: loading = false +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 7976987b58..ec931385d5 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -240,6 +240,8 @@ private slots: void noChildEvents(); + void earlyIdObjectAccess(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -3792,6 +3794,14 @@ void tst_qqmllanguage::noChildEvents() QCOMPARE(object->childAddedEventCount(), 0); } +void tst_qqmllanguage::earlyIdObjectAccess() +{ + QQmlComponent component(&engine, testFileUrl("earlyIdObjectAccess.qml")); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + QVERIFY(o->property("success").toBool()); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |