KWin
Loading...
Searching...
No Matches
window_selection_test.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#include "kwin_wayland_test.h"
10
11#include "core/output.h"
12#include "keyboard_input.h"
13#include "pointer_input.h"
14#include "wayland_server.h"
15#include "window.h"
16#include "workspace.h"
17
18#include <KWayland/Client/compositor.h>
19#include <KWayland/Client/keyboard.h>
20#include <KWayland/Client/pointer.h>
21#include <KWayland/Client/seat.h>
22#include <KWayland/Client/shm_pool.h>
23#include <KWayland/Client/surface.h>
24#include <KWayland/Client/touch.h>
25
26#include <linux/input.h>
27
28using namespace KWin;
29
30static const QString s_socketName = QStringLiteral("wayland_test_kwin_window_selection-0");
31
32class TestWindowSelection : public QObject
33{
34 Q_OBJECT
35private Q_SLOTS:
36 void initTestCase();
37 void init();
38 void cleanup();
39
40 void testSelectOnWindowPointer();
41 void testSelectOnWindowKeyboard_data();
42 void testSelectOnWindowKeyboard();
43 void testSelectOnWindowTouch();
44 void testCancelOnWindowPointer();
45 void testCancelOnWindowKeyboard();
46
47 void testSelectPointPointer();
48 void testSelectPointTouch();
49};
50
51void TestWindowSelection::initTestCase()
52{
53 qRegisterMetaType<KWin::Window *>();
54 QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
55 QVERIFY(waylandServer()->init(s_socketName));
57 QRect(0, 0, 1280, 1024),
58 QRect(1280, 0, 1280, 1024),
59 });
60 qputenv("XKB_DEFAULT_RULES", "evdev");
61
62 kwinApp()->start();
63 QVERIFY(applicationStartedSpy.wait());
64 const auto outputs = workspace()->outputs();
65 QCOMPARE(outputs.count(), 2);
66 QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
67 QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
68}
69
70void TestWindowSelection::init()
71{
72 QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
74
75 workspace()->setActiveOutput(QPoint(640, 512));
76 KWin::input()->pointer()->warp(QPoint(640, 512));
77}
78
79void TestWindowSelection::cleanup()
80{
82}
83
84void TestWindowSelection::testSelectOnWindowPointer()
85{
86 // this test verifies window selection through pointer works
87 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
88 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
89 std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
90 std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
91 QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
92 QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left);
93 QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
94 QSignalSpy keyboardLeftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
95
96 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
97 QVERIFY(window);
98 QVERIFY(keyboardEnteredSpy.wait());
99 KWin::input()->pointer()->warp(window->frameGeometry().center());
100 QCOMPARE(input()->pointer()->focus(), window);
101 QVERIFY(pointerEnteredSpy.wait());
102
103 Window *selectedWindow = nullptr;
104 auto callback = [&selectedWindow](Window *t) {
105 selectedWindow = t;
106 };
107
108 // start the interaction
109 QCOMPARE(input()->isSelectingWindow(), false);
110 kwinApp()->startInteractiveWindowSelection(callback);
111 QCOMPARE(input()->isSelectingWindow(), true);
112 QVERIFY(!selectedWindow);
113 QCOMPARE(keyboardLeftSpy.count(), 0);
114 QVERIFY(pointerLeftSpy.wait());
115 if (keyboardLeftSpy.isEmpty()) {
116 QVERIFY(keyboardLeftSpy.wait());
117 }
118 QCOMPARE(pointerLeftSpy.count(), 1);
119 QCOMPARE(keyboardLeftSpy.count(), 1);
120
121 // simulate left button press
122 quint32 timestamp = 0;
123 Test::pointerButtonPressed(BTN_LEFT, timestamp++);
124 // should not have ended the mode
125 QCOMPARE(input()->isSelectingWindow(), true);
126 QVERIFY(!selectedWindow);
127 QVERIFY(!input()->pointer()->focus());
128
129 // updating the pointer should not change anything
130 input()->pointer()->update();
131 QVERIFY(!input()->pointer()->focus());
132 // updating keyboard should also not change
133 input()->keyboard()->update();
134
135 // perform a right button click
136 Test::pointerButtonPressed(BTN_RIGHT, timestamp++);
137 Test::pointerButtonReleased(BTN_RIGHT, timestamp++);
138 // should not have ended the mode
139 QCOMPARE(input()->isSelectingWindow(), true);
140 QVERIFY(!selectedWindow);
141 // now release
142 Test::pointerButtonReleased(BTN_LEFT, timestamp++);
143 QCOMPARE(input()->isSelectingWindow(), false);
144 QCOMPARE(selectedWindow, window);
145 QCOMPARE(input()->pointer()->focus(), window);
146 // should give back keyboard and pointer
147 QVERIFY(pointerEnteredSpy.wait());
148 if (keyboardEnteredSpy.count() != 2) {
149 QVERIFY(keyboardEnteredSpy.wait());
150 }
151 QCOMPARE(pointerLeftSpy.count(), 1);
152 QCOMPARE(keyboardLeftSpy.count(), 1);
153 QCOMPARE(pointerEnteredSpy.count(), 2);
154 QCOMPARE(keyboardEnteredSpy.count(), 2);
155}
156
157void TestWindowSelection::testSelectOnWindowKeyboard_data()
158{
159 QTest::addColumn<qint32>("key");
160
161 QTest::newRow("enter") << KEY_ENTER;
162 QTest::newRow("keypad enter") << KEY_KPENTER;
163 QTest::newRow("space") << KEY_SPACE;
164}
165
166void TestWindowSelection::testSelectOnWindowKeyboard()
167{
168 // this test verifies window selection through keyboard key
169 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
170 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
171 std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
172 std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
173 QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
174 QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left);
175 QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
176 QSignalSpy keyboardLeftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
177
178 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
179 QVERIFY(window);
180 QVERIFY(keyboardEnteredSpy.wait());
181 QVERIFY(!exclusiveContains(window->frameGeometry(), KWin::Cursors::self()->mouse()->pos()));
182
183 Window *selectedWindow = nullptr;
184 auto callback = [&selectedWindow](Window *t) {
185 selectedWindow = t;
186 };
187
188 // start the interaction
189 QCOMPARE(input()->isSelectingWindow(), false);
190 kwinApp()->startInteractiveWindowSelection(callback);
191 QCOMPARE(input()->isSelectingWindow(), true);
192 QVERIFY(!selectedWindow);
193 QCOMPARE(keyboardLeftSpy.count(), 0);
194 QVERIFY(keyboardLeftSpy.wait());
195 QCOMPARE(pointerLeftSpy.count(), 0);
196 QCOMPARE(keyboardLeftSpy.count(), 1);
197
198 // simulate key press
199 quint32 timestamp = 0;
200 // move cursor through keys
201 auto keyPress = [&timestamp](qint32 key) {
202 Test::keyboardKeyPressed(key, timestamp++);
203 Test::keyboardKeyReleased(key, timestamp++);
204 };
205 while (KWin::Cursors::self()->mouse()->pos().x() >= window->frameGeometry().x() + window->frameGeometry().width()) {
206 keyPress(KEY_LEFT);
207 }
208 while (KWin::Cursors::self()->mouse()->pos().x() <= window->frameGeometry().x()) {
209 keyPress(KEY_RIGHT);
210 }
211 while (KWin::Cursors::self()->mouse()->pos().y() <= window->frameGeometry().y()) {
212 keyPress(KEY_DOWN);
213 }
214 while (KWin::Cursors::self()->mouse()->pos().y() >= window->frameGeometry().y() + window->frameGeometry().height()) {
215 keyPress(KEY_UP);
216 }
217 QFETCH(qint32, key);
218 Test::keyboardKeyPressed(key, timestamp++);
219 QCOMPARE(input()->isSelectingWindow(), false);
220 QCOMPARE(selectedWindow, window);
221 QCOMPARE(input()->pointer()->focus(), window);
222 // should give back keyboard and pointer
223 QVERIFY(pointerEnteredSpy.wait());
224 if (keyboardEnteredSpy.count() != 2) {
225 QVERIFY(keyboardEnteredSpy.wait());
226 }
227 QCOMPARE(pointerLeftSpy.count(), 0);
228 QCOMPARE(keyboardLeftSpy.count(), 1);
229 QCOMPARE(pointerEnteredSpy.count(), 1);
230 QCOMPARE(keyboardEnteredSpy.count(), 2);
231 Test::keyboardKeyReleased(key, timestamp++);
232}
233
234void TestWindowSelection::testSelectOnWindowTouch()
235{
236 // this test verifies window selection through touch
237 std::unique_ptr<KWayland::Client::Touch> touch(Test::waylandSeat()->createTouch());
238 QSignalSpy touchStartedSpy(touch.get(), &KWayland::Client::Touch::sequenceStarted);
239 QSignalSpy touchCanceledSpy(touch.get(), &KWayland::Client::Touch::sequenceCanceled);
240 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
241 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
242 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
243 QVERIFY(window);
244
245 Window *selectedWindow = nullptr;
246 auto callback = [&selectedWindow](Window *t) {
247 selectedWindow = t;
248 };
249
250 // start the interaction
251 QCOMPARE(input()->isSelectingWindow(), false);
252 kwinApp()->startInteractiveWindowSelection(callback);
253 QCOMPARE(input()->isSelectingWindow(), true);
254 QVERIFY(!selectedWindow);
255
256 // simulate touch down
257 quint32 timestamp = 0;
258 Test::touchDown(0, window->frameGeometry().center(), timestamp++);
259 QVERIFY(!selectedWindow);
260 Test::touchUp(0, timestamp++);
261 QCOMPARE(input()->isSelectingWindow(), false);
262 QCOMPARE(selectedWindow, window);
263
264 // with movement
265 selectedWindow = nullptr;
266 kwinApp()->startInteractiveWindowSelection(callback);
267 Test::touchDown(0, window->frameGeometry().bottomRight() + QPoint(20, 20), timestamp++);
268 QVERIFY(!selectedWindow);
269 Test::touchMotion(0, window->frameGeometry().bottomRight() - QPoint(1, 1), timestamp++);
270 QVERIFY(!selectedWindow);
271 Test::touchUp(0, timestamp++);
272 QCOMPARE(selectedWindow, window);
273 QCOMPARE(input()->isSelectingWindow(), false);
274
275 // it cancels active touch sequence on the window
276 Test::touchDown(0, window->frameGeometry().center(), timestamp++);
277 QVERIFY(touchStartedSpy.wait());
278 selectedWindow = nullptr;
279 kwinApp()->startInteractiveWindowSelection(callback);
280 QCOMPARE(input()->isSelectingWindow(), true);
281 QVERIFY(touchCanceledSpy.wait());
282 QVERIFY(!selectedWindow);
283 // this touch up does not yet select the window, it was started prior to the selection
284 Test::touchUp(0, timestamp++);
285 QVERIFY(!selectedWindow);
286 Test::touchDown(0, window->frameGeometry().center(), timestamp++);
287 Test::touchUp(0, timestamp++);
288 QCOMPARE(selectedWindow, window);
289 QCOMPARE(input()->isSelectingWindow(), false);
290
291 QCOMPARE(touchStartedSpy.count(), 1);
292 QCOMPARE(touchCanceledSpy.count(), 1);
293}
294
295void TestWindowSelection::testCancelOnWindowPointer()
296{
297 // this test verifies that window selection cancels through right button click
298 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
299 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
300 std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
301 std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
302 QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
303 QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left);
304 QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
305 QSignalSpy keyboardLeftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
306
307 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
308 QVERIFY(window);
309 QVERIFY(keyboardEnteredSpy.wait());
310 KWin::input()->pointer()->warp(window->frameGeometry().center());
311 QCOMPARE(input()->pointer()->focus(), window);
312 QVERIFY(pointerEnteredSpy.wait());
313
314 Window *selectedWindow = nullptr;
315 auto callback = [&selectedWindow](Window *t) {
316 selectedWindow = t;
317 };
318
319 // start the interaction
320 QCOMPARE(input()->isSelectingWindow(), false);
321 kwinApp()->startInteractiveWindowSelection(callback);
322 QCOMPARE(input()->isSelectingWindow(), true);
323 QVERIFY(!selectedWindow);
324 QCOMPARE(keyboardLeftSpy.count(), 0);
325 QVERIFY(pointerLeftSpy.wait());
326 if (keyboardLeftSpy.isEmpty()) {
327 QVERIFY(keyboardLeftSpy.wait());
328 }
329 QCOMPARE(pointerLeftSpy.count(), 1);
330 QCOMPARE(keyboardLeftSpy.count(), 1);
331
332 // simulate left button press
333 quint32 timestamp = 0;
334 Test::pointerButtonPressed(BTN_RIGHT, timestamp++);
335 Test::pointerButtonReleased(BTN_RIGHT, timestamp++);
336 QCOMPARE(input()->isSelectingWindow(), false);
337 QVERIFY(!selectedWindow);
338 QCOMPARE(input()->pointer()->focus(), window);
339 // should give back keyboard and pointer
340 QVERIFY(pointerEnteredSpy.wait());
341 if (keyboardEnteredSpy.count() != 2) {
342 QVERIFY(keyboardEnteredSpy.wait());
343 }
344 QCOMPARE(pointerLeftSpy.count(), 1);
345 QCOMPARE(keyboardLeftSpy.count(), 1);
346 QCOMPARE(pointerEnteredSpy.count(), 2);
347 QCOMPARE(keyboardEnteredSpy.count(), 2);
348}
349
350void TestWindowSelection::testCancelOnWindowKeyboard()
351{
352 // this test verifies that cancel window selection through escape key works
353 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
354 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
355 std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
356 std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
357 QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
358 QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left);
359 QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
360 QSignalSpy keyboardLeftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
361
362 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
363 QVERIFY(window);
364 QVERIFY(keyboardEnteredSpy.wait());
365 KWin::input()->pointer()->warp(window->frameGeometry().center());
366 QCOMPARE(input()->pointer()->focus(), window);
367 QVERIFY(pointerEnteredSpy.wait());
368
369 Window *selectedWindow = nullptr;
370 auto callback = [&selectedWindow](Window *t) {
371 selectedWindow = t;
372 };
373
374 // start the interaction
375 QCOMPARE(input()->isSelectingWindow(), false);
376 kwinApp()->startInteractiveWindowSelection(callback);
377 QCOMPARE(input()->isSelectingWindow(), true);
378 QVERIFY(!selectedWindow);
379 QCOMPARE(keyboardLeftSpy.count(), 0);
380 QVERIFY(pointerLeftSpy.wait());
381 if (keyboardLeftSpy.isEmpty()) {
382 QVERIFY(keyboardLeftSpy.wait());
383 }
384 QCOMPARE(pointerLeftSpy.count(), 1);
385 QCOMPARE(keyboardLeftSpy.count(), 1);
386
387 // simulate left button press
388 quint32 timestamp = 0;
389 Test::keyboardKeyPressed(KEY_ESC, timestamp++);
390 QCOMPARE(input()->isSelectingWindow(), false);
391 QVERIFY(!selectedWindow);
392 QCOMPARE(input()->pointer()->focus(), window);
393 // should give back keyboard and pointer
394 QVERIFY(pointerEnteredSpy.wait());
395 if (keyboardEnteredSpy.count() != 2) {
396 QVERIFY(keyboardEnteredSpy.wait());
397 }
398 QCOMPARE(pointerLeftSpy.count(), 1);
399 QCOMPARE(keyboardLeftSpy.count(), 1);
400 QCOMPARE(pointerEnteredSpy.count(), 2);
401 QCOMPARE(keyboardEnteredSpy.count(), 2);
402 Test::keyboardKeyReleased(KEY_ESC, timestamp++);
403}
404
405void TestWindowSelection::testSelectPointPointer()
406{
407 // this test verifies point selection through pointer works
408 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
409 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
410 std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
411 std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
412 QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
413 QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left);
414 QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
415 QSignalSpy keyboardLeftSpy(keyboard.get(), &KWayland::Client::Keyboard::left);
416
417 auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
418 QVERIFY(window);
419 QVERIFY(keyboardEnteredSpy.wait());
420 KWin::input()->pointer()->warp(window->frameGeometry().center());
421 QCOMPARE(input()->pointer()->focus(), window);
422 QVERIFY(pointerEnteredSpy.wait());
423
424 // start the interaction
425 QCOMPARE(input()->isSelectingWindow(), false);
426 QPointF point;
427 kwinApp()->startInteractivePositionSelection([&point](const QPointF &p) {
428 point = p;
429 });
430 QCOMPARE(input()->isSelectingWindow(), true);
431 QCOMPARE(point, QPoint());
432 QCOMPARE(keyboardLeftSpy.count(), 0);
433 QVERIFY(pointerLeftSpy.wait());
434 if (keyboardLeftSpy.isEmpty()) {
435 QVERIFY(keyboardLeftSpy.wait());
436 }
437 QCOMPARE(pointerLeftSpy.count(), 1);
438 QCOMPARE(keyboardLeftSpy.count(), 1);
439
440 // trying again should not be allowed
441 QPointF point2;
442 kwinApp()->startInteractivePositionSelection([&point2](const QPointF &p) {
443 point2 = p;
444 });
445 QCOMPARE(point2, QPoint(-1, -1));
446
447 // simulate left button press
448 quint32 timestamp = 0;
449 Test::pointerButtonPressed(BTN_LEFT, timestamp++);
450 // should not have ended the mode
451 QCOMPARE(input()->isSelectingWindow(), true);
452 QCOMPARE(point, QPoint());
453 QVERIFY(!input()->pointer()->focus());
454
455 // updating the pointer should not change anything
456 input()->pointer()->update();
457 QVERIFY(!input()->pointer()->focus());
458 // updating keyboard should also not change
459 input()->keyboard()->update();
460
461 // perform a right button click
462 Test::pointerButtonPressed(BTN_RIGHT, timestamp++);
463 Test::pointerButtonReleased(BTN_RIGHT, timestamp++);
464 // should not have ended the mode
465 QCOMPARE(input()->isSelectingWindow(), true);
466 QCOMPARE(point, QPoint());
467 // now release
468 Test::pointerButtonReleased(BTN_LEFT, timestamp++);
469 QCOMPARE(input()->isSelectingWindow(), false);
470 QCOMPARE(point, input()->globalPointer().toPoint());
471 QCOMPARE(input()->pointer()->focus(), window);
472 // should give back keyboard and pointer
473 QVERIFY(pointerEnteredSpy.wait());
474 if (keyboardEnteredSpy.count() != 2) {
475 QVERIFY(keyboardEnteredSpy.wait());
476 }
477 QCOMPARE(pointerLeftSpy.count(), 1);
478 QCOMPARE(keyboardLeftSpy.count(), 1);
479 QCOMPARE(pointerEnteredSpy.count(), 2);
480 QCOMPARE(keyboardEnteredSpy.count(), 2);
481}
482
483void TestWindowSelection::testSelectPointTouch()
484{
485 // this test verifies point selection through touch works
486 // start the interaction
487 QCOMPARE(input()->isSelectingWindow(), false);
488 QPointF point;
489 kwinApp()->startInteractivePositionSelection([&point](const QPointF &p) {
490 point = p;
491 });
492 QCOMPARE(input()->isSelectingWindow(), true);
493 QCOMPARE(point, QPoint());
494
495 // let's create multiple touch points
496 quint32 timestamp = 0;
497 Test::touchDown(0, QPointF(0, 1), timestamp++);
498 QCOMPARE(input()->isSelectingWindow(), true);
499 Test::touchDown(1, QPointF(10, 20), timestamp++);
500 QCOMPARE(input()->isSelectingWindow(), true);
501 Test::touchDown(2, QPointF(30, 40), timestamp++);
502 QCOMPARE(input()->isSelectingWindow(), true);
503
504 // let's move our points
505 Test::touchMotion(0, QPointF(5, 10), timestamp++);
506 Test::touchMotion(2, QPointF(20, 25), timestamp++);
507 Test::touchMotion(1, QPointF(25, 35), timestamp++);
508 QCOMPARE(input()->isSelectingWindow(), true);
509 Test::touchUp(0, timestamp++);
510 QCOMPARE(input()->isSelectingWindow(), true);
511 Test::touchUp(2, timestamp++);
512 QCOMPARE(input()->isSelectingWindow(), true);
513 Test::touchUp(1, timestamp++);
514 QCOMPARE(input()->isSelectingWindow(), false);
515 QCOMPARE(point, QPoint(25, 35));
516}
517
519#include "window_selection_test.moc"
QPointF pos()
Definition cursor.cpp:204
static Cursors * self()
Definition cursor.cpp:35
Cursor * mouse() const
Definition cursor.h:266
KeyboardInputRedirection * keyboard() const
Definition input.h:216
PointerInputRedirection * pointer() const
Definition input.h:220
void warp(const QPointF &pos)
QList< Output * > outputs() const
Definition workspace.h:762
void setActiveOutput(Output *output)
#define WAYLANDTEST_MAIN(TestObject)
Window * renderAndWaitForShown(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32, int timeout=5000)
void keyboardKeyReleased(quint32 key, quint32 time)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
void touchDown(qint32 id, const QPointF &pos, quint32 time)
void keyboardKeyPressed(quint32 key, quint32 time)
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
void touchMotion(qint32 id, const QPointF &pos, quint32 time)
KWayland::Client::Seat * waylandSeat()
void pointerButtonPressed(quint32 button, quint32 time)
QList< KWayland::Client::Output * > outputs
std::unique_ptr< KWayland::Client::Surface > createSurface()
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
bool waitForWaylandPointer()
void pointerButtonReleased(quint32 button, quint32 time)
void touchUp(qint32 id, quint32 time)
WaylandServer * waylandServer()
Workspace * workspace()
Definition workspace.h:830
InputRedirection * input()
Definition input.h:549