diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-09-08 17:21:10 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2022-10-28 14:53:51 +0200 |
commit | 26be677f84264d84fa6924f7cc4641552a6479f4 (patch) | |
tree | e0c4c9a2f885d8e46d7af62f587906c621a6819c /tests | |
parent | 1b165a141a8dc1d69a5f93f64e4c5ccdd594ad04 (diff) |
Qml: Don't crash on bad grouped properties
Amend and cherry-pick e061c934d5a6d93493ba2be7b61efdd055d1e164.
This commit is required by the (already-merged)
commit dc69a005755c4d4c1b3de6cd52321b543b49a1a1 to successfully
fix the grouped property crash.
Add the reproducer of the issue in the tests.
Task-number: QTBUG-106457
Fixes: QTBUG-107795
Change-Id: I7da381d2c3b9c58d370c1ed754140637e065bdec
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/alias.15a.qml | 21 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml | 10 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 |
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/alias.15a.qml b/tests/auto/qml/qqmllanguage/data/alias.15a.qml index ba8097c997..b5f96e15c1 100644 --- a/tests/auto/qml/qqmllanguage/data/alias.15a.qml +++ b/tests/auto/qml/qqmllanguage/data/alias.15a.qml @@ -9,4 +9,25 @@ Item { Item { id: symbol } + + Rectangle { + id: txtElevationValue + + property Rectangle background: Rectangle { } + + state: "ValidatorInvalid" + + states: [ + State { + name: "ValidatorInvalid" + PropertyChanges { + target: txtElevationValue + background.border.color: "red" // this line caused the segfault in qtbug107795 + } + }, + State { + name: "ValidatorAcceptable" + } + ] + } } diff --git a/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml b/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml new file mode 100644 index 0000000000..34dcbf96fa --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/badGroupedProperty.qml @@ -0,0 +1,10 @@ +import QtQml 2.15 + +QtObject { + id: testItem + property rect rect + onComplete { + rect.x: 2 + rect.width: 22 + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 1be1533b63..ac6634290a 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -341,6 +341,7 @@ private slots: void ambiguousContainingType(); void staticConstexprMembers(); void bindingAliasToComponentUrl(); + void badGroupedProperty(); private: QQmlEngine engine; @@ -5939,6 +5940,17 @@ void tst_qqmllanguage::bindingAliasToComponentUrl() } } +void tst_qqmllanguage::badGroupedProperty() +{ + QQmlEngine engine; + const QUrl url = testFileUrl("badGroupedProperty.qml"); + QQmlComponent c(&engine, url); + QVERIFY(c.isError()); + QCOMPARE(c.errorString(), + QStringLiteral("%1:6 Cannot assign to non-existent property \"onComplete\"\n") + .arg(url.toString())); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |