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
// even if the nominal format is stdout.
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) {
charFmt = charFormat(formatForParser);
formattedText.first().format = charFmt;

View File

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

View File

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