18#include <KWayland/Client/compositor.h>
19#include <KWayland/Client/connection_thread.h>
20#include <KWayland/Client/event_queue.h>
21#include <KWayland/Client/pointer.h>
22#include <KWayland/Client/registry.h>
23#include <KWayland/Client/seat.h>
24#include <KWayland/Client/shm_pool.h>
25#include <KWayland/Client/surface.h>
32static const QString s_socketName = QStringLiteral(
"wayland_test_kwin_input_stacking_order-0");
41 void testPointerFocusUpdatesOnStackingOrderChange();
44 void render(KWayland::Client::Surface *surface);
47void InputStackingOrderTest::initTestCase()
49 qRegisterMetaType<KWin::Window *>();
53 QRect(0, 0, 1280, 1024),
54 QRect(1280, 0, 1280, 1024),
58 QVERIFY(applicationStartedSpy.wait());
60 QCOMPARE(outputs.count(), 2);
61 QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
62 QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
63 setenv(
"QT_QPA_PLATFORM",
"wayland",
true);
66void InputStackingOrderTest::init()
75void InputStackingOrderTest::cleanup()
80void InputStackingOrderTest::render(KWayland::Client::Surface *surface)
86void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
96 QVERIFY(pointer->isValid());
97 QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
98 QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
105 QVERIFY(shellSurface1);
106 render(surface1.get());
107 QVERIFY(windowAddedSpy.wait());
114 QVERIFY(shellSurface2);
115 render(surface2.get());
116 QVERIFY(windowAddedSpy.wait());
120 QVERIFY(window1 != window2);
123 window2->move(window1->pos());
124 QCOMPARE(window1->frameGeometry(), window2->frameGeometry());
128 QVERIFY(enteredSpy.wait());
129 QCOMPARE(enteredSpy.count(), 1);
131 QCOMPARE(pointer->enteredSurface(), surface2.get());
136 QVERIFY(leftSpy.isEmpty());
139 QVERIFY(leftSpy.wait());
140 QCOMPARE(leftSpy.count(), 1);
142 QCOMPARE(enteredSpy.count(), 2);
143 QCOMPARE(pointer->enteredSurface(), surface1.get());
149 QVERIFY(windowClosedSpy.wait());
150 QVERIFY(enteredSpy.wait());
151 QCOMPARE(enteredSpy.count(), 3);
152 QCOMPARE(pointer->enteredSurface(), surface2.get());
159#include "input_stacking_order.moc"
Window * activeWindow() const
void raiseWindow(Window *window, bool nogroup=false)
void windowAdded(KWin::Window *)
QList< Output * > outputs() const
void setActiveOutput(Output *output)
#define WAYLANDTEST_MAIN(TestObject)
void destroyWaylandConnection()
void setOutputConfig(const QList< QRect > &geometries)
KWayland::Client::Seat * seat
bool setupWaylandConnection(AdditionalWaylandInterfaces flags=AdditionalWaylandInterfaces())
void render(KWayland::Client::Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format=QImage::Format_ARGB32_Premultiplied)
KWayland::Client::Seat * waylandSeat()
void pointerMotion(const QPointF &position, quint32 time)
std::unique_ptr< KWayland::Client::Surface > createSurface()
XdgToplevel * createXdgToplevelSurface(KWayland::Client::Surface *surface, QObject *parent=nullptr)
bool waitForWaylandPointer()
void flushWaylandConnection()
WaylandServer * waylandServer()
InputRedirection * input()