diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-08-12 11:20:48 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-08-12 11:30:56 +0200 |
commit | d19012c2624385809a7eef4111e88dd20530bd14 (patch) | |
tree | aa45f154eb50f2a20f725a855cf1eac6aceef4c2 /tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | |
parent | dfdc5cba89f8df2a8a9dd5a54072734f212f8772 (diff) |
tst_qqmlimport: improve failure messages
Print the component's errorString upon failure.
Task-number: QTBUG-95756
Pick-to: 6.2
Change-Id: I7eb2bb1c22d519f73f12cbb4c4f6b8d500540525
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlimport/tst_qqmlimport.cpp')
-rw-r--r-- | tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index 572c8771a0..fdf72b83f0 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -302,7 +302,7 @@ void tst_QQmlImport::interceptQmldir() QQmlComponent component(&engine); component.loadUrl(testFileUrl("interceptQmldir.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> obj(component.create()); QVERIFY(!obj.isNull()); } @@ -316,7 +316,7 @@ void tst_QQmlImport::singletonVersionResolution() // Singleton with higher version is simply ignored when importing lower version of plugin QQmlComponent component(&engine); component.loadUrl(testFileUrl("QTBUG-77102/main.0.9.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> obj(component.create()); QVERIFY(!obj.isNull()); } @@ -325,7 +325,7 @@ void tst_QQmlImport::singletonVersionResolution() QQmlComponent component(&engine); QTest::ignoreMessage(QtMsgType::QtWarningMsg, QRegularExpression {".*ReferenceError: MySettings is not defined$"} ); component.loadUrl(testFileUrl("QTBUG-77102/main.0.9.fail.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> obj(component.create()); QVERIFY(!obj.isNull()); } @@ -333,7 +333,7 @@ void tst_QQmlImport::singletonVersionResolution() // unless a version which is high enough is imported QQmlComponent component(&engine); component.loadUrl(testFileUrl("QTBUG-77102/main.1.0.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> obj(component.create()); QVERIFY(!obj.isNull()); auto item = qobject_cast<QQuickItem*>(obj.get()); @@ -343,7 +343,7 @@ void tst_QQmlImport::singletonVersionResolution() // or when there is no number because we are importing from a path QQmlComponent component(&engine); component.loadUrl(testFileUrl("QTBUG-77102/main.nonumber.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> obj(component.create()); QVERIFY(!obj.isNull()); auto item = qobject_cast<QQuickItem*>(obj.get()); @@ -359,7 +359,7 @@ void tst_QQmlImport::removeDynamicPlugin() // Load something that adds a dynamic plugin QQmlComponent component(&engine); component.setData(QByteArray("import QtTest 1.0; TestResult{}"), QUrl()); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); } QQmlImportDatabase *imports = &QQmlEnginePrivate::get(&engine)->importDatabase; const QStringList &plugins = imports->dynamicPlugins(); @@ -449,7 +449,7 @@ void tst_QQmlImport::importDependenciesPrecedence() engine.addImportPath(dataDirectory()); QQmlComponent component(&engine, testFile("dependencies.qml")); - QVERIFY(component.isReady()); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); QScopedPointer<QObject> instance(component.create()); QVERIFY(!instance.isNull()); |