Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/kwinbindings_test.cpp
Show All 23 Lines | |||||
24 | #include "screens.h" | 24 | #include "screens.h" | ||
25 | #include "shell_client.h" | 25 | #include "shell_client.h" | ||
26 | #include "scripting/scripting.h" | 26 | #include "scripting/scripting.h" | ||
27 | #include "useractions.h" | 27 | #include "useractions.h" | ||
28 | #include "virtualdesktops.h" | 28 | #include "virtualdesktops.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | #include "workspace.h" | 30 | #include "workspace.h" | ||
31 | 31 | | |||
32 | #include <KWayland/Client/shell.h> | | |||
33 | #include <KWayland/Client/surface.h> | 32 | #include <KWayland/Client/surface.h> | ||
34 | 33 | | |||
35 | #include <QDBusConnection> | 34 | #include <QDBusConnection> | ||
36 | #include <QDBusMessage> | 35 | #include <QDBusMessage> | ||
37 | #include <QDBusPendingReply> | 36 | #include <QDBusPendingReply> | ||
38 | 37 | | |||
39 | using namespace KWin; | 38 | using namespace KWin; | ||
40 | using namespace KWayland::Client; | 39 | using namespace KWayland::Client; | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
83 | { | 82 | { | ||
84 | Test::destroyWaylandConnection(); | 83 | Test::destroyWaylandConnection(); | ||
85 | } | 84 | } | ||
86 | 85 | | |||
87 | void KWinBindingsTest::testSwitchWindow() | 86 | void KWinBindingsTest::testSwitchWindow() | ||
88 | { | 87 | { | ||
89 | // first create windows | 88 | // first create windows | ||
90 | QScopedPointer<Surface> surface1(Test::createSurface()); | 89 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
91 | QScopedPointer<ShellSurface> shellSurface1(Test::createShellSurface(surface1.data())); | 90 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
92 | auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 91 | auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
93 | QScopedPointer<Surface> surface2(Test::createSurface()); | 92 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
94 | QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data())); | 93 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
95 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 94 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
96 | QScopedPointer<Surface> surface3(Test::createSurface()); | 95 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
97 | QScopedPointer<ShellSurface> shellSurface3(Test::createShellSurface(surface3.data())); | 96 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
98 | auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 97 | auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
99 | QScopedPointer<Surface> surface4(Test::createSurface()); | 98 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
100 | QScopedPointer<ShellSurface> shellSurface4(Test::createShellSurface(surface4.data())); | 99 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
101 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 100 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
102 | 101 | | |||
103 | QVERIFY(c4->isActive()); | 102 | QVERIFY(c4->isActive()); | ||
104 | QVERIFY(c4 != c3); | 103 | QVERIFY(c4 != c3); | ||
105 | QVERIFY(c3 != c2); | 104 | QVERIFY(c3 != c2); | ||
106 | QVERIFY(c2 != c1); | 105 | QVERIFY(c2 != c1); | ||
107 | 106 | | |||
108 | // let's position all windows | 107 | // let's position all windows | ||
Show All 34 Lines | |||||
143 | } | 142 | } | ||
144 | 143 | | |||
145 | void KWinBindingsTest::testSwitchWindowScript() | 144 | void KWinBindingsTest::testSwitchWindowScript() | ||
146 | { | 145 | { | ||
147 | QVERIFY(Scripting::self()); | 146 | QVERIFY(Scripting::self()); | ||
148 | 147 | | |||
149 | // first create windows | 148 | // first create windows | ||
150 | QScopedPointer<Surface> surface1(Test::createSurface()); | 149 | QScopedPointer<Surface> surface1(Test::createSurface()); | ||
151 | QScopedPointer<ShellSurface> shellSurface1(Test::createShellSurface(surface1.data())); | 150 | QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data())); | ||
152 | auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | 151 | auto c1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue); | ||
153 | QScopedPointer<Surface> surface2(Test::createSurface()); | 152 | QScopedPointer<Surface> surface2(Test::createSurface()); | ||
154 | QScopedPointer<ShellSurface> shellSurface2(Test::createShellSurface(surface2.data())); | 153 | QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data())); | ||
155 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | 154 | auto c2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue); | ||
156 | QScopedPointer<Surface> surface3(Test::createSurface()); | 155 | QScopedPointer<Surface> surface3(Test::createSurface()); | ||
157 | QScopedPointer<ShellSurface> shellSurface3(Test::createShellSurface(surface3.data())); | 156 | QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data())); | ||
158 | auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | 157 | auto c3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue); | ||
159 | QScopedPointer<Surface> surface4(Test::createSurface()); | 158 | QScopedPointer<Surface> surface4(Test::createSurface()); | ||
160 | QScopedPointer<ShellSurface> shellSurface4(Test::createShellSurface(surface4.data())); | 159 | QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data())); | ||
161 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | 160 | auto c4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue); | ||
162 | 161 | | |||
163 | QVERIFY(c4->isActive()); | 162 | QVERIFY(c4->isActive()); | ||
164 | QVERIFY(c4 != c3); | 163 | QVERIFY(c4 != c3); | ||
165 | QVERIFY(c3 != c2); | 164 | QVERIFY(c3 != c2); | ||
166 | QVERIFY(c2 != c1); | 165 | QVERIFY(c2 != c1); | ||
167 | 166 | | |||
168 | // let's position all windows | 167 | // let's position all windows | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
226 | 225 | | |||
227 | void KWinBindingsTest::testWindowToDesktop() | 226 | void KWinBindingsTest::testWindowToDesktop() | ||
228 | { | 227 | { | ||
229 | // first go to desktop one | 228 | // first go to desktop one | ||
230 | VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first()); | 229 | VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().first()); | ||
231 | 230 | | |||
232 | // now create a window | 231 | // now create a window | ||
233 | QScopedPointer<Surface> surface(Test::createSurface()); | 232 | QScopedPointer<Surface> surface(Test::createSurface()); | ||
234 | QScopedPointer<ShellSurface> shellSurface(Test::createShellSurface(surface.data())); | 233 | QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); | ||
235 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | 234 | auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); | ||
236 | QSignalSpy desktopChangedSpy(c, &AbstractClient::desktopChanged); | 235 | QSignalSpy desktopChangedSpy(c, &AbstractClient::desktopChanged); | ||
237 | QVERIFY(desktopChangedSpy.isValid()); | 236 | QVERIFY(desktopChangedSpy.isValid()); | ||
238 | QCOMPARE(workspace()->activeClient(), c); | 237 | QCOMPARE(workspace()->activeClient(), c); | ||
239 | 238 | | |||
240 | QFETCH(int, desktop); | 239 | QFETCH(int, desktop); | ||
241 | VirtualDesktopManager::self()->setCount(desktop); | 240 | VirtualDesktopManager::self()->setCount(desktop); | ||
242 | 241 | | |||
Show All 25 Lines |