From 26be677f84264d84fa6924f7cc4641552a6479f4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 8 Sep 2022 17:21:10 +0200 Subject: 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 Reviewed-by: Qt CI Bot --- tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp') 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" -- cgit v1.2.3