aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-12-19 15:44:48 +0100
committerUlf Hermann <ulf.hermann@qt.io>2025-01-06 17:27:52 +0100
commit78ccc84dde92d787a08b7cab6486527e9e57f183 (patch)
treebc8ee9fa914c05acfcad2858b056fc6cfe05cff8 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent735556d19d7bd67a1a9729586743e1c8b86de257 (diff)
QtQml: Do not crash when loading .js files as QML
Pick-to: 6.9 6.8 6.5 Fixes: QTBUG-132118 Change-Id: Id5f680b3dfe1118c3af7cf32d1da7492119a4e51 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 823f79c269..0fd90e90fd 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -1121,6 +1121,18 @@ void tst_QmlCppCodegen::confusedModule()
QTest::ignoreMessage(QtDebugMsg, "Hello from Test");
QScopedPointer<QObject> object(component.create());
QVERIFY(!object.isNull());
+
+ QQmlComponent component2(&engine, QUrl(u"qrc:/qt/qml/Confused/Main2.qml"_s));
+ QVERIFY2(!component2.isError(), component2.errorString().toUtf8());
+
+ // TODO: We would like to have a better error here, but we currently cannot propagate it.
+ QTest::ignoreMessage(
+ QtWarningMsg,
+ "qrc:/qt/qml/Confused/Main2.qml:5: "
+ "TypeError: Property 'Print' of object Broken is not a function");
+
+ QScopedPointer<QObject> object2(component2.create());
+ QVERIFY(!object2.isNull());
}
void tst_QmlCppCodegen::consoleObject()