summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2021-05-06 10:27:23 +0100
committerDavid Edmundson <davidedmundson@kde.org>2021-05-10 13:43:34 +0100
commit94b800806790c0bf4a08aebe62f6aa3c51a3815b (patch)
tree0c9e1e4a44e9cd3addc464c346cc69d06f49b5b2 /tests/auto/client/shared
parentd6e074d0d35221b0fac14c94fc79c98363f2f6c3 (diff)
Port fullscreen shell autotest away from shared_old
Change-Id: Ic6ef3b46fe6d6abf0f028389174fe4ac09dff60a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/client/shared')
-rw-r--r--tests/auto/client/shared/CMakeLists.txt2
-rw-r--r--tests/auto/client/shared/fullscreenshellv1.cpp47
-rw-r--r--tests/auto/client/shared/fullscreenshellv1.h59
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp1
-rw-r--r--tests/auto/client/shared/mockcompositor.h2
5 files changed, 111 insertions, 0 deletions
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 <davidedmundson@kde.org>
+** 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>(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 <davidedmundson@kde.org>
+** 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 <qwayland-server-fullscreen-shell-unstable-v1.h>
+
+#include <QList>
+
+namespace MockCompositor {
+
+class Surface;
+class FullScreenShellV1;
+
+class FullScreenShellV1 : public Global, public QtWaylandServer::zwp_fullscreen_shell_v1
+{
+ Q_OBJECT
+public:
+ explicit FullScreenShellV1(CoreCompositor *compositor);
+
+ QList<Surface *> 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<Surface *> 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>(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch);
add<XdgWmBase>();
add<Shm>();
+ add<FullScreenShellV1>();
// TODO: other shells, viewporter, xdgoutput etc
QObject::connect(get<WlCompositor>(), &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 <QtGui/QGuiApplication>
@@ -64,6 +65,7 @@ public:
Touch *touch() { auto *seat = get<Seat>(); Q_ASSERT(seat); return seat->m_touch; }
Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; }
Keyboard *keyboard() { auto *seat = get<Seat>(); Q_ASSERT(seat); return seat->m_keyboard; }
+ FullScreenShellV1 *fullScreenShellV1() {return get<FullScreenShellV1>();};
uint sendXdgShellPing();
void xdgPingAndWaitForPong();
// Things that can be changed run-time without confusing the client (i.e. don't require separate tests)