forked from qt-creator/qt-creator
AutoTest: Fix displaying XML content
CDATA sections that have line breaks at their line ends within a multiline CDATA section should get handled that these (inner) line breaks do not get lost. This patch fixes displaying failed Qt tests when using the XML output. Change-Id: I3aa7100836613372ac5b2b409c5cfacfb34209ba Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include "testresult.h"
|
||||
#include "testresultspane.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
|
||||
@@ -44,11 +46,7 @@ TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &future
|
||||
connect(m_testApplication, &QProcess::readyRead,
|
||||
this, [this] () {
|
||||
while (m_testApplication->canReadLine()) {
|
||||
QByteArray output = m_testApplication->readLine();
|
||||
output.chop(1); // remove the newline from the output
|
||||
if (output.endsWith('\r'))
|
||||
output.chop(1);
|
||||
|
||||
const QByteArray output = m_testApplication->readLine();
|
||||
emit newOutputAvailable(output);
|
||||
processOutput(output);
|
||||
}
|
||||
@@ -62,9 +60,9 @@ TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &future
|
||||
}
|
||||
}
|
||||
|
||||
void TestOutputReader::processStdError(const QByteArray &output)
|
||||
void TestOutputReader::processStdError(const QByteArray &outputLineWithNewLine)
|
||||
{
|
||||
qWarning() << "AutoTest.Run: Ignored plain output:" << output;
|
||||
qWarning() << "AutoTest.Run: Ignored plain output:" << outputLineWithNewLine;
|
||||
}
|
||||
|
||||
void TestOutputReader::reportCrash()
|
||||
@@ -83,6 +81,16 @@ void TestOutputReader::createAndReportResult(const QString &message, Result::Typ
|
||||
reportResult(result);
|
||||
}
|
||||
|
||||
QByteArray TestOutputReader::chopLineBreak(const QByteArray &original)
|
||||
{
|
||||
QTC_ASSERT(original.endsWith('\n'), return original);
|
||||
QByteArray output(original);
|
||||
output.chop(1); // remove the newline from the output
|
||||
if (output.endsWith('\r'))
|
||||
output.chop(1);
|
||||
return output;
|
||||
}
|
||||
|
||||
void TestOutputReader::reportResult(const TestResultPtr &result)
|
||||
{
|
||||
m_futureInterface.reportResult(result);
|
||||
|
||||
Reference in New Issue
Block a user