diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-15 11:35:14 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-15 11:36:53 +1000 |
commit | 9a9c2bd643b066571aa94d1b16d767bcf36a5e30 (patch) | |
tree | 10427a005bd13551a05260aeef3716f299e84a36 | |
parent | 3527fa349115459d710e2936f6cd26e3863a266f (diff) |
Report QML compile errors in the log
-rw-r--r-- | src/quicktestlib/quicktest.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/quicktestlib/quicktest.cpp b/src/quicktestlib/quicktest.cpp index ce00cde..19e8605 100644 --- a/src/quicktestlib/quicktest.cpp +++ b/src/quicktestlib/quicktest.cpp @@ -167,7 +167,6 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Scan through all of the "tst_*.qml" files and run each of them // in turn with a QDeclarativeView. - bool compileFail = false; foreach (QString file, files) { QFileInfo fi(file); if (!fi.exists()) @@ -197,8 +196,20 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport else view.setSource(QUrl::fromLocalFile(path)); if (view.status() == QDeclarativeView::Error) { - // Error compiling the test - flag failure and continue. - compileFail = true; + // Error compiling the test - flag failure in the log and continue. + QList<QDeclarativeError> errors = view.errors(); + QuickTestResult results; + results.setTestCaseName(fi.baseName()); + results.startLogging(); + results.setFunctionName(QLatin1String("compile")); + results.setFunctionType(QuickTestResult::Func); + results.fail(errors.at(0).description(), + errors.at(0).url().toString(), + errors.at(0).line()); + results.finishTestFunction(); + results.setFunctionName(QString()); + results.setFunctionType(QuickTestResult::NoWhere); + results.stopLogging(); continue; } if (!rootobj.hasQuit) { @@ -218,10 +229,7 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport QuickTestResult::setProgramName(0); // Return the number of failures as the exit code. - int code = QuickTestResult::exitCode(); - if (!code && compileFail) - ++code; - return code; + return QuickTestResult::exitCode(); } QT_END_NAMESPACE |