mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-26 17:03:08 +00:00
tests: use generated DBus proxies
This commit is contained in:
parent
d94029fbc4
commit
d93dbc9ecc
1 changed files with 34 additions and 31 deletions
|
|
@ -17,6 +17,9 @@
|
|||
#include <QUuid>
|
||||
#include <QtTest>
|
||||
|
||||
#include "gamecenter1interface.h"
|
||||
#include "runner1interface.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static QString takeArgValue(const QStringList &args, const QString &key)
|
||||
|
|
@ -235,12 +238,13 @@ void DbusSmokeTest::cleanupTestCase()
|
|||
|
||||
void DbusSmokeTest::pingGameCenter()
|
||||
{
|
||||
QDBusInterface iface(QStringLiteral("org.kde.GameCenter1"), QStringLiteral("/org/kde/ALaKarte/GameCenter1"), QStringLiteral("org.kde.GameCenter1"), m_bus);
|
||||
org::kde::GameCenter1 iface(QStringLiteral("org.kde.GameCenter1"), QStringLiteral("/org/kde/ALaKarte/GameCenter1"), m_bus);
|
||||
QVERIFY(iface.isValid());
|
||||
iface.setTimeout(2000);
|
||||
|
||||
const QDBusReply<QString> reply = iface.call(QStringLiteral("Ping"));
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QString> reply = iface.Ping();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QCOMPARE(reply.value(), QStringLiteral("ok"));
|
||||
}
|
||||
|
||||
|
|
@ -274,15 +278,13 @@ void DbusSmokeTest::gameCenterUniqueness()
|
|||
|
||||
void DbusSmokeTest::pingRunner()
|
||||
{
|
||||
QDBusInterface iface(QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
QStringLiteral("/org/kde/ALaKarte/Runner1"),
|
||||
QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
m_bus);
|
||||
org::kde::ALaKarte::Runner1 iface(QStringLiteral("org.kde.ALaKarte.Runner1"), QStringLiteral("/org/kde/ALaKarte/Runner1"), m_bus);
|
||||
QVERIFY(iface.isValid());
|
||||
iface.setTimeout(2000);
|
||||
|
||||
const QDBusReply<QString> reply = iface.call(QStringLiteral("Ping"));
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QString> reply = iface.Ping();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QCOMPARE(reply.value(), QStringLiteral("ok"));
|
||||
}
|
||||
|
||||
|
|
@ -302,10 +304,7 @@ void DbusSmokeTest::pingInput()
|
|||
|
||||
void DbusSmokeTest::runnerResolveLaunchNative()
|
||||
{
|
||||
QDBusInterface iface(QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
QStringLiteral("/org/kde/ALaKarte/Runner1"),
|
||||
QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
m_bus);
|
||||
org::kde::ALaKarte::Runner1 iface(QStringLiteral("org.kde.ALaKarte.Runner1"), QStringLiteral("/org/kde/ALaKarte/Runner1"), m_bus);
|
||||
QVERIFY(iface.isValid());
|
||||
iface.setTimeout(2000);
|
||||
|
||||
|
|
@ -313,8 +312,9 @@ void DbusSmokeTest::runnerResolveLaunchNative()
|
|||
spec.insert(QStringLiteral("program"), QStringLiteral("/bin/true"));
|
||||
spec.insert(QStringLiteral("args"), QStringList{});
|
||||
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("ResolveLaunch"), spec);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.ResolveLaunch(spec);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
|
||||
const QVariantMap out = reply.value();
|
||||
QVERIFY(out.value(QStringLiteral("ok")).toBool());
|
||||
|
|
@ -324,18 +324,16 @@ void DbusSmokeTest::runnerResolveLaunchNative()
|
|||
|
||||
void DbusSmokeTest::runnerGameProfiles()
|
||||
{
|
||||
QDBusInterface iface(QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
QStringLiteral("/org/kde/ALaKarte/Runner1"),
|
||||
QStringLiteral("org.kde.ALaKarte.Runner1"),
|
||||
m_bus);
|
||||
org::kde::ALaKarte::Runner1 iface(QStringLiteral("org.kde.ALaKarte.Runner1"), QStringLiteral("/org/kde/ALaKarte/Runner1"), m_bus);
|
||||
QVERIFY(iface.isValid());
|
||||
iface.setTimeout(2000);
|
||||
|
||||
const QString gameId = QStringLiteral("alakarte-test-game");
|
||||
|
||||
{
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("ClearGameProfile"), gameId);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.ClearGameProfile(gameId);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QVERIFY(reply.value().value(QStringLiteral("ok")).toBool());
|
||||
}
|
||||
|
||||
|
|
@ -349,8 +347,9 @@ void DbusSmokeTest::runnerGameProfiles()
|
|||
spec.insert(QStringLiteral("dllOverrides"),
|
||||
QVariantMap{{QStringLiteral("d3d11"), QStringLiteral("native,builtin")}, {QStringLiteral("dxgi"), QStringLiteral("native,builtin")}});
|
||||
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("SetGameProfile"), spec);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.SetGameProfile(spec);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
const QVariantMap out = reply.value();
|
||||
QVERIFY(out.value(QStringLiteral("ok")).toBool());
|
||||
|
||||
|
|
@ -367,8 +366,9 @@ void DbusSmokeTest::runnerGameProfiles()
|
|||
}
|
||||
|
||||
{
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("GetGameProfile"), gameId);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.GetGameProfile(gameId);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
const QVariantMap out = reply.value();
|
||||
QVERIFY(out.value(QStringLiteral("ok")).toBool());
|
||||
const QVariantMap profile = unwrapVariantMap(out.value(QStringLiteral("profile")));
|
||||
|
|
@ -389,8 +389,9 @@ void DbusSmokeTest::runnerGameProfiles()
|
|||
spec.insert(QStringLiteral("args"), QStringList{QStringLiteral("--base-arg")});
|
||||
spec.insert(QStringLiteral("extraArgs"), QStringList{QStringLiteral("--spec-arg")});
|
||||
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("ResolveLaunch"), spec);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.ResolveLaunch(spec);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
const QVariantMap out = reply.value();
|
||||
QVERIFY(out.value(QStringLiteral("ok")).toBool());
|
||||
QCOMPARE(out.value(QStringLiteral("finalProgram")).toString(), QStringLiteral("/bin/true"));
|
||||
|
|
@ -408,8 +409,9 @@ void DbusSmokeTest::runnerGameProfiles()
|
|||
}
|
||||
|
||||
{
|
||||
const QDBusReply<QVariantList> reply = iface.call(QStringLiteral("ListGameProfiles"));
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantList> reply = iface.ListGameProfiles();
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
const QVariantList list = reply.value();
|
||||
bool found = false;
|
||||
for (const QVariant &v : list) {
|
||||
|
|
@ -423,8 +425,9 @@ void DbusSmokeTest::runnerGameProfiles()
|
|||
}
|
||||
|
||||
{
|
||||
const QDBusReply<QVariantMap> reply = iface.call(QStringLiteral("ClearGameProfile"), gameId);
|
||||
QVERIFY(reply.isValid());
|
||||
QDBusPendingReply<QVariantMap> reply = iface.ClearGameProfile(gameId);
|
||||
reply.waitForFinished();
|
||||
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||
QVERIFY(reply.value().value(QStringLiteral("ok")).toBool());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue