mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-27 01:03:09 +00:00
tests: use generated Input1 proxy and cover profile CRUD
This commit is contained in:
parent
47cab1cbe5
commit
cd23253386
2 changed files with 70 additions and 6 deletions
|
|
@ -20,6 +20,11 @@ qt_add_dbus_interface(alakarte_dbus_smoketest_dbus_sources
|
||||||
runner1interface
|
runner1interface
|
||||||
)
|
)
|
||||||
|
|
||||||
|
qt_add_dbus_interface(alakarte_dbus_smoketest_dbus_sources
|
||||||
|
${CMAKE_SOURCE_DIR}/src/input/dbus/org.kde.ALaKarte.Input1.xml
|
||||||
|
input1interface
|
||||||
|
)
|
||||||
|
|
||||||
target_sources(alakarte_dbus_smoketest PRIVATE
|
target_sources(alakarte_dbus_smoketest PRIVATE
|
||||||
${alakarte_dbus_smoketest_dbus_sources}
|
${alakarte_dbus_smoketest_dbus_sources}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
#include "gamecenter1interface.h"
|
#include "gamecenter1interface.h"
|
||||||
|
#include "input1interface.h"
|
||||||
#include "runner1interface.h"
|
#include "runner1interface.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
@ -90,6 +91,7 @@ private Q_SLOTS:
|
||||||
void pingRunner();
|
void pingRunner();
|
||||||
void runnerVersionAndListRunners();
|
void runnerVersionAndListRunners();
|
||||||
void pingInput();
|
void pingInput();
|
||||||
|
void inputProfilesCrud();
|
||||||
void runnerResolveLaunchNative();
|
void runnerResolveLaunchNative();
|
||||||
void runnerGameProfiles();
|
void runnerGameProfiles();
|
||||||
|
|
||||||
|
|
@ -429,18 +431,75 @@ void DbusSmokeTest::runnerVersionAndListRunners()
|
||||||
|
|
||||||
void DbusSmokeTest::pingInput()
|
void DbusSmokeTest::pingInput()
|
||||||
{
|
{
|
||||||
QDBusInterface iface(QStringLiteral("org.kde.ALaKarte.Input1"),
|
org::kde::ALaKarte::Input1 iface(QStringLiteral("org.kde.ALaKarte.Input1"), QStringLiteral("/org/kde/ALaKarte/Input1"), m_bus);
|
||||||
QStringLiteral("/org/kde/ALaKarte/Input1"),
|
|
||||||
QStringLiteral("org.kde.ALaKarte.Input1"),
|
|
||||||
m_bus);
|
|
||||||
QVERIFY(iface.isValid());
|
QVERIFY(iface.isValid());
|
||||||
iface.setTimeout(2000);
|
iface.setTimeout(2000);
|
||||||
|
|
||||||
const QDBusReply<QString> reply = iface.call(QStringLiteral("Ping"));
|
QDBusPendingReply<QString> reply = iface.Ping();
|
||||||
QVERIFY(reply.isValid());
|
reply.waitForFinished();
|
||||||
|
QVERIFY2(!reply.isError(), qPrintable(reply.error().message()));
|
||||||
QCOMPARE(reply.value(), QStringLiteral("ok"));
|
QCOMPARE(reply.value(), QStringLiteral("ok"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbusSmokeTest::inputProfilesCrud()
|
||||||
|
{
|
||||||
|
org::kde::ALaKarte::Input1 iface(QStringLiteral("org.kde.ALaKarte.Input1"), QStringLiteral("/org/kde/ALaKarte/Input1"), m_bus);
|
||||||
|
QVERIFY(iface.isValid());
|
||||||
|
iface.setTimeout(2000);
|
||||||
|
|
||||||
|
QDBusPendingReply<QString> createReply = iface.CreateProfile(QStringLiteral("Test Profile"));
|
||||||
|
createReply.waitForFinished();
|
||||||
|
QVERIFY2(!createReply.isError(), qPrintable(createReply.error().message()));
|
||||||
|
const QString profileId = createReply.value();
|
||||||
|
QVERIFY(!profileId.isEmpty());
|
||||||
|
|
||||||
|
{
|
||||||
|
QDBusPendingReply<QVariantList> listReply = iface.ListProfiles();
|
||||||
|
listReply.waitForFinished();
|
||||||
|
QVERIFY2(!listReply.isError(), qPrintable(listReply.error().message()));
|
||||||
|
const QVariantList list = listReply.value();
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (const QVariant &v : list) {
|
||||||
|
const QVariantMap m = unwrapVariantMap(v);
|
||||||
|
if (m.value(QStringLiteral("id")).toString() == profileId) {
|
||||||
|
found = true;
|
||||||
|
QCOMPARE(m.value(QStringLiteral("name")).toString(), QStringLiteral("Test Profile"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QVERIFY(found);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QDBusPendingReply<QVariantMap> getReply = iface.GetProfile(profileId);
|
||||||
|
getReply.waitForFinished();
|
||||||
|
QVERIFY2(!getReply.isError(), qPrintable(getReply.error().message()));
|
||||||
|
const QVariantMap m = getReply.value();
|
||||||
|
QCOMPARE(m.value(QStringLiteral("id")).toString(), profileId);
|
||||||
|
QCOMPARE(m.value(QStringLiteral("name")).toString(), QStringLiteral("Test Profile"));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QDBusPendingReply<bool> delReply = iface.DeleteProfile(profileId);
|
||||||
|
delReply.waitForFinished();
|
||||||
|
QVERIFY2(!delReply.isError(), qPrintable(delReply.error().message()));
|
||||||
|
QVERIFY(delReply.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QDBusPendingReply<QVariantList> listReply = iface.ListProfiles();
|
||||||
|
listReply.waitForFinished();
|
||||||
|
QVERIFY2(!listReply.isError(), qPrintable(listReply.error().message()));
|
||||||
|
const QVariantList list = listReply.value();
|
||||||
|
|
||||||
|
for (const QVariant &v : list) {
|
||||||
|
const QVariantMap m = unwrapVariantMap(v);
|
||||||
|
QVERIFY(m.value(QStringLiteral("id")).toString() != profileId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DbusSmokeTest::runnerResolveLaunchNative()
|
void DbusSmokeTest::runnerResolveLaunchNative()
|
||||||
{
|
{
|
||||||
org::kde::ALaKarte::Runner1 iface(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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue