diff options
author | David Edmundson <davidedmundson@kde.org> | 2020-09-07 14:17:53 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2020-11-11 08:38:10 +0000 |
commit | 2c2599fc299322667e3fe931a16ebe26bee9df6e (patch) | |
tree | ae051352c6a5152c77a26f11cfb83b93ddccb7e1 /tests | |
parent | 43f9bc8d95c1427937dac8271aba3e311ece84b3 (diff) | |
download | qtwayland-2c2599fc299322667e3fe931a16ebe26bee9df6e.tar.gz |
Client: Drop XdgShellV5 and XdgShellV6
Both of these are deprecated given this is now formalised as the final
xdg-wm-base. This final release has been out for several years and all
main compositors (kwin, sway, mutter) have dropped or are dropping
legacy support.
tst_nooutput is moved to stable XdgShell.
Change-Id: I46a011502dfec6d4a215c3b22d03e8ceebed46c3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests')
22 files changed, 20 insertions, 898 deletions
diff --git a/tests/auto/client/CMakeLists.txt b/tests/auto/client/CMakeLists.txt index 5939853c..78354604 100644 --- a/tests/auto/client/CMakeLists.txt +++ b/tests/auto/client/CMakeLists.txt @@ -15,7 +15,6 @@ add_subdirectory(wl_connect) add_subdirectory(xdgdecorationv1) add_subdirectory(xdgoutput) add_subdirectory(xdgshell) -add_subdirectory(xdgshellv6) if(QT_FEATURE_im) add_subdirectory(inputcontext) endif() diff --git a/tests/auto/client/client.pro b/tests/auto/client/client.pro index 46a3aa42..7f5ffc0f 100644 --- a/tests/auto/client/client.pro +++ b/tests/auto/client/client.pro @@ -15,7 +15,6 @@ SUBDIRS += \ wl_connect \ xdgdecorationv1 \ xdgoutput \ - xdgshell \ - xdgshellv6 + xdgshell qtConfig(im): SUBDIRS += inputcontext diff --git a/tests/auto/client/client/.prev_CMakeLists.txt b/tests/auto/client/client/.prev_CMakeLists.txt index cdcae2ff..0aeb3f27 100644 --- a/tests/auto/client/client/.prev_CMakeLists.txt +++ b/tests/auto/client/client/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_client.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,7 +32,7 @@ qt6_generate_wayland_protocol_server_sources(tst_client ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) #### Keys ignored in scope 1:.:.:client.pro:<TRUE>: diff --git a/tests/auto/client/client/CMakeLists.txt b/tests/auto/client/client/CMakeLists.txt index 86eb420e..2b6df4a3 100644 --- a/tests/auto/client/client/CMakeLists.txt +++ b/tests/auto/client/client/CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_client.cpp INCLUDE_DIRECTORIES ../shared_old @@ -34,7 +33,7 @@ qt6_generate_wayland_protocol_server_sources(tst_client ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) #### Keys ignored in scope 1:.:.:client.pro:<TRUE>: diff --git a/tests/auto/client/client/run-with-all-shells.sh b/tests/auto/client/client/run-with-all-shells.sh index 41f38390..5acd85a4 100755 --- a/tests/auto/client/client/run-with-all-shells.sh +++ b/tests/auto/client/client/run-with-all-shells.sh @@ -3,4 +3,3 @@ set -ex $@ env QT_WAYLAND_SHELL_INTEGRATION=wl-shell $@ env QT_WAYLAND_SHELL_INTEGRATION=ivi-shell $@ -env QT_WAYLAND_SHELL_INTEGRATION=xdg-shell-v6 $@ diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index ad63eca0..9c99220d 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -167,7 +167,6 @@ public slots: // and don't show up as false positives in the next test QTRY_VERIFY(!compositor->surface()); QTRY_VERIFY(!compositor->iviSurface()); - QTRY_VERIFY(!compositor->xdgToplevelV6()); } private slots: @@ -212,9 +211,6 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus() QTRY_VERIFY(window.isExposed()); - if (compositor->xdgToplevelV6()) - QSKIP("On xdg-shell v6 focus is handled by configure events"); - QCOMPARE(window.focusInEventCount, 0); compositor->setKeyboardFocus(surface); QTRY_COMPARE(window.focusInEventCount, 1); diff --git a/tests/auto/client/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/client/fullscreenshellv1/.prev_CMakeLists.txt index c3e375c0..ca850796 100644 --- a/tests/auto/client/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/client/fullscreenshellv1/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,5 +32,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/fullscreenshellv1/CMakeLists.txt b/tests/auto/client/fullscreenshellv1/CMakeLists.txt index 42d328a6..4a64b9e2 100644 --- a/tests/auto/client/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/client/fullscreenshellv1/CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_fullscreenshellv1.cpp INCLUDE_DIRECTORIES ../shared_old @@ -34,5 +33,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_fullscreenshellv1 ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/iviapplication/.prev_CMakeLists.txt b/tests/auto/client/iviapplication/.prev_CMakeLists.txt index ce9c8fd9..a545e55f 100644 --- a/tests/auto/client/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/client/iviapplication/.prev_CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_iviapplication ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_iviapplication.cpp INCLUDE_DIRECTORIES ../shared_old @@ -33,5 +32,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_iviapplication ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/iviapplication/CMakeLists.txt b/tests/auto/client/iviapplication/CMakeLists.txt index ca9679af..601b4c91 100644 --- a/tests/auto/client/iviapplication/CMakeLists.txt +++ b/tests/auto/client/iviapplication/CMakeLists.txt @@ -14,7 +14,6 @@ qt_internal_add_test(tst_client_iviapplication ../shared_old/mockregion.cpp ../shared_old/mockregion.h ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h tst_iviapplication.cpp INCLUDE_DIRECTORIES ../shared_old @@ -34,5 +33,5 @@ qt6_generate_wayland_protocol_server_sources(tst_client_iviapplication ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml ) diff --git a/tests/auto/client/nooutput/tst_nooutput.cpp b/tests/auto/client/nooutput/tst_nooutput.cpp index 098d88d9..b80a8178 100644 --- a/tests/auto/client/nooutput/tst_nooutput.cpp +++ b/tests/auto/client/nooutput/tst_nooutput.cpp @@ -60,8 +60,17 @@ void tst_nooutput::noScreens() window.resize(16, 16); window.show(); - // We have to handle showing a window when there are no real outputs - QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + QTRY_VERIFY(window.isVisible()); + // The window should not be exposed before the first xdg_surface configure event + QTRY_VERIFY(!window.isExposed()); + + exec([=] { + xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size + }); + + QTRY_VERIFY(window.isExposed()); } QCOMPOSITOR_TEST_MAIN(tst_nooutput) diff --git a/tests/auto/client/shared_old/mockcompositor.cpp b/tests/auto/client/shared_old/mockcompositor.cpp index 6fd2ec6b..9353d894 100644 --- a/tests/auto/client/shared_old/mockcompositor.cpp +++ b/tests/auto/client/shared_old/mockcompositor.cpp @@ -31,11 +31,8 @@ #include "mockoutput.h" #include "mocksurface.h" #include "mockwlshell.h" -#include "mockxdgshellv6.h" #include "mockiviapplication.h" -#include <wayland-xdg-shell-unstable-v6-server-protocol.h> - #include <stdio.h> MockCompositor::MockCompositor() { @@ -199,17 +196,6 @@ void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer<MockIviSurface processCommand(command); } -void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer<MockXdgToplevelV6> toplevel, const QSize &size, const QList<uint> &states) -{ - Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor); - command.parameters << QVariant::fromValue(toplevel); - command.parameters << QVariant::fromValue(size); - QByteArray statesBytes(reinterpret_cast<const char *>(states.data()), - states.size() * static_cast<int>(sizeof(uint))); - command.parameters << statesBytes; - processCommand(command); -} - void MockCompositor::waitForStartDrag() { Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor); @@ -254,16 +240,6 @@ QSharedPointer<MockIviSurface> MockCompositor::iviSurface(int index) return result; } -QSharedPointer<MockXdgToplevelV6> MockCompositor::xdgToplevelV6(int index) -{ - QSharedPointer<MockXdgToplevelV6> result; - lock(); - if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr)) - result = toplevel->mockToplevel(); - unlock(); - return result; -} - QSharedPointer<MockSurface> MockCompositor::fullScreenShellV1Surface(int index) { QSharedPointer<MockSurface> result; @@ -356,7 +332,6 @@ Compositor::Compositor(MockCompositor *mockCompositor) m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0))); m_iviApplication.reset(new IviApplication(m_display)); m_wlShell.reset(new WlShell(m_display)); - m_xdgShellV6.reset(new XdgShellV6(m_display)); m_fullScreenShellV1.reset(new FullScreenShellV1(m_display)); m_loop = wl_display_get_event_loop(m_display); @@ -430,11 +405,6 @@ IviApplication *Compositor::iviApplication() const return m_iviApplication.data(); } -XdgShellV6 *Compositor::xdgShellV6() const -{ - return m_xdgShellV6.data(); -} - FullScreenShellV1 *Compositor::fullScreenShellV1() const { return m_fullScreenShellV1.data(); @@ -480,10 +450,4 @@ IviSurface *Compositor::resolveIviSurface(const QVariant &v) return mockIviSurface ? mockIviSurface->handle() : nullptr; } -XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v) -{ - QSharedPointer<MockXdgToplevelV6> mockToplevel = v.value<QSharedPointer<MockXdgToplevelV6>>(); - return mockToplevel ? mockToplevel->handle() : nullptr; -} - } diff --git a/tests/auto/client/shared_old/mockcompositor.h b/tests/auto/client/shared_old/mockcompositor.h index cbcf34cb..40fedf7d 100644 --- a/tests/auto/client/shared_old/mockcompositor.h +++ b/tests/auto/client/shared_old/mockcompositor.h @@ -29,7 +29,6 @@ #ifndef MOCKCOMPOSITOR_H #define MOCKCOMPOSITOR_H -#include "mockxdgshellv6.h" #include "mockiviapplication.h" #include "mockfullscreenshellv1.h" #include "mockregion.h" @@ -62,7 +61,6 @@ class Surface; class Output; class IviApplication; class WlShell; -class XdgShellV6; class Region; class Compositor @@ -81,7 +79,6 @@ public: QList<Output *> outputs() const; IviApplication *iviApplication() const; - XdgShellV6 *xdgShellV6() const; FullScreenShellV1 *fullScreenShellV1() const; void addSurface(Surface *surface); @@ -105,7 +102,6 @@ public: static void setOutputMode(void *compositor, const QList<QVariant> ¶meters); static void sendShellSurfaceConfigure(void *data, const QList<QVariant> ¶meters); static void sendIviSurfaceConfigure(void *data, const QList<QVariant> ¶meters); - static void sendXdgToplevelV6Configure(void *data, const QList<QVariant> ¶meters); public: bool m_startDragSeen = false; @@ -115,7 +111,6 @@ private: static Surface *resolveSurface(const QVariant &v); static Output *resolveOutput(const QVariant &v); static IviSurface *resolveIviSurface(const QVariant &v); - static XdgToplevelV6 *resolveToplevel(const QVariant &v); void initShm(); @@ -137,7 +132,6 @@ private: QList<Output *> m_outputs; QScopedPointer<IviApplication> m_iviApplication; QScopedPointer<WlShell> m_wlShell; - QScopedPointer<XdgShellV6> m_xdgShellV6; QScopedPointer<FullScreenShellV1> m_fullScreenShellV1; }; @@ -193,32 +187,6 @@ private: Q_DECLARE_METATYPE(QSharedPointer<MockIviSurface>) -class MockXdgToplevelV6 : public QObject -{ - Q_OBJECT -public: - Impl::XdgToplevelV6 *handle() const { return m_toplevel; } - - void sendConfigure(const QSharedPointer<MockXdgToplevelV6> toplevel); - -signals: - uint setMinimizedRequested(); - uint setMaximizedRequested(); - uint unsetMaximizedRequested(); - uint setFullscreenRequested(); - uint unsetFullscreenRequested(); - void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event - -private: - MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {} - friend class Impl::Compositor; - friend class Impl::XdgToplevelV6; - - Impl::XdgToplevelV6 *m_toplevel; -}; - -Q_DECLARE_METATYPE(QSharedPointer<MockXdgToplevelV6>) - class MockOutput { public: Impl::Output *handle() const { return m_output; } @@ -259,14 +227,11 @@ public: void sendSurfaceLeave(const QSharedPointer<MockSurface> &surface, QSharedPointer<MockOutput> &output); void sendShellSurfaceConfigure(const QSharedPointer<MockSurface> surface, const QSize &size = QSize(0, 0)); void sendIviSurfaceConfigure(const QSharedPointer<MockIviSurface> iviSurface, const QSize &size); - void sendXdgToplevelV6Configure(const QSharedPointer<MockXdgToplevelV6> toplevel, const QSize &size = QSize(0, 0), - const QList<uint> &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); void waitForStartDrag(); QSharedPointer<MockSurface> surface(); QSharedPointer<MockOutput> output(int index = 0); QSharedPointer<MockIviSurface> iviSurface(int index = 0); - QSharedPointer<MockXdgToplevelV6> xdgToplevelV6(int index = 0); QSharedPointer<MockSurface> fullScreenShellV1Surface(int index = 0); void lock(); diff --git a/tests/auto/client/shared_old/mocksurface.cpp b/tests/auto/client/shared_old/mocksurface.cpp index 23e088d3..de162b07 100644 --- a/tests/auto/client/shared_old/mocksurface.cpp +++ b/tests/auto/client/shared_old/mocksurface.cpp @@ -41,13 +41,7 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList<QVariant> &pa Surface *surface = resolveSurface(parameters.at(0)); QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); - if (auto toplevel = surface->xdgToplevelV6()) { - QList<uint> states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; - auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()), - states.size() * static_cast<int>(sizeof(uint))); - toplevel->send_configure(size.width(), size.height(), statesBytes); - toplevel->xdgSurface()->sendConfigure(compositor->nextSerial()); - } else if (auto wlShellSurface = surface->wlShellSurface()) { + if (auto wlShellSurface = surface->wlShellSurface()) { const uint edges = 0; wlShellSurface->send_configure(edges, size.width(), size.height()); } else { @@ -95,17 +89,11 @@ void Surface::surface_destroy(Resource *resource) if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface wl_resource_destroy(m_wlShellSurface->resource()->handle); Q_ASSERT(!m_wlShellSurface); - Q_ASSERT(!m_xdgSurfaceV6); wl_resource_destroy(resource->handle); } void Surface::surface_attach(Resource *resource, struct wl_resource *buffer, int x, int y) { - if (m_xdgSurfaceV6) { - // It's a protocol error to attach a buffer to an xdgSurface that's not configured - Q_ASSERT(xdgSurfaceV6()->configureSent()); - } - Q_UNUSED(resource); Q_UNUSED(x); Q_UNUSED(y); diff --git a/tests/auto/client/shared_old/mocksurface.h b/tests/auto/client/shared_old/mocksurface.h index d176837e..4b646230 100644 --- a/tests/auto/client/shared_old/mocksurface.h +++ b/tests/auto/client/shared_old/mocksurface.h @@ -37,7 +37,6 @@ namespace Impl { -class XdgToplevelV6; class WlShellSurface; class Surface : public QtWaylandServer::wl_surface @@ -50,8 +49,6 @@ public: static Surface *fromResource(struct ::wl_resource *resource); void map(); bool isMapped() const; - XdgSurfaceV6 *xdgSurfaceV6() const { return m_xdgSurfaceV6; } - XdgToplevelV6 *xdgToplevelV6() const { return m_xdgSurfaceV6 ? m_xdgSurfaceV6->toplevel() : nullptr; } WlShellSurface *wlShellSurface() const { return m_wlShellSurface; } QSharedPointer<MockSurface> mockSurface() const { return m_mockSurface; } @@ -72,7 +69,6 @@ protected: void surface_commit(Resource *resource) override; private: wl_resource *m_buffer = nullptr; - XdgSurfaceV6 *m_xdgSurfaceV6 = nullptr; WlShellSurface *m_wlShellSurface = nullptr; Compositor *m_compositor = nullptr; @@ -80,7 +76,6 @@ private: QList<wl_resource *> m_frameCallbackList; bool m_mapped = false; - friend class XdgSurfaceV6; friend class WlShellSurface; }; diff --git a/tests/auto/client/shared_old/mockxdgshellv6.cpp b/tests/auto/client/shared_old/mockxdgshellv6.cpp deleted file mode 100644 index 05eff74a..00000000 --- a/tests/auto/client/shared_old/mockxdgshellv6.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** 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 "mockxdgshellv6.h" -#include "mocksurface.h" -#include "mockcompositor.h" - -namespace Impl { - -void Compositor::sendXdgToplevelV6Configure(void *data, const QList<QVariant> ¶meters) -{ - Compositor *compositor = static_cast<Compositor *>(data); - XdgToplevelV6 *toplevel = resolveToplevel(parameters.at(0)); - Q_ASSERT(toplevel && toplevel->resource()); - QSize size = parameters.at(1).toSize(); - Q_ASSERT(size.isValid()); - auto statesBytes = parameters.at(2).toByteArray(); - toplevel->send_configure(size.width(), size.height(), statesBytes); - toplevel->xdgSurface()->send_configure(compositor->nextSerial()); -} - -XdgSurfaceV6::XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id) - : QtWaylandServer::zxdg_surface_v6(client, id, 1) - , m_surface(surface) - , m_shell(shell) -{ - m_surface->m_xdgSurfaceV6 = this; -} - -XdgSurfaceV6::~XdgSurfaceV6() -{ - m_surface->m_xdgSurfaceV6 = nullptr; -} - -void XdgSurfaceV6::sendConfigure(uint32_t serial) -{ - send_configure(serial); - m_configureSent = true; -} - -void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) -{ - int version = wl_resource_get_version(resource->handle); - m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); -} - -void XdgSurfaceV6::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - if (m_toplevel) { - QRect geometry(x, y, width, height); - emit m_toplevel->mockToplevel()->windowGeometryRequested(geometry); - } -} - -void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) -{ - Q_ASSERT(!m_toplevel); - wl_resource_destroy(resource->handle); -} - -XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) - : QtWaylandServer::zxdg_toplevel_v6(client, id, version) - , m_xdgSurface(xdgSurface) - , m_mockToplevel(new MockXdgToplevelV6(this)) -{ - auto *surface = m_xdgSurface->surface(); - m_xdgSurface->shell()->addToplevel(this); - surface->map(); -} - -XdgToplevelV6::~XdgToplevelV6() -{ - m_xdgSurface->shell()->removeToplevel(this); - m_mockToplevel->m_toplevel = nullptr; -} - -void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - m_xdgSurface->m_toplevel = nullptr; - wl_resource_destroy(resource->handle); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->setMinimizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->setMaximizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->unsetMaximizedRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output) -{ - Q_UNUSED(resource); - Q_UNUSED(output); - emit m_mockToplevel->setFullscreenRequested(); -} - -void XdgToplevelV6::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - emit m_mockToplevel->unsetFullscreenRequested(); -} - -void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface) -{ - new XdgSurfaceV6(this, Surface::fromResource(surface), resource->client(), id); -} - -} // namespace Impl diff --git a/tests/auto/client/shared_old/mockxdgshellv6.h b/tests/auto/client/shared_old/mockxdgshellv6.h deleted file mode 100644 index 4528dd1b..00000000 --- a/tests/auto/client/shared_old/mockxdgshellv6.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** 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 <qwayland-server-xdg-shell-unstable-v6.h> - -#include <QList> -#include <QSharedPointer> - -#ifndef MOCKXDGSHELLV6_H -#define MOCKXDGSHELLV6_H - -class MockXdgToplevelV6; - -namespace Impl { - -class XdgToplevelV6; -class XdgShellV6; -class Surface; - -class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 -{ -public: - XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id); - ~XdgSurfaceV6() override; - XdgShellV6 *shell() const { return m_shell; } - Surface *surface() const { return m_surface; } - XdgToplevelV6 *toplevel() const { return m_toplevel; } - - void sendConfigure(uint32_t serial); - bool configureSent() const { return m_configureSent; } - -protected: - void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; - void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; - void zxdg_surface_v6_destroy(Resource *resource) override; - -private: - Surface *m_surface = nullptr; - XdgToplevelV6 *m_toplevel = nullptr; - XdgShellV6 *m_shell = nullptr; - bool m_configureSent = false; - - friend class XdgToplevelV6; -}; - -class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 -{ -public: - XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version); - ~XdgToplevelV6() override; - XdgSurfaceV6 *xdgSurface() const { return m_xdgSurface; } - - QSharedPointer<MockXdgToplevelV6> mockToplevel() const { return m_mockToplevel; } - -protected: - void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } - void zxdg_toplevel_v6_destroy(Resource *resource) override; - void zxdg_toplevel_v6_set_minimized(Resource *resource) override; - void zxdg_toplevel_v6_set_maximized(Resource *resource) override; - void zxdg_toplevel_v6_unset_maximized(Resource *resource) override; - void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override; - void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override; - -private: - XdgSurfaceV6 *m_xdgSurface = nullptr; - QSharedPointer<MockXdgToplevelV6> m_mockToplevel; -}; - -class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6 -{ -public: - explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {} - QList<XdgToplevelV6 *> toplevels() const { return m_toplevels; } - -protected: - void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override; - -private: - void addToplevel(XdgToplevelV6 *toplevel) { m_toplevels.append(toplevel); } - void removeToplevel(XdgToplevelV6 *toplevel) { m_toplevels.removeOne(toplevel); } - QList<XdgToplevelV6 *> m_toplevels; - - friend class XdgToplevelV6; -}; - -} // namespace Impl - -#endif // MOCKXDGSHELLV6_H diff --git a/tests/auto/client/shared_old/shared_old.pri b/tests/auto/client/shared_old/shared_old.pri index 899e6b30..7b22c776 100644 --- a/tests/auto/client/shared_old/shared_old.pri +++ b/tests/auto/client/shared_old/shared_old.pri @@ -8,7 +8,7 @@ CONFIG += wayland-scanner WAYLANDSERVERSOURCES += \ ../../../../src/3rdparty/protocol/ivi-application.xml \ ../../../../src/3rdparty/protocol/wayland.xml \ - ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \ + ../../../../src/3rdparty/protocol/xdg-shell.xml \ ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml INCLUDEPATH += ../shared_old @@ -19,7 +19,6 @@ SOURCES += \ ../shared_old/mockinput.cpp \ ../shared_old/mockiviapplication.cpp \ ../shared_old/mockwlshell.cpp \ - ../shared_old/mockxdgshellv6.cpp \ ../shared_old/mocksurface.cpp \ ../shared_old/mockregion.cpp \ ../shared_old/mockoutput.cpp @@ -30,7 +29,6 @@ HEADERS += \ ../shared_old/mockinput.h \ ../shared_old/mockiviapplication.h \ ../shared_old/mockwlshell.h \ - ../shared_old/mockxdgshellv6.h \ ../shared_old/mocksurface.h \ ../shared_old/mockregion.h \ ../shared_old/mockoutput.h diff --git a/tests/auto/client/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/client/xdgshellv6/.prev_CMakeLists.txt deleted file mode 100644 index dc40fd63..00000000 --- a/tests/auto/client/xdgshellv6/.prev_CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Generated from xdgshellv6.pro. - -##################################################################### -## tst_client_xdgshellv6 Test: -##################################################################### - -qt_internal_add_test(tst_client_xdgshellv6 - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h - tst_xdgshellv6.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server -) - -qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml -) diff --git a/tests/auto/client/xdgshellv6/CMakeLists.txt b/tests/auto/client/xdgshellv6/CMakeLists.txt deleted file mode 100644 index 0e1704ea..00000000 --- a/tests/auto/client/xdgshellv6/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Generated from xdgshellv6.pro. - -##################################################################### -## tst_client_xdgshellv6 Test: -##################################################################### - -qt_internal_add_test(tst_client_xdgshellv6 - SOURCES - ../shared_old/mockcompositor.cpp ../shared_old/mockcompositor.h - ../shared_old/mockfullscreenshellv1.cpp ../shared_old/mockfullscreenshellv1.h - ../shared_old/mockinput.cpp ../shared_old/mockinput.h - ../shared_old/mockiviapplication.cpp ../shared_old/mockiviapplication.h - ../shared_old/mockoutput.cpp ../shared_old/mockoutput.h - ../shared_old/mockregion.cpp ../shared_old/mockregion.h - ../shared_old/mocksurface.cpp ../shared_old/mocksurface.h - ../shared_old/mockwlshell.cpp ../shared_old/mockwlshell.h - ../shared_old/mockxdgshellv6.cpp ../shared_old/mockxdgshellv6.h - tst_xdgshellv6.cpp - INCLUDE_DIRECTORIES - ../shared_old - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::OpenGL - Qt::WaylandClientPrivate - Wayland::Client - Wayland::Server - Threads::Threads # special case -) - -qt6_generate_wayland_protocol_server_sources(tst_client_xdgshellv6 - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml -) diff --git a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp deleted file mode 100644 index 76df6eb5..00000000 --- a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** 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 "mockcompositor.h" - -#include <QBackingStore> -#include <QPainter> -#include <QScreen> -#include <QWindow> -#include <QMimeData> -#include <QPixmap> -#include <QDrag> - -#include <QtTest/QtTest> - -static const QSize screenSize(1600, 1200); - -class TestWindow : public QWindow -{ - Q_OBJECT -public: - TestWindow() - { - setSurfaceType(QSurface::RasterSurface); - setGeometry(0, 0, 32, 32); - create(); - } - - bool event(QEvent *event) override - { - if (event->type() == QEvent::WindowStateChange) - emit windowStateChangeEventReceived(static_cast<QWindowStateChangeEvent *>(event)->oldState()); - return QWindow::event(event); - } - - void exposeEvent(QExposeEvent *event) override - { - ++exposeEventCount; - QWindow::exposeEvent(event); - } - - int exposeEventCount = 0; - -signals: - void windowStateChangeEventReceived(uint oldState); -}; - -class tst_WaylandClientXdgShellV6 : public QObject -{ - Q_OBJECT -public: - tst_WaylandClientXdgShellV6(MockCompositor *c) - : m_compositor(c) - { - qRegisterMetaType<Qt::WindowState>(); - QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this); - connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - // connect to the event dispatcher to make sure to flush out the outgoing message queue - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientXdgShellV6::processWaylandEvents); - } - -public slots: - void processWaylandEvents() - { - m_compositor->processWaylandEvents(); - } - - void cleanup() - { - // make sure the surfaces from the last test are properly cleaned up - // and don't show up as false positives in the next test - QTRY_VERIFY(!m_compositor->surface()); - QTRY_VERIFY(!m_compositor->xdgToplevelV6()); - } - -private slots: - void createDestroyWindow(); - void configure(); - void showMinimized(); - void setMinimized(); - void unsetMaximized(); - void focusWindowFollowsConfigure(); - void windowStateChangedEvents(); - void windowGeometrySimple(); - void windowGeometryFixed(); - void flushUnconfiguredXdgSurface(); - void dontSpamExposeEvents(); - -private: - MockCompositor *m_compositor = nullptr; -}; - -void tst_WaylandClientXdgShellV6::createDestroyWindow() -{ - TestWindow window; - window.show(); - - QTRY_VERIFY(m_compositor->surface()); - - window.destroy(); - QTRY_VERIFY(!m_compositor->surface()); -} - -void tst_WaylandClientXdgShellV6::configure() -{ - QSharedPointer<MockOutput> output; - QTRY_VERIFY(output = m_compositor->output()); - - TestWindow window; - window.show(); - - QSharedPointer<MockSurface> surface; - QTRY_VERIFY(surface = m_compositor->surface()); - - m_compositor->processWaylandEvents(); - QTRY_VERIFY(window.isVisible()); - QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event - - //TODO: according to xdg-shell protocol, a buffer should not be attached to a the surface - //until it's configured. Ensure this in the test! - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - const QSize newSize(123, 456); - m_compositor->sendXdgToplevelV6Configure(toplevel, newSize); - QTRY_VERIFY(window.isExposed()); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - QTRY_COMPARE(window.visibility(), QWindow::Maximized); - QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); - QTRY_COMPARE(window.visibility(), QWindow::FullScreen); - QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize)); - - //The window should remember it's original size - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize)); -} - -void tst_WaylandClientXdgShellV6::showMinimized() -{ - // On xdg-shell v6 there's really no way for the compositor to tell the window if it's minimized - // There are wl_surface.enter events and so on, but there's really no way to differentiate - // between a window preview and an unminimized window. - TestWindow window; - window.showMinimized(); - QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged - - // Make sure the window on the compositor side is/was created here, and not after the test - // finishes, as that may mess up for later tests. - QTRY_VERIFY(m_compositor->xdgToplevelV6()); -} - -void tst_WaylandClientXdgShellV6::setMinimized() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(window.visibility(), QWindow::Windowed); - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - - QSignalSpy setMinimizedSpy(toplevel.data(), SIGNAL(setMinimizedRequested())); - QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - - window.setVisibility(QWindow::Minimized); - QCOMPARE(window.visibility(), QWindow::Minimized); - QCOMPARE(window.windowStates(), Qt::WindowMinimized); - QTRY_COMPARE(setMinimizedSpy.count(), 1); - { - QTRY_VERIFY(windowStateChangeSpy.count() > 0); - Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); - } - - // In the meantime the compositor may minimize, do nothing or reshow the window without - // telling us. - - QTRY_COMPARE(window.visibility(), QWindow::Windowed); // verify that we don't know anything - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - { - QTRY_COMPARE(windowStateChangeSpy.count(), 1); - Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); // because the window never was minimized - } - - // Setting visibility again should send another set_minimized request - window.setVisibility(QWindow::Minimized); - QTRY_COMPARE(setMinimizedSpy.count(), 2); -} - -void tst_WaylandClientXdgShellV6::unsetMaximized() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - QSignalSpy unsetMaximizedSpy(toplevel.data(), SIGNAL(unsetMaximizedRequested())); - - QSignalSpy windowStateChangedSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowMaximized); - - window.setWindowStates(Qt::WindowNoState); - - QTRY_COMPARE(unsetMaximizedSpy.count(), 1); - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - - QTRY_COMPARE(windowStateChangedSpy.count(), 1); - QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState); -} - -void tst_WaylandClientXdgShellV6::focusWindowFollowsConfigure() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QTRY_VERIFY(!window.isActive()); - - QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }); - QTRY_VERIFY(window.isActive()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - QTRY_VERIFY(!window.isActive()); -} - -void tst_WaylandClientXdgShellV6::windowStateChangedEvents() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - - QSignalSpy eventSpy(&window, SIGNAL(windowStateChangeEventReceived(uint))); - QSignalSpy signalSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState))); - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED }); - - QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized); - QTRY_COMPARE(window.windowState(), Qt::WindowMaximized); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowNoState); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowMaximized); - } - - m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN }); - - QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen); - QTRY_COMPARE(window.windowState(), Qt::WindowFullScreen); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowMaximized); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowFullScreen); - } - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {}); - - QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); - QTRY_COMPARE(window.windowState(), Qt::WindowNoState); - { - QTRY_COMPARE(eventSpy.count(), 1); - Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt()); - QCOMPARE(oldStates, Qt::WindowFullScreen); - - QTRY_COMPARE(signalSpy.count(), 1); - uint newState = signalSpy.takeFirst().at(0).toUInt(); - QCOMPARE(newState, Qt::WindowNoState); - } -} - -void tst_WaylandClientXdgShellV6::windowGeometrySimple() -{ - QSKIP("TODO: This test is flaky, figure out why."); - QWindow window; - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(geometrySpy.count(), 1); - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), window.frameGeometry().size()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); - QTRY_COMPARE(geometrySpy.count(), 1); - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), QSize(123, 456)); -} - -void tst_WaylandClientXdgShellV6::windowGeometryFixed() -{ - QSKIP("TODO: This test is flaky, figure out why."); - QWindow window; - window.resize(QSize(1337, 137)); - window.setMaximumSize(window.size()); - window.setMinimumSize(window.size()); - window.show(); - - QSharedPointer<MockXdgToplevelV6> toplevel; - QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6()); - QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect))); - - m_compositor->sendXdgToplevelV6Configure(toplevel); - QTRY_COMPARE(geometrySpy.count(), 1); - QRect initialWindowGeometry = geometrySpy.takeFirst().at(0).toRect(); - QCOMPARE(initialWindowGeometry.size(), window.frameGeometry().size()); - - m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456)); - QTRY_COMPARE(geometrySpy.count(), 1); - // Configuring the window should not change the window geometry - QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size()); -} - -void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockSurface> surface; - QTRY_VERIFY(surface = m_compositor->surface()); - - // Paint and flush some magenta - QBackingStore backingStore(&window); - QRect rect(QPoint(), window.size()); - backingStore.resize(rect.size()); - backingStore.beginPaint(rect); - QColor color = Qt::magenta; - QPainter p(backingStore.paintDevice()); - p.fillRect(rect, color); - p.end(); - backingStore.endPaint(); - backingStore.flush(rect); - - // We're not allowed to send buffer on this surface since it isn't yet configured. - // So, from the compositor's point of view there should be no buffer data yet. - m_compositor->processWaylandEvents(); - QVERIFY(surface->image.isNull()); - QVERIFY(!window.isExposed()); - - // Finally sending the configure should trigger an attach and commit with the - // right buffer. - m_compositor->sendShellSurfaceConfigure(surface); - QTRY_COMPARE(surface->image.size(), window.frameGeometry().size()); - QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba()); - QTRY_VERIFY(window.isExposed()); -} - -void tst_WaylandClientXdgShellV6::dontSpamExposeEvents() -{ - TestWindow window; - window.show(); - - QSharedPointer<MockSurface> surface; - QTRY_VERIFY(surface = m_compositor->surface()); - QTRY_COMPARE(window.exposeEventCount, 0); - - m_compositor->sendShellSurfaceConfigure(surface); - QTRY_VERIFY(window.isExposed()); - QTRY_COMPARE(window.exposeEventCount, 1); -} - -int main(int argc, char **argv) -{ - QTemporaryDir tmpRuntimeDir; - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); - setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - setenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell-v6", 1); - - // wayland-egl hangs in the test setup when we try to initialize. Until it gets - // figured out, avoid clientBufferIntegration() from being called in - // QWaylandWindow::createDecorations(). - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); - - MockCompositor compositor; - compositor.setOutputMode(screenSize); - - QGuiApplication app(argc, argv); - compositor.applicationInitialized(); - - tst_WaylandClientXdgShellV6 tc(&compositor); - return QTest::qExec(&tc, argc, argv); -} - -#include <tst_xdgshellv6.moc> diff --git a/tests/auto/client/xdgshellv6/xdgshellv6.pro b/tests/auto/client/xdgshellv6/xdgshellv6.pro deleted file mode 100644 index cc8a22d8..00000000 --- a/tests/auto/client/xdgshellv6/xdgshellv6.pro +++ /dev/null @@ -1,5 +0,0 @@ -include (../shared_old/shared_old.pri) - -TARGET = tst_client_xdgshellv6 -SOURCES += tst_xdgshellv6.cpp - |