diff options
Diffstat (limited to 'tests')
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/EdgeObject.qml b/tests/auto/qml/qqmllanguage/data/EdgeObject.qml new file mode 100644 index 0000000000..b25dc29c49 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/EdgeObject.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + property int edgeWidth: bg.width + + Rectangle { + id: bg + } + + states: [ + State { + when: 1 === 1 + PropertyChanges { + target: bg + anchors.left: parent.left + anchors.right: parent.right + } + } + ] +} diff --git a/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml b/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml new file mode 100644 index 0000000000..8b1682da92 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml @@ -0,0 +1,10 @@ +import QtQuick 2.9 + +Item { + width: 200 + property int edgeWidth: edge.edgeWidth + EdgeObject { + id: edge + anchors.fill: parent + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 9a3f488cea..dea7c6c7ee 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -299,6 +299,7 @@ private slots: void retrieveQmlTypeId(); void polymorphicFunctionLookup(); + void anchorsToParentInPropertyChanges(); private: QQmlEngine engine; @@ -5069,6 +5070,16 @@ void tst_qqmllanguage::polymorphicFunctionLookup() QVERIFY(o->property("ok").toBool()); } +void tst_qqmllanguage::anchorsToParentInPropertyChanges() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("anchorsToParentInPropertyChagnes.qml")); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + QTRY_COMPARE(o->property("edgeWidth").toInt(), 200); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |