diff options
Diffstat (limited to 'tests/auto')
4 files changed, 30 insertions, 2 deletions
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index 6f147446f0..f95a7ade9a 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -274,9 +274,10 @@ public: void dumpStackTrace() const { qDebug() << "Stack depth:" << m_stackTrace.size(); - foreach (const QV4::StackFrame &frame, m_stackTrace) + for (const QV4::StackFrame &frame : m_stackTrace) { qDebug("\t%s (%s:%d:%d)", qPrintable(frame.function), qPrintable(frame.source), - frame.line, frame.column); + qAbs(frame.line), frame.column); + } } }; diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt index 370ef4ac9c..363c24c648 100644 --- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt +++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt @@ -105,6 +105,7 @@ set(qml_files equalityQUrl.qml equalityVarAndNonStorable.qml equalsUndefined.qml + exceptionFromInner.qml excessiveParameters.qml extendedTypes.qml failures.qml diff --git a/tests/auto/qml/qmlcppcodegen/data/exceptionFromInner.qml b/tests/auto/qml/qmlcppcodegen/data/exceptionFromInner.qml new file mode 100644 index 0000000000..13855356f2 --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/exceptionFromInner.qml @@ -0,0 +1,10 @@ +pragma Strict +import QtQml + +QtObject { + property QtObject theNull: null + + function doFail() : string { return theNull.objectName } + function delegateFail() : string { doFail() } + function disbelieveFail() : string { delegateFail() } +} diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 20e6922dc4..f3869e6e40 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -74,6 +74,7 @@ private slots: void equalityVarAndNonStorable(); void equalsUndefined(); void evadingAmbiguity(); + void exceptionFromInner(); void excessiveParameters(); void extendedTypes(); void failures(); @@ -1415,6 +1416,21 @@ void tst_QmlCppCodegen::evadingAmbiguity() QCOMPARE(o2->property("i").toString(), QStringLiteral("Ambiguous2")); } +void tst_QmlCppCodegen::exceptionFromInner() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/exceptionFromInner.qml"_s)); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QTest::ignoreMessage( + QtWarningMsg, + "qrc:/qt/qml/TestTypes/exceptionFromInner.qml:7: TypeError: " + "Cannot read property 'objectName' of null"); + QMetaObject::invokeMethod(object.data(), "disbelieveFail"); +} + void tst_QmlCppCodegen::excessiveParameters() { QQmlEngine engine; |