From 550c867ead52c575b9d7117754d8c935916f0bb7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Nov 2021 17:53:00 +0100 Subject: tst_seatv4: fix deprecated implicit capture of this by [=] Since exec() is a synchronous call, we can just take everything by reference instead. Pick-to: 6.2 5.15 Change-Id: Ic1588db69ed6bb0d8dd39ff0439ad0fc97dd957f Reviewed-by: David Edmundson --- tests/auto/client/seatv4/tst_seatv4.cpp | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/auto/client/seatv4/tst_seatv4.cpp b/tests/auto/client/seatv4/tst_seatv4.cpp index b6394652b..e23ed37d1 100644 --- a/tests/auto/client/seatv4/tst_seatv4.cpp +++ b/tests/auto/client/seatv4/tst_seatv4.cpp @@ -135,19 +135,19 @@ void tst_seatv4::setsCursorOnEnter() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); } void tst_seatv4::usesEnterSerial() { - QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - uint enterSerial = exec([=] { + uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); @@ -158,7 +158,7 @@ void tst_seatv4::usesEnterSerial() void tst_seatv4::focusDestruction() { - QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor); + QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor); QRasterWindow window; window.resize(64, 64); window.show(); @@ -166,7 +166,7 @@ void tst_seatv4::focusDestruction() // Setting a cursor now is not allowed since there has been no enter event QCOMPARE(setCursorSpy.count(), 0); - uint enterSerial = exec([=] { + uint enterSerial = exec([&] { return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); @@ -298,7 +298,7 @@ void tst_seatv4::simpleAxis() WheelWindow window; QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { Surface *surface = xdgSurface()->m_surface; pointer()->sendEnter(surface, {32, 32}); wl_client *client = surface->resource()->client(); @@ -322,7 +322,7 @@ void tst_seatv4::invalidPointerEvents() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { + exec([&] { auto *p = pointer(); auto *c = client(); // Purposefully send events without a wl_pointer.enter @@ -355,7 +355,7 @@ static bool supportsCursorSizes(const QList &sizes) { auto *waylandIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); wl_shm *shm = waylandIntegration->display()->shm()->object(); - return std::all_of(sizes.begin(), sizes.end(), [=](uint size) { + return std::all_of(sizes.begin(), sizes.end(), [&](uint size) { return supportsCursorSize(size, shm); }); } @@ -384,15 +384,15 @@ void tst_seatv4::scaledCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); - QSize unscaledPixelSize = exec([=] { + QSize unscaledPixelSize = exec([&] { return cursorSurface()->m_committed.buffer->size(); }); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -412,7 +412,7 @@ void tst_seatv4::unscaledFallbackCursor() const int screens = 4; // with scales 1, 2, 4, 8 - exec([=] { + exec([&] { for (int i = 1; i < screens; ++i) { OutputData d; d.scale = int(qPow(2, i)); @@ -425,11 +425,11 @@ void tst_seatv4::unscaledFallbackCursor() window.resize(64, 64); window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1); - QSize unscaledPixelSize = exec([=] { + QSize unscaledPixelSize = exec([&] { return cursorSurface()->m_committed.buffer->size(); }); @@ -437,7 +437,7 @@ void tst_seatv4::unscaledFallbackCursor() QCOMPARE(unscaledPixelSize.height(), int(defaultSize)); for (int i = 1; i < screens; ++i) { - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[i]); surface->sendLeave(getAll()[i-1]); @@ -475,14 +475,14 @@ void tst_seatv4::bitmapCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(24, 24)); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 1); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -521,14 +521,14 @@ void tst_seatv4::hidpiBitmapCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(48, 48)); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2); QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12)); - exec([=] { + exec([&] { auto *surface = cursorSurface(); surface->sendEnter(getAll()[1]); surface->sendLeave(getAll()[0]); @@ -558,7 +558,7 @@ void tst_seatv4::hidpiBitmapCursorNonInt() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(100, 100)); @@ -576,12 +576,12 @@ void tst_seatv4::animatedCursor() window.show(); QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); - exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); + exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); }); QCOMPOSITOR_TRY_VERIFY(cursorSurface()); // We should get the first buffer without waiting for a frame callback QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer); - QSignalSpy bufferSpy(exec([=] { return cursorSurface(); }), &Surface::bufferCommitted); + QSignalSpy bufferSpy(exec([&] { return cursorSurface(); }), &Surface::bufferCommitted); exec([&] { // Make sure no extra buffers have arrived -- cgit v1.2.3