forked from qt-creator/qt-creator
AutoTest: Use result type string also for summary items
But use a grey'ish color to explicitly mark them as summary items as they are no real test results. Change-Id: I7e682a7753e8467e6ec65ac09fb27a7b798d765f Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -92,13 +92,12 @@ Result::Type TestResult::toResultType(int rt)
|
|||||||
|
|
||||||
QString TestResult::resultToString(const Result::Type type)
|
QString TestResult::resultToString(const Result::Type type)
|
||||||
{
|
{
|
||||||
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Result::Pass:
|
case Result::Pass:
|
||||||
|
case Result::MessageTestCaseSuccess:
|
||||||
return QLatin1String("PASS");
|
return QLatin1String("PASS");
|
||||||
case Result::Fail:
|
case Result::Fail:
|
||||||
|
case Result::MessageTestCaseFail:
|
||||||
return QLatin1String("FAIL");
|
return QLatin1String("FAIL");
|
||||||
case Result::ExpectedFail:
|
case Result::ExpectedFail:
|
||||||
return QLatin1String("XFAIL");
|
return QLatin1String("XFAIL");
|
||||||
@@ -113,6 +112,7 @@ QString TestResult::resultToString(const Result::Type type)
|
|||||||
case Result::MessageInfo:
|
case Result::MessageInfo:
|
||||||
return QLatin1String("INFO");
|
return QLatin1String("INFO");
|
||||||
case Result::MessageWarn:
|
case Result::MessageWarn:
|
||||||
|
case Result::MessageTestCaseWarn:
|
||||||
return QLatin1String("WARN");
|
return QLatin1String("WARN");
|
||||||
case Result::MessageFatal:
|
case Result::MessageFatal:
|
||||||
return QLatin1String("FATAL");
|
return QLatin1String("FATAL");
|
||||||
@@ -123,6 +123,8 @@ QString TestResult::resultToString(const Result::Type type)
|
|||||||
case Result::BlacklistedFail:
|
case Result::BlacklistedFail:
|
||||||
return QLatin1String("BFAIL");
|
return QLatin1String("BFAIL");
|
||||||
default:
|
default:
|
||||||
|
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
|
||||||
|
return QString();
|
||||||
return QLatin1String("UNKNOWN");
|
return QLatin1String("UNKNOWN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ namespace Internal {
|
|||||||
|
|
||||||
const static int outputLimit = 100000;
|
const static int outputLimit = 100000;
|
||||||
|
|
||||||
|
static bool isSummaryItem(Result::Type type)
|
||||||
|
{
|
||||||
|
return type == Result::MessageTestCaseSuccess || type == Result::MessageTestCaseFail
|
||||||
|
|| type == Result::MessageTestCaseWarn;
|
||||||
|
}
|
||||||
|
|
||||||
TestResultDelegate::TestResultDelegate(QObject *parent)
|
TestResultDelegate::TestResultDelegate(QObject *parent)
|
||||||
: QStyledItemDelegate(parent)
|
: QStyledItemDelegate(parent)
|
||||||
{
|
{
|
||||||
@@ -82,6 +88,9 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
|||||||
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
|
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
|
||||||
} else {
|
} else {
|
||||||
QPen tmp = painter->pen();
|
QPen tmp = painter->pen();
|
||||||
|
if (isSummaryItem(testResult->result()))
|
||||||
|
painter->setPen(opt.palette.mid().color());
|
||||||
|
else
|
||||||
painter->setPen(TestResult::colorForType(testResult->result()));
|
painter->setPen(TestResult::colorForType(testResult->result()));
|
||||||
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
|
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
|
||||||
painter->setPen(tmp);
|
painter->setPen(tmp);
|
||||||
|
|||||||
Reference in New Issue
Block a user