Commit 183cd8ce authored by Christian Stenger's avatar Christian Stenger

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's avatarDavid Schulz <david.schulz@qt.io>
parent 6417865a
......@@ -92,13 +92,12 @@ Result::Type TestResult::toResultType(int rt)
QString TestResult::resultToString(const Result::Type type)
{
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
return QString();
switch (type) {
case Result::Pass:
case Result::MessageTestCaseSuccess:
return QLatin1String("PASS");
case Result::Fail:
case Result::MessageTestCaseFail:
return QLatin1String("FAIL");
case Result::ExpectedFail:
return QLatin1String("XFAIL");
......@@ -113,6 +112,7 @@ QString TestResult::resultToString(const Result::Type type)
case Result::MessageInfo:
return QLatin1String("INFO");
case Result::MessageWarn:
case Result::MessageTestCaseWarn:
return QLatin1String("WARN");
case Result::MessageFatal:
return QLatin1String("FATAL");
......@@ -123,6 +123,8 @@ QString TestResult::resultToString(const Result::Type type)
case Result::BlacklistedFail:
return QLatin1String("BFAIL");
default:
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
return QString();
return QLatin1String("UNKNOWN");
}
}
......
......@@ -39,6 +39,12 @@ namespace Internal {
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)
: QStyledItemDelegate(parent)
{
......@@ -82,7 +88,10 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
} else {
QPen tmp = painter->pen();
painter->setPen(TestResult::colorForType(testResult->result()));
if (isSummaryItem(testResult->result()))
painter->setPen(opt.palette.mid().color());
else
painter->setPen(TestResult::colorForType(testResult->result()));
painter->drawText(positions.typeAreaLeft(), positions.top() + fm.ascent(), typeStr);
painter->setPen(tmp);
}
......
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