MCPcopy Create free account
hub / github.com/KDE/kdevelop / loadPlugin

Method loadPlugin

kdevplatform/shell/tests/test_pluginenabling.cpp:30–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void 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
65void TestPluginEnabling::loadPluginCustomDefaults_data()
66{

Callers 5

pluginInfoMethod · 0.45
loadUnloadPluginMethod · 0.45
cleanupTestCaseMethod · 0.45
testPluginMethod · 0.45
testPluginUnloadMethod · 0.45

Calls 7

readEntryMethod · 0.80
writeEntryMethod · 0.80
configMethod · 0.45
activeSessionMethod · 0.45
hasKeyMethod · 0.45
pluginMethod · 0.45
unloadPluginMethod · 0.45

Tested by

no test coverage detected