From 183cd8ce994ca373f3b6d5c13f9f2926ecba0a44 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 14 Dec 2016 14:42:28 +0100 Subject: [PATCH] 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 --- src/plugins/autotest/testresult.cpp | 8 +++++--- src/plugins/autotest/testresultdelegate.cpp | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index 93ad46354aa..11b09067b27 100644 --- a/src/plugins/autotest/testresult.cpp +++ b/src/plugins/autotest/testresult.cpp @@ -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"); } } diff --git a/src/plugins/autotest/testresultdelegate.cpp b/src/plugins/autotest/testresultdelegate.cpp index 4baa15ba2ae..fc97ab93fce 100644 --- a/src/plugins/autotest/testresultdelegate.cpp +++ b/src/plugins/autotest/testresultdelegate.cpp @@ -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); }