disable the tests when no plugins are installed

this test relies on plugins installed from plasma-workspace
so it can't reliably work on CI, it has to be run from
the desktop.
in the end it will have proably to install in this case one dummy
plugin per type
This commit is contained in:
Marco Martin 2016-05-20 12:16:21 +02:00
parent 2275db4b39
commit 1d81c83779
2 changed files with 16 additions and 8 deletions

View File

@ -32,9 +32,10 @@
QTEST_MAIN(PluginTest)
// Switch to true in order to let tests pass, this test usually will only
// work with plugins installed, but there aren't any in plasma-framework
bool buildonly = true;
PluginTest::PluginTest()
: m_buildonly(false)
{
}
void PluginTest::listEngines()
{
@ -43,28 +44,31 @@ void PluginTest::listEngines()
//qDebug() << " Found DataEngine: " << info.pluginName() << info.name();
// }
qDebug() << " Found " << plugins.count() << " DataEngines";
QVERIFY(plugins.count() > 0 || buildonly);
// Switch to true in order to let tests pass, this test usually will only
// work with plugins installed, but there aren't any in plasma-framework
m_buildonly = plugins.count() == 0;
QVERIFY(plugins.count() > 0 || m_buildonly);
}
void PluginTest::listAppletCategories()
{
const QStringList cats = Plasma::PluginLoader::self()->listAppletCategories();
qDebug() << "Categories" << cats;
QVERIFY(cats.count() > 0 || buildonly);
QVERIFY(cats.count() > 0 || m_buildonly);
}
void PluginTest::listContainmentActions()
{
const KPluginInfo::List plugins = Plasma::PluginLoader::self()->listContainmentActionsInfo(QStringLiteral("plasma-shell"));
qDebug() << "Categories: " << plugins.count();
//QVERIFY(plugins.count() > 0 || buildonly);
//QVERIFY(plugins.count() > 0 || m_buildonly);
}
void PluginTest::listContainmentsOfType()
{
const KPluginInfo::List plugins = Plasma::PluginLoader::listContainmentsOfType(QStringLiteral("Desktop"));
qDebug() << "Desktop Containments: " << plugins.count();
QVERIFY(plugins.count() > 0 || buildonly);
QVERIFY(plugins.count() > 0 || m_buildonly);
}
@ -77,6 +81,9 @@ void EngineTest::dataUpdated(const QString &s, const Plasma::DataEngine::Data &d
void PluginTest::loadDataEngine()
{
if (m_buildonly) {
return;
}
QPointer<Plasma::DataEngine> engine, nullEngine;
{
Plasma::DataEngineConsumer consumer;

View File

@ -27,7 +27,7 @@ class PluginTest : public QObject
{
Q_OBJECT
public:
PluginTest() {}
PluginTest();
private Q_SLOTS:
void listEngines();
@ -38,6 +38,7 @@ private Q_SLOTS:
void loadDataEngine();
private:
bool m_buildonly;
};
class EngineTest : public QObject