forked from qt-creator/qt-creator
McuSupport: basic test & required refactoring
Introduced Package interface for mocking purposes. Made some functions visible in headers for testing. Added basic test skeleton for mcu plugin. run cmd: `qtcreator -test McuSupport` Change-Id: I1011d49052bd8c894da393d8a285b241682f1f94 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -31,6 +31,10 @@
|
||||
#include "mcusupportoptionspage.h"
|
||||
#include "mcusupportrunconfiguration.h"
|
||||
|
||||
#if defined(WITH_TESTS) && defined(GOOGLE_TEST_IS_FOUND)
|
||||
#include "test/unittest.h"
|
||||
#endif
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -61,14 +65,9 @@ public:
|
||||
};
|
||||
McuSupportOptionsPage optionsPage;
|
||||
McuDependenciesKitAspect environmentPathsKitAspect;
|
||||
};
|
||||
}; // class McuSupportPluginPrivate
|
||||
|
||||
static McuSupportPluginPrivate *dd = nullptr;
|
||||
|
||||
McuSupportPlugin::McuSupportPlugin()
|
||||
{
|
||||
setObjectName("McuSupportPlugin");
|
||||
}
|
||||
static McuSupportPluginPrivate* dd{nullptr};
|
||||
|
||||
McuSupportPlugin::~McuSupportPlugin()
|
||||
{
|
||||
@@ -76,11 +75,12 @@ McuSupportPlugin::~McuSupportPlugin()
|
||||
dd = nullptr;
|
||||
}
|
||||
|
||||
bool McuSupportPlugin::initialize(const QStringList& arguments, QString* errorString)
|
||||
bool McuSupportPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
setObjectName("McuSupportPlugin");
|
||||
dd = new McuSupportPluginPrivate;
|
||||
|
||||
McuSupportOptions::registerQchFiles();
|
||||
@@ -150,5 +150,14 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade()
|
||||
ICore::infoBar()->addInfo(info);
|
||||
}
|
||||
|
||||
QVector<QObject *> McuSupportPlugin::createTestObjects() const
|
||||
{
|
||||
QVector<QObject *> tests;
|
||||
#if defined(WITH_TESTS) && defined(GOOGLE_TEST_IS_FOUND)
|
||||
tests << new Test::McuSupportTest;
|
||||
#endif
|
||||
return tests;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace McuSupport
|
||||
|
||||
Reference in New Issue
Block a user