diff options
Diffstat (limited to 'tests')
3 files changed, 23 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickloader/data/Component.qml b/tests/auto/quick/qquickloader/data/Component.qml new file mode 100644 index 0000000000..8a9318a0de --- /dev/null +++ b/tests/auto/quick/qquickloader/data/Component.qml @@ -0,0 +1,5 @@ +import QtQuick 2.15 + +Item { + property int i +} diff --git a/tests/auto/quick/qquickloader/data/initialPropertyTriggerException.qml b/tests/auto/quick/qquickloader/data/initialPropertyTriggerException.qml new file mode 100644 index 0000000000..457a6a4e26 --- /dev/null +++ b/tests/auto/quick/qquickloader/data/initialPropertyTriggerException.qml @@ -0,0 +1,12 @@ +import QtQuick 2.15 + +Item { + id: root + Loader { + id: myloader + } + function f() {} + Component.onCompleted: { + myloader.setSource("Component.qml", {"i": root.f}); + } +} diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 698f410f9f..fcc6d0914d 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -706,6 +706,11 @@ void tst_QQuickLoader::initialPropertyValues_data() << QStringList() << (QStringList() << "i") << (QVariantList() << 12); + + QTest::newRow("initial property errors get reported") << testFileUrl("initialPropertyTriggerException.qml") + << (QStringList() << "^.*:11: Error: Cannot assign JavaScript function to int") + << QStringList() + << QVariantList(); } void tst_QQuickLoader::initialPropertyValues() @@ -718,7 +723,7 @@ void tst_QQuickLoader::initialPropertyValues() ThreadedTestHTTPServer server(dataDirectory()); foreach (const QString &warning, expectedWarnings) - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(warning.toLatin1().constData())); QQmlEngine engine; QQmlComponent component(&engine, qmlFile); |