| 31 | } |
| 32 | |
| 33 | TestCore* TestCore::initialize(Core::Setup mode, const QString& session) |
| 34 | { |
| 35 | qRegisterMetaType<QList<QUrl>>("QList<QUrl>"); |
| 36 | KLocalizedString::setApplicationDomain(QByteArrayLiteral("kdevelop")); |
| 37 | |
| 38 | if (!Core::m_self) { |
| 39 | new TestCore; |
| 40 | } |
| 41 | |
| 42 | auto* core = qobject_cast<TestCore*>(Core::m_self); |
| 43 | Q_ASSERT(core); |
| 44 | core->initializeNonStatic(mode, session); |
| 45 | |
| 46 | if (mode == Default) { |
| 47 | // we don't want the window to be visible, hide it |
| 48 | // the unit tests should work anyways |
| 49 | core->uiController()->activeMainWindow()->hide(); |
| 50 | } |
| 51 | |
| 52 | // resume the background parser when a unit test replaces the project controller |
| 53 | QObject::connect(core->d->projectController.data(), &ProjectController::destroyed, |
| 54 | core, [core]() { |
| 55 | core->d->languageController->backgroundParser()->resume(); |
| 56 | }); |
| 57 | |
| 58 | return core; |
| 59 | } |
| 60 | |
| 61 | void TestCore::initializeNonStatic(Core::Setup mode, const QString& _session) |
| 62 | { |
no test coverage detected