Commit ce926564 authored by Christian Stenger's avatar Christian Stenger
Browse files

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: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent c8c79c40
......@@ -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();
}
......
......@@ -42,6 +42,7 @@ enum Type {
MessageFatal,
MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal,
MessageDisabledTests,
MessageTestCaseStart,
MessageTestCaseSuccess,
MessageTestCaseWarn,
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment