mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-26 17:03:08 +00:00
tests: cover GameCenter policy and capabilities
This commit is contained in:
parent
16d4129ede
commit
239e3a9071
1 changed files with 73 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ private Q_SLOTS:
|
|||
|
||||
void pingGameCenter();
|
||||
void gameCenterUniqueness();
|
||||
void gameCenterPolicyAndCapabilities();
|
||||
void pingRunner();
|
||||
void pingInput();
|
||||
void runnerResolveLaunchNative();
|
||||
|
|
@ -276,6 +277,78 @@ void DbusSmokeTest::gameCenterUniqueness()
|
|||
pingGameCenter();
|
||||
}
|
||||
|
||||
void DbusSmokeTest::gameCenterPolicyAndCapabilities()
|
||||
{
|
||||
org::kde::GameCenter1 iface(QStringLiteral("org.kde.GameCenter1"), QStringLiteral("/org/kde/ALaKarte/GameCenter1"), m_bus);
|
||||
QVERIFY(iface.isValid());
|
||||
iface.setTimeout(2000);
|
||||
|
||||
{
|
||||
QDBusPendingReply<uint, uint> reply = iface.Version();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QCOMPARE(reply.argumentAt<0>(), 1u);
|
||||
QCOMPARE(reply.argumentAt<1>(), 0u);
|
||||
}
|
||||
|
||||
{
|
||||
QDBusPendingReply<QVariantMap> reply = iface.GetCapabilities();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
const QVariantMap caps = reply.value();
|
||||
QVERIFY(caps.contains(QStringLiteral("supportsSystemd")));
|
||||
QVERIFY(caps.value(QStringLiteral("supportsSystemd")).canConvert<bool>());
|
||||
QVERIFY(caps.contains(QStringLiteral("supportsSystemBus")));
|
||||
QCOMPARE(caps.value(QStringLiteral("supportsSystemBus")).toBool(), false);
|
||||
QVERIFY(caps.contains(QStringLiteral("supportsPowerProfiles")));
|
||||
QVERIFY(caps.value(QStringLiteral("supportsPowerProfiles")).canConvert<bool>());
|
||||
}
|
||||
|
||||
QVariantMap originalPolicy;
|
||||
{
|
||||
QDBusPendingReply<QVariantMap> reply = iface.GetPolicy();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
originalPolicy = reply.value();
|
||||
}
|
||||
|
||||
{
|
||||
QVariantMap policy;
|
||||
policy.insert(QStringLiteral("maxConcurrent"), 0);
|
||||
QDBusPendingReply<> reply = iface.SetPolicy(policy);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
}
|
||||
|
||||
{
|
||||
QDBusPendingReply<QVariantMap> reply = iface.GetPolicy();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QCOMPARE(reply.value().value(QStringLiteral("maxConcurrent")).toInt(), 0);
|
||||
}
|
||||
|
||||
{
|
||||
const int originalMaxConcurrent = originalPolicy.value(QStringLiteral("maxConcurrent"), 0).toInt();
|
||||
QVariantMap policy;
|
||||
policy.insert(QStringLiteral("maxConcurrent"), originalMaxConcurrent);
|
||||
QDBusPendingReply<> reply = iface.SetPolicy(policy);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
}
|
||||
|
||||
{
|
||||
QDBusPendingReply<QVariantList> reply = iface.ListSessions();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
}
|
||||
|
||||
{
|
||||
QDBusPendingReply<> reply = iface.StopByGameId(QStringLiteral("alakarte-test-nonexistent"));
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
}
|
||||
}
|
||||
|
||||
void DbusSmokeTest::pingRunner()
|
||||
{
|
||||
org::kde::ALaKarte::Runner1 iface(QStringLiteral("org.kde.ALaKarte.Runner1"), QStringLiteral("/org/kde/ALaKarte/Runner1"), m_bus);
|
||||
|
|
|
|||
Loading…
Reference in a new issue