From 9b5b02c957a3f95535be95c55304c6ce27ae1aec Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 21 Jul 2021 01:37:58 +0200 Subject: [PATCH] kwin tests: Add heplers to access the input panel client and its surface It's useful when dealing with unit tests for input methods --- autotests/integration/kwin_wayland_test.h | 3 +++ autotests/integration/test_helpers.cpp | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index 1699bbdd5e..8420a9dce8 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -391,6 +391,9 @@ bool unlockScreen(); void initWaylandWorkspace(); +AbstractClient *inputPanelClient(); +KWayland::Client::Surface *inputPanelSurface(); + } } diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index c7e289f647..4ca96119f2 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -257,16 +257,29 @@ public: MockInputMethod(struct wl_registry *registry, int id, int version); ~MockInputMethod(); + AbstractClient *client() const { return m_client; } + Surface *inputPanelSurface() const { return m_inputSurface; } + protected: void zwp_input_method_v1_activate(struct ::zwp_input_method_context_v1 *context) override; void zwp_input_method_v1_deactivate(struct ::zwp_input_method_context_v1 *context) override; private: - Surface *m_inputSurface = nullptr; + QPointer m_inputSurface; QtWayland::zwp_input_panel_surface_v1 *m_inputMethodSurface = nullptr; - AbstractClient *m_client = nullptr; + QPointer m_client; }; +AbstractClient *inputPanelClient() +{ + return s_waylandConnection.inputMethodV1->client(); +} + +Surface *inputPanelSurface() +{ + return s_waylandConnection.inputMethodV1->inputPanelSurface(); +} + MockInputMethod::MockInputMethod(struct wl_registry *registry, int id, int version) : QtWayland::zwp_input_method_v1(registry, id, version) {