From 8875bb5645742851e521d3a32a8a8779c46fc9f6 Mon Sep 17 00:00:00 2001 From: Raphael Freudiger Date: Thu, 26 Oct 2017 10:01:55 +0200 Subject: fix build without xkbcommon-evdev Change-Id: I1a223b440a6678aebc04df49f62fedc382bd898b Reviewed-by: Frederik Gladhorn Reviewed-by: Johan Helsing --- tests/auto/compositor/compositor/compositor.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro index 112e2e74f..2919fa4bb 100644 --- a/tests/auto/compositor/compositor/compositor.pro +++ b/tests/auto/compositor/compositor/compositor.pro @@ -7,7 +7,7 @@ QT += core-private gui-private waylandcompositor waylandcompositor-private QMAKE_USE += wayland-client wayland-server -qtConfig(xkbcommon-evdev) +qtConfig(xkbcommon-evdev): \ QMAKE_USE += xkbcommon_evdev WAYLANDCLIENTSOURCES += \ -- cgit v1.2.3 From a25c186126fe37a0e5e12e2d12865ed27eb1f4e8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 22 Dec 2017 11:26:41 +0100 Subject: Client tests: Fix wrong position being sent when mocking touch events We were sending ints when we should have been sending wl_fixed_ts. Change-Id: I9f074334cb3ea8a3d61789ff641c2d022a5989b7 Reviewed-by: Pier Luigi Fiorini --- tests/auto/client/client/mockinput.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/client/client/mockinput.cpp b/tests/auto/client/client/mockinput.cpp index 99acdd43a..b2bcdf2e6 100644 --- a/tests/auto/client/client/mockinput.cpp +++ b/tests/auto/client/client/mockinput.cpp @@ -365,7 +365,9 @@ void Touch::sendDown(Surface *surface, const QPoint &position, int id) Q_ASSERT(surface); Resource *resource = resourceMap().value(surface->resource()->client()); Q_ASSERT(resource); - wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, x, y); } void Touch::sendUp(Surface *surface, int id) @@ -378,7 +380,9 @@ void Touch::sendMotion(Surface *surface, const QPoint &position, int id) { Resource *resource = resourceMap().value(surface->resource()->client()); uint32_t time = m_compositor->time(); - wl_touch_send_motion(resource->handle, time, id, position.x(), position.y()); + auto x = wl_fixed_from_int(position.x()); + auto y = wl_fixed_from_int(position.y()); + wl_touch_send_motion(resource->handle, time, id, x, y); } void Touch::sendFrame(Surface *surface) -- cgit v1.2.3 From ec029b1a4c104c2400da23d4f5f04d7f03731beb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 22 Dec 2017 11:21:38 +0100 Subject: Client tests: Support testing with window decorations enabled Previously tests would hang because eglInitialize (which was called on window decoration creation) would wait for a Wayland roundtrip while our compositor thread was waiting for more commands. Work around this by prematurely causing the clientBufferIntegration to be initialized before applicationInitialized (when the compositors switches to handling requests synchronously). Change-Id: I793c70a8f3a764cb3a70f00ddcab76cd4044b442 Reviewed-by: Pier Luigi Fiorini --- tests/auto/client/client/client.pro | 2 +- tests/auto/client/client/tst_client.cpp | 37 ++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/client/client/client.pro b/tests/auto/client/client/client.pro index 34fc67474..e6e607c3f 100644 --- a/tests/auto/client/client/client.pro +++ b/tests/auto/client/client/client.pro @@ -2,7 +2,7 @@ CONFIG += testcase link_pkgconfig TARGET = tst_client QT += testlib -QT += core-private gui-private +QT += core-private gui-private waylandclient-private QMAKE_USE += wayland-client wayland-server diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 1eee90f49..3897bd3b1 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -37,6 +37,8 @@ #include #include +#include +#include static const QSize screenSize(1600, 1200); @@ -96,6 +98,8 @@ public: ++touchEventCount; } + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } + int focusInEventCount; int focusOutEventCount; int keyPressEventCount; @@ -201,7 +205,7 @@ void tst_WaylandClient::events() QPoint mousePressPos(16, 16); QCOMPARE(window.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, window.frameOffset() + mousePressPos); QTRY_COMPARE(window.mousePressEventCount, 1); QTRY_COMPARE(window.mousePressPos, mousePressPos); @@ -210,7 +214,7 @@ void tst_WaylandClient::events() QTRY_COMPARE(window.mouseReleaseEventCount, 1); const int touchId = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), touchId); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId); compositor->sendTouchFrame(surface); QTRY_COMPARE(window.touchEventCount, 1); @@ -269,6 +273,7 @@ public: m_dragIcon = QPixmap::fromImage(cursorImage); } ~DndWindow(){} + QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } bool dragStarted; protected: @@ -302,14 +307,14 @@ void tst_WaylandClient::touchDrag() QTRY_COMPARE(QGuiApplication::focusWindow(), &window); const int id = 0; - compositor->sendTouchDown(surface, QPoint(10, 10), id); + compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), id); compositor->sendTouchFrame(surface); - compositor->sendTouchMotion(surface, QPoint(20, 20), id); + compositor->sendTouchMotion(surface, window.frameOffset() + QPoint(20, 20), id); compositor->sendTouchFrame(surface); compositor->waitForStartDrag(); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); QTRY_VERIFY(window.dragStarted); @@ -326,10 +331,10 @@ void tst_WaylandClient::mouseDrag() compositor->setKeyboardFocus(surface); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); - compositor->sendMousePress(surface, QPoint(10, 10)); + compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10)); compositor->sendDataDeviceDataOffer(surface); - compositor->sendDataDeviceEnter(surface, QPoint(20, 20)); - compositor->sendDataDeviceMotion( QPoint(21, 21)); + compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20)); + compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21)); compositor->waitForStartDrag(); compositor->sendDataDeviceDrop(surface); compositor->sendDataDeviceLeave(surface); @@ -390,7 +395,7 @@ void tst_WaylandClient::hiddenPopupParent() QTRY_VERIFY(surface = compositor->surface()); QPoint mousePressPos(16, 16); QCOMPARE(toplevel.mousePressEventCount, 0); - compositor->sendMousePress(surface, mousePressPos); + compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos); QTRY_COMPARE(toplevel.mousePressEventCount, 1); QWindow popup; @@ -409,15 +414,17 @@ int main(int argc, char **argv) setenv("XDG_RUNTIME_DIR", ".", 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - // wayland-egl hangs in the test setup when we try to initialize. Until it gets - // figured out, avoid clientBufferIntegration() from being called in - // QWaylandWindow::createDecorations(). - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); - MockCompositor compositor; compositor.setOutputGeometry(QRect(QPoint(), screenSize)); QGuiApplication app(argc, argv); + + // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting + // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized + // (while the compositor processes events without waiting) in order to avoid hanging later. + auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + waylandIntegration->clientBufferIntegration(); + compositor.applicationInitialized(); tst_WaylandClient tc(&compositor); -- cgit v1.2.3