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

Method debug

plugins/debuggercommon/tests/test_midbus.cpp:100–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void TestMIDBus::debug()
101{
102#ifdef Q_OS_WIN
103 QSKIP("somehow, running this test makes Windows CI jobs fail via KeyboardInterrupt (^C)");
104#endif
105
106 auto plugin = dynamic_cast<KDevMI::MIDebuggerPlugin*>(KDevelop::ICore::self()->pluginController()->loadPlugin(QStringLiteral("testdebugger")));
107 QVERIFY(plugin);
108 connect(plugin, &KDevMI::MIDebuggerPlugin::showMessage, this, &TestMIDBus::message);
109
110 // Start the adaptor (DrKonqi) after KDevelop was started
111 auto adaptor = new DrKonqiAdaptor(this);
112
113 QTRY_COMPARE(adaptor->registeredPid, QApplication::applicationPid());
114
115 emit adaptor->acceptDebuggingApplication(QStringLiteral("KDevelop (Test) - test-test_midbus"));
116
117 QTRY_VERIFY(!m_lastMessage.isEmpty());
118 QCOMPARE(m_lastMessage, QStringLiteral("Attaching to process 123"));
119
120 QVERIFY(!adaptor->finished);
121 QTRY_VERIFY(adaptor->finished);
122
123 QVERIFY(!adaptor->closed);
124 plugin->unload();
125 QTRY_VERIFY(adaptor->closed);
126
127 // Shut down KDevelop, but let the adaptor continue.
128 KDevelop::TestCore::shutdown();
129 m_lastMessage.clear();
130
131 // Now restart KDevelop with the adaptor (DrKonqi) already running
132 KDevelop::AutoTestShell::init({QStringLiteral("testdebugger")});
133 KDevelop::TestCore::initialize(KDevelop::Core::NoUi);
134
135 plugin = dynamic_cast<KDevMI::MIDebuggerPlugin*>(KDevelop::ICore::self()->pluginController()->loadPlugin(QStringLiteral("testdebugger")));
136 QVERIFY(plugin);
137 connect(plugin, &KDevMI::MIDebuggerPlugin::showMessage, this, &TestMIDBus::message);
138
139 QTRY_COMPARE(adaptor->registeredPid, QApplication::applicationPid());
140
141 emit adaptor->acceptDebuggingApplication(QStringLiteral("KDevelop (Test) - test-test_midbus"));
142
143 QTRY_VERIFY(!m_lastMessage.isEmpty());
144 QCOMPARE(m_lastMessage, QStringLiteral("Attaching to process 123"));
145
146 QVERIFY(!adaptor->finished);
147 QTRY_VERIFY(adaptor->finished);
148}
149
150void TestMIDBus::cleanupTestCase()
151{

Callers 2

util.jsFile · 0.80
__builtin_dom.jsFile · 0.80

Calls 7

initializeFunction · 0.85
pluginControllerMethod · 0.80
initClass · 0.50
loadPluginMethod · 0.45
isEmptyMethod · 0.45
unloadMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected