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

Method initTestCase

kdevplatform/shell/tests/languagecontrollertestbase.cpp:57–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void LanguageControllerTestBase::initTestCase()
58{
59 AutoTestShell::init({"kdevclangsupport", "kdevpatchreview", "kdevqmljs",
60 "KDevCMakeManager", "KDevCMakeBuilder", "KDevMakeBuilder", "KDevStandardOutputView"});
61 TestCore::initialize();
62 m_subject = Core::self()->languageController();
63
64 // Remove entries for languages supported by unavailable optional plugins.
65 for (auto it = m_differentLanguagesUrls.cbegin(); it != m_differentLanguagesUrls.cend();) {
66 const auto mimeType = QMimeDatabase().mimeTypeForFile(it->url.fileName(), QMimeDatabase::MatchExtension);
67 QVERIFY(mimeType.isValid());
68 QVERIFY(!mimeType.isDefault());
69
70 const QVariantMap constraints{{"X-KDevelop-SupportedMimeTypes", mimeType.name()}};
71 const bool languagePluginLoaded =
72 !ICore::self()->pluginController()->queryExtensionPlugins("ILanguageSupport", constraints).empty();
73 if (languagePluginLoaded) {
74 ++it;
75 } else {
76 qWarning() << "expected language plugin" << it->languageName << "for MIME type" << mimeType.name()
77 << "has not been loaded => skipping test data rows for this language";
78 it = m_differentLanguagesUrls.erase(it);
79 }
80 }
81
82 if (m_differentLanguagesUrls.empty()) {
83 QSKIP("zero language plugins => skip the entire test to prevent an assertion failure in QTest::fetchData()");
84 }
85}
86
87void LanguageControllerTestBase::init()
88{

Callers

nothing calls this directly

Calls 9

initializeFunction · 0.85
languageControllerMethod · 0.80
emptyMethod · 0.80
pluginControllerMethod · 0.80
initFunction · 0.50
fileNameMethod · 0.45
isValidMethod · 0.45
nameMethod · 0.45
queryExtensionPluginsMethod · 0.45

Tested by

no test coverage detected