Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/x11_client_test.cpp
Show All 18 Lines | |||||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "kwin_wayland_test.h" | 20 | #include "kwin_wayland_test.h" | ||
21 | #include "atoms.h" | 21 | #include "atoms.h" | ||
22 | #include "client.h" | 22 | #include "client.h" | ||
23 | #include "composite.h" | 23 | #include "composite.h" | ||
24 | #include "effects.h" | 24 | #include "effects.h" | ||
25 | #include "effectloader.h" | 25 | #include "effectloader.h" | ||
26 | #include "cursor.h" | 26 | #include "cursor.h" | ||
27 | #include "deleted.h" | ||||
27 | #include "platform.h" | 28 | #include "platform.h" | ||
28 | #include "screens.h" | 29 | #include "screens.h" | ||
29 | #include "shell_client.h" | 30 | #include "shell_client.h" | ||
30 | #include "wayland_server.h" | 31 | #include "wayland_server.h" | ||
31 | #include "workspace.h" | 32 | #include "workspace.h" | ||
32 | 33 | | |||
33 | #include <KWayland/Client/surface.h> | 34 | #include <KWayland/Client/surface.h> | ||
34 | #include <KWayland/Client/shell.h> | 35 | #include <KWayland/Client/shell.h> | ||
Show All 20 Lines | 47 | private Q_SLOTS: | |||
55 | void testCaptionChanges(); | 56 | void testCaptionChanges(); | ||
56 | void testCaptionWmName(); | 57 | void testCaptionWmName(); | ||
57 | void testCaptionMultipleWindows(); | 58 | void testCaptionMultipleWindows(); | ||
58 | void testFullscreenWindowGroups(); | 59 | void testFullscreenWindowGroups(); | ||
59 | }; | 60 | }; | ||
60 | 61 | | |||
61 | void X11ClientTest::initTestCase() | 62 | void X11ClientTest::initTestCase() | ||
62 | { | 63 | { | ||
64 | qRegisterMetaType<KWin::Deleted*>(); | ||||
63 | qRegisterMetaType<KWin::ShellClient*>(); | 65 | qRegisterMetaType<KWin::ShellClient*>(); | ||
64 | qRegisterMetaType<KWin::AbstractClient*>(); | 66 | qRegisterMetaType<KWin::AbstractClient*>(); | ||
65 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | 67 | QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); | ||
66 | QVERIFY(workspaceCreatedSpy.isValid()); | 68 | QVERIFY(workspaceCreatedSpy.isValid()); | ||
67 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | 69 | kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); | ||
68 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | 70 | QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); | ||
69 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | 71 | kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); | ||
70 | 72 | | |||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 99 | { | |||
126 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 128 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
127 | QVERIFY(windowCreatedSpy.isValid()); | 129 | QVERIFY(windowCreatedSpy.isValid()); | ||
128 | QVERIFY(windowCreatedSpy.wait()); | 130 | QVERIFY(windowCreatedSpy.wait()); | ||
129 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 131 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | ||
130 | QVERIFY(client); | 132 | QVERIFY(client); | ||
131 | QCOMPARE(client->window(), w); | 133 | QCOMPARE(client->window(), w); | ||
132 | QVERIFY(client->caption() != QString::fromUtf8(origTitle)); | 134 | QVERIFY(client->caption() != QString::fromUtf8(origTitle)); | ||
133 | QCOMPARE(client->caption(), QString::fromUtf8(origTitle).simplified()); | 135 | QCOMPARE(client->caption(), QString::fromUtf8(origTitle).simplified()); | ||
134 | 136 | | |||
135 | // and destroy the window again | 137 | // and destroy the window again | ||
136 | xcb_unmap_window(c.data(), w); | 138 | xcb_unmap_window(c.data(), w); | ||
137 | xcb_flush(c.data()); | 139 | xcb_flush(c.data()); | ||
138 | 140 | | |||
139 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | 141 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | ||
zzag: Is it a good place for this test? It looks like this test verifies some caption stuff. | |||||
No, it's not. Somehow I followed the ShellClient test and assumed the first test method is generic. Will move to testX11WindowId graesslin: No, it's not. Somehow I followed the ShellClient test and assumed the first test method is… | |||||
140 | QVERIFY(windowClosedSpy.isValid()); | 142 | QVERIFY(windowClosedSpy.isValid()); | ||
141 | QVERIFY(windowClosedSpy.wait()); | 143 | QVERIFY(windowClosedSpy.wait()); | ||
142 | xcb_destroy_window(c.data(), w); | 144 | xcb_destroy_window(c.data(), w); | ||
143 | c.reset(); | 145 | c.reset(); | ||
144 | } | 146 | } | ||
145 | 147 | | |||
146 | void X11ClientTest::testFullscreenLayerWithActiveWaylandWindow() | 148 | void X11ClientTest::testFullscreenLayerWithActiveWaylandWindow() | ||
147 | { | 149 | { | ||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Line(s) | 328 | { | |||
347 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | 349 | QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); | ||
348 | QVERIFY(windowCreatedSpy.isValid()); | 350 | QVERIFY(windowCreatedSpy.isValid()); | ||
349 | QVERIFY(windowCreatedSpy.wait()); | 351 | QVERIFY(windowCreatedSpy.wait()); | ||
350 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | 352 | Client *client = windowCreatedSpy.first().first().value<Client*>(); | ||
351 | QVERIFY(client); | 353 | QVERIFY(client); | ||
352 | QCOMPARE(client->windowId(), w); | 354 | QCOMPARE(client->windowId(), w); | ||
353 | QVERIFY(client->isActive()); | 355 | QVERIFY(client->isActive()); | ||
354 | QCOMPARE(client->window(), w); | 356 | QCOMPARE(client->window(), w); | ||
357 | QCOMPARE(client->internalId().isNull(), false); | ||||
358 | const auto uuid = client->internalId(); | ||||
359 | QUuid deletedUuid; | ||||
360 | QCOMPARE(deletedUuid.isNull(), true); | ||||
361 | | ||||
362 | connect(client, &Client::windowClosed, this, [&deletedUuid] (Toplevel *, Deleted *d) { deletedUuid = d->internalId(); }); | ||||
363 | | ||||
355 | 364 | | |||
356 | NETRootInfo rootInfo(c.data(), NET::WMAllProperties); | 365 | NETRootInfo rootInfo(c.data(), NET::WMAllProperties); | ||
357 | QCOMPARE(rootInfo.activeWindow(), client->window()); | 366 | QCOMPARE(rootInfo.activeWindow(), client->window()); | ||
358 | 367 | | |||
359 | // activate a wayland window | 368 | // activate a wayland window | ||
360 | QScopedPointer<Surface> surface(Test::createSurface()); | 369 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
361 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 370 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | ||
362 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 371 | auto waylandClient = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
Show All 11 Lines | |||||
374 | 383 | | |||
375 | QTRY_VERIFY(client->isActive()); | 384 | QTRY_VERIFY(client->isActive()); | ||
376 | NETRootInfo rootInfo3(c.data(), NET::WMAllProperties); | 385 | NETRootInfo rootInfo3(c.data(), NET::WMAllProperties); | ||
377 | QCOMPARE(rootInfo3.activeWindow(), client->window()); | 386 | QCOMPARE(rootInfo3.activeWindow(), client->window()); | ||
378 | 387 | | |||
379 | // and destroy the window again | 388 | // and destroy the window again | ||
380 | xcb_unmap_window(c.data(), w); | 389 | xcb_unmap_window(c.data(), w); | ||
381 | xcb_flush(c.data()); | 390 | xcb_flush(c.data()); | ||
391 | QSignalSpy windowClosedSpy(client, &Client::windowClosed); | ||||
392 | QVERIFY(windowClosedSpy.isValid()); | ||||
393 | QVERIFY(windowClosedSpy.wait()); | ||||
394 | | ||||
395 | QCOMPARE(deletedUuid.isNull(), false); | ||||
396 | QCOMPARE(deletedUuid, uuid); | ||||
382 | } | 397 | } | ||
383 | 398 | | |||
384 | void X11ClientTest::testCaptionChanges() | 399 | void X11ClientTest::testCaptionChanges() | ||
385 | { | 400 | { | ||
386 | // verifies that caption is updated correctly when the X11 window updates it | 401 | // verifies that caption is updated correctly when the X11 window updates it | ||
387 | // BUG: 383444 | 402 | // BUG: 383444 | ||
388 | QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr)); | 403 | QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr)); | ||
389 | QVERIFY(!xcb_connection_has_error(c.data())); | 404 | QVERIFY(!xcb_connection_has_error(c.data())); | ||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |
Is it a good place for this test? It looks like this test verifies some caption stuff.