Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/decoration_input_test.cpp
Show All 34 Lines | |||||
35 | #include "decorations/decorationbridge.h" | 35 | #include "decorations/decorationbridge.h" | ||
36 | #include "decorations/settings.h" | 36 | #include "decorations/settings.h" | ||
37 | 37 | | |||
38 | #include <KWayland/Client/connection_thread.h> | 38 | #include <KWayland/Client/connection_thread.h> | ||
39 | #include <KWayland/Client/compositor.h> | 39 | #include <KWayland/Client/compositor.h> | ||
40 | #include <KWayland/Client/keyboard.h> | 40 | #include <KWayland/Client/keyboard.h> | ||
41 | #include <KWayland/Client/pointer.h> | 41 | #include <KWayland/Client/pointer.h> | ||
42 | #include <KWayland/Client/server_decoration.h> | 42 | #include <KWayland/Client/server_decoration.h> | ||
43 | #include <KWayland/Client/shell.h> | | |||
44 | #include <KWayland/Client/seat.h> | 43 | #include <KWayland/Client/seat.h> | ||
45 | #include <KWayland/Client/shm_pool.h> | 44 | #include <KWayland/Client/shm_pool.h> | ||
46 | #include <KWayland/Client/surface.h> | 45 | #include <KWayland/Client/surface.h> | ||
47 | 46 | | |||
48 | #include <KDecoration2/Decoration> | 47 | #include <KDecoration2/Decoration> | ||
49 | #include <KDecoration2/DecorationSettings> | 48 | #include <KDecoration2/DecorationSettings> | ||
50 | 49 | | |||
51 | #include <linux/input.h> | 50 | #include <linux/input.h> | ||
Show All 31 Lines | 62 | private Q_SLOTS: | |||
83 | void testModifierScrollOpacity_data(); | 82 | void testModifierScrollOpacity_data(); | ||
84 | void testModifierScrollOpacity(); | 83 | void testModifierScrollOpacity(); | ||
85 | void testTouchEvents_data(); | 84 | void testTouchEvents_data(); | ||
86 | void testTouchEvents(); | 85 | void testTouchEvents(); | ||
87 | void testTooltipDoesntEatKeyEvents_data(); | 86 | void testTooltipDoesntEatKeyEvents_data(); | ||
88 | void testTooltipDoesntEatKeyEvents(); | 87 | void testTooltipDoesntEatKeyEvents(); | ||
89 | 88 | | |||
90 | private: | 89 | private: | ||
91 | AbstractClient *showWindow(Test::ShellSurfaceType type); | 90 | AbstractClient *showWindow(Test::XdgShellSurfaceType type); | ||
92 | }; | 91 | }; | ||
93 | 92 | | |||
94 | #define MOTION(target) \ | 93 | #define MOTION(target) \ | ||
95 | kwinApp()->platform()->pointerMotion(target, timestamp++) | 94 | kwinApp()->platform()->pointerMotion(target, timestamp++) | ||
96 | 95 | | |||
97 | #define PRESS \ | 96 | #define PRESS \ | ||
98 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++) | 97 | kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++) | ||
99 | 98 | | |||
100 | #define RELEASE \ | 99 | #define RELEASE \ | ||
101 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) | 100 | kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++) | ||
102 | 101 | | |||
103 | AbstractClient *DecorationInputTest::showWindow(Test::ShellSurfaceType type) | 102 | AbstractClient *DecorationInputTest::showWindow(Test::XdgShellSurfaceType type) | ||
104 | { | 103 | { | ||
105 | using namespace KWayland::Client; | 104 | using namespace KWayland::Client; | ||
106 | #define VERIFY(statement) \ | 105 | #define VERIFY(statement) \ | ||
107 | if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ | 106 | if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ | ||
108 | return nullptr; | 107 | return nullptr; | ||
109 | #define COMPARE(actual, expected) \ | 108 | #define COMPARE(actual, expected) \ | ||
110 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | 109 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | ||
111 | return nullptr; | 110 | return nullptr; | ||
112 | 111 | | |||
113 | Surface *surface = Test::createSurface(Test::waylandCompositor()); | 112 | Surface *surface = Test::createSurface(Test::waylandCompositor()); | ||
114 | VERIFY(surface); | 113 | VERIFY(surface); | ||
115 | auto shellSurface = Test::createShellSurface(type, surface, surface); | 114 | XdgShellSurface *shellSurface = Test::createXdgShellSurface(type, surface, surface); | ||
116 | VERIFY(shellSurface); | 115 | VERIFY(shellSurface); | ||
117 | auto deco = Test::waylandServerSideDecoration()->create(surface, surface); | 116 | auto deco = Test::waylandServerSideDecoration()->create(surface, surface); | ||
118 | QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); | 117 | QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged); | ||
119 | VERIFY(decoSpy.isValid()); | 118 | VERIFY(decoSpy.isValid()); | ||
120 | VERIFY(decoSpy.wait()); | 119 | VERIFY(decoSpy.wait()); | ||
121 | deco->requestMode(ServerSideDecoration::Mode::Server); | 120 | deco->requestMode(ServerSideDecoration::Mode::Server); | ||
122 | VERIFY(decoSpy.wait()); | 121 | VERIFY(decoSpy.wait()); | ||
123 | COMPARE(deco->mode(), ServerSideDecoration::Mode::Server); | 122 | COMPARE(deco->mode(), ServerSideDecoration::Mode::Server); | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
175 | { | 174 | { | ||
176 | Test::destroyWaylandConnection(); | 175 | Test::destroyWaylandConnection(); | ||
177 | } | 176 | } | ||
178 | 177 | | |||
179 | void DecorationInputTest::testAxis_data() | 178 | void DecorationInputTest::testAxis_data() | ||
180 | { | 179 | { | ||
181 | QTest::addColumn<QPoint>("decoPoint"); | 180 | QTest::addColumn<QPoint>("decoPoint"); | ||
182 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | 181 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | ||
183 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 182 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
184 | 183 | | |||
185 | QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; | 184 | QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
186 | QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell; | 185 | QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
187 | QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; | 186 | QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
188 | QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; | 187 | QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
189 | QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; | 188 | QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
190 | QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; | 189 | QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
191 | QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; | 190 | QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
192 | QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; | 191 | QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
193 | QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; | 192 | QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
194 | QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; | | |||
195 | QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; | | |||
196 | QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; | | |||
197 | } | 193 | } | ||
198 | 194 | | |||
199 | void DecorationInputTest::testAxis() | 195 | void DecorationInputTest::testAxis() | ||
200 | { | 196 | { | ||
201 | QFETCH(Test::ShellSurfaceType, type); | 197 | QFETCH(Test::XdgShellSurfaceType, type); | ||
202 | AbstractClient *c = showWindow(type); | 198 | AbstractClient *c = showWindow(type); | ||
203 | QVERIFY(c); | 199 | QVERIFY(c); | ||
204 | QVERIFY(c->isDecorated()); | 200 | QVERIFY(c->isDecorated()); | ||
205 | QVERIFY(!c->noBorder()); | 201 | QVERIFY(!c->noBorder()); | ||
206 | QCOMPARE(c->titlebarPosition(), AbstractClient::PositionTop); | 202 | QCOMPARE(c->titlebarPosition(), AbstractClient::PositionTop); | ||
207 | QVERIFY(!c->keepAbove()); | 203 | QVERIFY(!c->keepAbove()); | ||
208 | QVERIFY(!c->keepBelow()); | 204 | QVERIFY(!c->keepBelow()); | ||
209 | 205 | | |||
Show All 25 Lines | |||||
235 | QVERIFY(!c->keepBelow()); | 231 | QVERIFY(!c->keepBelow()); | ||
236 | QVERIFY(!c->keepAbove()); | 232 | QVERIFY(!c->keepAbove()); | ||
237 | } | 233 | } | ||
238 | 234 | | |||
239 | void DecorationInputTest::testDoubleClick_data() | 235 | void DecorationInputTest::testDoubleClick_data() | ||
240 | { | 236 | { | ||
241 | QTest::addColumn<QPoint>("decoPoint"); | 237 | QTest::addColumn<QPoint>("decoPoint"); | ||
242 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | 238 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | ||
243 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 239 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
244 | 240 | | |||
245 | QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; | 241 | QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
246 | QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::WlShell; | 242 | QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
247 | QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; | 243 | QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
248 | QTest::newRow("topLeft|xdgv5") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; | 244 | QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
249 | QTest::newRow("top|xdgv5") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; | 245 | QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
250 | QTest::newRow("topRight|xdgv5") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; | 246 | QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
251 | QTest::newRow("topLeft|xdgv6") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; | 247 | QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
252 | QTest::newRow("top|xdgv6") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; | 248 | QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
253 | QTest::newRow("topRight|xdgv6") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; | 249 | QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
254 | QTest::newRow("topLeft|xdgWmBase") << QPoint(0, 0) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; | | |||
255 | QTest::newRow("top|xdgWmBase") << QPoint(250, 0) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; | | |||
256 | QTest::newRow("topRight|xdgWmBase") << QPoint(499, 0) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; | | |||
257 | } | 250 | } | ||
258 | 251 | | |||
259 | void KWin::DecorationInputTest::testDoubleClick() | 252 | void KWin::DecorationInputTest::testDoubleClick() | ||
260 | { | 253 | { | ||
261 | QFETCH(Test::ShellSurfaceType, type); | 254 | QFETCH(Test::XdgShellSurfaceType, type); | ||
262 | AbstractClient *c = showWindow(type); | 255 | AbstractClient *c = showWindow(type); | ||
263 | QVERIFY(c); | 256 | QVERIFY(c); | ||
264 | QVERIFY(c->isDecorated()); | 257 | QVERIFY(c->isDecorated()); | ||
265 | QVERIFY(!c->noBorder()); | 258 | QVERIFY(!c->noBorder()); | ||
266 | QVERIFY(!c->isOnAllDesktops()); | 259 | QVERIFY(!c->isOnAllDesktops()); | ||
267 | quint32 timestamp = 1; | 260 | quint32 timestamp = 1; | ||
268 | MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2)); | 261 | MOTION(QPoint(c->geometry().center().x(), c->clientPos().y() / 2)); | ||
269 | 262 | | |||
Show All 26 Lines | |||||
296 | RELEASE; | 289 | RELEASE; | ||
297 | QVERIFY(c->isOnAllDesktops()); | 290 | QVERIFY(c->isOnAllDesktops()); | ||
298 | } | 291 | } | ||
299 | 292 | | |||
300 | void DecorationInputTest::testDoubleTap_data() | 293 | void DecorationInputTest::testDoubleTap_data() | ||
301 | { | 294 | { | ||
302 | QTest::addColumn<QPoint>("decoPoint"); | 295 | QTest::addColumn<QPoint>("decoPoint"); | ||
303 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | 296 | QTest::addColumn<Qt::WindowFrameSection>("expectedSection"); | ||
304 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 297 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
305 | 298 | | |||
306 | QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::WlShell; | 299 | QTest::newRow("topLeft|xdgv5") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
307 | QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::WlShell; | 300 | QTest::newRow("top|xdgv5") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
308 | QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::WlShell; | 301 | QTest::newRow("topRight|xdgv5") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV5; | ||
309 | QTest::newRow("topLeft|xdgv5") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV5; | 302 | QTest::newRow("topLeft|xdgv6") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
310 | QTest::newRow("top|xdgv5") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV5; | 303 | QTest::newRow("top|xdgv6") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
311 | QTest::newRow("topRight|xdgv5") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV5; | 304 | QTest::newRow("topRight|xdgv6") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellV6; | ||
312 | QTest::newRow("topLeft|xdgv6") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellV6; | 305 | QTest::newRow("topLeft|xdgWmBase") << QPoint(10, 10) << Qt::TopLeftSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
313 | QTest::newRow("top|xdgv6") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellV6; | 306 | QTest::newRow("top|xdgWmBase") << QPoint(260, 10) << Qt::TopSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
314 | QTest::newRow("topRight|xdgv6") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellV6; | 307 | QTest::newRow("topRight|xdgWmBase") << QPoint(509, 10) << Qt::TopRightSection << Test::XdgShellSurfaceType::XdgShellStable; | ||
315 | QTest::newRow("topLeft|xdgWmBase") << QPoint(10, 10) << Qt::TopLeftSection << Test::ShellSurfaceType::XdgShellStable; | | |||
316 | QTest::newRow("top|xdgWmBase") << QPoint(260, 10) << Qt::TopSection << Test::ShellSurfaceType::XdgShellStable; | | |||
317 | QTest::newRow("topRight|xdgWmBase") << QPoint(509, 10) << Qt::TopRightSection << Test::ShellSurfaceType::XdgShellStable; | | |||
318 | } | 308 | } | ||
319 | 309 | | |||
320 | void KWin::DecorationInputTest::testDoubleTap() | 310 | void KWin::DecorationInputTest::testDoubleTap() | ||
321 | { | 311 | { | ||
322 | QFETCH(Test::ShellSurfaceType, type); | 312 | QFETCH(Test::XdgShellSurfaceType, type); | ||
323 | AbstractClient *c = showWindow(type); | 313 | AbstractClient *c = showWindow(type); | ||
324 | QVERIFY(c); | 314 | QVERIFY(c); | ||
325 | QVERIFY(c->isDecorated()); | 315 | QVERIFY(c->isDecorated()); | ||
326 | QVERIFY(!c->noBorder()); | 316 | QVERIFY(!c->noBorder()); | ||
327 | QVERIFY(!c->isOnAllDesktops()); | 317 | QVERIFY(!c->isOnAllDesktops()); | ||
328 | quint32 timestamp = 1; | 318 | quint32 timestamp = 1; | ||
329 | const QPoint tapPoint(c->geometry().center().x(), c->clientPos().y() / 2); | 319 | const QPoint tapPoint(c->geometry().center().x(), c->clientPos().y() / 2); | ||
330 | 320 | | |||
Show All 26 Lines | |||||
357 | QVERIFY(!c->isOnAllDesktops()); | 347 | QVERIFY(!c->isOnAllDesktops()); | ||
358 | kwinApp()->platform()->touchDown(0, decoPoint, timestamp++); | 348 | kwinApp()->platform()->touchDown(0, decoPoint, timestamp++); | ||
359 | kwinApp()->platform()->touchUp(0, timestamp++); | 349 | kwinApp()->platform()->touchUp(0, timestamp++); | ||
360 | QVERIFY(c->isOnAllDesktops()); | 350 | QVERIFY(c->isOnAllDesktops()); | ||
361 | } | 351 | } | ||
362 | 352 | | |||
363 | void DecorationInputTest::testHover_data() | 353 | void DecorationInputTest::testHover_data() | ||
364 | { | 354 | { | ||
365 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 355 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
366 | 356 | | |||
367 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 357 | QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
368 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 358 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
369 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 359 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
370 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
371 | } | 360 | } | ||
372 | 361 | | |||
373 | void DecorationInputTest::testHover() | 362 | void DecorationInputTest::testHover() | ||
374 | { | 363 | { | ||
375 | QFETCH(Test::ShellSurfaceType, type); | 364 | QFETCH(Test::XdgShellSurfaceType, type); | ||
376 | AbstractClient *c = showWindow(type); | 365 | AbstractClient *c = showWindow(type); | ||
377 | QVERIFY(c); | 366 | QVERIFY(c); | ||
378 | QVERIFY(c->isDecorated()); | 367 | QVERIFY(c->isDecorated()); | ||
379 | QVERIFY(!c->noBorder()); | 368 | QVERIFY(!c->noBorder()); | ||
380 | 369 | | |||
381 | // our left border is moved out of the visible area, so move the window to a better place | 370 | // our left border is moved out of the visible area, so move the window to a better place | ||
382 | c->move(QPoint(20, 0)); | 371 | c->move(QPoint(20, 0)); | ||
383 | 372 | | |||
Show All 34 Lines | |||||
418 | QCOMPARE(c->cursor(), CursorShape(Qt::ArrowCursor)); | 407 | QCOMPARE(c->cursor(), CursorShape(Qt::ArrowCursor)); | ||
419 | } | 408 | } | ||
420 | 409 | | |||
421 | void DecorationInputTest::testPressToMove_data() | 410 | void DecorationInputTest::testPressToMove_data() | ||
422 | { | 411 | { | ||
423 | QTest::addColumn<QPoint>("offset"); | 412 | QTest::addColumn<QPoint>("offset"); | ||
424 | QTest::addColumn<QPoint>("offset2"); | 413 | QTest::addColumn<QPoint>("offset2"); | ||
425 | QTest::addColumn<QPoint>("offset3"); | 414 | QTest::addColumn<QPoint>("offset3"); | ||
426 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 415 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
427 | 416 | | |||
428 | QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell; | 417 | QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV5; | ||
429 | QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell; | 418 | QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV5; | ||
430 | QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell; | 419 | QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV5; | ||
431 | QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell; | 420 | QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV5; | ||
432 | QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5; | 421 | QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV6; | ||
433 | QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5; | 422 | QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV6; | ||
434 | QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5; | 423 | QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV6; | ||
435 | QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5; | 424 | QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV6; | ||
436 | QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6; | 425 | QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; | ||
437 | QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6; | 426 | QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; | ||
438 | QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6; | 427 | QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; | ||
439 | QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6; | 428 | QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; | ||
440 | QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellStable; | | |||
441 | QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellStable; | | |||
442 | QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellStable; | | |||
443 | QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellStable; | | |||
444 | } | 429 | } | ||
445 | 430 | | |||
446 | void DecorationInputTest::testPressToMove() | 431 | void DecorationInputTest::testPressToMove() | ||
447 | { | 432 | { | ||
448 | QFETCH(Test::ShellSurfaceType, type); | 433 | QFETCH(Test::XdgShellSurfaceType, type); | ||
449 | AbstractClient *c = showWindow(type); | 434 | AbstractClient *c = showWindow(type); | ||
450 | QVERIFY(c); | 435 | QVERIFY(c); | ||
451 | QVERIFY(c->isDecorated()); | 436 | QVERIFY(c->isDecorated()); | ||
452 | QVERIFY(!c->noBorder()); | 437 | QVERIFY(!c->noBorder()); | ||
453 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | 438 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||
454 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | 439 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | ||
455 | QVERIFY(startMoveResizedSpy.isValid()); | 440 | QVERIFY(startMoveResizedSpy.isValid()); | ||
456 | QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized); | 441 | QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized); | ||
Show All 34 Lines | |||||
491 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | 476 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | ||
492 | } | 477 | } | ||
493 | 478 | | |||
494 | void DecorationInputTest::testTapToMove_data() | 479 | void DecorationInputTest::testTapToMove_data() | ||
495 | { | 480 | { | ||
496 | QTest::addColumn<QPoint>("offset"); | 481 | QTest::addColumn<QPoint>("offset"); | ||
497 | QTest::addColumn<QPoint>("offset2"); | 482 | QTest::addColumn<QPoint>("offset2"); | ||
498 | QTest::addColumn<QPoint>("offset3"); | 483 | QTest::addColumn<QPoint>("offset3"); | ||
499 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 484 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
500 | 485 | | |||
501 | QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::WlShell; | 486 | QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV5; | ||
502 | QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::WlShell; | 487 | QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV5; | ||
503 | QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::WlShell; | 488 | QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV5; | ||
504 | QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::WlShell; | 489 | QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV5; | ||
505 | QTest::newRow("To right|xdgv5") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV5; | 490 | QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellV6; | ||
506 | QTest::newRow("To left|xdgv5") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV5; | 491 | QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellV6; | ||
507 | QTest::newRow("To bottom|xdgv5") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV5; | 492 | QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellV6; | ||
508 | QTest::newRow("To top|xdgv5") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV5; | 493 | QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellV6; | ||
509 | QTest::newRow("To right|xdgv6") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellV6; | 494 | QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::XdgShellSurfaceType::XdgShellStable; | ||
510 | QTest::newRow("To left|xdgv6") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellV6; | 495 | QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::XdgShellSurfaceType::XdgShellStable; | ||
511 | QTest::newRow("To bottom|xdgv6") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellV6; | 496 | QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::XdgShellSurfaceType::XdgShellStable; | ||
512 | QTest::newRow("To top|xdgv6") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellV6; | 497 | QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::XdgShellSurfaceType::XdgShellStable; | ||
513 | QTest::newRow("To right|xdgWmBase") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0) << Test::ShellSurfaceType::XdgShellStable; | | |||
514 | QTest::newRow("To left|xdgWmBase") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0) << Test::ShellSurfaceType::XdgShellStable; | | |||
515 | QTest::newRow("To bottom|xdgWmBase") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30) << Test::ShellSurfaceType::XdgShellStable; | | |||
516 | QTest::newRow("To top|xdgWmBase") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30) << Test::ShellSurfaceType::XdgShellStable; | | |||
517 | } | 498 | } | ||
518 | 499 | | |||
519 | void DecorationInputTest::testTapToMove() | 500 | void DecorationInputTest::testTapToMove() | ||
520 | { | 501 | { | ||
521 | QFETCH(Test::ShellSurfaceType, type); | 502 | QFETCH(Test::XdgShellSurfaceType, type); | ||
522 | AbstractClient *c = showWindow(type); | 503 | AbstractClient *c = showWindow(type); | ||
523 | QVERIFY(c); | 504 | QVERIFY(c); | ||
524 | QVERIFY(c->isDecorated()); | 505 | QVERIFY(c->isDecorated()); | ||
525 | QVERIFY(!c->noBorder()); | 506 | QVERIFY(!c->noBorder()); | ||
526 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | 507 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||
527 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | 508 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | ||
528 | QVERIFY(startMoveResizedSpy.isValid()); | 509 | QVERIFY(startMoveResizedSpy.isValid()); | ||
529 | QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized); | 510 | QSignalSpy clientFinishUserMovedResizedSpy(c, &AbstractClient::clientFinishUserMovedResized); | ||
Show All 32 Lines | |||||
562 | QTRY_VERIFY(!c->isMove()); | 543 | QTRY_VERIFY(!c->isMove()); | ||
563 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); | 544 | QCOMPARE(clientFinishUserMovedResizedSpy.count(), 2); | ||
564 | // TODO: the offset should also be included | 545 | // TODO: the offset should also be included | ||
565 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | 546 | QCOMPARE(c->pos(), oldPos + offset2 + offset3); | ||
566 | } | 547 | } | ||
567 | 548 | | |||
568 | void DecorationInputTest::testResizeOutsideWindow_data() | 549 | void DecorationInputTest::testResizeOutsideWindow_data() | ||
569 | { | 550 | { | ||
570 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 551 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
571 | QTest::addColumn<Qt::Edge>("edge"); | 552 | QTest::addColumn<Qt::Edge>("edge"); | ||
572 | QTest::addColumn<Qt::CursorShape>("expectedCursor"); | 553 | QTest::addColumn<Qt::CursorShape>("expectedCursor"); | ||
573 | 554 | | |||
574 | QTest::newRow("wlShell - left") << Test::ShellSurfaceType::WlShell << Qt::LeftEdge << Qt::SizeHorCursor; | 555 | QTest::newRow("xdgShellV5 - left") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor; | ||
575 | QTest::newRow("xdgShellV5 - left") << Test::ShellSurfaceType::XdgShellV5 << Qt::LeftEdge << Qt::SizeHorCursor; | 556 | QTest::newRow("xdgShellV6 - left") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::LeftEdge << Qt::SizeHorCursor; | ||
576 | QTest::newRow("xdgShellV6 - left") << Test::ShellSurfaceType::XdgShellV6 << Qt::LeftEdge << Qt::SizeHorCursor; | 557 | QTest::newRow("xdgWmBase - left") << Test::XdgShellSurfaceType::XdgShellStable << Qt::LeftEdge << Qt::SizeHorCursor; | ||
577 | QTest::newRow("xdgWmBase - left") << Test::ShellSurfaceType::XdgShellStable << Qt::LeftEdge << Qt::SizeHorCursor; | 558 | QTest::newRow("xdgShellV5 - right") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor; | ||
578 | QTest::newRow("wlShell - right") << Test::ShellSurfaceType::WlShell << Qt::RightEdge << Qt::SizeHorCursor; | 559 | QTest::newRow("xdgShellV6 - right") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::RightEdge << Qt::SizeHorCursor; | ||
579 | QTest::newRow("xdgShellV5 - right") << Test::ShellSurfaceType::XdgShellV5 << Qt::RightEdge << Qt::SizeHorCursor; | 560 | QTest::newRow("xdgWmBase - right") << Test::XdgShellSurfaceType::XdgShellStable << Qt::RightEdge << Qt::SizeHorCursor; | ||
580 | QTest::newRow("xdgShellV6 - right") << Test::ShellSurfaceType::XdgShellV6 << Qt::RightEdge << Qt::SizeHorCursor; | 561 | QTest::newRow("xdgShellV5 - bottom") << Test::XdgShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor; | ||
581 | QTest::newRow("xdgWmBase - right") << Test::ShellSurfaceType::XdgShellStable << Qt::RightEdge << Qt::SizeHorCursor; | 562 | QTest::newRow("xdgShellV6 - bottom") << Test::XdgShellSurfaceType::XdgShellV6 << Qt::BottomEdge << Qt::SizeVerCursor; | ||
582 | QTest::newRow("wlShell - bottom") << Test::ShellSurfaceType::WlShell << Qt::BottomEdge << Qt::SizeVerCursor; | 563 | QTest::newRow("xdgWmBase - bottom") << Test::XdgShellSurfaceType::XdgShellStable << Qt::BottomEdge << Qt::SizeVerCursor; | ||
583 | QTest::newRow("xdgShellV5 - bottom") << Test::ShellSurfaceType::XdgShellV5 << Qt::BottomEdge << Qt::SizeVerCursor; | | |||
584 | QTest::newRow("xdgShellV6 - bottom") << Test::ShellSurfaceType::XdgShellV6 << Qt::BottomEdge << Qt::SizeVerCursor; | | |||
585 | QTest::newRow("xdgWmBase - bottom") << Test::ShellSurfaceType::XdgShellStable << Qt::BottomEdge << Qt::SizeVerCursor; | | |||
586 | } | 564 | } | ||
587 | 565 | | |||
588 | void DecorationInputTest::testResizeOutsideWindow() | 566 | void DecorationInputTest::testResizeOutsideWindow() | ||
589 | { | 567 | { | ||
590 | // this test verifies that one can resize the window outside the decoration with NoSideBorder | 568 | // this test verifies that one can resize the window outside the decoration with NoSideBorder | ||
591 | 569 | | |||
592 | // first adjust config | 570 | // first adjust config | ||
593 | kwinApp()->config()->group("org.kde.kdecoration2").writeEntry("BorderSize", QStringLiteral("None")); | 571 | kwinApp()->config()->group("org.kde.kdecoration2").writeEntry("BorderSize", QStringLiteral("None")); | ||
594 | kwinApp()->config()->sync(); | 572 | kwinApp()->config()->sync(); | ||
595 | workspace()->slotReconfigure(); | 573 | workspace()->slotReconfigure(); | ||
596 | 574 | | |||
597 | // now create window | 575 | // now create window | ||
598 | QFETCH(Test::ShellSurfaceType, type); | 576 | QFETCH(Test::XdgShellSurfaceType, type); | ||
599 | AbstractClient *c = showWindow(type); | 577 | AbstractClient *c = showWindow(type); | ||
600 | QVERIFY(c); | 578 | QVERIFY(c); | ||
601 | QVERIFY(c->isDecorated()); | 579 | QVERIFY(c->isDecorated()); | ||
602 | QVERIFY(!c->noBorder()); | 580 | QVERIFY(!c->noBorder()); | ||
603 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | 581 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||
604 | QVERIFY(c->geometry() != c->inputGeometry()); | 582 | QVERIFY(c->geometry() != c->inputGeometry()); | ||
605 | QVERIFY(c->inputGeometry().contains(c->geometry())); | 583 | QVERIFY(c->inputGeometry().contains(c->geometry())); | ||
606 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | 584 | QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); | ||
Show All 28 Lines | |||||
635 | } | 613 | } | ||
636 | 614 | | |||
637 | void DecorationInputTest::testModifierClickUnrestrictedMove_data() | 615 | void DecorationInputTest::testModifierClickUnrestrictedMove_data() | ||
638 | { | 616 | { | ||
639 | QTest::addColumn<int>("modifierKey"); | 617 | QTest::addColumn<int>("modifierKey"); | ||
640 | QTest::addColumn<int>("mouseButton"); | 618 | QTest::addColumn<int>("mouseButton"); | ||
641 | QTest::addColumn<QString>("modKey"); | 619 | QTest::addColumn<QString>("modKey"); | ||
642 | QTest::addColumn<bool>("capsLock"); | 620 | QTest::addColumn<bool>("capsLock"); | ||
643 | QTest::addColumn<Test::ShellSurfaceType>("surfaceType"); | 621 | QTest::addColumn<Test::XdgShellSurfaceType>("surfaceType"); | ||
644 | 622 | | |||
645 | const QString alt = QStringLiteral("Alt"); | 623 | const QString alt = QStringLiteral("Alt"); | ||
646 | const QString meta = QStringLiteral("Meta"); | 624 | const QString meta = QStringLiteral("Meta"); | ||
647 | 625 | | |||
648 | const QVector<std::pair<Test::ShellSurfaceType, QByteArray>> surfaceTypes{ | 626 | const QVector<std::pair<Test::XdgShellSurfaceType, QByteArray>> surfaceTypes{ | ||
649 | {Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")}, | 627 | { Test::XdgShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5") }, | ||
650 | {Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")}, | 628 | { Test::XdgShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6") }, | ||
651 | {Test::ShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6")}, | 629 | { Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, | ||
652 | {Test::ShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase")}, | | |||
653 | }; | 630 | }; | ||
654 | 631 | | |||
655 | for (const auto &type: surfaceTypes) { | 632 | for (const auto &type : surfaceTypes) { | ||
656 | QTest::newRow("Left Alt + Left Click" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << false << type.first; | 633 | QTest::newRow("Left Alt + Left Click" + type.second) << KEY_LEFTALT << BTN_LEFT << alt << false << type.first; | ||
657 | QTest::newRow("Left Alt + Right Click" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << false << type.first; | 634 | QTest::newRow("Left Alt + Right Click" + type.second) << KEY_LEFTALT << BTN_RIGHT << alt << false << type.first; | ||
658 | QTest::newRow("Left Alt + Middle Click" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << false << type.first; | 635 | QTest::newRow("Left Alt + Middle Click" + type.second) << KEY_LEFTALT << BTN_MIDDLE << alt << false << type.first; | ||
659 | QTest::newRow("Right Alt + Left Click" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << false << type.first; | 636 | QTest::newRow("Right Alt + Left Click" + type.second) << KEY_RIGHTALT << BTN_LEFT << alt << false << type.first; | ||
660 | QTest::newRow("Right Alt + Right Click" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << false << type.first; | 637 | QTest::newRow("Right Alt + Right Click" + type.second) << KEY_RIGHTALT << BTN_RIGHT << alt << false << type.first; | ||
661 | QTest::newRow("Right Alt + Middle Click" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << false << type.first; | 638 | QTest::newRow("Right Alt + Middle Click" + type.second) << KEY_RIGHTALT << BTN_MIDDLE << alt << false << type.first; | ||
662 | // now everything with meta | 639 | // now everything with meta | ||
663 | QTest::newRow("Left Meta + Left Click" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << false << type.first; | 640 | QTest::newRow("Left Meta + Left Click" + type.second) << KEY_LEFTMETA << BTN_LEFT << meta << false << type.first; | ||
Show All 34 Lines | 665 | { | |||
698 | group.sync(); | 675 | group.sync(); | ||
699 | workspace()->slotReconfigure(); | 676 | workspace()->slotReconfigure(); | ||
700 | QCOMPARE(options->commandAllModifier(), modKey == QStringLiteral("Alt") ? Qt::AltModifier : Qt::MetaModifier); | 677 | QCOMPARE(options->commandAllModifier(), modKey == QStringLiteral("Alt") ? Qt::AltModifier : Qt::MetaModifier); | ||
701 | QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); | 678 | QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove); | ||
702 | QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); | 679 | QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove); | ||
703 | QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); | 680 | QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); | ||
704 | 681 | | |||
705 | // create a window | 682 | // create a window | ||
706 | QFETCH(Test::ShellSurfaceType, surfaceType); | 683 | QFETCH(Test::XdgShellSurfaceType, surfaceType); | ||
707 | AbstractClient *c = showWindow(surfaceType); | 684 | AbstractClient *c = showWindow(surfaceType); | ||
708 | QVERIFY(c); | 685 | QVERIFY(c); | ||
709 | QVERIFY(c->isDecorated()); | 686 | QVERIFY(c->isDecorated()); | ||
710 | QVERIFY(!c->noBorder()); | 687 | QVERIFY(!c->noBorder()); | ||
711 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | 688 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||
712 | // move cursor on window | 689 | // move cursor on window | ||
713 | Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2)); | 690 | Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2)); | ||
714 | 691 | | |||
Show All 20 Lines | |||||
735 | } | 712 | } | ||
736 | } | 713 | } | ||
737 | 714 | | |||
738 | void DecorationInputTest::testModifierScrollOpacity_data() | 715 | void DecorationInputTest::testModifierScrollOpacity_data() | ||
739 | { | 716 | { | ||
740 | QTest::addColumn<int>("modifierKey"); | 717 | QTest::addColumn<int>("modifierKey"); | ||
741 | QTest::addColumn<QString>("modKey"); | 718 | QTest::addColumn<QString>("modKey"); | ||
742 | QTest::addColumn<bool>("capsLock"); | 719 | QTest::addColumn<bool>("capsLock"); | ||
743 | QTest::addColumn<Test::ShellSurfaceType>("surfaceType"); | 720 | QTest::addColumn<Test::XdgShellSurfaceType>("surfaceType"); | ||
744 | 721 | | |||
745 | const QString alt = QStringLiteral("Alt"); | 722 | const QString alt = QStringLiteral("Alt"); | ||
746 | const QString meta = QStringLiteral("Meta"); | 723 | const QString meta = QStringLiteral("Meta"); | ||
747 | 724 | | |||
748 | const QVector<std::pair<Test::ShellSurfaceType, QByteArray>> surfaceTypes{ | 725 | const QVector<std::pair<Test::XdgShellSurfaceType, QByteArray>> surfaceTypes{ | ||
749 | {Test::ShellSurfaceType::WlShell, QByteArrayLiteral("WlShell")}, | 726 | { Test::XdgShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5") }, | ||
750 | {Test::ShellSurfaceType::XdgShellV5, QByteArrayLiteral("XdgShellV5")}, | 727 | { Test::XdgShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6") }, | ||
751 | {Test::ShellSurfaceType::XdgShellV6, QByteArrayLiteral("XdgShellV6")}, | 728 | { Test::XdgShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase") }, | ||
752 | {Test::ShellSurfaceType::XdgShellStable, QByteArrayLiteral("XdgWmBase")}, | | |||
753 | }; | 729 | }; | ||
754 | 730 | | |||
755 | for (const auto &type: surfaceTypes) { | 731 | for (const auto &type : surfaceTypes) { | ||
756 | QTest::newRow("Left Alt" + type.second) << KEY_LEFTALT << alt << false << type.first; | 732 | QTest::newRow("Left Alt" + type.second) << KEY_LEFTALT << alt << false << type.first; | ||
757 | QTest::newRow("Right Alt" + type.second) << KEY_RIGHTALT << alt << false << type.first; | 733 | QTest::newRow("Right Alt" + type.second) << KEY_RIGHTALT << alt << false << type.first; | ||
758 | QTest::newRow("Left Meta" + type.second) << KEY_LEFTMETA << meta << false << type.first; | 734 | QTest::newRow("Left Meta" + type.second) << KEY_LEFTMETA << meta << false << type.first; | ||
759 | QTest::newRow("Right Meta" + type.second) << KEY_RIGHTMETA << meta << false << type.first; | 735 | QTest::newRow("Right Meta" + type.second) << KEY_RIGHTMETA << meta << false << type.first; | ||
760 | QTest::newRow("Left Alt/CapsLock" + type.second) << KEY_LEFTALT << alt << true << type.first; | 736 | QTest::newRow("Left Alt/CapsLock" + type.second) << KEY_LEFTALT << alt << true << type.first; | ||
761 | QTest::newRow("Right Alt/CapsLock" + type.second) << KEY_RIGHTALT << alt << true << type.first; | 737 | QTest::newRow("Right Alt/CapsLock" + type.second) << KEY_RIGHTALT << alt << true << type.first; | ||
762 | QTest::newRow("Left Meta/CapsLock" + type.second) << KEY_LEFTMETA << meta << true << type.first; | 738 | QTest::newRow("Left Meta/CapsLock" + type.second) << KEY_LEFTMETA << meta << true << type.first; | ||
763 | QTest::newRow("Right Meta/CapsLock" + type.second) << KEY_RIGHTMETA << meta << true << type.first; | 739 | QTest::newRow("Right Meta/CapsLock" + type.second) << KEY_RIGHTMETA << meta << true << type.first; | ||
764 | } | 740 | } | ||
765 | } | 741 | } | ||
766 | 742 | | |||
767 | void DecorationInputTest::testModifierScrollOpacity() | 743 | void DecorationInputTest::testModifierScrollOpacity() | ||
768 | { | 744 | { | ||
769 | // this test verifies that mod+wheel performs a window operation | 745 | // this test verifies that mod+wheel performs a window operation | ||
770 | 746 | | |||
771 | // first modify the config for this run | 747 | // first modify the config for this run | ||
772 | QFETCH(QString, modKey); | 748 | QFETCH(QString, modKey); | ||
773 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | 749 | KConfigGroup group = kwinApp()->config()->group("MouseBindings"); | ||
774 | group.writeEntry("CommandAllKey", modKey); | 750 | group.writeEntry("CommandAllKey", modKey); | ||
775 | group.writeEntry("CommandAllWheel", "change opacity"); | 751 | group.writeEntry("CommandAllWheel", "change opacity"); | ||
776 | group.sync(); | 752 | group.sync(); | ||
777 | workspace()->slotReconfigure(); | 753 | workspace()->slotReconfigure(); | ||
778 | 754 | | |||
779 | QFETCH(Test::ShellSurfaceType, surfaceType); | 755 | QFETCH(Test::XdgShellSurfaceType, surfaceType); | ||
780 | AbstractClient *c = showWindow(surfaceType); | 756 | AbstractClient *c = showWindow(surfaceType); | ||
781 | QVERIFY(c); | 757 | QVERIFY(c); | ||
782 | QVERIFY(c->isDecorated()); | 758 | QVERIFY(c->isDecorated()); | ||
783 | QVERIFY(!c->noBorder()); | 759 | QVERIFY(!c->noBorder()); | ||
784 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | 760 | c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); | ||
785 | // move cursor on window | 761 | // move cursor on window | ||
786 | Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2)); | 762 | Cursor::setPos(QPoint(c->geometry().center().x(), c->y() + c->clientPos().y() / 2)); | ||
787 | // set the opacity to 0.5 | 763 | // set the opacity to 0.5 | ||
Show All 15 Lines | |||||
803 | kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); | 779 | kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++); | ||
804 | if (capsLock) { | 780 | if (capsLock) { | ||
805 | kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); | 781 | kwinApp()->platform()->keyboardKeyReleased(KEY_CAPSLOCK, timestamp++); | ||
806 | } | 782 | } | ||
807 | } | 783 | } | ||
808 | 784 | | |||
809 | void DecorationInputTest::testTouchEvents_data() | 785 | void DecorationInputTest::testTouchEvents_data() | ||
810 | { | 786 | { | ||
811 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 787 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
812 | 788 | | |||
813 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 789 | QTest::newRow("xdgShellV5") << Test::XdgShellSurfaceType::XdgShellV5; | ||
814 | QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5; | 790 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
815 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 791 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
816 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
817 | } | 792 | } | ||
818 | 793 | | |||
819 | class EventHelper : public QObject | 794 | class EventHelper : public QObject | ||
820 | { | 795 | { | ||
821 | Q_OBJECT | 796 | Q_OBJECT | ||
822 | public: | 797 | public: | ||
823 | EventHelper() : QObject() {} | 798 | EventHelper() : QObject() {} | ||
824 | ~EventHelper() override = default; | 799 | ~EventHelper() override = default; | ||
Show All 13 Lines | 812 | Q_SIGNALS: | |||
838 | void hoverMove(); | 813 | void hoverMove(); | ||
839 | void hoverLeave(); | 814 | void hoverLeave(); | ||
840 | }; | 815 | }; | ||
841 | 816 | | |||
842 | void DecorationInputTest::testTouchEvents() | 817 | void DecorationInputTest::testTouchEvents() | ||
843 | { | 818 | { | ||
844 | // this test verifies that the decoration gets a hover leave event on touch release | 819 | // this test verifies that the decoration gets a hover leave event on touch release | ||
845 | // see BUG 386231 | 820 | // see BUG 386231 | ||
846 | QFETCH(Test::ShellSurfaceType, type); | 821 | QFETCH(Test::XdgShellSurfaceType, type); | ||
847 | AbstractClient *c = showWindow(type); | 822 | AbstractClient *c = showWindow(type); | ||
848 | QVERIFY(c); | 823 | QVERIFY(c); | ||
849 | QVERIFY(c->isDecorated()); | 824 | QVERIFY(c->isDecorated()); | ||
850 | QVERIFY(!c->noBorder()); | 825 | QVERIFY(!c->noBorder()); | ||
851 | 826 | | |||
852 | EventHelper helper; | 827 | EventHelper helper; | ||
853 | c->decoration()->installEventFilter(&helper); | 828 | c->decoration()->installEventFilter(&helper); | ||
854 | QSignalSpy hoverMoveSpy(&helper, &EventHelper::hoverMove); | 829 | QSignalSpy hoverMoveSpy(&helper, &EventHelper::hoverMove); | ||
Show All 24 Lines | |||||
879 | QCOMPARE(hoverLeaveSpy.count(), 1); | 854 | QCOMPARE(hoverLeaveSpy.count(), 1); | ||
880 | kwinApp()->platform()->touchUp(0, timestamp++); | 855 | kwinApp()->platform()->touchUp(0, timestamp++); | ||
881 | QCOMPARE(hoverMoveSpy.count(), 3); | 856 | QCOMPARE(hoverMoveSpy.count(), 3); | ||
882 | QCOMPARE(hoverLeaveSpy.count(), 2); | 857 | QCOMPARE(hoverLeaveSpy.count(), 2); | ||
883 | } | 858 | } | ||
884 | 859 | | |||
885 | void DecorationInputTest::testTooltipDoesntEatKeyEvents_data() | 860 | void DecorationInputTest::testTooltipDoesntEatKeyEvents_data() | ||
886 | { | 861 | { | ||
887 | QTest::addColumn<Test::ShellSurfaceType>("type"); | 862 | QTest::addColumn<Test::XdgShellSurfaceType>("type"); | ||
888 | 863 | | |||
889 | QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell; | 864 | QTest::newRow("xdgShellV6") << Test::XdgShellSurfaceType::XdgShellV6; | ||
890 | QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6; | 865 | QTest::newRow("xdgWmBase") << Test::XdgShellSurfaceType::XdgShellStable; | ||
891 | QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable; | | |||
892 | } | 866 | } | ||
893 | 867 | | |||
894 | void DecorationInputTest::testTooltipDoesntEatKeyEvents() | 868 | void DecorationInputTest::testTooltipDoesntEatKeyEvents() | ||
895 | { | 869 | { | ||
896 | // this test verifies that a tooltip on the decoration does not steal key events | 870 | // this test verifies that a tooltip on the decoration does not steal key events | ||
897 | // BUG: 393253 | 871 | // BUG: 393253 | ||
898 | 872 | | |||
899 | // first create a keyboard | 873 | // first create a keyboard | ||
900 | auto keyboard = Test::waylandSeat()->createKeyboard(Test::waylandSeat()); | 874 | auto keyboard = Test::waylandSeat()->createKeyboard(Test::waylandSeat()); | ||
901 | QVERIFY(keyboard); | 875 | QVERIFY(keyboard); | ||
902 | QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered); | 876 | QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered); | ||
903 | QVERIFY(enteredSpy.isValid()); | 877 | QVERIFY(enteredSpy.isValid()); | ||
904 | 878 | | |||
905 | QFETCH(Test::ShellSurfaceType, type); | 879 | QFETCH(Test::XdgShellSurfaceType, type); | ||
906 | AbstractClient *c = showWindow(type); | 880 | AbstractClient *c = showWindow(type); | ||
907 | QVERIFY(c); | 881 | QVERIFY(c); | ||
908 | QVERIFY(c->isDecorated()); | 882 | QVERIFY(c->isDecorated()); | ||
909 | QVERIFY(!c->noBorder()); | 883 | QVERIFY(!c->noBorder()); | ||
910 | QTRY_COMPARE(enteredSpy.count(), 1); | 884 | QTRY_COMPARE(enteredSpy.count(), 1); | ||
911 | 885 | | |||
912 | QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged); | 886 | QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged); | ||
913 | QVERIFY(keyEvent.isValid()); | 887 | QVERIFY(keyEvent.isValid()); | ||
Show All 25 Lines |