diff --git a/tests/auto/wayland/client/.prev_CMakeLists.txt b/tests/auto/wayland/client/.prev_CMakeLists.txt index ece394fcc0d..cdcae2ff158 100644 --- a/tests/auto/wayland/client/.prev_CMakeLists.txt +++ b/tests/auto/wayland/client/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client ../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 diff --git a/tests/auto/wayland/client/CMakeLists.txt b/tests/auto/wayland/client/CMakeLists.txt index 919bf064d78..86eb420e5ca 100644 --- a/tests/auto/wayland/client/CMakeLists.txt +++ b/tests/auto/wayland/client/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client ../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 diff --git a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt index 7cf9624c009..c3e375c0f19 100644 --- a/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../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 diff --git a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt index 7a5a72c2415..42d328a6481 100644 --- a/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt +++ b/tests/auto/wayland/fullscreenshellv1/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_fullscreenshellv1 ../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 diff --git a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt index 2aaed6bab05..ce9c8fd9122 100644 --- a/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt +++ b/tests/auto/wayland/iviapplication/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_iviapplication ../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 diff --git a/tests/auto/wayland/shared_old/mockcompositor.cpp b/tests/auto/wayland/shared_old/mockcompositor.cpp index 61494cbb5f1..6fd2ec6bb73 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.cpp +++ b/tests/auto/wayland/shared_old/mockcompositor.cpp @@ -382,9 +382,9 @@ static void compositor_create_surface(wl_client *client, wl_resource *compositor static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id) { - Q_UNUSED(client); - Q_UNUSED(compositorResource); - Q_UNUSED(id); + Compositor *compositor = + static_cast(wl_resource_get_user_data(compositorResource)); + new Region(client, id, wl_resource_get_version(compositorResource), compositor); } void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id) diff --git a/tests/auto/wayland/shared_old/mockcompositor.h b/tests/auto/wayland/shared_old/mockcompositor.h index 3238039960a..cbcf34cbd65 100644 --- a/tests/auto/wayland/shared_old/mockcompositor.h +++ b/tests/auto/wayland/shared_old/mockcompositor.h @@ -32,12 +32,14 @@ #include "mockxdgshellv6.h" #include "mockiviapplication.h" #include "mockfullscreenshellv1.h" +#include "mockregion.h" #include #include #include #include +#include #include #include #include @@ -61,6 +63,7 @@ class Output; class IviApplication; class WlShell; class XdgShellV6; +class Region; class Compositor { @@ -159,6 +162,21 @@ private: Q_DECLARE_METATYPE(QSharedPointer) +class MockRegion +{ +public: + Impl::Region *handle() const { return m_region; } + +private: + MockRegion(Impl::Region *region); + friend class Impl::Compositor; + friend class Impl::Region; + + Impl::Region *m_region = nullptr; +}; + +Q_DECLARE_METATYPE(QSharedPointer) + class MockIviSurface { public: diff --git a/tests/auto/wayland/shared_old/mockregion.cpp b/tests/auto/wayland/shared_old/mockregion.cpp new file mode 100644 index 00000000000..78b457fae49 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockregion.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** 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 "mockregion.h" +#include "mockcompositor.h" + +namespace Impl { + +Region::Region(wl_client *client, uint32_t id, int v, Compositor *compositor) + : QtWaylandServer::wl_region(client, id, v), + m_compositor(compositor), + m_mockRegion(new MockRegion(this)) +{ +} + +Region::~Region() = default; + +void Region::region_destroy_resource(Resource *resource) +{ + Q_UNUSED(resource) + delete this; +} + +} + +MockRegion::MockRegion(Impl::Region *region) : m_region(region) { } diff --git a/tests/auto/wayland/shared_old/mockregion.h b/tests/auto/wayland/shared_old/mockregion.h new file mode 100644 index 00000000000..f98a25fbb07 --- /dev/null +++ b/tests/auto/wayland/shared_old/mockregion.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Aleix Pol Gonzalez +** 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 MOCKREGION_H +#define MOCKREGION_H + +#include +#include + +#include "qwayland-server-wayland.h" + +class MockRegion; + +namespace Impl { + +class Compositor; + +class Region : public QtWaylandServer::wl_region +{ +public: + Region(wl_client *client, uint32_t id, int v, Compositor *compositor); + ~Region(); + + Compositor *compositor() const { return m_compositor; } + static Region *fromResource(struct ::wl_resource *resource); + +protected: + void region_destroy_resource(Resource *resource) override; + +private: + Compositor *m_compositor = nullptr; + QSharedPointer m_mockRegion; +}; + +} + +#endif // MOCKREGION_H diff --git a/tests/auto/wayland/shared_old/shared_old.pri b/tests/auto/wayland/shared_old/shared_old.pri index 6989e613e6c..899e6b30902 100644 --- a/tests/auto/wayland/shared_old/shared_old.pri +++ b/tests/auto/wayland/shared_old/shared_old.pri @@ -21,6 +21,7 @@ SOURCES += \ ../shared_old/mockwlshell.cpp \ ../shared_old/mockxdgshellv6.cpp \ ../shared_old/mocksurface.cpp \ + ../shared_old/mockregion.cpp \ ../shared_old/mockoutput.cpp HEADERS += \ @@ -31,4 +32,5 @@ HEADERS += \ ../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/wayland/xdgshellv6/.prev_CMakeLists.txt b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt index 12f3ee19022..dc40fd637a0 100644 --- a/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/.prev_CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_xdgshellv6 ../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 diff --git a/tests/auto/wayland/xdgshellv6/CMakeLists.txt b/tests/auto/wayland/xdgshellv6/CMakeLists.txt index cc8b154b4b4..0e1704ea4a8 100644 --- a/tests/auto/wayland/xdgshellv6/CMakeLists.txt +++ b/tests/auto/wayland/xdgshellv6/CMakeLists.txt @@ -11,6 +11,7 @@ qt_internal_add_test(tst_client_xdgshellv6 ../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