Commit f29c7b10 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Fix locationsrunner test on BSD CI

parent 4eb900ae
Pipeline #158097 passed with stage
in 10 minutes and 28 seconds
......@@ -20,6 +20,11 @@ private:
private Q_SLOTS:
void initTestCase();
void cleanupTestCase()
{
QFile::remove(normalHomeFile);
QFile::remove(executableHomeFile);
}
void shouldNotProduceResult();
void shouldNotProduceResult_data();
void shouldProduceResult();
......@@ -30,14 +35,13 @@ private Q_SLOTS:
void LocationsRunnerTest::initTestCase()
{
initProperties();
const QFileInfoList entries = QDir::home().entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Hidden);
for (const QFileInfo &entry : entries) {
if (entry.isExecutable()) {
executableHomeFile = entry.absoluteFilePath();
} else {
normalHomeFile = entry.absoluteFilePath();
}
}
normalHomeFile = KShell::tildeExpand(QStringLiteral("~/.krunner_locationsrunner_testfile"));
executableHomeFile = KShell::tildeExpand(QStringLiteral("~/.krunner_locationsrunner_testexecutablefile"));
QFile normalFile(normalHomeFile);
normalFile.open(QIODevice::WriteOnly);
QFile executableFile(executableHomeFile);
executableFile.open(QIODevice::WriteOnly);
executableFile.setPermissions(executableFile.permissions() | QFile::ExeOwner);
QVERIFY(!normalHomeFile.isEmpty());
}
......@@ -54,7 +58,7 @@ void LocationsRunnerTest::shouldProduceResult()
QFETCH(QVariant, data);
launchQuery(query);
const QList<Plasma::QueryMatch> matches = manager->matches();
QCOMPARE(1, matches.size());
QCOMPARE(matches.size(), 1);
QCOMPARE(matches.first().data(), data);
}
......@@ -92,9 +96,7 @@ void LocationsRunnerTest::shouldProduceResult_data()
QTest::newRow("file with $HOME as env variable") << KShell::tildeCollapse(normalHomeFile).replace("~", "$HOME")
<< QVariant(QUrl::fromLocalFile(normalHomeFile));
QTest::newRow("file URL") << QUrl::fromLocalFile(normalHomeFile).toString() << QVariant(QUrl::fromLocalFile(normalHomeFile));
if (!executableHomeFile.isEmpty()) {
QTest::newRow("file URL to executable") << QUrl::fromLocalFile(executableHomeFile).toString() << QVariant(QUrl::fromLocalFile(executableHomeFile));
}
QTest::newRow("file URL to executable") << QUrl::fromLocalFile(executableHomeFile).toString() << QVariant(QUrl::fromLocalFile(executableHomeFile));
if (KProtocolInfo::isHelperProtocol("vnc")) {
QTest::newRow("vnc URL") << "vnc:foo" << QVariant("vnc:foo");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment