forked from qt-creator/qt-creator
AutoTest: Support gathering failed tests
Mark test tree items as failed for the last run to be able to re-run them in an easier way. Change-Id: I7ea3dcd16e5a02797d41f13e02b2fa95b857cf5e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include "testresultdelegate.h"
|
||||
#include "testrunner.h"
|
||||
#include "testsettings.h"
|
||||
#include "testtreeitem.h"
|
||||
#include "testtreemodel.h"
|
||||
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -242,6 +244,16 @@ void TestResultModel::updateParent(const TestResultItem *item)
|
||||
updateParent(parentItem);
|
||||
}
|
||||
|
||||
static bool isFailed(ResultType type)
|
||||
{
|
||||
switch (type) {
|
||||
case ResultType::Fail: case ResultType::UnexpectedPass: case ResultType::MessageFatal:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoExpand)
|
||||
{
|
||||
const int lastRow = rootItem()->childCount() - 1;
|
||||
@@ -307,6 +319,13 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
// there is no MessageCurrentTest at the last row, but we have a toplevel item - just add it
|
||||
rootItem()->appendChild(newItem);
|
||||
}
|
||||
|
||||
if (isFailed(testResult->result())) {
|
||||
if (const TestTreeItem *it = testResult->findTestTreeItem()) {
|
||||
TestTreeModel *model = TestTreeModel::instance();
|
||||
model->setData(model->indexForItem(it), true, FailedRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestResultModel::removeCurrentTestMessage()
|
||||
|
||||
Reference in New Issue
Block a user