diff options
author | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-12-14 12:48:58 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2016-01-13 10:11:04 +0000 |
commit | ce926564b027e7c8c18dc934f9221f7382ffa53d (patch) | |
tree | 7194d0762fbdef8f28b8b8045c3e20e1bedc7fb5 | |
parent | c8c79c409f3398a5e8b145d711f62b3c35ab11e0 (diff) |
Handle disabled gtests more correctly
Test summary now displays the number of disabled tests instead of having
them printed as loose messages.
Change-Id: I8ea736f789afc7c8ad6101a03fa5ca6428d92744
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
-rw-r--r-- | plugins/autotest/testoutputreader.cpp | 3 | ||||
-rw-r--r-- | plugins/autotest/testresult.h | 1 | ||||
-rw-r--r-- | plugins/autotest/testresultmodel.cpp | 6 | ||||
-rw-r--r-- | plugins/autotest/testresultmodel.h | 2 | ||||
-rw-r--r-- | plugins/autotest/testresultspane.cpp | 4 |
5 files changed, 14 insertions, 2 deletions
diff --git a/plugins/autotest/testoutputreader.cpp b/plugins/autotest/testoutputreader.cpp index 0b77f71c63..c75260ef01 100644 --- a/plugins/autotest/testoutputreader.cpp +++ b/plugins/autotest/testoutputreader.cpp @@ -344,9 +344,10 @@ void TestOutputReader::processGTestOutput() description.clear(); } else if (disabledTests.exactMatch(line)) { auto testResult = new GTestResult(); - testResult->setResult(Result::MessageInternal); + testResult->setResult(Result::MessageDisabledTests); int disabled = disabledTests.cap(1).toInt(); testResult->setDescription(tr("You have %n disabled test(s).", 0, disabled)); + testResult->setLine(disabled); // misuse line property to hold number of disabled testResultCreated(testResult); description.clear(); } diff --git a/plugins/autotest/testresult.h b/plugins/autotest/testresult.h index 3515805030..a6c4f3e32a 100644 --- a/plugins/autotest/testresult.h +++ b/plugins/autotest/testresult.h @@ -42,6 +42,7 @@ enum Type { MessageFatal, MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal, + MessageDisabledTests, MessageTestCaseStart, MessageTestCaseSuccess, MessageTestCaseWarn, diff --git a/plugins/autotest/testresultmodel.cpp b/plugins/autotest/testresultmodel.cpp index 8ab0aa8a14..a3dac8e319 100644 --- a/plugins/autotest/testresultmodel.cpp +++ b/plugins/autotest/testresultmodel.cpp @@ -116,7 +116,8 @@ void TestResultItem::updateResult() TestResultModel::TestResultModel(QObject *parent) : Utils::TreeModel(parent), m_widthOfLineNumber(0), - m_maxWidthOfFileName(0) + m_maxWidthOfFileName(0), + m_disabled(0) { } @@ -140,6 +141,8 @@ void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand) // we'll add the new item, so raising it's counter if (!isCurrentTestMssg) { int count = m_testResultCount.value(testResult->result(), 0); + if (testResult->result() == Result::MessageDisabledTests) + m_disabled += testResult->line(); m_testResultCount.insert(testResult->result(), ++count); } else { // MessageCurrentTest should always be the last top level item @@ -205,6 +208,7 @@ void TestResultModel::clearTestResults() { clear(); m_testResultCount.clear(); + m_disabled = 0; m_processedIndices.clear(); m_maxWidthOfFileName = 0; m_widthOfLineNumber = 0; diff --git a/plugins/autotest/testresultmodel.h b/plugins/autotest/testresultmodel.h index 5a108aa45c..782f7223b3 100644 --- a/plugins/autotest/testresultmodel.h +++ b/plugins/autotest/testresultmodel.h @@ -62,11 +62,13 @@ public: int maxWidthOfLineNumber(const QFont &font); int resultTypeCount(Result::Type type) const { return m_testResultCount.value(type, 0); } + int disabledTests() const { return m_disabled; } private: QMap<Result::Type, int> m_testResultCount; int m_widthOfLineNumber; int m_maxWidthOfFileName; + int m_disabled; QList<int> m_processedIndices; QFont m_measurementFont; }; diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index acd6027478..42886027fc 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -445,6 +445,10 @@ void TestResultsPane::updateSummaryLabel() labelText.append(QString::fromLatin1(", %1 %2") .arg(QString::number(count), tr("blacklisted"))); + count = m_model->disabledTests(); + if (count) + labelText.append(tr(", %1 disabled").arg(count)); + labelText.append(QLatin1String(".</p>")); m_summaryLabel->setText(labelText); } |