QtSupport: Use red color for failing test cases

We want them to stick out in the output pane.

Change-Id: I2276c93301500fa67a3e23a61cde021b1993a247
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-25 17:44:48 +01:00
parent 421d8038dc
commit 510ab1a659
3 changed files with 7 additions and 4 deletions

View File

@@ -302,7 +302,8 @@ void OutputFormatter::doAppendMessage(const QString &text, OutputFormat format)
// then our formatting should reflect that redirection as well, i.e. print in red // then our formatting should reflect that redirection as well, i.e. print in red
// even if the nominal format is stdout. // even if the nominal format is stdout.
if (!involvedParsers.isEmpty()) { if (!involvedParsers.isEmpty()) {
const OutputFormat formatForParser = outputTypeForParser(involvedParsers.last(), format); const OutputFormat formatForParser = res.formatOverride
? *res.formatOverride : outputTypeForParser(involvedParsers.last(), format);
if (formatForParser != format && cleanLine == text && formattedText.length() == 1) { if (formatForParser != format && cleanLine == text && formattedText.length() == 1) {
charFmt = charFormat(formatForParser); charFmt = charFormat(formatForParser);
formattedText.first().format = charFmt; formattedText.first().format = charFmt;

View File

@@ -65,11 +65,13 @@ public:
using LinkSpecs = QList<LinkSpec>; using LinkSpecs = QList<LinkSpec>;
class Result { class Result {
public: public:
Result(Status s, const LinkSpecs &l = {}, const optional<QString> &c = {}) Result(Status s, const LinkSpecs &l = {}, const optional<QString> &c = {},
: status(s), linkSpecs(l), newContent(c) {} const optional<OutputFormat> &f = {})
: status(s), linkSpecs(l), newContent(c), formatOverride(f) {}
Status status; Status status;
LinkSpecs linkSpecs; LinkSpecs linkSpecs;
optional<QString> newContent; // Hard content override. Only to be used in extreme cases. optional<QString> newContent; // Hard content override. Only to be used in extreme cases.
optional<OutputFormat> formatOverride;
}; };
static bool isLinkTarget(const QString &target); static bool isLinkTarget(const QString &target);

View File

@@ -59,7 +59,7 @@ OutputLineParser::Result QtTestParser::handleLine(const QString &line, OutputFor
emitCurrentTask(); emitCurrentTask();
m_currentTask = Task(Task::Error, theLine, FilePath(), -1, m_currentTask = Task(Task::Error, theLine, FilePath(), -1,
Constants::TASK_CATEGORY_AUTOTEST); Constants::TASK_CATEGORY_AUTOTEST);
return Status::InProgress; return {Status::InProgress, {}, {}, StdErrFormat};
} }
if (m_currentTask.isNull()) if (m_currentTask.isNull())
return Status::NotHandled; return Status::NotHandled;