aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-09-23 16:39:00 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-09-25 10:42:01 +0200
commitbfd80e8dac231923ca4a58fe655d144506784c0c (patch)
tree6c195cd9e2a69831f53045dcf48319c76dfb9d0c /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent1c7e8aa0f004b90293f41ec44df76aea594d2200 (diff)
QmlCompiler: Don't crash on broken type assertions
If we cannot properly resolve the types we should still set the accumulator to something so that the type propagator can continue. Amends commit 6a2308e500425535ff0fdfcc3048bf2933b9ea76 Change-Id: Idf3d093ca877bcf11f6a9a82a9d01ccead19e2cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 32c313c2a8..c1ab9476a9 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -57,6 +57,7 @@ private slots:
void blockComments();
void boolCoercions();
void boolPointerMerge();
+ void brokenAs();
void boundComponents();
void callContextPropertyLookupResult();
void callWithSpread();
@@ -959,6 +960,18 @@ void tst_QmlCppCodegen::boolPointerMerge()
QCOMPARE(item->property("ppp").toInt(), -99);
}
+void tst_QmlCppCodegen::brokenAs()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/brokenAs.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QVERIFY(o->property("a").value<QObject *>() != nullptr);
+ QCOMPARE(o->property("b").value<QObject *>(), nullptr);
+}
+
void tst_QmlCppCodegen::boundComponents()
{
QQmlEngine engine;