From 94b800806790c0bf4a08aebe62f6aa3c51a3815b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 6 May 2021 10:27:23 +0100 Subject: Port fullscreen shell autotest away from shared_old Change-Id: Ic6ef3b46fe6d6abf0f028389174fe4ac09dff60a Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/client/shared/CMakeLists.txt | 2 + tests/auto/client/shared/fullscreenshellv1.cpp | 47 ++++++++++++++++++++ tests/auto/client/shared/fullscreenshellv1.h | 59 ++++++++++++++++++++++++++ tests/auto/client/shared/mockcompositor.cpp | 1 + tests/auto/client/shared/mockcompositor.h | 2 + 5 files changed, 111 insertions(+) create mode 100644 tests/auto/client/shared/fullscreenshellv1.cpp create mode 100644 tests/auto/client/shared/fullscreenshellv1.h (limited to 'tests/auto/client/shared') diff --git a/tests/auto/client/shared/CMakeLists.txt b/tests/auto/client/shared/CMakeLists.txt index c465ea1b5..530acf264 100644 --- a/tests/auto/client/shared/CMakeLists.txt +++ b/tests/auto/client/shared/CMakeLists.txt @@ -7,6 +7,7 @@ add_library(SharedClientTest corecompositor.cpp corecompositor.h coreprotocol.cpp coreprotocol.h datadevice.cpp datadevice.h + fullscreenshellv1.cpp fullscreenshellv1.h mockcompositor.cpp mockcompositor.h textinput.cpp textinput.h xdgoutputv1.cpp xdgoutputv1.h @@ -17,6 +18,7 @@ set_property(TARGET SharedClientTest PROPERTY AUTOMOC ON) qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml diff --git a/tests/auto/client/shared/fullscreenshellv1.cpp b/tests/auto/client/shared/fullscreenshellv1.cpp new file mode 100644 index 000000000..f97088d50 --- /dev/null +++ b/tests/auto/client/shared/fullscreenshellv1.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2021 David Edmundson +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "fullscreenshellv1.h" + +namespace MockCompositor { + +FullScreenShellV1::FullScreenShellV1(CoreCompositor *compositor) +{ + init(compositor->m_display, 1); +} + +void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) +{ + Q_UNUSED(resource); + Q_UNUSED(method); + Q_UNUSED(output); + + m_surfaces.append(fromResource(surface)); +} + +} // namespace MockCompositor diff --git a/tests/auto/client/shared/fullscreenshellv1.h b/tests/auto/client/shared/fullscreenshellv1.h new file mode 100644 index 000000000..f5bdc8c74 --- /dev/null +++ b/tests/auto/client/shared/fullscreenshellv1.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2021 David Edmundson +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKCOMPOSITOR_FULLSCREENSHELLV1_H +#define MOCKCOMPOSITOR_FULLSCREENSHELLV1_H + +#include "coreprotocol.h" +#include + +#include + +namespace MockCompositor { + +class Surface; +class FullScreenShellV1; + +class FullScreenShellV1 : public Global, public QtWaylandServer::zwp_fullscreen_shell_v1 +{ + Q_OBJECT +public: + explicit FullScreenShellV1(CoreCompositor *compositor); + + QList surfaces() const { return m_surfaces; } + +protected: + void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override; + +private: + QList m_surfaces; +}; + +} // namespace MockCompositor + +#endif // MOCKCOMPOSITOR_FULLSCREENSHELLV1_H diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp index dca9dac49..c958e6e81 100644 --- a/tests/auto/client/shared/mockcompositor.cpp +++ b/tests/auto/client/shared/mockcompositor.cpp @@ -44,6 +44,7 @@ DefaultCompositor::DefaultCompositor() add(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch); add(); add(); + add(); // TODO: other shells, viewporter, xdgoutput etc QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ diff --git a/tests/auto/client/shared/mockcompositor.h b/tests/auto/client/shared/mockcompositor.h index 485816178..878560a24 100644 --- a/tests/auto/client/shared/mockcompositor.h +++ b/tests/auto/client/shared/mockcompositor.h @@ -33,6 +33,7 @@ #include "coreprotocol.h" #include "datadevice.h" #include "xdgshell.h" +#include "fullscreenshellv1.h" #include @@ -64,6 +65,7 @@ public: Touch *touch() { auto *seat = get(); Q_ASSERT(seat); return seat->m_touch; } Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; } Keyboard *keyboard() { auto *seat = get(); Q_ASSERT(seat); return seat->m_keyboard; } + FullScreenShellV1 *fullScreenShellV1() {return get();}; uint sendXdgShellPing(); void xdgPingAndWaitForPong(); // Things that can be changed run-time without confusing the client (i.e. don't require separate tests) -- cgit v1.2.3