diff options
Diffstat (limited to 'plugins/autotest')
-rw-r--r-- | plugins/autotest/testresult.cpp | 138 | ||||
-rw-r--r-- | plugins/autotest/testresult.h | 22 | ||||
-rw-r--r-- | plugins/autotest/testresultdelegate.cpp | 30 | ||||
-rw-r--r-- | plugins/autotest/testresultmodel.cpp | 44 | ||||
-rw-r--r-- | plugins/autotest/testresultmodel.h | 12 | ||||
-rw-r--r-- | plugins/autotest/testresultspane.cpp | 42 | ||||
-rw-r--r-- | plugins/autotest/testrunner.cpp | 34 |
7 files changed, 162 insertions, 160 deletions
diff --git a/plugins/autotest/testresult.cpp b/plugins/autotest/testresult.cpp index 6c8d0639da..810dcf2c43 100644 --- a/plugins/autotest/testresult.cpp +++ b/plugins/autotest/testresult.cpp @@ -21,13 +21,13 @@ namespace Autotest { namespace Internal { -FaultyTestResult::FaultyTestResult(ResultType result, const QString &description) +FaultyTestResult::FaultyTestResult(Result::Type result, const QString &description) : TestResult(QString(), QString(), QString(), result, description) { } TestResult::TestResult(const QString &className, const QString &testCase, const QString &dataTag, - ResultType result, const QString &description) + Result::Type result, const QString &description) : m_class(className), m_case(testCase), m_dataTag(dataTag), @@ -37,125 +37,125 @@ TestResult::TestResult(const QString &className, const QString &testCase, const { } -ResultType TestResult::resultFromString(const QString &resultString) +Result::Type TestResult::resultFromString(const QString &resultString) { if (resultString == QLatin1String("pass")) - return PASS; + return Result::PASS; if (resultString == QLatin1String("fail")) - return FAIL; + return Result::FAIL; if (resultString == QLatin1String("xfail")) - return EXPECTED_FAIL; + return Result::EXPECTED_FAIL; if (resultString == QLatin1String("xpass")) - return UNEXPECTED_PASS; + return Result::UNEXPECTED_PASS; if (resultString == QLatin1String("skip")) - return SKIP; + return Result::SKIP; if (resultString == QLatin1String("qdebug")) - return MESSAGE_DEBUG; + return Result::MESSAGE_DEBUG; if (resultString == QLatin1String("warn") || resultString == QLatin1String("qwarn")) - return MESSAGE_WARN; + return Result::MESSAGE_WARN; if (resultString == QLatin1String("qfatal")) - return MESSAGE_FATAL; + return Result::MESSAGE_FATAL; if (resultString == QLatin1String("bpass")) - return BLACKLISTED_PASS; + return Result::BLACKLISTED_PASS; if (resultString == QLatin1String("bfail")) - return BLACKLISTED_FAIL; + return Result::BLACKLISTED_FAIL; qDebug(" unexpected testresult..."); qDebug(resultString.toLatin1()); - return UNKNOWN; + return Result::UNKNOWN; } -ResultType TestResult::toResultType(int rt) +Result::Type TestResult::toResultType(int rt) { switch(rt) { - case PASS: - return PASS; - case FAIL: - return FAIL; - case EXPECTED_FAIL: - return EXPECTED_FAIL; - case UNEXPECTED_PASS: - return UNEXPECTED_PASS; - case SKIP: - return SKIP; - case BLACKLISTED_PASS: - return BLACKLISTED_PASS; - case BLACKLISTED_FAIL: - return BLACKLISTED_FAIL; - case BENCHMARK: - return BENCHMARK; - case MESSAGE_DEBUG: - return MESSAGE_DEBUG; - case MESSAGE_WARN: - return MESSAGE_WARN; - case MESSAGE_FATAL: - return MESSAGE_FATAL; - case MESSAGE_INTERNAL: - return MESSAGE_INTERNAL; - case MESSAGE_CURRENT_TEST: - return MESSAGE_CURRENT_TEST; + case Result::PASS: + return Result::PASS; + case Result::FAIL: + return Result::FAIL; + case Result::EXPECTED_FAIL: + return Result::EXPECTED_FAIL; + case Result::UNEXPECTED_PASS: + return Result::UNEXPECTED_PASS; + case Result::SKIP: + return Result::SKIP; + case Result::BLACKLISTED_PASS: + return Result::BLACKLISTED_PASS; + case Result::BLACKLISTED_FAIL: + return Result::BLACKLISTED_FAIL; + case Result::BENCHMARK: + return Result::BENCHMARK; + case Result::MESSAGE_DEBUG: + return Result::MESSAGE_DEBUG; + case Result::MESSAGE_WARN: + return Result::MESSAGE_WARN; + case Result::MESSAGE_FATAL: + return Result::MESSAGE_FATAL; + case Result::MESSAGE_INTERNAL: + return Result::MESSAGE_INTERNAL; + case Result::MESSAGE_CURRENT_TEST: + return Result::MESSAGE_CURRENT_TEST; default: - return UNKNOWN; + return Result::UNKNOWN; } } -QString TestResult::resultToString(const ResultType type) +QString TestResult::resultToString(const Result::Type type) { switch(type) { - case PASS: + case Result::PASS: return QLatin1String("PASS"); - case FAIL: + case Result::FAIL: return QLatin1String("FAIL"); - case EXPECTED_FAIL: + case Result::EXPECTED_FAIL: return QLatin1String("XFAIL"); - case UNEXPECTED_PASS: + case Result::UNEXPECTED_PASS: return QLatin1String("XPASS"); - case SKIP: + case Result::SKIP: return QLatin1String("SKIP"); - case BENCHMARK: + case Result::BENCHMARK: return QLatin1String("BENCH"); - case MESSAGE_DEBUG: + case Result::MESSAGE_DEBUG: return QLatin1String("DEBUG"); - case MESSAGE_WARN: + case Result::MESSAGE_WARN: return QLatin1String("WARN"); - case MESSAGE_FATAL: + case Result::MESSAGE_FATAL: return QLatin1String("FATAL"); - case MESSAGE_INTERNAL: - case MESSAGE_CURRENT_TEST: + case Result::MESSAGE_INTERNAL: + case Result::MESSAGE_CURRENT_TEST: return QString(); - case BLACKLISTED_PASS: + case Result::BLACKLISTED_PASS: return QLatin1String("BPASS"); - case BLACKLISTED_FAIL: + case Result::BLACKLISTED_FAIL: return QLatin1String("BFAIL"); default: return QLatin1String("UNKNOWN"); } } -QColor TestResult::colorForType(const ResultType type) +QColor TestResult::colorForType(const Result::Type type) { switch(type) { - case PASS: + case Result::PASS: return QColor("#009900"); - case FAIL: + case Result::FAIL: return QColor("#a00000"); - case EXPECTED_FAIL: + case Result::EXPECTED_FAIL: return QColor("#00ff00"); - case UNEXPECTED_PASS: + case Result::UNEXPECTED_PASS: return QColor("#ff0000"); - case SKIP: + case Result::SKIP: return QColor("#787878"); - case BLACKLISTED_PASS: + case Result::BLACKLISTED_PASS: return QColor(0, 0, 0); - case BLACKLISTED_FAIL: + case Result::BLACKLISTED_FAIL: return QColor(0, 0, 0); - case MESSAGE_DEBUG: + case Result::MESSAGE_DEBUG: return QColor("#329696"); - case MESSAGE_WARN: + case Result::MESSAGE_WARN: return QColor("#d0bb00"); - case MESSAGE_FATAL: + case Result::MESSAGE_FATAL: return QColor("#640000"); - case MESSAGE_INTERNAL: - case MESSAGE_CURRENT_TEST: + case Result::MESSAGE_INTERNAL: + case Result::MESSAGE_CURRENT_TEST: return QColor("transparent"); default: return QColor("#000000"); diff --git a/plugins/autotest/testresult.h b/plugins/autotest/testresult.h index 1a9da57528..65b801d5d0 100644 --- a/plugins/autotest/testresult.h +++ b/plugins/autotest/testresult.h @@ -25,7 +25,8 @@ namespace Autotest { namespace Internal { -enum ResultType { +namespace Result{ +enum Type { PASS, FAIL, EXPECTED_FAIL, @@ -41,6 +42,7 @@ enum ResultType { MESSAGE_CURRENT_TEST, UNKNOWN // ??? }; +} class TestResult { @@ -48,12 +50,12 @@ public: TestResult(const QString &className = QString(), const QString &testCase = QString(), const QString &dataTag = QString(), - ResultType result = UNKNOWN, const QString &description = QString()); + Result::Type result = Result::UNKNOWN, const QString &description = QString()); QString className() const { return m_class; } QString testCase() const { return m_case; } QString dataTag() const { return m_dataTag; } - ResultType result() const { return m_result; } + Result::Type result() const { return m_result; } QString description() const { return m_description; } QString fileName() const { return m_file; } int line() const { return m_line; } @@ -62,16 +64,16 @@ public: void setFileName(const QString &fileName) { m_file = fileName; } void setLine(int line) { m_line = line; } - static ResultType resultFromString(const QString &resultString); - static ResultType toResultType(int rt); - static QString resultToString(const ResultType type); - static QColor colorForType(const ResultType type); + static Result::Type resultFromString(const QString &resultString); + static Result::Type toResultType(int rt); + static QString resultToString(const Result::Type type); + static QColor colorForType(const Result::Type type); private: QString m_class; QString m_case; QString m_dataTag; - ResultType m_result; + Result::Type m_result; QString m_description; QString m_file; int m_line; @@ -81,7 +83,7 @@ private: class FaultyTestResult : public TestResult { public: - FaultyTestResult(ResultType result, const QString &description); + FaultyTestResult(Result::Type result, const QString &description); }; bool operator==(const TestResult &t1, const TestResult &t2); @@ -90,6 +92,6 @@ bool operator==(const TestResult &t1, const TestResult &t2); } // namespace Autotest Q_DECLARE_METATYPE(Autotest::Internal::TestResult) -Q_DECLARE_METATYPE(Autotest::Internal::ResultType) +Q_DECLARE_METATYPE(Autotest::Internal::Result::Type) #endif // TESTRESULT_H diff --git a/plugins/autotest/testresultdelegate.cpp b/plugins/autotest/testresultdelegate.cpp index 21a595fa6f..e6df02dc9f 100644 --- a/plugins/autotest/testresultdelegate.cpp +++ b/plugins/autotest/testresultdelegate.cpp @@ -68,7 +68,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op TestResultModel *resultModel = static_cast<TestResultModel *>(resultFilterModel->sourceModel()); LayoutPositions positions(opt, resultModel); TestResult testResult = resultModel->testResult(resultFilterModel->mapToSource(index)); - ResultType type = testResult.result(); + Result::Type type = testResult.result(); QIcon icon = index.data(Qt::DecorationRole).value<QIcon>(); if (!icon.isNull()) @@ -88,12 +88,12 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op const QString desc = testResult.description(); QString output; switch (type) { - case ResultType::PASS: - case ResultType::FAIL: - case ResultType::EXPECTED_FAIL: - case ResultType::UNEXPECTED_PASS: - case ResultType::BLACKLISTED_FAIL: - case ResultType::BLACKLISTED_PASS: + case Result::PASS: + case Result::FAIL: + case Result::EXPECTED_FAIL: + case Result::UNEXPECTED_PASS: + case Result::BLACKLISTED_FAIL: + case Result::BLACKLISTED_PASS: output = testResult.className() + QLatin1String("::") + testResult.testCase(); if (!testResult.dataTag().isEmpty()) output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag())); @@ -101,7 +101,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op output.append(QLatin1Char('\n')).append(desc); } break; - case ResultType::BENCHMARK: + case Result::BENCHMARK: output = testResult.className() + QLatin1String("::") + testResult.testCase(); if (!testResult.dataTag().isEmpty()) output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag())); @@ -202,12 +202,12 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo QString desc = testResult.description(); QString output; switch (testResult.result()) { - case ResultType::PASS: - case ResultType::FAIL: - case ResultType::EXPECTED_FAIL: - case ResultType::UNEXPECTED_PASS: - case ResultType::BLACKLISTED_FAIL: - case ResultType::BLACKLISTED_PASS: + case Result::PASS: + case Result::FAIL: + case Result::EXPECTED_FAIL: + case Result::UNEXPECTED_PASS: + case Result::BLACKLISTED_FAIL: + case Result::BLACKLISTED_PASS: output = testResult.className() + QLatin1String("::") + testResult.testCase(); if (!testResult.dataTag().isEmpty()) output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag())); @@ -215,7 +215,7 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo output.append(QLatin1Char('\n')).append(desc); } break; - case ResultType::BENCHMARK: + case Result::BENCHMARK: output = testResult.className() + QLatin1String("::") + testResult.testCase(); if (!testResult.dataTag().isEmpty()) output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag())); diff --git a/plugins/autotest/testresultmodel.cpp b/plugins/autotest/testresultmodel.cpp index 1f96257596..f0324458c3 100644 --- a/plugins/autotest/testresultmodel.cpp +++ b/plugins/autotest/testresultmodel.cpp @@ -61,7 +61,7 @@ int TestResultModel::columnCount(const QModelIndex &parent) const return parent.isValid() ? 0 : 1; } -static QIcon testResultIcon(ResultType result) { +static QIcon testResultIcon(Result::Type result) { static QIcon icons[11] = { QIcon(QLatin1String(":/images/pass.png")), QIcon(QLatin1String(":/images/fail.png")), @@ -76,7 +76,7 @@ static QIcon testResultIcon(ResultType result) { QIcon(QLatin1String(":/images/fatal.png")), }; // provide an icon for unknown?? - if (result < 0 || result >= MESSAGE_INTERNAL) + if (result < 0 || result >= Result::MESSAGE_INTERNAL) return QIcon(); return icons[result]; } @@ -88,14 +88,14 @@ QVariant TestResultModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { const TestResult &tr = m_testResults.at(index.row()); switch (tr.result()) { - case ResultType::PASS: - case ResultType::FAIL: - case ResultType::EXPECTED_FAIL: - case ResultType::UNEXPECTED_PASS: - case ResultType::SKIP: - case ResultType::BLACKLISTED_PASS: - case ResultType::BLACKLISTED_FAIL: - case ResultType::BENCHMARK: + case Result::PASS: + case Result::FAIL: + case Result::EXPECTED_FAIL: + case Result::UNEXPECTED_PASS: + case Result::SKIP: + case Result::BLACKLISTED_PASS: + case Result::BLACKLISTED_FAIL: + case Result::BENCHMARK: return QString::fromLatin1("%1::%2 (%3) - %4").arg(tr.className(), tr.testCase(), tr.dataTag(), tr.fileName()); default: @@ -112,8 +112,8 @@ QVariant TestResultModel::data(const QModelIndex &index, int role) const void TestResultModel::addTestResult(const TestResult &testResult) { - const bool isCurrentTestMssg = testResult.result() == ResultType::MESSAGE_CURRENT_TEST; - const bool hasCurrentTestMssg = m_availableResultTypes.contains(ResultType::MESSAGE_CURRENT_TEST); + const bool isCurrentTestMssg = testResult.result() == Result::MESSAGE_CURRENT_TEST; + const bool hasCurrentTestMssg = m_availableResultTypes.contains(Result::MESSAGE_CURRENT_TEST); int position = m_testResults.size(); @@ -139,11 +139,11 @@ void TestResultModel::addTestResult(const TestResult &testResult) void TestResultModel::removeCurrentTestMessage() { - if (m_availableResultTypes.contains(ResultType::MESSAGE_CURRENT_TEST)) { + if (m_availableResultTypes.contains(Result::MESSAGE_CURRENT_TEST)) { beginRemoveRows(QModelIndex(), m_testResults.size() - 1, m_testResults.size() - 1); m_testResults.removeLast(); endRemoveRows(); - m_availableResultTypes.remove(ResultType::MESSAGE_CURRENT_TEST); + m_availableResultTypes.remove(Result::MESSAGE_CURRENT_TEST); } } @@ -201,7 +201,7 @@ int TestResultModel::maxWidthOfLineNumber(const QFont &font) return m_widthOfLineNumber; } -int TestResultModel::resultTypeCount(ResultType type) +int TestResultModel::resultTypeCount(Result::Type type) { return m_testResultCount.value(type, 0); } @@ -218,16 +218,16 @@ TestResultFilterModel::TestResultFilterModel(TestResultModel *sourceModel, QObje void TestResultFilterModel::enableAllResultTypes() { - m_enabled << ResultType::PASS << ResultType::FAIL << ResultType::EXPECTED_FAIL - << ResultType::UNEXPECTED_PASS << ResultType::SKIP << ResultType::MESSAGE_DEBUG - << ResultType::MESSAGE_WARN << ResultType::MESSAGE_INTERNAL - << ResultType::MESSAGE_FATAL << ResultType::UNKNOWN << ResultType::BLACKLISTED_PASS - << ResultType::BLACKLISTED_FAIL << ResultType::BENCHMARK - << ResultType::MESSAGE_CURRENT_TEST; + m_enabled << Result::PASS << Result::FAIL << Result::EXPECTED_FAIL + << Result::UNEXPECTED_PASS << Result::SKIP << Result::MESSAGE_DEBUG + << Result::MESSAGE_WARN << Result::MESSAGE_INTERNAL + << Result::MESSAGE_FATAL << Result::UNKNOWN << Result::BLACKLISTED_PASS + << Result::BLACKLISTED_FAIL << Result::BENCHMARK + << Result::MESSAGE_CURRENT_TEST; invalidateFilter(); } -void TestResultFilterModel::toggleTestResultType(ResultType type) +void TestResultFilterModel::toggleTestResultType(Result::Type type) { if (m_enabled.contains(type)) { m_enabled.remove(type); diff --git a/plugins/autotest/testresultmodel.h b/plugins/autotest/testresultmodel.h index 9485e25649..5747194a88 100644 --- a/plugins/autotest/testresultmodel.h +++ b/plugins/autotest/testresultmodel.h @@ -51,8 +51,8 @@ public: int maxWidthOfFileName(const QFont &font); int maxWidthOfLineNumber(const QFont &font); - bool hasResultType(ResultType type) { return m_availableResultTypes.contains(type); } - int resultTypeCount(ResultType type); + bool hasResultType(Result::Type type) { return m_availableResultTypes.contains(type); } + int resultTypeCount(Result::Type type); signals: @@ -60,12 +60,12 @@ public slots: private: QList<TestResult> m_testResults; - QMap<ResultType, int> m_testResultCount; + QMap<Result::Type, int> m_testResultCount; int m_widthOfLineNumber; int m_maxWidthOfFileName; int m_lastMaxWidthIndex; QFont m_measurementFont; - QSet<ResultType> m_availableResultTypes; + QSet<Result::Type> m_availableResultTypes; }; class TestResultFilterModel : public QSortFilterProxyModel @@ -75,7 +75,7 @@ public: TestResultFilterModel(TestResultModel *sourceModel, QObject *parent = 0); void enableAllResultTypes(); - void toggleTestResultType(ResultType type); + void toggleTestResultType(Result::Type type); void clearTestResults(); bool hasResults(); TestResult testResult(const QModelIndex &index) const; @@ -85,7 +85,7 @@ protected: private: TestResultModel *m_sourceModel; - QSet<ResultType> m_enabled; + QSet<Result::Type> m_enabled; }; } // namespace Internal diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index 6d902705f1..20c4fe2340 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -276,23 +276,23 @@ void TestResultsPane::initializeFilterMenu() const bool omitIntern = AutotestPlugin::instance()->settings()->omitInternalMssg; // FilterModel has all messages enabled by default if (omitIntern) - m_filterModel->toggleTestResultType(ResultType::MESSAGE_INTERNAL); - - QMap<ResultType, QString> textAndType; - textAndType.insert(ResultType::PASS, tr("Pass")); - textAndType.insert(ResultType::FAIL, tr("Fail")); - textAndType.insert(ResultType::EXPECTED_FAIL, tr("Expected Fail")); - textAndType.insert(ResultType::UNEXPECTED_PASS, tr("Unexpected Pass")); - textAndType.insert(ResultType::SKIP, tr("Skip")); - textAndType.insert(ResultType::BENCHMARK, tr("Benchmarks")); - textAndType.insert(ResultType::MESSAGE_DEBUG, tr("Debug Messages")); - textAndType.insert(ResultType::MESSAGE_WARN, tr("Warning Messages")); - textAndType.insert(ResultType::MESSAGE_INTERNAL, tr("Internal Messages")); - foreach (ResultType result, textAndType.keys()) { + m_filterModel->toggleTestResultType(Result::MESSAGE_INTERNAL); + + QMap<Result::Type, QString> textAndType; + textAndType.insert(Result::PASS, tr("Pass")); + textAndType.insert(Result::FAIL, tr("Fail")); + textAndType.insert(Result::EXPECTED_FAIL, tr("Expected Fail")); + textAndType.insert(Result::UNEXPECTED_PASS, tr("Unexpected Pass")); + textAndType.insert(Result::SKIP, tr("Skip")); + textAndType.insert(Result::BENCHMARK, tr("Benchmarks")); + textAndType.insert(Result::MESSAGE_DEBUG, tr("Debug Messages")); + textAndType.insert(Result::MESSAGE_WARN, tr("Warning Messages")); + textAndType.insert(Result::MESSAGE_INTERNAL, tr("Internal Messages")); + foreach (Result::Type result, textAndType.keys()) { QAction *action = new QAction(m_filterMenu); action->setText(textAndType.value(result)); action->setCheckable(true); - action->setChecked(result != ResultType::MESSAGE_INTERNAL || !omitIntern); + action->setChecked(result != Result::MESSAGE_INTERNAL || !omitIntern); action->setData(result); m_filterMenu->addAction(action); } @@ -307,22 +307,22 @@ void TestResultsPane::initializeFilterMenu() void TestResultsPane::updateSummaryLabel() { QString labelText = QString::fromLatin1("<p><b>Test Summary:</b> %1 %2, %3 %4") - .arg(QString::number(m_model->resultTypeCount(ResultType::PASS)), tr("passes"), - QString::number(m_model->resultTypeCount(ResultType::FAIL)), tr("fails")); - int count = m_model->resultTypeCount(ResultType::UNEXPECTED_PASS); + .arg(QString::number(m_model->resultTypeCount(Result::PASS)), tr("passes"), + QString::number(m_model->resultTypeCount(Result::FAIL)), tr("fails")); + int count = m_model->resultTypeCount(Result::UNEXPECTED_PASS); if (count) labelText.append(QString::fromLatin1(", %1 %2") .arg(QString::number(count), tr("unexpected passes"))); - count = m_model->resultTypeCount(ResultType::EXPECTED_FAIL); + count = m_model->resultTypeCount(Result::EXPECTED_FAIL); if (count) labelText.append(QString::fromLatin1(", %1 %2") .arg(QString::number(count), tr("expected fails"))); - count = m_model->resultTypeCount(ResultType::MESSAGE_FATAL); + count = m_model->resultTypeCount(Result::MESSAGE_FATAL); if (count) labelText.append(QString::fromLatin1(", %1 %2") .arg(QString::number(count), tr("fatals"))); - count = m_model->resultTypeCount(ResultType::BLACKLISTED_FAIL) - + m_model->resultTypeCount(ResultType::BLACKLISTED_PASS); + count = m_model->resultTypeCount(Result::BLACKLISTED_FAIL) + + m_model->resultTypeCount(Result::BLACKLISTED_PASS); if (count) labelText.append(QString::fromLatin1(", %1 %2") .arg(QString::number(count), tr("blacklisted"))); diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp index e687b03fe7..fb24280183 100644 --- a/plugins/autotest/testrunner.cpp +++ b/plugins/autotest/testrunner.cpp @@ -99,7 +99,7 @@ static bool xmlCData(const QString &code, const QString &start, QString &result) } static bool xmlExtractTypeFileLine(const QString &code, const QString &tagStart, - ResultType &result, QString &file, int &line) + Result::Type &result, QString &file, int &line) { if (code.startsWith(tagStart)) { int start = code.indexOf(QLatin1String(" type=\"")) + 7; @@ -206,7 +206,7 @@ void processOutput() static QString className; static QString testCase; static QString dataTag; - static ResultType result = ResultType::UNKNOWN; + static Result::Type result = Result::UNKNOWN; static QString description; static QString file; static int lineNumber = 0; @@ -230,11 +230,11 @@ void processOutput() description = QString(); duration = QString(); file = QString(); - result = ResultType::UNKNOWN; + result = Result::UNKNOWN; lineNumber = 0; readingDescription = false; emitTestResultCreated( - TestResult(QString(), QString(), QString(), ResultType::MESSAGE_CURRENT_TEST, + TestResult(QString(), QString(), QString(), Result::MESSAGE_CURRENT_TEST, QObject::tr("Entering Test Function %1::%2") .arg(className).arg(testCase))); continue; @@ -263,7 +263,7 @@ void processOutput() continue; } if (xmlExtractBenchmarkInformation(line, QLatin1String("<BenchmarkResult"), bmDescription)) { - TestResult testResult(className, testCase, dataTag, ResultType::BENCHMARK, bmDescription); + TestResult testResult(className, testCase, dataTag, Result::BENCHMARK, bmDescription); emitTestResultCreated(testResult); continue; } @@ -276,12 +276,12 @@ void processOutput() emitTestResultCreated(testResult); description = QString(); } else if (line == QLatin1String("</TestFunction>") && !duration.isEmpty()) { - TestResult testResult(className, testCase, QString(), ResultType::MESSAGE_INTERNAL, + TestResult testResult(className, testCase, QString(), Result::MESSAGE_INTERNAL, QObject::tr("execution took %1ms").arg(duration)); emitTestResultCreated(testResult); m_currentFuture->setProgressValue(m_currentFuture->progressValue() + 1); } else if (line == QLatin1String("</TestCase>") && !duration.isEmpty()) { - TestResult testResult(className, QString(), QString(), ResultType::MESSAGE_INTERNAL, + TestResult testResult(className, QString(), QString(), Result::MESSAGE_INTERNAL, QObject::tr("Test execution took %1ms").arg(duration)); emitTestResultCreated(testResult); } else if (readingDescription) { @@ -294,10 +294,10 @@ void processOutput() description.append(line); } } else if (xmlStartsWith(line, QLatin1String("<QtVersion>"), qtVersion)) { - emitTestResultCreated(FaultyTestResult(ResultType::MESSAGE_INTERNAL, + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_INTERNAL, QObject::tr("Qt Version: %1").arg(qtVersion))); } else if (xmlStartsWith(line, QLatin1String("<QTestVersion>"), qtestVersion)) { - emitTestResultCreated(FaultyTestResult(ResultType::MESSAGE_INTERNAL, + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_INTERNAL, QObject::tr("QTest Version: %1").arg(qtestVersion))); } else { // qDebug() << "Unhandled line:" << line; // TODO remove @@ -349,7 +349,7 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor } if (runCmd.isEmpty()) { - emitTestResultCreated(FaultyTestResult(ResultType::MESSAGE_FATAL, + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL, QObject::tr("*** Could not find command '%1' ***").arg(cmd))); return false; } @@ -371,7 +371,7 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor if (m_currentFuture->isCanceled()) { m_runner->kill(); m_runner->waitForFinished(); - emitTestResultCreated(FaultyTestResult(ResultType::MESSAGE_FATAL, + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL, QObject::tr("*** Test Run canceled by user ***"))); } qApp->processEvents(); @@ -383,7 +383,7 @@ bool performExec(const QString &cmd, const QStringList &args, const QString &wor if (m_runner->state() != QProcess::NotRunning) { m_runner->kill(); m_runner->waitForFinished(); - emitTestResultCreated(FaultyTestResult(ResultType::MESSAGE_FATAL, + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL, QObject::tr("*** Test Case canceled due to timeout ***\nMaybe raise the timeout?"))); } return false; @@ -443,7 +443,7 @@ void TestRunner::runTests() foreach (TestConfiguration *config, m_selectedTests) if (!config->project()) { toBeRemoved.append(config); - TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, tr("*** Project is null for '%1' - removing from Test Run ***\n" "This might be the case for a faulty environment or similar." ).arg(config->displayName()))); @@ -454,14 +454,14 @@ void TestRunner::runTests() } if (m_selectedTests.empty()) { - TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, tr("*** No tests selected - canceling Test Run ***"))); return; } ProjectExplorer::Project *project = m_selectedTests.at(0)->project(); if (!project) { - TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_WARN, + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, tr("*** Project is null - canceling Test Run ***\n" "Actually only Desktop kits are supported - make sure the " "current active kit is a Desktop kit."))); @@ -472,7 +472,7 @@ void TestRunner::runTests() ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings(); if (pes.buildBeforeDeploy) { if (!project->hasActiveBuildSettings()) { - TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL, tr("*** Project is not configured - canceling Test Run ***"))); return; } @@ -482,7 +482,7 @@ void TestRunner::runTests() } if (!m_buildSucceeded) { - TestResultsPane::instance()->addTestResult(FaultyTestResult(ResultType::MESSAGE_FATAL, + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL, tr("*** Build failed - canceling Test Run ***"))); return; } |