forked from qt-creator/qt-creator
ProjectExplorer: Move plugin unit tests definition to new class
This removes it from the central public header. Change-Id: Icf1c552f9136a2e262e1bc48ae164b2fdd8edc79 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -128,6 +128,7 @@ add_qtc_plugin(ProjectExplorer
|
||||
projectexplorer.cpp projectexplorer.h
|
||||
projectexplorer.qrc
|
||||
projectexplorer_export.h
|
||||
projectexplorer_test.h
|
||||
projectexplorerconstants.cpp
|
||||
projectexplorerconstants.h
|
||||
projectexplorericons.cpp projectexplorericons.h
|
||||
|
||||
@@ -1234,14 +1234,16 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
|
||||
# include <QTest>
|
||||
# include <QFileInfo>
|
||||
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
static bool isGenericFlavor(ProjectExplorer::Abi::OSFlavor f)
|
||||
{
|
||||
return f == ProjectExplorer::Abi::GenericFlavor;
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiRoundTrips()
|
||||
void ProjectExplorerTest::testAbiRoundTrips()
|
||||
{
|
||||
for (int i = 0; i <= Abi::UnknownArchitecture; ++i) {
|
||||
const QString string = Abi::toString(static_cast<Abi::Architecture>(i));
|
||||
@@ -1278,7 +1280,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiRoundTrips()
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
|
||||
void ProjectExplorerTest::testAbiOfBinary_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<QStringList>("abis");
|
||||
@@ -1415,7 +1417,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
|
||||
<< (QStringList() << QString::fromLatin1("x86-windows-msys-pe-32bit"));
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
|
||||
void ProjectExplorerTest::testAbiOfBinary()
|
||||
{
|
||||
QFETCH(QString, file);
|
||||
QFETCH(QStringList, abis);
|
||||
@@ -1431,7 +1433,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
|
||||
QCOMPARE(result.at(i).toString(), abis.at(i));
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet_data()
|
||||
void ProjectExplorerTest::testAbiFromTargetTriplet_data()
|
||||
{
|
||||
QTest::addColumn<int>("architecture");
|
||||
QTest::addColumn<int>("os");
|
||||
@@ -1548,7 +1550,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet_data()
|
||||
<< int(Abi::EmscriptenFormat) << 32;
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet()
|
||||
void ProjectExplorerTest::testAbiFromTargetTriplet()
|
||||
{
|
||||
QFETCH(int, architecture);
|
||||
QFETCH(int, os);
|
||||
@@ -1564,7 +1566,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet()
|
||||
QCOMPARE(Abi::abiFromTargetTriplet(QLatin1String(QTest::currentDataTag())), expectedAbi);
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiUserOsFlavor_data()
|
||||
void ProjectExplorerTest::testAbiUserOsFlavor_data()
|
||||
{
|
||||
QTest::addColumn<int>("os");
|
||||
QTest::addColumn<QString>("osFlavorName");
|
||||
@@ -1592,7 +1594,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiUserOsFlavor_data()
|
||||
<< int(Abi::UnixOS) << "msvc2100" << int(Abi::UnknownFlavor) + 1;
|
||||
}
|
||||
|
||||
void ProjectExplorer::ProjectExplorerPlugin::testAbiUserOsFlavor()
|
||||
void ProjectExplorerTest::testAbiUserOsFlavor()
|
||||
{
|
||||
QFETCH(int, os);
|
||||
QFETCH(QString, osFlavorName);
|
||||
@@ -1624,5 +1626,6 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiUserOsFlavor()
|
||||
}
|
||||
}
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
#include "lldparser.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
static Task::TaskType taskType(const QString &capture)
|
||||
{
|
||||
const QString lc = capture.toLower();
|
||||
@@ -109,15 +110,19 @@ Utils::Id ClangParser::id()
|
||||
return Utils::Id("ProjectExplorer.OutputParser.Clang");
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
|
||||
// Unit tests:
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
# include "outputparser_test.h"
|
||||
|
||||
void ProjectExplorerPlugin::testClangOutputParser_data()
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void ProjectExplorerTest::testClangOutputParser_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -268,7 +273,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
|
||||
<< QString();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testClangOutputParser()
|
||||
void ProjectExplorerTest::testClangOutputParser()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.setLineParsers(ClangParser::clangParserSuite());
|
||||
@@ -283,4 +288,7 @@ void ProjectExplorerPlugin::testClangOutputParser()
|
||||
tasks, childStdOutLines, childStdErrLines,
|
||||
outputLines);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
# include "outputparser_test.h"
|
||||
#endif
|
||||
|
||||
@@ -358,7 +358,7 @@ void CustomParsersSelectionWidget::updateSummary()
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
void ProjectExplorerTest::testCustomOutputParsers_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<QString>("workDir");
|
||||
@@ -657,7 +657,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< QString();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testCustomOutputParsers()
|
||||
void ProjectExplorerTest::testCustomOutputParsers()
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(QString, workDir);
|
||||
|
||||
@@ -527,7 +527,7 @@ IDevice::ConstPtr DeviceManager::defaultDevice(Id deviceType) const
|
||||
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorer_test.h>
|
||||
#include <QSignalSpy>
|
||||
#include <QTest>
|
||||
#include <QUuid>
|
||||
@@ -561,7 +561,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void ProjectExplorerPlugin::testDeviceManager()
|
||||
void ProjectExplorerTest::testDeviceManager()
|
||||
{
|
||||
TestDeviceFactory factory;
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
|
||||
#include <numeric>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
// opt. drive letter + filename: (2 brackets)
|
||||
static const char FILE_PATTERN[] = "(<command[ -]line>|([A-Za-z]:)?[^:]+):";
|
||||
static const char COMMAND_PATTERN[] = "^(.*?[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+)(-[0-9.]+)?(\\.exe)?: ";
|
||||
@@ -247,15 +248,19 @@ bool GccParser::isContinuation(const QString &newLine) const
|
||||
|| newLine.contains("note:"));
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
|
||||
// Unit tests:
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
# include "outputparser_test.h"
|
||||
|
||||
void ProjectExplorerPlugin::testGccOutputParsers_data()
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void ProjectExplorerTest::testGccOutputParsers_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -1432,7 +1437,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
|
||||
<< QString();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testGccOutputParsers()
|
||||
void ProjectExplorerTest::testGccOutputParsers()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.setLineParsers(GccParser::gccParserSuite());
|
||||
@@ -1447,4 +1452,7 @@ void ProjectExplorerPlugin::testGccOutputParsers()
|
||||
tasks, childStdOutLines, childStdErrLines,
|
||||
outputLines);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -2060,13 +2060,13 @@ void GccToolchainConfigWidget::updateParentToolchainComboBox()
|
||||
// Unit tests:
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
|
||||
# include <QTest>
|
||||
# include <QUrl>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
void ProjectExplorerPlugin::testGccAbiGuessing_data()
|
||||
void ProjectExplorerTest::testGccAbiGuessing_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<QByteArray>("macros");
|
||||
@@ -2204,7 +2204,7 @@ void ProjectExplorerPlugin::testGccAbiGuessing_data()
|
||||
<< QStringList({"x86-bsd-freebsd-elf-32bit"});
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testGccAbiGuessing()
|
||||
void ProjectExplorerTest::testGccAbiGuessing()
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(QByteArray, macros);
|
||||
|
||||
@@ -134,21 +134,28 @@ bool GnuMakeParser::hasFatalErrors() const
|
||||
# include <QUuid>
|
||||
|
||||
# include "outputparser_test.h"
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
GnuMakeParserTester::GnuMakeParserTester(GnuMakeParser *p, QObject *parent) :
|
||||
QObject(parent),
|
||||
parser(p)
|
||||
{ }
|
||||
|
||||
void GnuMakeParserTester::parserIsAboutToBeDeleted()
|
||||
class GnuMakeParserTester : public QObject
|
||||
{
|
||||
directories = parser->searchDirectories();
|
||||
}
|
||||
public:
|
||||
explicit GnuMakeParserTester(GnuMakeParser *p, QObject *parent = nullptr) :
|
||||
QObject(parent),
|
||||
parser(p)
|
||||
{ }
|
||||
|
||||
void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
|
||||
void parserIsAboutToBeDeleted()
|
||||
{
|
||||
directories = parser->searchDirectories();
|
||||
}
|
||||
|
||||
FilePaths directories;
|
||||
GnuMakeParser *parser;
|
||||
};
|
||||
|
||||
void ProjectExplorerTest::testGnuMakeParserParsing_data()
|
||||
{
|
||||
QTest::addColumn<QStringList>("extraSearchDirs");
|
||||
QTest::addColumn<QString>("input");
|
||||
@@ -325,7 +332,7 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
|
||||
<< QStringList();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testGnuMakeParserParsing()
|
||||
void ProjectExplorerTest::testGnuMakeParserParsing()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
auto *childParser = new GnuMakeParser;
|
||||
@@ -371,7 +378,7 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing()
|
||||
delete tester;
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
|
||||
void ProjectExplorerTest::testGnuMakeParserTaskMangling()
|
||||
{
|
||||
TemporaryFile theMakeFile("Makefile.XXXXXX");
|
||||
QVERIFY2(theMakeFile.open(), qPrintable(theMakeFile.errorString()));
|
||||
@@ -391,6 +398,6 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
|
||||
QString(), QString(), QString());
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -37,18 +37,4 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined WITH_TESTS
|
||||
class GnuMakeParserTester : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GnuMakeParserTester(GnuMakeParser *parser, QObject *parent = nullptr);
|
||||
void parserIsAboutToBeDeleted();
|
||||
|
||||
Utils::FilePaths directories;
|
||||
GnuMakeParser *parser;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorer_test.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
static QJsonObject createWidget(const QString &type, const QString &nameSuffix, const QJsonObject &data)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ struct FactoryDeleter { void operator()(JsonWizardFactory *f) { f->deleteLater()
|
||||
|
||||
using FactoryPtr = std::unique_ptr<JsonWizardFactory, FactoryDeleter>;
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsEmptyWizard()
|
||||
void ProjectExplorerTest::testJsonWizardsEmptyWizard()
|
||||
{
|
||||
QString errorMessage;
|
||||
const QJsonObject wizard = createGeneralWizard(QJsonObject());
|
||||
@@ -94,7 +94,7 @@ void ProjectExplorerPlugin::testJsonWizardsEmptyWizard()
|
||||
QCOMPARE(qPrintable(errorMessage), "Page has no typeId set.");
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsEmptyPage()
|
||||
void ProjectExplorerTest::testJsonWizardsEmptyPage()
|
||||
{
|
||||
QString errorMessage;
|
||||
const QJsonObject pages = createFieldPageJsonObject(QJsonArray());
|
||||
@@ -105,7 +105,7 @@ void ProjectExplorerPlugin::testJsonWizardsEmptyPage()
|
||||
QCOMPARE(qPrintable(errorMessage), "When parsing fields of page \"PE.Wizard.Page.Fields\": ");
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsUnusedKeyAtFields_data()
|
||||
void ProjectExplorerTest::testJsonWizardsUnusedKeyAtFields_data()
|
||||
{
|
||||
const QPair<QString, QJsonValue> wrongData = {"wrong", false};
|
||||
|
||||
@@ -119,7 +119,7 @@ void ProjectExplorerPlugin::testJsonWizardsUnusedKeyAtFields_data()
|
||||
QTest::newRow("ComboBox") << QJsonObject({{wrongData, {"items", QJsonArray()}}});
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsUnusedKeyAtFields()
|
||||
void ProjectExplorerTest::testJsonWizardsUnusedKeyAtFields()
|
||||
{
|
||||
QString fieldType(QString::fromLatin1(QTest::currentDataTag()));
|
||||
QFETCH(QJsonObject, wrongDataJsonObect);
|
||||
@@ -138,7 +138,7 @@ void ProjectExplorerPlugin::testJsonWizardsUnusedKeyAtFields()
|
||||
QVERIFY(errorMessage.isEmpty());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsCheckBox()
|
||||
void ProjectExplorerTest::testJsonWizardsCheckBox()
|
||||
{
|
||||
QString errorMessage;
|
||||
|
||||
@@ -177,7 +177,7 @@ void ProjectExplorerPlugin::testJsonWizardsCheckBox()
|
||||
QCOMPARE(qPrintable(wizard->field("SpecialValueCheckedCheckBox").toString()), "SpecialCheckedValue");
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsLineEdit()
|
||||
void ProjectExplorerTest::testJsonWizardsLineEdit()
|
||||
{
|
||||
QString errorMessage;
|
||||
|
||||
@@ -201,7 +201,7 @@ void ProjectExplorerPlugin::testJsonWizardsLineEdit()
|
||||
QVERIFY(wizard->page(0)->isComplete());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsComboBox()
|
||||
void ProjectExplorerTest::testJsonWizardsComboBox()
|
||||
{
|
||||
QString errorMessage;
|
||||
QWidget parent;
|
||||
@@ -243,7 +243,7 @@ static QString iconInsideResource(const QString &relativePathToIcon)
|
||||
return Core::ICore::resourcePath().resolvePath(relativePathToIcon).toString();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testJsonWizardsIconList()
|
||||
void ProjectExplorerTest::testJsonWizardsIconList()
|
||||
{
|
||||
QString errorMessage;
|
||||
QWidget parent;
|
||||
@@ -286,4 +286,4 @@ void ProjectExplorerPlugin::testJsonWizardsIconList()
|
||||
QVERIFY(!wizard->page(0)->isComplete());
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace ProjectExplorer {
|
||||
|
||||
class ProjectExplorerPlugin;
|
||||
class ProjectExplorerPluginPrivate;
|
||||
namespace Internal { class ProjectExplorerTest; }
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT JsonWizardFactory : public Core::IWizardFactory
|
||||
@@ -93,6 +94,7 @@ private:
|
||||
|
||||
friend class ProjectExplorerPlugin;
|
||||
friend class ProjectExplorerPluginPrivate;
|
||||
friend class Internal::ProjectExplorerTest;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
LinuxIccParser::LinuxIccParser() :
|
||||
m_temporary(Task())
|
||||
{
|
||||
@@ -109,12 +110,16 @@ void LinuxIccParser::flush()
|
||||
scheduleTask(t, m_lines, 1);
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
# include "outputparser_test.h"
|
||||
|
||||
void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void ProjectExplorerTest::testLinuxIccOutputParsers_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -197,7 +202,7 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
|
||||
<< QString();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testLinuxIccOutputParsers()
|
||||
void ProjectExplorerTest::testLinuxIccOutputParsers()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.setLineParsers(LinuxIccParser::iccParserSuite());
|
||||
@@ -213,4 +218,6 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers()
|
||||
outputLines);
|
||||
}
|
||||
|
||||
#endif
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -290,12 +290,12 @@ void ClangClParser::flush()
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include <QTest>
|
||||
# include "projectexplorer.h"
|
||||
# include "projectexplorer_test.h"
|
||||
# include "projectexplorer/outputparser_test.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void ProjectExplorerPlugin::testMsvcOutputParsers_data()
|
||||
void ProjectExplorerTest::testMsvcOutputParsers_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -594,7 +594,7 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
|
||||
<< "";
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testMsvcOutputParsers()
|
||||
void ProjectExplorerTest::testMsvcOutputParsers()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.addLineParser(new MsvcParser);
|
||||
@@ -610,7 +610,7 @@ void ProjectExplorerPlugin::testMsvcOutputParsers()
|
||||
outputLines);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testClangClOutputParsers_data()
|
||||
void ProjectExplorerTest::testClangClOutputParsers_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||
@@ -694,7 +694,7 @@ void ProjectExplorerPlugin::testClangClOutputParsers_data()
|
||||
<< "";
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testClangClOutputParsers()
|
||||
void ProjectExplorerTest::testClangClOutputParsers()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
testbench.addLineParser(new ClangClParser);
|
||||
@@ -710,6 +710,6 @@ void ProjectExplorerPlugin::testClangClOutputParsers()
|
||||
outputLines);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TEST
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <limits>
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
#include "projectexplorer_test.h"
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
@@ -1358,7 +1359,11 @@ void Project::addVariablesToMacroExpander(const QByteArray &prefix,
|
||||
});
|
||||
}
|
||||
|
||||
#if defined(WITH_TESTS)
|
||||
} // ProjectExplorer
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
static FilePath constructTestPath(const QString &basePath)
|
||||
{
|
||||
@@ -1405,7 +1410,7 @@ public:
|
||||
Target *target = nullptr;
|
||||
};
|
||||
|
||||
void ProjectExplorerPlugin::testProject_setup()
|
||||
void ProjectExplorerTest::testProject_setup()
|
||||
{
|
||||
TestProject project;
|
||||
|
||||
@@ -1433,7 +1438,7 @@ void ProjectExplorerPlugin::testProject_setup()
|
||||
QVERIFY(!project.target->buildSystem()->hasParsingData());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testProject_changeDisplayName()
|
||||
void ProjectExplorerTest::testProject_changeDisplayName()
|
||||
{
|
||||
TestProject project;
|
||||
|
||||
@@ -1449,7 +1454,7 @@ void ProjectExplorerPlugin::testProject_changeDisplayName()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testProject_parsingSuccess()
|
||||
void ProjectExplorerTest::testProject_parsingSuccess()
|
||||
{
|
||||
TestProject project;
|
||||
|
||||
@@ -1475,7 +1480,7 @@ void ProjectExplorerPlugin::testProject_parsingSuccess()
|
||||
QVERIFY(project.target->buildSystem()->hasParsingData());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testProject_parsingFail()
|
||||
void ProjectExplorerTest::testProject_parsingFail()
|
||||
{
|
||||
TestProject project;
|
||||
|
||||
@@ -1512,7 +1517,7 @@ std::unique_ptr<ProjectNode> createFileTree(Project *project)
|
||||
return root;
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testProject_projectTree()
|
||||
void ProjectExplorerTest::testProject_projectTree()
|
||||
{
|
||||
TestProject project;
|
||||
QSignalSpy fileSpy(&project, &Project::fileListChanged);
|
||||
@@ -1554,7 +1559,7 @@ void ProjectExplorerPlugin::testProject_projectTree()
|
||||
QVERIFY(!project.rootProjectNode());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testProject_multipleBuildConfigs()
|
||||
void ProjectExplorerTest::testProject_multipleBuildConfigs()
|
||||
{
|
||||
// Find suitable kit.
|
||||
Kit * const kit = findOr(KitManager::kits(), nullptr, [](const Kit *k) {
|
||||
@@ -1575,7 +1580,7 @@ void ProjectExplorerPlugin::testProject_multipleBuildConfigs()
|
||||
const QFileInfoList files = QDir(projectDir.toString()).entryInfoList(QDir::Files | QDir::Dirs);
|
||||
for (const QFileInfo &f : files)
|
||||
QFile(f.absoluteFilePath()).setPermissions(f.permissions() | QFile::WriteUser);
|
||||
const auto theProject = openProject(projectDir.pathAppended("generic-project.creator"));
|
||||
const auto theProject = ProjectExplorerPlugin::openProject(projectDir.pathAppended("generic-project.creator"));
|
||||
QVERIFY2(theProject, qPrintable(theProject.errorMessage()));
|
||||
theProject.project()->configureAsExampleProject(kit);
|
||||
QCOMPARE(theProject.project()->targets().size(), 1);
|
||||
@@ -1606,7 +1611,7 @@ void ProjectExplorerPlugin::testProject_multipleBuildConfigs()
|
||||
ProjectManager::closeAllProjects(); // QTCREATORBUG-25655
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testSourceToBinaryMapping()
|
||||
void ProjectExplorerTest::testSourceToBinaryMapping()
|
||||
{
|
||||
// Find suitable kit.
|
||||
Kit * const kit = findOr(KitManager::kits(), nullptr, [](const Kit *k) {
|
||||
@@ -1642,7 +1647,7 @@ void ProjectExplorerPlugin::testSourceToBinaryMapping()
|
||||
|
||||
// Load Project.
|
||||
QFETCH(QString, projectFileName);
|
||||
const auto theProject = openProject(projectDir.pathAppended(projectFileName));
|
||||
const auto theProject = ProjectExplorerPlugin::openProject(projectDir.pathAppended(projectFileName));
|
||||
if (theProject.errorMessage().contains("text/")) {
|
||||
QSKIP("This test requires the presence of the qmake/cmake/qbs project managers "
|
||||
"to be fully functional");
|
||||
@@ -1682,7 +1687,7 @@ void ProjectExplorerPlugin::testSourceToBinaryMapping()
|
||||
QCOMPARE(binariesForSource("multi-target-project-shared.h").size(), 2);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testSourceToBinaryMapping_data()
|
||||
void ProjectExplorerTest::testSourceToBinaryMapping_data()
|
||||
{
|
||||
QTest::addColumn<QString>("projectFileName");
|
||||
QTest::addRow("cmake") << "CMakeLists.txt";
|
||||
@@ -1690,6 +1695,6 @@ void ProjectExplorerPlugin::testSourceToBinaryMapping_data()
|
||||
QTest::addRow("qmake") << "multi-target-project.pro";
|
||||
}
|
||||
|
||||
#endif // WITH_TESTS
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "processstep.h"
|
||||
#include "project.h"
|
||||
#include "projectcommentssettings.h"
|
||||
#include "projectexplorer_test.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "projectexplorericons.h"
|
||||
#include "projectexplorersettings.h"
|
||||
@@ -795,7 +796,7 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
|
||||
m_instance = nullptr;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
deleteTestToolchains();
|
||||
ProjectExplorerTest::deleteTestToolchains();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -809,6 +810,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
Q_UNUSED(error)
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
addTest<ProjectExplorerTest>();
|
||||
addTestCreator(createOutputParserTest);
|
||||
#endif
|
||||
|
||||
@@ -2505,7 +2507,7 @@ bool ProjectExplorerPlugin::renameFile(const Utils::FilePath &source, const Util
|
||||
{
|
||||
const bool success = Core::FileUtils::renameFile(source, target, HandleIncludeGuards::Yes);
|
||||
if (success)
|
||||
emit instance()->filesRenamed({std::make_pair(source, target)});
|
||||
emit ProjectExplorerPlugin::instance()->filesRenamed({std::make_pair(source, target)});
|
||||
return success;
|
||||
}
|
||||
#endif // WITH_TESTS
|
||||
|
||||
@@ -190,80 +190,6 @@ private:
|
||||
void handleCommandLineArguments(const QStringList &arguments);
|
||||
static std::optional<std::pair<Utils::FilePath, Utils::FilePath>>
|
||||
renameFile(Node *node, const QString &newFilePath);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void testJsonWizardsEmptyWizard();
|
||||
void testJsonWizardsEmptyPage();
|
||||
void testJsonWizardsUnusedKeyAtFields_data();
|
||||
void testJsonWizardsUnusedKeyAtFields();
|
||||
void testJsonWizardsCheckBox();
|
||||
void testJsonWizardsLineEdit();
|
||||
void testJsonWizardsComboBox();
|
||||
void testJsonWizardsIconList();
|
||||
|
||||
void testGccOutputParsers_data();
|
||||
void testGccOutputParsers();
|
||||
|
||||
void testCustomOutputParsers_data();
|
||||
void testCustomOutputParsers();
|
||||
|
||||
void testClangOutputParser_data();
|
||||
void testClangOutputParser();
|
||||
|
||||
void testLinuxIccOutputParsers_data();
|
||||
void testLinuxIccOutputParsers();
|
||||
|
||||
void testGnuMakeParserParsing_data();
|
||||
void testGnuMakeParserParsing();
|
||||
void testGnuMakeParserTaskMangling();
|
||||
|
||||
void testXcodebuildParserParsing_data();
|
||||
void testXcodebuildParserParsing();
|
||||
|
||||
void testMsvcOutputParsers_data();
|
||||
void testMsvcOutputParsers();
|
||||
|
||||
void testClangClOutputParsers_data();
|
||||
void testClangClOutputParsers();
|
||||
|
||||
void testGccAbiGuessing_data();
|
||||
void testGccAbiGuessing();
|
||||
|
||||
void testAbiRoundTrips();
|
||||
void testAbiOfBinary_data();
|
||||
void testAbiOfBinary();
|
||||
void testAbiFromTargetTriplet_data();
|
||||
void testAbiFromTargetTriplet();
|
||||
void testAbiUserOsFlavor_data();
|
||||
void testAbiUserOsFlavor();
|
||||
|
||||
void testDeviceManager();
|
||||
|
||||
void testToolChainMerging_data();
|
||||
void testToolChainMerging();
|
||||
void deleteTestToolchains();
|
||||
|
||||
void testUserFileAccessor_prepareToReadSettings();
|
||||
void testUserFileAccessor_prepareToReadSettingsObsoleteVersion();
|
||||
void testUserFileAccessor_prepareToReadSettingsObsoleteVersionNewVersion();
|
||||
void testUserFileAccessor_prepareToWriteSettings();
|
||||
void testUserFileAccessor_mergeSettings();
|
||||
void testUserFileAccessor_mergeSettingsEmptyUser();
|
||||
void testUserFileAccessor_mergeSettingsEmptyShared();
|
||||
|
||||
void testProject_setup();
|
||||
void testProject_changeDisplayName();
|
||||
void testProject_parsingSuccess();
|
||||
void testProject_parsingFail();
|
||||
void testProject_projectTree();
|
||||
void testProject_multipleBuildConfigs();
|
||||
|
||||
void testSourceToBinaryMapping();
|
||||
void testSourceToBinaryMapping_data();
|
||||
|
||||
void testSessionSwitch();
|
||||
#endif // WITH_TESTS
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -102,6 +102,7 @@ QtcPlugin {
|
||||
"projectexplorer.cpp", "projectexplorer.h",
|
||||
"projectexplorer.qrc",
|
||||
"projectexplorer_export.h",
|
||||
"projectexplorer_test.h",
|
||||
"projectexplorerconstants.cpp",
|
||||
"projectexplorerconstants.h",
|
||||
"projectexplorericons.h", "projectexplorericons.cpp",
|
||||
|
||||
96
src/plugins/projectexplorer/projectexplorer_test.h
Normal file
96
src/plugins/projectexplorer/projectexplorer_test.h
Normal file
@@ -0,0 +1,96 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectExplorer { class ProjectExplorerPlugin; }
|
||||
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
class ProjectExplorerTest final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testJsonWizardsEmptyWizard();
|
||||
void testJsonWizardsEmptyPage();
|
||||
void testJsonWizardsUnusedKeyAtFields_data();
|
||||
void testJsonWizardsUnusedKeyAtFields();
|
||||
void testJsonWizardsCheckBox();
|
||||
void testJsonWizardsLineEdit();
|
||||
void testJsonWizardsComboBox();
|
||||
void testJsonWizardsIconList();
|
||||
|
||||
void testGccOutputParsers_data();
|
||||
void testGccOutputParsers();
|
||||
|
||||
void testCustomOutputParsers_data();
|
||||
void testCustomOutputParsers();
|
||||
|
||||
void testClangOutputParser_data();
|
||||
void testClangOutputParser();
|
||||
|
||||
void testLinuxIccOutputParsers_data();
|
||||
void testLinuxIccOutputParsers();
|
||||
|
||||
void testGnuMakeParserParsing_data();
|
||||
void testGnuMakeParserParsing();
|
||||
void testGnuMakeParserTaskMangling();
|
||||
|
||||
void testXcodebuildParserParsing_data();
|
||||
void testXcodebuildParserParsing();
|
||||
|
||||
void testMsvcOutputParsers_data();
|
||||
void testMsvcOutputParsers();
|
||||
|
||||
void testClangClOutputParsers_data();
|
||||
void testClangClOutputParsers();
|
||||
|
||||
void testGccAbiGuessing_data();
|
||||
void testGccAbiGuessing();
|
||||
|
||||
void testAbiRoundTrips();
|
||||
void testAbiOfBinary_data();
|
||||
void testAbiOfBinary();
|
||||
void testAbiFromTargetTriplet_data();
|
||||
void testAbiFromTargetTriplet();
|
||||
void testAbiUserOsFlavor_data();
|
||||
void testAbiUserOsFlavor();
|
||||
|
||||
void testDeviceManager();
|
||||
|
||||
void testToolChainMerging_data();
|
||||
void testToolChainMerging();
|
||||
static void deleteTestToolchains();
|
||||
|
||||
void testUserFileAccessor_prepareToReadSettings();
|
||||
void testUserFileAccessor_prepareToReadSettingsObsoleteVersion();
|
||||
void testUserFileAccessor_prepareToReadSettingsObsoleteVersionNewVersion();
|
||||
void testUserFileAccessor_prepareToWriteSettings();
|
||||
void testUserFileAccessor_mergeSettings();
|
||||
void testUserFileAccessor_mergeSettingsEmptyUser();
|
||||
void testUserFileAccessor_mergeSettingsEmptyShared();
|
||||
|
||||
void testProject_setup();
|
||||
void testProject_changeDisplayName();
|
||||
void testProject_parsingSuccess();
|
||||
void testProject_parsingFail();
|
||||
void testProject_projectTree();
|
||||
void testProject_multipleBuildConfigs();
|
||||
|
||||
void testSourceToBinaryMapping();
|
||||
void testSourceToBinaryMapping_data();
|
||||
|
||||
void testSessionSwitch();
|
||||
|
||||
private:
|
||||
friend class ::ProjectExplorer::ProjectExplorerPlugin;
|
||||
};
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <QPushButton>
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
#include "projectexplorer_test.h"
|
||||
|
||||
#include <QTemporaryFile>
|
||||
#include <QTest>
|
||||
#include <vector>
|
||||
@@ -709,7 +711,7 @@ FilePaths ProjectManager::projectsForSessionName(const QString &session)
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
void ProjectExplorerPlugin::testSessionSwitch()
|
||||
void ProjectExplorerTest::testSessionSwitch()
|
||||
{
|
||||
QVERIFY(SessionManager::createSession("session1"));
|
||||
QVERIFY(SessionManager::createSession("session2"));
|
||||
|
||||
@@ -290,7 +290,7 @@ Toolchains ToolchainSettingsAccessor::toolChains(const Store &data) const
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorer_test.h"
|
||||
|
||||
#include "abi.h"
|
||||
#include "toolchainconfigwidget.h"
|
||||
@@ -363,9 +363,9 @@ QList<TTC *> TTC::m_toolChains;
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectExplorer::Toolchain *)
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void ProjectExplorerPlugin::testToolChainMerging_data()
|
||||
void ProjectExplorerTest::testToolChainMerging_data()
|
||||
{
|
||||
class TestToolchainFactory : ToolchainFactory
|
||||
{
|
||||
@@ -469,7 +469,7 @@ void ProjectExplorerPlugin::testToolChainMerging_data()
|
||||
<< (Toolchains()) << (Toolchains() << system1 << user1 << auto1);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testToolChainMerging()
|
||||
void ProjectExplorerTest::testToolChainMerging()
|
||||
{
|
||||
QFETCH(Toolchains, system);
|
||||
QFETCH(Toolchains, user);
|
||||
@@ -508,12 +508,12 @@ void ProjectExplorerPlugin::testToolChainMerging()
|
||||
Utils::toSet(ops.toRegister + ops.toDemote + ops.toDelete));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::deleteTestToolchains()
|
||||
void ProjectExplorerTest::deleteTestToolchains()
|
||||
{
|
||||
qDeleteAll(TTC::toolChains());
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
|
||||
@@ -885,11 +885,11 @@ QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WITH_TESTS)
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include <QTest>
|
||||
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorer_test.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -921,7 +921,7 @@ public:
|
||||
|
||||
} // namespace
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettings()
|
||||
void ProjectExplorerTest::testUserFileAccessor_prepareToReadSettings()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -935,7 +935,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettings()
|
||||
QCOMPARE(result, data);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettingsObsoleteVersion()
|
||||
void ProjectExplorerTest::testUserFileAccessor_prepareToReadSettingsObsoleteVersion()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -951,7 +951,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettingsObsoleteVe
|
||||
QCOMPARE(result.value("Version"), data.value("ProjectExplorer.Project.Updater.FileVersion"));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettingsObsoleteVersionNewVersion()
|
||||
void ProjectExplorerTest::testUserFileAccessor_prepareToReadSettingsObsoleteVersionNewVersion()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -968,7 +968,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettingsObsoleteVe
|
||||
QCOMPARE(result.value("Version"), data.value("Version"));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_prepareToWriteSettings()
|
||||
void ProjectExplorerTest::testUserFileAccessor_prepareToWriteSettings()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -990,7 +990,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_prepareToWriteSettings()
|
||||
|
||||
QCOMPARE(result.count(), data.count() + 3);
|
||||
QCOMPARE(result.value("EnvironmentId").toByteArray(),
|
||||
projectExplorerSettings().environmentId.toByteArray());
|
||||
ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray());
|
||||
QCOMPARE(result.value("UserStickyKeys"), QVariant(QStringList({"shared1"})));
|
||||
QCOMPARE(result.value("Version").toInt(), accessor.currentVersion());
|
||||
QCOMPARE(result.value("ProjectExplorer.Project.Updater.FileVersion").toInt(), accessor.currentVersion());
|
||||
@@ -999,7 +999,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_prepareToWriteSettings()
|
||||
QCOMPARE(result.value("unique1"), data.value("unique1"));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_mergeSettings()
|
||||
void ProjectExplorerTest::testUserFileAccessor_mergeSettings()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -1013,7 +1013,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_mergeSettings()
|
||||
|
||||
Store data;
|
||||
data.insert("Version", accessor.currentVersion());
|
||||
data.insert("EnvironmentId", projectExplorerSettings().environmentId.toByteArray());
|
||||
data.insert("EnvironmentId", ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray());
|
||||
data.insert("UserStickyKeys", QStringList({"shared1"}));
|
||||
data.insert("shared1", "bar1");
|
||||
data.insert("unique1", 1234);
|
||||
@@ -1025,7 +1025,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_mergeSettings()
|
||||
QCOMPARE(result.data.count(), data.count() + 1);
|
||||
// mergeSettings does not run updateSettings, so no OriginalVersion will be set
|
||||
QCOMPARE(result.data.value("EnvironmentId").toByteArray(),
|
||||
projectExplorerSettings().environmentId.toByteArray()); // unchanged
|
||||
ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray()); // unchanged
|
||||
QCOMPARE(result.data.value("UserStickyKeys"), QVariant(QStringList({"shared1"}))); // unchanged
|
||||
QCOMPARE(result.data.value("Version").toInt(), accessor.currentVersion()); // forced
|
||||
QCOMPARE(result.data.value("shared1"), data.value("shared1")); // from data
|
||||
@@ -1034,7 +1034,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_mergeSettings()
|
||||
QCOMPARE(result.data.value("unique1"), data.value("unique1"));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_mergeSettingsEmptyUser()
|
||||
void ProjectExplorerTest::testUserFileAccessor_mergeSettingsEmptyUser()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -1055,7 +1055,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_mergeSettingsEmptyUser()
|
||||
QCOMPARE(result.data, sharedData);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testUserFileAccessor_mergeSettingsEmptyShared()
|
||||
void ProjectExplorerTest::testUserFileAccessor_mergeSettingsEmptyShared()
|
||||
{
|
||||
TestProject project;
|
||||
TestUserFileAccessor accessor(&project);
|
||||
@@ -1066,7 +1066,7 @@ void ProjectExplorerPlugin::testUserFileAccessor_mergeSettingsEmptyShared()
|
||||
Store data;
|
||||
data.insert("Version", accessor.currentVersion());
|
||||
data.insert("OriginalVersion", accessor.currentVersion());
|
||||
data.insert("EnvironmentId", projectExplorerSettings().environmentId.toByteArray());
|
||||
data.insert("EnvironmentId", ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray());
|
||||
data.insert("UserStickyKeys", QStringList({"shared1"}));
|
||||
data.insert("shared1", "bar1");
|
||||
data.insert("unique1", 1234);
|
||||
|
||||
@@ -88,23 +88,31 @@ bool XcodebuildParser::hasDetectedRedirection() const
|
||||
# include <QTest>
|
||||
|
||||
# include "outputparser_test.h"
|
||||
# include "projectexplorer.h"
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
# include "projectexplorer_test.h"
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectExplorer::XcodebuildParser::XcodebuildStatus)
|
||||
|
||||
XcodebuildParserTester::XcodebuildParserTester(XcodebuildParser *p, QObject *parent) :
|
||||
QObject(parent),
|
||||
parser(p)
|
||||
{ }
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
void XcodebuildParserTester::onAboutToDeleteParser()
|
||||
class XcodebuildParserTester : public QObject
|
||||
{
|
||||
QCOMPARE(parser->m_xcodeBuildParserState, expectedFinalState);
|
||||
}
|
||||
public:
|
||||
explicit XcodebuildParserTester(XcodebuildParser *p, QObject *parent = nullptr) :
|
||||
QObject(parent),
|
||||
parser(p)
|
||||
{ }
|
||||
|
||||
void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
|
||||
XcodebuildParser *parser;
|
||||
XcodebuildParser::XcodebuildStatus expectedFinalState = XcodebuildParser::OutsideXcodebuild;
|
||||
|
||||
public:
|
||||
void onAboutToDeleteParser()
|
||||
{
|
||||
QCOMPARE(parser->m_xcodeBuildParserState, expectedFinalState);
|
||||
}
|
||||
};
|
||||
|
||||
void ProjectExplorerTest::testXcodebuildParserParsing_data()
|
||||
{
|
||||
QTest::addColumn<ProjectExplorer::XcodebuildParser::XcodebuildStatus>("initialStatus");
|
||||
QTest::addColumn<QString>("input");
|
||||
@@ -240,7 +248,7 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
|
||||
<< XcodebuildParser::OutsideXcodebuild;
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::testXcodebuildParserParsing()
|
||||
void ProjectExplorerTest::testXcodebuildParserParsing()
|
||||
{
|
||||
OutputParserTester testbench;
|
||||
auto *childParser = new XcodebuildParser;
|
||||
@@ -268,5 +276,7 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing()
|
||||
delete tester;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace Internal {
|
||||
class XcodebuildParserTester;
|
||||
class ProjectExplorerTest;
|
||||
} // Internal
|
||||
|
||||
class PROJECTEXPLORER_EXPORT XcodebuildParser : public OutputTaskParser
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -35,24 +40,9 @@ private:
|
||||
XcodebuildStatus m_xcodeBuildParserState = OutsideXcodebuild;
|
||||
|
||||
#if defined WITH_TESTS
|
||||
friend class XcodebuildParserTester;
|
||||
friend class ProjectExplorerPlugin;
|
||||
friend class Internal::XcodebuildParserTester;
|
||||
friend class Internal::ProjectExplorerTest;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined WITH_TESTS
|
||||
class XcodebuildParserTester : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XcodebuildParserTester(XcodebuildParser *parser, QObject *parent = nullptr);
|
||||
|
||||
XcodebuildParser *parser;
|
||||
XcodebuildParser::XcodebuildStatus expectedFinalState = XcodebuildParser::OutsideXcodebuild;
|
||||
|
||||
public slots:
|
||||
void onAboutToDeleteParser();
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
Reference in New Issue
Block a user