forked from qt-creator/qt-creator
QtSupport: Add QtTestParser to the list of output formatters
... when creating a run control for a Qt project. Now tasks will appear in the issues pane for QtTest application output in the app output pane. Task-number: QTCREATORBUG-22665 Change-Id: I2674f3d4f9aabc0a4db4178dcd5495b822f14022 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1604,15 +1604,12 @@ OutputFormatterFactory::~OutputFormatterFactory()
|
|||||||
QList<OutputLineParser *> OutputFormatterFactory::createFormatters(Target *target)
|
QList<OutputLineParser *> OutputFormatterFactory::createFormatters(Target *target)
|
||||||
{
|
{
|
||||||
QList<OutputLineParser *> formatters;
|
QList<OutputLineParser *> formatters;
|
||||||
for (auto factory : qAsConst(g_outputFormatterFactories)) {
|
for (auto factory : qAsConst(g_outputFormatterFactories))
|
||||||
if (auto formatter = factory->m_creator(target))
|
formatters << factory->m_creator(target);
|
||||||
formatters << formatter;
|
|
||||||
}
|
|
||||||
return formatters;
|
return formatters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputFormatterFactory::setFormatterCreator
|
void OutputFormatterFactory::setFormatterCreator(const FormatterCreator &creator)
|
||||||
(const std::function<OutputLineParser *(Target *)> &creator)
|
|
||||||
{
|
{
|
||||||
m_creator = creator;
|
m_creator = creator;
|
||||||
}
|
}
|
||||||
|
@@ -312,10 +312,11 @@ public:
|
|||||||
static QList<Utils::OutputLineParser *> createFormatters(Target *target);
|
static QList<Utils::OutputLineParser *> createFormatters(Target *target);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setFormatterCreator(const std::function<Utils::OutputLineParser *(Target *)> &creator);
|
using FormatterCreator = std::function<QList<Utils::OutputLineParser *>(Target *)>;
|
||||||
|
void setFormatterCreator(const FormatterCreator &creator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::function<Utils::OutputLineParser *(Target *)> m_creator;
|
FormatterCreator m_creator;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -331,10 +331,10 @@ PythonRunConfigurationFactory::PythonRunConfigurationFactory()
|
|||||||
|
|
||||||
PythonOutputFormatterFactory::PythonOutputFormatterFactory()
|
PythonOutputFormatterFactory::PythonOutputFormatterFactory()
|
||||||
{
|
{
|
||||||
setFormatterCreator([](Target *t) -> OutputLineParser * {
|
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
|
||||||
if (t && t->project()->mimeType() == Constants::C_PY_MIMETYPE)
|
if (t && t->project()->mimeType() == Constants::C_PY_MIMETYPE)
|
||||||
return new PythonOutputLineParser;
|
return {new PythonOutputLineParser};
|
||||||
return nullptr;
|
return {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "qtkitinformation.h"
|
#include "qtkitinformation.h"
|
||||||
#include "qtsupportconstants.h"
|
#include "qtsupportconstants.h"
|
||||||
|
#include "qttestparser.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -242,9 +243,10 @@ void QtOutputLineParser::updateProjectFileList()
|
|||||||
|
|
||||||
QtOutputFormatterFactory::QtOutputFormatterFactory()
|
QtOutputFormatterFactory::QtOutputFormatterFactory()
|
||||||
{
|
{
|
||||||
setFormatterCreator([](Target *t) -> OutputLineParser * {
|
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
|
||||||
BaseQtVersion *qt = QtKitAspect::qtVersion(t ? t->kit() : nullptr);
|
if (QtKitAspect::qtVersion(t ? t->kit() : nullptr))
|
||||||
return qt ? new QtOutputLineParser(t) : nullptr;
|
return {new QtTestParser, new QtOutputLineParser(t)};
|
||||||
|
return {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user