init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
56
Telegram/ThirdParty/kcoreaddons/autotests/klibexectest.cpp
vendored
Normal file
56
Telegram/ThirdParty/kcoreaddons/autotests/klibexectest.cpp
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
#include <QTest>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <KLibexec>
|
||||
|
||||
class KLibexecTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
const QString m_relative = QStringLiteral("fakeexec/kf" QT_STRINGIFY(QT_VERSION_MAJOR));
|
||||
const QString m_fixtureName =
|
||||
#ifdef Q_OS_WIN
|
||||
QStringLiteral("klibexectest-fixture-binary.exe");
|
||||
#else
|
||||
QStringLiteral("klibexectest-fixture-binary");
|
||||
#endif
|
||||
QString m_fixtureDir;
|
||||
QString m_fixturePath;
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase()
|
||||
{
|
||||
m_fixtureDir = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + m_relative);
|
||||
m_fixturePath = QDir::cleanPath(m_fixtureDir + QDir::separator() + m_fixtureName);
|
||||
QVERIFY(QDir().mkpath(m_fixtureDir));
|
||||
QFile fixture(m_fixturePath);
|
||||
QVERIFY(fixture.open(QFile::ReadWrite));
|
||||
fixture.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
|
||||
|
||||
m_fixtureDir = QFileInfo(m_fixtureDir).canonicalFilePath();
|
||||
m_fixturePath = QFileInfo(m_fixtureDir).canonicalFilePath();
|
||||
}
|
||||
|
||||
void testPath()
|
||||
{
|
||||
QCOMPARE(KLibexec::path(m_relative), m_fixtureDir);
|
||||
}
|
||||
|
||||
void testKDEFrameworksPaths()
|
||||
{
|
||||
auto paths = KLibexec::kdeFrameworksPaths(m_relative);
|
||||
QVERIFY(paths.contains(QCoreApplication::applicationDirPath()));
|
||||
QVERIFY(paths.contains(m_fixtureDir));
|
||||
// not exhaustive verification
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(KLibexecTest)
|
||||
|
||||
#include "klibexectest.moc"
|
||||
Reference in New Issue
Block a user