| 28 | } |
| 29 | |
| 30 | void TestPluginEnabling::loadPlugin(const QString& pluginId, bool shouldBeEnabled) |
| 31 | { |
| 32 | // check config storage |
| 33 | KConfigGroup grp = Core::self()->activeSession()->config()->group(QStringLiteral("Plugins")); |
| 34 | |
| 35 | const QString pluginEnabledKey = pluginId + QLatin1String("Enabled"); |
| 36 | // logic in kdevelop |
| 37 | const bool enabled = grp.hasKey(pluginEnabledKey) ? grp.readEntry(pluginEnabledKey, true) : false; |
| 38 | |
| 39 | QCOMPARE(enabled, shouldBeEnabled); |
| 40 | |
| 41 | // check plugin loading |
| 42 | QCOMPARE((m_pluginCtrl->loadPlugin(pluginId) != nullptr), shouldBeEnabled); |
| 43 | QCOMPARE((m_pluginCtrl->plugin(pluginId) != nullptr), shouldBeEnabled); |
| 44 | |
| 45 | if (shouldBeEnabled) { |
| 46 | m_pluginCtrl->unloadPlugin(pluginId); |
| 47 | QVERIFY(!m_pluginCtrl->plugin(pluginId)); |
| 48 | } |
| 49 | |
| 50 | // switch enabled state |
| 51 | const bool shouldNowBeEnabled = !shouldBeEnabled; |
| 52 | grp.writeEntry(pluginEnabledKey, shouldNowBeEnabled); |
| 53 | |
| 54 | // check plugin loading again |
| 55 | QCOMPARE((m_pluginCtrl->loadPlugin(pluginId) != nullptr), shouldNowBeEnabled); |
| 56 | QCOMPARE((m_pluginCtrl->plugin(pluginId) != nullptr), shouldNowBeEnabled); |
| 57 | |
| 58 | if (shouldNowBeEnabled) { |
| 59 | m_pluginCtrl->unloadPlugin(pluginId); |
| 60 | QVERIFY(!m_pluginCtrl->plugin(pluginId)); |
| 61 | } |
| 62 | |
| 63 | } |
| 64 | |
| 65 | void TestPluginEnabling::loadPluginCustomDefaults_data() |
| 66 | { |
no test coverage detected