Remove unneeded parts of servies runner test

The logic that is tested does not exist in this runner anymore, but it imported in systemsettings.
wilder-5.24
Alexander Lohnau 5 years ago
parent c97dddf20d
commit bbb8343a2d
No known key found for this signature in database
GPG Key ID: 1F58708D54A003E7
  1. 53
      runners/services/autotests/servicerunnertest.cpp

@ -31,9 +31,7 @@ private Q_SLOTS:
void testChromeAppsRelevance();
void testKonsoleVsYakuakeComment();
void testSystemSettings();
void testForeignAppsOutscoreKCMs();
void testINotifyUsage();
void testKCMId();
};
void ServiceRunnerTest::initTestCase()
@ -155,42 +153,6 @@ void ServiceRunnerTest::testSystemSettings()
QVERIFY(!foreignSystemSettingsFound);
}
void ServiceRunnerTest::testForeignAppsOutscoreKCMs()
{
// Our software outscores other things, but foreign applications should still
// outscore our KCMs.
ServiceRunner runner(this, KPluginMetaData(), QVariantList());
Plasma::RunnerContext context;
context.setQuery(QStringLiteral("virt"));
runner.match(context);
std::optional<qreal> virtManRelevance;
std::optional<qreal> virtThingsRelevance;
std::optional<qreal> kcmRelevance;
const auto matches = context.matches();
for (const auto &match : matches) {
const QUrl url = match.data().toUrl();
if (url == QUrl(QStringLiteral("applications:virt-manager.desktop"))) {
virtManRelevance = match.relevance();
} else if (url == QUrl(QStringLiteral("applications:kcm_kwin_virtualdesktops.desktop"))) {
kcmRelevance = match.relevance();
} else if (url == QUrl(QStringLiteral("applications:org.kde.virtthings.desktop"))) {
virtThingsRelevance = match.relevance();
}
}
QVERIFY(virtManRelevance.has_value());
QVERIFY(virtThingsRelevance.has_value());
QVERIFY(kcmRelevance.has_value());
// KDE app should be >= non-KDE app
QVERIFY2(virtThingsRelevance >= virtManRelevance, qPrintable(QStringLiteral("%1 >= %2").arg(virtThingsRelevance.value(), virtManRelevance.value())));
// KDE app strictly greater KDE kcm
QVERIFY2(virtThingsRelevance > kcmRelevance, qPrintable(QStringLiteral("%1 > %2").arg(virtThingsRelevance.value(), kcmRelevance.value())));
// non-KDE app also strictly greater (because it is an app)
QVERIFY2(virtManRelevance > kcmRelevance, qPrintable(QStringLiteral("%1 > %2").arg(virtManRelevance.value(), kcmRelevance.value())));
}
void ServiceRunnerTest::testINotifyUsage()
{
auto inotifyCount = []() -> uint {
@ -226,21 +188,6 @@ void ServiceRunnerTest::testINotifyUsage()
QVERIFY(inotifyCountCool);
}
void ServiceRunnerTest::testKCMId()
{
ServiceRunner runner(this, KPluginMetaData(), QVariantList());
Plasma::RunnerContext context;
context.setQuery(QStringLiteral("kcm_kwin_virtualdesktops"));
runner.match(context);
const auto matches = context.matches();
QCOMPARE(matches.count(), 1);
// Ensure KCM ids are uniquely identifying the KCM, not just the host application.
// The specific format of the id is a bit besides the point so we'll only check for our kcm being mentioned.
QVERIFY(matches.at(0).id().contains("kcm_kwin_virtualdesktops"));
}
QTEST_MAIN(ServiceRunnerTest)
#include "servicerunnertest.moc"

Loading…
Cancel
Save