summaryrefslogtreecommitdiff
path: root/plugins/autotest/testresultmodel.cpp
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 /plugins/autotest/testresultmodel.cpp
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>
Diffstat (limited to 'plugins/autotest/testresultmodel.cpp')
-rw-r--r--plugins/autotest/testresultmodel.cpp43
1 files changed, 37 insertions, 6 deletions
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();
}