Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/dbus_interface_test.cpp
Show All 26 Lines | |||||
27 | #include "platform.h" | 27 | #include "platform.h" | ||
28 | #include "rules.h" | 28 | #include "rules.h" | ||
29 | #include "screens.h" | 29 | #include "screens.h" | ||
30 | #include "shell_client.h" | 30 | #include "shell_client.h" | ||
31 | #include "virtualdesktops.h" | 31 | #include "virtualdesktops.h" | ||
32 | #include "wayland_server.h" | 32 | #include "wayland_server.h" | ||
33 | #include "workspace.h" | 33 | #include "workspace.h" | ||
34 | 34 | | |||
35 | #include <KWayland/Client/shell.h> | | |||
36 | #include <KWayland/Client/surface.h> | 35 | #include <KWayland/Client/surface.h> | ||
37 | #include <KWayland/Client/xdgshell.h> | | |||
38 | 36 | | |||
39 | #include <QDBusArgument> | 37 | #include <QDBusArgument> | ||
40 | #include <QDBusConnection> | 38 | #include <QDBusConnection> | ||
41 | #include <QDBusMessage> | 39 | #include <QDBusMessage> | ||
42 | #include <QDBusPendingReply> | 40 | #include <QDBusPendingReply> | ||
43 | #include <QUuid> | 41 | #include <QUuid> | ||
44 | 42 | | |||
45 | #include <netwm.h> | 43 | #include <netwm.h> | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 106 | { | |||
111 | QVERIFY(reply.isValid()); | 109 | QVERIFY(reply.isValid()); | ||
112 | QVERIFY(!reply.isError()); | 110 | QVERIFY(!reply.isError()); | ||
113 | const auto windowData = reply.value(); | 111 | const auto windowData = reply.value(); | ||
114 | QVERIFY(windowData.empty()); | 112 | QVERIFY(windowData.empty()); | ||
115 | } | 113 | } | ||
116 | 114 | | |||
117 | void TestDbusInterface::testGetWindowInfoShellClient_data() | 115 | void TestDbusInterface::testGetWindowInfoShellClient_data() | ||
118 | { | 116 | { | ||
119 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 117 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
120 | 118 | | |||
121 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 119 | QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
122 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 120 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
123 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 121 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
124 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
125 | } | 122 | } | ||
126 | 123 | | |||
127 | void TestDbusInterface::testGetWindowInfoShellClient() | 124 | void TestDbusInterface::testGetWindowInfoShellClient() | ||
128 | { | 125 | { | ||
129 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | 126 | QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); | ||
130 | QVERIFY(clientAddedSpy.isValid()); | 127 | QVERIFY(clientAddedSpy.isValid()); | ||
131 | 128 | | |||
132 | QScopedPointer<Surface> surface(Test::createSurface()); | 129 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
133 | QFETCH(Test::ShellSurfaceType, type); | 130 | QFETCH(Test::XdgShellSurfaceType, type); | ||
134 | QScopedPointer<QObject> shellSurface(Test::createShellSurface(type, surface.data())); | 131 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
135 | if (type != Test::ShellSurfaceType::WlShell) { | 132 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | ||
136 | qobject_cast<XdgShellSurface*>(shellSurface.data())->setAppId(QByteArrayLiteral("org.kde.foo")); | 133 | shellSurface->setTitle(QStringLiteral("Test window")); | ||
137 | qobject_cast<XdgShellSurface*>(shellSurface.data())->setTitle(QStringLiteral("Test window")); | | |||
138 | } | | |||
139 | 134 | | |||
140 | // now let's render | 135 | // now let's render | ||
141 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 136 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
142 | QVERIFY(clientAddedSpy.isEmpty()); | 137 | QVERIFY(clientAddedSpy.isEmpty()); | ||
143 | QVERIFY(clientAddedSpy.wait()); | 138 | QVERIFY(clientAddedSpy.wait()); | ||
144 | auto client = clientAddedSpy.first().first().value<ShellClient*>(); | 139 | auto client = clientAddedSpy.first().first().value<ShellClient*>(); | ||
145 | QVERIFY(client); | 140 | QVERIFY(client); | ||
146 | 141 | | |||
Show All 21 Lines | |||||
168 | QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false); | 163 | QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false); | ||
169 | QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false); | 164 | QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false); | ||
170 | QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false); | 165 | QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false); | ||
171 | QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), true); | 166 | QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), true); | ||
172 | QCOMPARE(windowData.value(QStringLiteral("clientMachine")).toString(), QString()); | 167 | QCOMPARE(windowData.value(QStringLiteral("clientMachine")).toString(), QString()); | ||
173 | QCOMPARE(windowData.value(QStringLiteral("localhost")).toBool(), true); | 168 | QCOMPARE(windowData.value(QStringLiteral("localhost")).toBool(), true); | ||
174 | QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString()); | 169 | QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString()); | ||
175 | QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("testDbusInterface")); | 170 | QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("testDbusInterface")); | ||
176 | if (type == Test::ShellSurfaceType::WlShell) { | | |||
177 | QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QString()); | | |||
178 | QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QString()); | | |||
179 | QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QString()); | | |||
180 | } else { | | |||
181 | QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo")); | 171 | QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo")); | ||
182 | QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo")); | 172 | QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo")); | ||
183 | QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window")); | 173 | QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window")); | ||
184 | } | | |||
185 | 174 | | |||
186 | auto verifyProperty = [client] (const QString &name) { | 175 | auto verifyProperty = [client] (const QString &name) { | ||
187 | QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())}; | 176 | QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())}; | ||
188 | reply.waitForFinished(); | 177 | reply.waitForFinished(); | ||
189 | return reply.value().value(name).toBool(); | 178 | return reply.value().value(name).toBool(); | ||
190 | }; | 179 | }; | ||
191 | 180 | | |||
192 | QVERIFY(!client->isMinimized()); | 181 | QVERIFY(!client->isMinimized()); | ||
▲ Show 20 Lines • Show All 223 Lines • Show Last 20 Lines |