| 98 | } |
| 99 | |
| 100 | void 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 | |
| 150 | void TestMIDBus::cleanupTestCase() |
| 151 | { |
no test coverage detected