Commit c793d5d6 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

autotests: Fix PointerInputTest

The "Active screen follows mouse" option may make the test fail. We want
it to pass no matter what the current value of the option is.
parent 919e878d
......@@ -319,8 +319,6 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
// this test verifies that a pointer enter event is generated when the cursor changes to another
// screen due to removal of screen
using namespace KWayland::Client;
// ensure cursor is on second screen
Cursors::self()->mouse()->setPos(1500, 300);
// create pointer and signal spy for enter and motion
auto pointer = m_seat->createPointer(m_seat);
......@@ -328,6 +326,8 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
QVERIFY(pointer->isValid());
QSignalSpy enteredSpy(pointer, &Pointer::entered);
QVERIFY(enteredSpy.isValid());
QSignalSpy leftSpy(pointer, &Pointer::left);
QVERIFY(leftSpy.isValid());
// create a window
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
......@@ -340,7 +340,13 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
QVERIFY(clientAddedSpy.wait());
AbstractClient *window = workspace()->activeClient();
QVERIFY(window);
QVERIFY(window->frameGeometry().contains(Cursors::self()->mouse()->pos()));
QTRY_COMPARE(enteredSpy.count(), 1);
// move the cursor to the second screen
Cursors::self()->mouse()->setPos(1500, 300);
QVERIFY(!window->frameGeometry().contains(Cursors::self()->mouse()->pos()));
QVERIFY(leftSpy.wait());
QSignalSpy screensChangedSpy(screens(), &Screens::changed);
QVERIFY(screensChangedSpy.isValid());
......@@ -357,7 +363,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
QVERIFY(window->frameGeometry().contains(Cursors::self()->mouse()->pos()));
// and we should get an enter event
QTRY_COMPARE(enteredSpy.count(), 1);
QTRY_COMPARE(enteredSpy.count(), 2);
}
void PointerInputTest::testModifierClickUnrestrictedMove_data()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment