summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2014-12-05 14:01:16 +0100
committerChristian Stenger <christian.stenger@theqtcompany.com>2014-12-09 10:33:15 +0200
commitac24550a22ad59712e4cb5ea9955583c25101839 (patch)
treed4ae86dbf4f5f10736ee4866e520778e68a46963
parente71a2c44fc64b3e3ced132731bf57fc6809516e1 (diff)
downloadqt-creator-ac24550a22ad59712e4cb5ea9955583c25101839.tar.gz
Add special message to results pane
This message just states which function actually is executed and will always be on the bottom of the list of results. When test run finishes this message will be completely removed. Change-Id: Ie8fedfc74f67eba71a2bcf55f4dc1553754fca9a Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
-rw-r--r--plugins/autotest/testresult.cpp4
-rw-r--r--plugins/autotest/testresult.h1
-rw-r--r--plugins/autotest/testresultmodel.cpp43
-rw-r--r--plugins/autotest/testresultmodel.h1
-rw-r--r--plugins/autotest/testresultspane.cpp1
-rw-r--r--plugins/autotest/testrunner.cpp4
6 files changed, 48 insertions, 6 deletions
diff --git a/plugins/autotest/testresult.cpp b/plugins/autotest/testresult.cpp
index 175644d570..2ade2c42ae 100644
--- a/plugins/autotest/testresult.cpp
+++ b/plugins/autotest/testresult.cpp
@@ -86,6 +86,8 @@ ResultType TestResult::toResultType(int rt)
return MESSAGE_FATAL;
case MESSAGE_INTERNAL:
return MESSAGE_INTERNAL;
+ case MESSAGE_CURRENT_TEST:
+ return MESSAGE_CURRENT_TEST;
default:
return UNKNOWN;
}
@@ -113,6 +115,7 @@ QString TestResult::resultToString(const ResultType type)
case MESSAGE_FATAL:
return QLatin1String("FATAL");
case MESSAGE_INTERNAL:
+ case MESSAGE_CURRENT_TEST:
return QString();
case BLACKLISTED_PASS:
return QLatin1String("BPASS");
@@ -147,6 +150,7 @@ QColor TestResult::colorForType(const ResultType type)
case MESSAGE_FATAL:
return QColor("#640000");
case MESSAGE_INTERNAL:
+ case MESSAGE_CURRENT_TEST:
return QColor("transparent");
default:
return QColor("#000000");
diff --git a/plugins/autotest/testresult.h b/plugins/autotest/testresult.h
index 6ebcff9a6f..86d3517a9d 100644
--- a/plugins/autotest/testresult.h
+++ b/plugins/autotest/testresult.h
@@ -38,6 +38,7 @@ enum ResultType {
MESSAGE_WARN,
MESSAGE_FATAL,
MESSAGE_INTERNAL,
+ MESSAGE_CURRENT_TEST,
UNKNOWN // ???
};
diff --git a/plugins/autotest/testresultmodel.cpp b/plugins/autotest/testresultmodel.cpp
index 8a5e8aca64..78dbf1d883 100644
--- a/plugins/autotest/testresultmodel.cpp
+++ b/plugins/autotest/testresultmodel.cpp
@@ -115,18 +115,48 @@ 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);
+
QReadLocker rLock(&m_rwLock);
- beginInsertRows(QModelIndex(), m_testResults.size(), m_testResults.size());
+ int position = m_testResults.size();
rLock.unlock();
+
QWriteLocker wLock(&m_rwLock);
- m_testResults.append(testResult);
+ if (hasCurrentTestMssg && isCurrentTestMssg) {
+ beginRemoveRows(QModelIndex(), position, position);
+ m_testResults.replace(position - 1, testResult);
+ endRemoveRows();
+ } else {
+ if (!isCurrentTestMssg && position) // decrement only if at least one other item
+ --position;
+ beginInsertRows(QModelIndex(), position, position);
+ m_testResults.insert(position, testResult);
+ endInsertRows();
+ }
wLock.unlock();
- int count = m_testResultCount.value(testResult.result(), 0);
- m_testResultCount.insert(testResult.result(), ++count);
- endInsertRows();
+
+ if (!isCurrentTestMssg) {
+ int count = m_testResultCount.value(testResult.result(), 0);
+ m_testResultCount.insert(testResult.result(), ++count);
+ }
+
m_availableResultTypes.insert(testResult.result());
}
+void TestResultModel::removeCurrentTestMessage()
+{
+ QReadLocker rLock(&m_rwLock);
+ if (m_availableResultTypes.contains(ResultType::MESSAGE_CURRENT_TEST)) {
+ rLock.unlock();
+ QWriteLocker wLock(&m_rwLock);
+ beginRemoveRows(QModelIndex(), m_testResults.size() - 1, m_testResults.size() - 1);
+ m_testResults.removeLast();
+ endRemoveRows();
+ m_availableResultTypes.remove(ResultType::MESSAGE_CURRENT_TEST);
+ }
+}
+
void TestResultModel::clearTestResults()
{
QReadLocker rLock(&m_rwLock);
@@ -211,7 +241,8 @@ void TestResultFilterModel::enableAllResultTypes()
<< 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::BLACKLISTED_FAIL << ResultType::BENCHMARK
+ << ResultType::MESSAGE_CURRENT_TEST;
invalidateFilter();
}
diff --git a/plugins/autotest/testresultmodel.h b/plugins/autotest/testresultmodel.h
index 1ef019a456..7494161bb7 100644
--- a/plugins/autotest/testresultmodel.h
+++ b/plugins/autotest/testresultmodel.h
@@ -43,6 +43,7 @@ public:
QVariant data(const QModelIndex &index, int role) const;
void addTestResult(const TestResult &testResult);
+ void removeCurrentTestMessage();
void clearTestResults();
bool hasResults() const { return m_testResults.size() > 0; }
diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp
index cb28412a4c..6d902705f1 100644
--- a/plugins/autotest/testresultspane.cpp
+++ b/plugins/autotest/testresultspane.cpp
@@ -370,6 +370,7 @@ void TestResultsPane::onTestRunFinished()
m_runSelected->setEnabled(true);
updateSummaryLabel();
m_summaryWidget->setVisible(true);
+ m_model->removeCurrentTestMessage();
}
void TestResultsPane::onTestTreeModelChanged()
diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp
index 4ec7478453..f3f7e37143 100644
--- a/plugins/autotest/testrunner.cpp
+++ b/plugins/autotest/testrunner.cpp
@@ -228,6 +228,10 @@ void processOutput()
result = ResultType::UNKNOWN;
lineNumber = 0;
readingDescription = false;
+ TestResultsPane::instance()->addTestResult(
+ TestResult(className, testCase, QString(), ResultType::MESSAGE_CURRENT_TEST,
+ QObject::tr("Entering Test Function %1::%2")
+ .arg(className).arg(testCase)));
continue;
}
if (xmlStartsWith(line, QLatin1String("<Duration msecs=\""), duration)) {