AutoTest: Allow colored commandline output

Some test frameworks allow to print their output colorful
to further indicate meanings of messages or test results.
Provide a highlighter for the textual output of the results
and enable this functionality for GTest and Boost UTF.
Keep at least a small backdoor for overwriting this by
the user.

Fixes: QTCREATORBUG-22297
Change-Id: Iddd2b734416de807635d90c6519553081f7372f2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2019-11-06 14:26:40 +01:00
parent e58f376068
commit 333b8f9812
15 changed files with 269 additions and 8 deletions

View File

@@ -34,6 +34,7 @@
#include "testcodeparser.h"
#include "testeditormark.h"
#include "testoutputreader.h"
#include "outputhighlighter.h"
#include <aggregation/aggregate.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -135,6 +136,7 @@ TestResultsPane::TestResultsPane(QObject *parent) :
m_textOutput->setFont(font);
m_textOutput->setWordWrapMode(QTextOption::WordWrap);
m_textOutput->setReadOnly(true);
new OutputHighlighter(m_textOutput->document());
m_outputWidget->addWidget(m_textOutput);
auto agg = new Aggregation::Aggregate;
@@ -707,5 +709,12 @@ void TestResultsPane::showTestResult(const QModelIndex &index)
}
}
OutputChannel TestResultsPane::channelForBlockNumber(int blockNumber) const
{
QTC_ASSERT(blockNumber > -1 && blockNumber < m_outputChannels.size(),
return OutputChannel::StdOut);
return m_outputChannels.at(blockNumber);
}
} // namespace Internal
} // namespace Autotest