From 1d81c837792cfe4defe5932e7fe2021a58122a1f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 20 May 2016 12:16:21 +0200 Subject: [PATCH] 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 --- autotests/pluginloadertest.cpp | 21 ++++++++++++++------- autotests/pluginloadertest.h | 3 ++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/autotests/pluginloadertest.cpp b/autotests/pluginloadertest.cpp index 5b5c76cc0..b43b93a30 100644 --- a/autotests/pluginloadertest.cpp +++ b/autotests/pluginloadertest.cpp @@ -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 engine, nullEngine; { Plasma::DataEngineConsumer consumer; diff --git a/autotests/pluginloadertest.h b/autotests/pluginloadertest.h index 02011cdb0..709823540 100644 --- a/autotests/pluginloadertest.h +++ b/autotests/pluginloadertest.h @@ -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