Changeset View
Changeset View
Standalone View
Standalone View
shell/tests/test_plugincontroller.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Library General Public * | 14 | * You should have received a copy of the GNU Library General Public * | ||
15 | * License along with this program; if not, write to the * | 15 | * License along with this program; if not, write to the * | ||
16 | * Free Software Foundation, Inc., * | 16 | * Free Software Foundation, Inc., * | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #include "test_plugincontroller.h" | 20 | #include "test_plugincontroller.h" | ||
21 | 21 | | |||
22 | #include "nonguiinterfaceplugin.h" | ||||
23 | #include "testfilepaths.h" | ||||
24 | | ||||
22 | #include <QtCore/QProcess> | 25 | #include <QtCore/QProcess> | ||
23 | #include <QtCore/QStringList> | 26 | #include <QtCore/QStringList> | ||
24 | #include <QtTest/QSignalSpy> | 27 | #include <QtTest/QSignalSpy> | ||
25 | #include <QtTest/QTest> | 28 | #include <QtTest/QTest> | ||
26 | 29 | | |||
27 | #include <tests/autotestshell.h> | 30 | #include <tests/autotestshell.h> | ||
28 | #include <tests/testcore.h> | 31 | #include <tests/testcore.h> | ||
29 | 32 | | |||
30 | #include "../core.h" | 33 | #include "../core.h" | ||
31 | #include "../plugincontroller.h" | 34 | #include "../plugincontroller.h" | ||
32 | 35 | | |||
33 | #include "testfilepaths.h" | | |||
34 | | ||||
35 | using namespace KDevelop; | 36 | using namespace KDevelop; | ||
36 | 37 | | |||
37 | void TestPluginController::initTestCase() | 38 | void TestPluginController::initTestCase() | ||
38 | { | 39 | { | ||
39 | qApp->addLibraryPath(QStringLiteral(TEST_PLUGIN_DIR)); | 40 | qApp->addLibraryPath(QStringLiteral(TEST_PLUGIN_DIR)); | ||
40 | 41 | | |||
41 | AutoTestShell::init({QStringLiteral("kdevnonguiinterface")}); | 42 | AutoTestShell::init({QStringLiteral("kdevnonguiinterface")}); | ||
42 | TestCore::initialize( Core::NoUi ); | 43 | TestCore::initialize( Core::NoUi ); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 69 | { | |||
89 | QCOMPARE(spy2.size(), 1); | 90 | QCOMPARE(spy2.size(), 1); | ||
90 | QCOMPARE(spy3.size(), 1); | 91 | QCOMPARE(spy3.size(), 1); | ||
91 | } | 92 | } | ||
92 | 93 | | |||
93 | void TestPluginController::loadFromExtension() | 94 | void TestPluginController::loadFromExtension() | ||
94 | { | 95 | { | ||
95 | IPlugin* plugin = m_pluginCtrl->pluginForExtension( QStringLiteral("org.kdevelop.ITestNonGuiInterface") ); | 96 | IPlugin* plugin = m_pluginCtrl->pluginForExtension( QStringLiteral("org.kdevelop.ITestNonGuiInterface") ); | ||
96 | QVERIFY( plugin ); | 97 | QVERIFY( plugin ); | ||
97 | QCOMPARE( plugin->extensions(), QVector<QByteArray>() << "org.kdevelop.ITestNonGuiInterface" ); | 98 | QVERIFY( plugin->inherits("org.kdevelop.ITestNonGuiInterface") ); | ||
99 | QVERIFY( plugin->extension<ITestNonGuiInterface>()); | ||||
98 | } | 100 | } | ||
99 | 101 | | |||
100 | void TestPluginController::benchPluginForExtension() | 102 | void TestPluginController::benchPluginForExtension() | ||
101 | { | 103 | { | ||
102 | QBENCHMARK { | 104 | QBENCHMARK { | ||
103 | IPlugin* plugin = m_pluginCtrl->pluginForExtension( QStringLiteral("org.kdevelop.ITestNonGuiInterface") ); | 105 | IPlugin* plugin = m_pluginCtrl->pluginForExtension( QStringLiteral("org.kdevelop.ITestNonGuiInterface") ); | ||
104 | QVERIFY( plugin ); | 106 | QVERIFY( plugin ); | ||
105 | } | 107 | } | ||
106 | } | 108 | } | ||
107 | 109 | | |||
108 | QTEST_MAIN( TestPluginController) | 110 | QTEST_MAIN( TestPluginController) |