Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/dbus_interface_test.cpp
Show All 15 Lines | |||||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | 18 | GNU General Public License for more details. | ||
19 | 19 | | |||
20 | You should have received a copy of the GNU General Public License | 20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
22 | *********************************************************************/ | 22 | *********************************************************************/ | ||
23 | #include "kwin_wayland_test.h" | 23 | #include "kwin_wayland_test.h" | ||
24 | #include "abstract_client.h" | ||||
24 | #include "atoms.h" | 25 | #include "atoms.h" | ||
25 | #include "x11client.h" | 26 | #include "x11client.h" | ||
26 | #include "deleted.h" | 27 | #include "deleted.h" | ||
27 | #include "platform.h" | 28 | #include "platform.h" | ||
28 | #include "rules.h" | 29 | #include "rules.h" | ||
29 | #include "screens.h" | 30 | #include "screens.h" | ||
30 | #include "xdgshellclient.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/surface.h> | 35 | #include <KWayland/Client/surface.h> | ||
36 | 36 | | |||
37 | #include <QDBusArgument> | 37 | #include <QDBusArgument> | ||
38 | #include <QDBusConnection> | 38 | #include <QDBusConnection> | ||
Show All 25 Lines | 58 | private Q_SLOTS: | |||
64 | void testGetWindowInfoXdgShellClient_data(); | 64 | void testGetWindowInfoXdgShellClient_data(); | ||
65 | void testGetWindowInfoXdgShellClient(); | 65 | void testGetWindowInfoXdgShellClient(); | ||
66 | void testGetWindowInfoX11Client(); | 66 | void testGetWindowInfoX11Client(); | ||
67 | }; | 67 | }; | ||
68 | 68 | | |||
69 | void TestDbusInterface::initTestCase() | 69 | void TestDbusInterface::initTestCase() | ||
70 | { | 70 | { | ||
71 | qRegisterMetaType<KWin::Deleted*>(); | 71 | qRegisterMetaType<KWin::Deleted*>(); | ||
72 | qRegisterMetaType<KWin::XdgShellClient *>(); | | |||
73 | qRegisterMetaType<KWin::AbstractClient*>(); | 72 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
74 | 73 | | |||
75 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 74 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
76 | QVERIFY(workspaceCreatedSpy.isValid()); | 75 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
77 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 76 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
78 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 77 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
79 | 78 | | |||
80 | kwinApp()->start(); | 79 | kwinApp()->start(); | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 123 | { | |||
130 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | 129 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(type, surface.data())); | ||
131 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | 130 | shellSurface->setAppId(QByteArrayLiteral("org.kde.foo")); | ||
132 | shellSurface->setTitle(QStringLiteral("Test window")); | 131 | shellSurface->setTitle(QStringLiteral("Test window")); | ||
133 | 132 | | |||
134 | // now let's render | 133 | // now let's render | ||
135 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | 134 | Test::render(surface.data(), QSize(100, 50), Qt::blue); | ||
136 | QVERIFY(clientAddedSpy.isEmpty()); | 135 | QVERIFY(clientAddedSpy.isEmpty()); | ||
137 | QVERIFY(clientAddedSpy.wait()); | 136 | QVERIFY(clientAddedSpy.wait()); | ||
138 | auto client = clientAddedSpy.first().first().value<XdgShellClient *>(); | 137 | auto client = clientAddedSpy.first().first().value<AbstractClient *>(); | ||
139 | QVERIFY(client); | 138 | QVERIFY(client); | ||
140 | 139 | | |||
141 | // let's get the window info | 140 | // let's get the window info | ||
142 | QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())}; | 141 | QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())}; | ||
143 | reply.waitForFinished(); | 142 | reply.waitForFinished(); | ||
144 | QVERIFY(reply.isValid()); | 143 | QVERIFY(reply.isValid()); | ||
145 | QVERIFY(!reply.isError()); | 144 | QVERIFY(!reply.isError()); | ||
146 | auto windowData = reply.value(); | 145 | auto windowData = reply.value(); | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | |||||
221 | reply = getWindowInfo(client->internalId()); | 220 | reply = getWindowInfo(client->internalId()); | ||
222 | reply.waitForFinished(); | 221 | reply.waitForFinished(); | ||
223 | QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), client->x()); | 222 | QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), client->x()); | ||
224 | QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), client->y()); | 223 | QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), client->y()); | ||
225 | // not testing width, height as that would require window geometry change | 224 | // not testing width, height as that would require window geometry change | ||
226 | 225 | | |||
227 | // finally close window | 226 | // finally close window | ||
228 | const auto id = client->internalId(); | 227 | const auto id = client->internalId(); | ||
229 | QSignalSpy windowClosedSpy(client, &XdgShellClient::windowClosed); | 228 | QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed); | ||
230 | QVERIFY(windowClosedSpy.isValid()); | 229 | QVERIFY(windowClosedSpy.isValid()); | ||
231 | shellSurface.reset(); | 230 | shellSurface.reset(); | ||
232 | surface.reset(); | 231 | surface.reset(); | ||
233 | QVERIFY(windowClosedSpy.wait()); | 232 | QVERIFY(windowClosedSpy.wait()); | ||
234 | QCOMPARE(windowClosedSpy.count(), 1); | 233 | QCOMPARE(windowClosedSpy.count(), 1); | ||
235 | 234 | | |||
236 | reply = getWindowInfo(id); | 235 | reply = getWindowInfo(id); | ||
237 | reply.waitForFinished(); | 236 | reply.waitForFinished(); | ||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |