Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/pointer_constraints_test.cpp
Show First 20 Lines • Show All 334 Lines • ▼ Show 20 Line(s) | 309 | { | |||
---|---|---|---|---|---|
335 | KWin::Cursor::setPos(c->geometry().center()); | 335 | KWin::Cursor::setPos(c->geometry().center()); | ||
336 | QCOMPARE(KWin::Cursor::pos(), c->geometry().center()); | 336 | QCOMPARE(KWin::Cursor::pos(), c->geometry().center()); | ||
337 | QCOMPARE(input()->pointer()->isConstrained(), true); | 337 | QCOMPARE(input()->pointer()->isConstrained(), true); | ||
338 | QVERIFY(lockedSpy.wait()); | 338 | QVERIFY(lockedSpy.wait()); | ||
339 | 339 | | |||
340 | // now try to break | 340 | // now try to break | ||
341 | quint32 timestamp = 0; | 341 | quint32 timestamp = 0; | ||
342 | kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); | 342 | kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); | ||
343 | QVERIFY(keyboardLeftSpy.wait()); | 343 | QVERIFY(keyChangedSpy.wait()); | ||
344 | // and just waiting should break constrain | 344 | // and just waiting should break constrain | ||
345 | QVERIFY(unlockedSpy.wait()); | 345 | QVERIFY(unlockedSpy.wait()); | ||
346 | QCOMPARE(keyboardLeftSpy.count(), 1); | ||||
346 | QCOMPARE(input()->pointer()->isConstrained(), false); | 347 | QCOMPARE(input()->pointer()->isConstrained(), false); | ||
347 | // and should enter again | 348 | // and should enter again | ||
348 | QTRY_COMPARE(keyboardEnteredSpy.count(), 2); | 349 | QTRY_COMPARE(keyboardEnteredSpy.count(), 2); | ||
349 | QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), c->surface()); | 350 | QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), c->surface()); | ||
350 | kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); | 351 | kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); | ||
351 | QVERIFY(!keyChangedSpy.wait()); | 352 | QVERIFY(!keyChangedSpy.wait()); | ||
352 | QVERIFY(keyChangedSpy.isEmpty()); | 353 | QCOMPARE(keyChangedSpy.count(), 1); | ||
353 | 354 | | |||
354 | // now lock again | 355 | // now lock again | ||
355 | // need to move out and in | 356 | // need to move out and in | ||
356 | KWin::Cursor::setPos(c->geometry().bottomRight() + QPoint(1, 1)); | 357 | KWin::Cursor::setPos(c->geometry().bottomRight() + QPoint(1, 1)); | ||
357 | KWin::Cursor::setPos(c->geometry().center()); | 358 | KWin::Cursor::setPos(c->geometry().center()); | ||
358 | QCOMPARE(KWin::Cursor::pos(), c->geometry().center()); | 359 | QCOMPARE(KWin::Cursor::pos(), c->geometry().center()); | ||
359 | QCOMPARE(input()->pointer()->isConstrained(), true); | 360 | QCOMPARE(input()->pointer()->isConstrained(), true); | ||
360 | QVERIFY(lockedSpy.wait()); | 361 | QVERIFY(lockedSpy.wait()); | ||
Show All 28 Lines |