From 5e47af01b4b3cd7a8dd50b06f752867517f10db6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 15 Jun 2023 15:07:32 +0100 Subject: [PATCH] tests: Send frame callbacks by default Currently we have special handling for wl-shell to automatically respond to frame callbacks in the mock compositor. With the framecallback timer this results in flaky tests as the window becomes unexposed. Pick-to: 6.6 Change-Id: I2add44d59ba26368c031a381849891f49764bfb5 Reviewed-by: David Edmundson --- tests/auto/wayland/seatv4/tst_seatv4.cpp | 1 + tests/auto/wayland/shared/mockcompositor.cpp | 3 +++ tests/auto/wayland/shared/mockcompositor.h | 1 + tests/auto/wayland/surface/tst_surface.cpp | 7 +++++++ 4 files changed, 12 insertions(+) diff --git a/tests/auto/wayland/seatv4/tst_seatv4.cpp b/tests/auto/wayland/seatv4/tst_seatv4.cpp index 8d78c2b3643..7b80c02f508 100644 --- a/tests/auto/wayland/seatv4/tst_seatv4.cpp +++ b/tests/auto/wayland/seatv4/tst_seatv4.cpp @@ -23,6 +23,7 @@ public: { exec([this] { m_config.autoConfigure = true; + m_config.autoFrameCallback = false; // for cursor animation test removeAll(); diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 5748c51ae57..571117d6b4b 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -43,6 +43,9 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); } + if (m_config.autoFrameCallback) { + surface->sendFrameCallbacks(); + } if (m_config.autoEnter && get() && surface->m_outputs.empty()) surface->sendEnter(get()); wl_display_flush_clients(m_display); diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 8d26361a4f9..268f77680df 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -61,6 +61,7 @@ public: bool autoEnter = true; bool autoRelease = true; bool autoConfigure = false; + bool autoFrameCallback = true; } m_config; void resetConfig() { exec([&] { m_config = Config{}; }); } }; diff --git a/tests/auto/wayland/surface/tst_surface.cpp b/tests/auto/wayland/surface/tst_surface.cpp index ad7af036a14..75a83e23023 100644 --- a/tests/auto/wayland/surface/tst_surface.cpp +++ b/tests/auto/wayland/surface/tst_surface.cpp @@ -12,6 +12,8 @@ using namespace MockCompositor; class tst_surface : public QObject, private DefaultCompositor { Q_OBJECT +public: + explicit tst_surface(); private slots: void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void createDestroySurface(); @@ -26,6 +28,11 @@ private slots: void createSubsurfaceForHiddenParent(); }; +tst_surface::tst_surface() +{ + m_config.autoFrameCallback = false; +} + void tst_surface::createDestroySurface() { QWindow window;