diff options
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 9bbe15ca7d..86e6c4cd16 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -98,6 +98,7 @@ private slots: void cppValueTypeList(); void dateConstruction(); void dateConversions(); + void deadContext(); void deadShoeSize(); void deduplicateConversionOrigins(); void destroyAndToString(); @@ -1673,6 +1674,28 @@ void tst_QmlCppCodegen::dateConversions() } +void tst_QmlCppCodegen::deadContext() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/deadContext.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + const char *vmeError = "QQmlVMEMetaObject: Internal error " + "- attempted to evaluate a function in an invalid context"; + static const QRegularExpression timerError( + u"qrc:/qt/qml/TestTypes/deadContext\\.qml:[0-9]+: TypeError: Property 'doit' of " + "object QQmlTimer_QML_[0-9]+\\(0x[0-9a-f]+\\) is not a function"_s); + + for (int i = 0; i < 4; ++i) { + QTest::ignoreMessage(QtWarningMsg, vmeError); + QTest::ignoreMessage(QtWarningMsg, timerError); + } + + QTRY_COMPARE(o->property("choice").toInt(), 4); +} + void tst_QmlCppCodegen::deadShoeSize() { QQmlEngine engine; |
