diff options
Diffstat (limited to 'tests')
30 files changed, 1070 insertions, 488 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 822fdeb88..a704c7322 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,9 +1,5 @@ TEMPLATE=subdirs -#Only build compositor test when we are -#building QtCompositor -contains(CONFIG, wayland-compositor) { - SUBDIRS += compositor - SUBDIRS += client - SUBDIRS += cmake -} +SUBDIRS += client +SUBDIRS += cmake +SUBDIRS += compositor diff --git a/tests/auto/client/mockcompositor.cpp b/tests/auto/client/mockcompositor.cpp index 2f73734f1..9fe02629d 100644 --- a/tests/auto/client/mockcompositor.cpp +++ b/tests/auto/client/mockcompositor.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mockcompositor.h b/tests/auto/client/mockcompositor.h index cf3b270a2..48b410698 100644 --- a/tests/auto/client/mockcompositor.h +++ b/tests/auto/client/mockcompositor.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mockinput.cpp b/tests/auto/client/mockinput.cpp index 5b1d4f4fd..a4d42c103 100644 --- a/tests/auto/client/mockinput.cpp +++ b/tests/auto/client/mockinput.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mockinput.h b/tests/auto/client/mockinput.h index 7d36a5325..eb9beb564 100644 --- a/tests/auto/client/mockinput.h +++ b/tests/auto/client/mockinput.h @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mockoutput.cpp b/tests/auto/client/mockoutput.cpp index 573de90b9..057387160 100644 --- a/tests/auto/client/mockoutput.cpp +++ b/tests/auto/client/mockoutput.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mockshell.cpp b/tests/auto/client/mockshell.cpp index dfc39e5e4..2ce5965a3 100644 --- a/tests/auto/client/mockshell.cpp +++ b/tests/auto/client/mockshell.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mocksurface.cpp b/tests/auto/client/mocksurface.cpp index b6d338b29..749a1470d 100644 --- a/tests/auto/client/mocksurface.cpp +++ b/tests/auto/client/mocksurface.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/mocksurface.h b/tests/auto/client/mocksurface.h index 821d49f54..d04386ac8 100644 --- a/tests/auto/client/mocksurface.h +++ b/tests/auto/client/mocksurface.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/client/tst_client.cpp b/tests/auto/client/tst_client.cpp index dd35b681c..9635c215f 100644 --- a/tests/auto/client/tst_client.cpp +++ b/tests/auto/client/tst_client.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 9041fff95..270d11aa6 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -11,7 +11,7 @@ set(Qt5_MODULE_TEST_DEPENDS Quick) include("${_Qt5CTestMacros}") test_module_includes( - Compositor QWaylandBufferRef + WaylandCompositor QWaylandBufferRef ) # Can't test in `test_module_includes`, WaylandClient has no public headers diff --git a/tests/auto/compositor/compositor.pro b/tests/auto/compositor/compositor.pro index 035beeb41..9f9044fdf 100644 --- a/tests/auto/compositor/compositor.pro +++ b/tests/auto/compositor/compositor.pro @@ -1,8 +1,9 @@ CONFIG += testcase link_pkgconfig +CONFIG += wayland-scanner TARGET = tst_compositor QT += testlib -QT += core-private gui-private compositor compositor-private +QT += core-private gui-private waylandcompositor waylandcompositor-private !contains(QT_CONFIG, no-pkg-config) { PKGCONFIG += wayland-client wayland-server @@ -20,6 +21,9 @@ config_xkbcommon { DEFINES += QT_NO_WAYLAND_XKB } +WAYLANDCLIENTSOURCES += \ + ../../../src/3rdparty/protocol/xdg-shell.xml \ + SOURCES += tst_compositor.cpp \ testcompositor.cpp \ testkeyboardgrabber.cpp \ diff --git a/tests/auto/compositor/mockclient.cpp b/tests/auto/compositor/mockclient.cpp index 33847da7d..9b6d327a9 100644 --- a/tests/auto/compositor/mockclient.cpp +++ b/tests/auto/compositor/mockclient.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -50,11 +45,12 @@ const struct wl_registry_listener MockClient::registryListener = { }; MockClient::MockClient() - : display(wl_display_connect(0)) + : display(wl_display_connect("wayland-qt-test-0")) , compositor(0) , output(0) , registry(0) , wlshell(0) + , xdgShell(nullptr) { if (!display) qFatal("MockClient(): wl_display_connect() failed"); @@ -98,6 +94,8 @@ void MockClient::outputGeometryEvent(void *data, wl_output *, int, const char *, const char *, int32_t ) { + Q_UNUSED(width); + Q_UNUSED(height); resolve(data)->geometry.moveTopLeft(QPoint(x, y)); } @@ -130,6 +128,8 @@ void MockClient::flushDisplay() void MockClient::handleGlobal(void *data, wl_registry *registry, uint32_t id, const char *interface, uint32_t version) { + Q_UNUSED(registry); + Q_UNUSED(version); resolve(data)->handleGlobal(id, QByteArray(interface)); } @@ -144,6 +144,8 @@ void MockClient::handleGlobal(uint32_t id, const QByteArray &interface) shm = static_cast<wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface, 1)); } else if (interface == "wl_shell") { wlshell = static_cast<wl_shell *>(wl_registry_bind(registry, id, &wl_shell_interface, 1)); + } else if (interface == "xdg_shell") { + xdgShell = static_cast<xdg_shell *>(wl_registry_bind(registry, id, &xdg_shell_interface, 1)); } else if (interface == "wl_seat") { wl_seat *s = static_cast<wl_seat *>(wl_registry_bind(registry, id, &wl_seat_interface, 1)); m_seats << new MockSeat(s); @@ -162,6 +164,12 @@ wl_shell_surface *MockClient::createShellSurface(wl_surface *surface) return wl_shell_get_shell_surface(wlshell, surface); } +xdg_surface *MockClient::createXdgSurface(wl_surface *surface) +{ + flushDisplay(); + return xdg_shell_get_xdg_surface(xdgShell, surface); +} + ShmBuffer::ShmBuffer(const QSize &size, wl_shm *shm) : handle(0) { @@ -191,7 +199,7 @@ ShmBuffer::ShmBuffer(const QSize &size, wl_shm *shm) return; } - image = QImage(static_cast<uchar *>(data), size.width(), size.height(), stride, QImage::Format_ARGB32); + image = QImage(static_cast<uchar *>(data), size.width(), size.height(), stride, QImage::Format_ARGB32_Premultiplied); shm_pool = wl_shm_create_pool(shm,fd,alloc); handle = wl_shm_pool_create_buffer(shm_pool,0, size.width(), size.height(), stride, WL_SHM_FORMAT_ARGB8888); diff --git a/tests/auto/compositor/mockclient.h b/tests/auto/compositor/mockclient.h index 8647205f2..33ada638a 100644 --- a/tests/auto/compositor/mockclient.h +++ b/tests/auto/compositor/mockclient.h @@ -1,37 +1,33 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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 <wayland-client.h> +#include <wayland-xdg-shell-client-protocol.h> #include <QObject> #include <QImage> @@ -61,6 +57,7 @@ public: wl_surface *createSurface(); wl_shell_surface *createShellSurface(wl_surface *surface); + xdg_surface *createXdgSurface(wl_surface *surface); wl_display *display; wl_compositor *compositor; @@ -68,6 +65,7 @@ public: wl_shm *shm; wl_registry *registry; wl_shell *wlshell; + xdg_shell *xdgShell; QList<MockSeat *> m_seats; diff --git a/tests/auto/compositor/mockseat.cpp b/tests/auto/compositor/mockseat.cpp index ebf387f94..29c4a4e13 100644 --- a/tests/auto/compositor/mockseat.cpp +++ b/tests/auto/compositor/mockseat.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/compositor/mockseat.h b/tests/auto/compositor/mockseat.h index 24399a448..1c6d324c2 100644 --- a/tests/auto/compositor/mockseat.h +++ b/tests/auto/compositor/mockseat.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics Ltd., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/compositor/testcompositor.cpp b/tests/auto/compositor/testcompositor.cpp index 95dd87e3c..dfa26a542 100644 --- a/tests/auto/compositor/testcompositor.cpp +++ b/tests/auto/compositor/testcompositor.cpp @@ -1,52 +1,77 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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 "testcompositor.h" +#include "testinputdevice.h" +#include "testkeyboardgrabber.h" + +#include <wayland-server.h> + +TestCompositor::TestCompositor(bool createInputDev) + : QWaylandCompositor() + , shell(new QWaylandWlShell(this)) + , m_createInputDevice(createInputDev) +{ + setSocketName("wayland-qt-test-0"); +} + +void TestCompositor::create() +{ + new QWaylandOutput(this, Q_NULLPTR); + QWaylandCompositor::create(); + + connect(this, &QWaylandCompositor::surfaceCreated, this, &TestCompositor::onSurfaceCreated); + connect(this, &QWaylandCompositor::surfaceAboutToBeDestroyed, this, &TestCompositor::onSurfaceAboutToBeDestroyed); +} -TestCompositor::TestCompositor(QWaylandCompositor::ExtensionFlag flags) : QWaylandCompositor(0, flags) +void TestCompositor::flushClients() { - createOutput(0, "", ""); - addDefaultShell(); + wl_display_flush_clients(display()); } -void TestCompositor::surfaceCreated(QWaylandSurface *surface) +void TestCompositor::onSurfaceCreated(QWaylandSurface *surface) { surfaces << surface; } -void TestCompositor::surfaceAboutToBeDestroyed(QWaylandSurface *surface) +void TestCompositor::onSurfaceAboutToBeDestroyed(QWaylandSurface *surface) { surfaces.removeOne(surface); } +QWaylandInputDevice *TestCompositor::createInputDevice() +{ + if (m_createInputDevice) + return new TestInputDevice(this, QWaylandInputDevice::Pointer | QWaylandInputDevice::Keyboard); + else + return QWaylandCompositor::createInputDevice(); +} +QWaylandKeyboard *TestCompositor::createKeyboardDevice(QWaylandInputDevice *inputDevice) { + return new TestKeyboardGrabber(inputDevice); +} diff --git a/tests/auto/compositor/testcompositor.h b/tests/auto/compositor/testcompositor.h index c7d571d23..fb5909d19 100644 --- a/tests/auto/compositor/testcompositor.h +++ b/tests/auto/compositor/testcompositor.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -33,15 +28,27 @@ #include "qwaylandcompositor.h" #include "qwaylandsurface.h" +#include "qwaylandwlshell.h" class TestCompositor : public QWaylandCompositor { + Q_OBJECT public: - TestCompositor(QWaylandCompositor::ExtensionFlag flags = QWaylandCompositor::DefaultExtensions); + TestCompositor(bool createInputDev = false); + void create(); + void flushClients(); + +public slots: + void onSurfaceCreated(QWaylandSurface *surface); + void onSurfaceAboutToBeDestroyed(QWaylandSurface *surface); - void surfaceCreated(QWaylandSurface *surface); - void surfaceAboutToBeDestroyed(QWaylandSurface *surface); +protected: + QWaylandInputDevice *createInputDevice() Q_DECL_OVERRIDE; + QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; +public: QList<QWaylandSurface *> surfaces; + QWaylandWlShell* shell; + bool m_createInputDevice; }; diff --git a/tests/auto/compositor/testinputdevice.cpp b/tests/auto/compositor/testinputdevice.cpp index db2d1d706..5c02dff85 100644 --- a/tests/auto/compositor/testinputdevice.cpp +++ b/tests/auto/compositor/testinputdevice.cpp @@ -1,38 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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 "testinputdevice.h" - #include <QMouseEvent> TestInputDevice::TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps) @@ -45,7 +39,7 @@ TestInputDevice::~TestInputDevice() { } -bool TestInputDevice::isOwner(QInputEvent *event) +bool TestInputDevice::isOwner(QInputEvent *event) const { m_queryCount++; QMouseEvent *me = dynamic_cast<QMouseEvent *>(event); @@ -59,4 +53,3 @@ QList<QMouseEvent *> TestInputDevice::createMouseEvents(int count) } return m_events; } - diff --git a/tests/auto/compositor/testinputdevice.h b/tests/auto/compositor/testinputdevice.h index df5c646d1..e6134aa18 100644 --- a/tests/auto/compositor/testinputdevice.h +++ b/tests/auto/compositor/testinputdevice.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -47,13 +42,13 @@ public: TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps); ~TestInputDevice(); - bool isOwner(QInputEvent *event); + bool isOwner(QInputEvent *inputEvent) const Q_DECL_OVERRIDE; QList<QMouseEvent *> createMouseEvents(int count); int queryCount() { return m_queryCount; } private: - int m_queryCount; + mutable int m_queryCount; QList<QMouseEvent *> m_events; }; diff --git a/tests/auto/compositor/testkeyboardgrabber.cpp b/tests/auto/compositor/testkeyboardgrabber.cpp index da2f467d9..315b7f4fd 100644 --- a/tests/auto/compositor/testkeyboardgrabber.cpp +++ b/tests/auto/compositor/testkeyboardgrabber.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -33,33 +28,31 @@ #include "testkeyboardgrabber.h" -namespace QtWayland { - KeyboardGrabber::~KeyboardGrabber() {} +TestKeyboardGrabber::TestKeyboardGrabber(QWaylandInputDevice *inputDevice) + : QWaylandKeyboard(inputDevice) +{ } -void TestKeyboardGrabber::focused(QtWayland::Surface *surface) +void TestKeyboardGrabber::setFocus(QWaylandSurface *surface) { - Q_UNUSED(surface); Q_EMIT focusedCalled(); + QWaylandKeyboard::setFocus(surface); } -void TestKeyboardGrabber::key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +void TestKeyboardGrabber::sendKeyPressEvent(uint code) { - Q_UNUSED(serial); - Q_UNUSED(time); - Q_UNUSED(key); - Q_UNUSED(state); - Q_EMIT keyCalled(); + Q_EMIT keyPressCalled(); + QWaylandKeyboard::sendKeyPressEvent(code); } -void TestKeyboardGrabber::modifiers(uint32_t serial, uint32_t mods_depressed, - uint32_t mods_latched, uint32_t mods_locked, uint32_t group) +void TestKeyboardGrabber::sendKeyReleaseEvent(uint code) { - Q_UNUSED(serial); - Q_UNUSED(mods_depressed); - Q_UNUSED(mods_latched); - Q_UNUSED(mods_locked); - Q_UNUSED(group); - Q_EMIT modifiersCalled(); + Q_EMIT keyReleaseCalled(); + QWaylandKeyboard::sendKeyReleaseEvent(code); } +void TestKeyboardGrabber::sendKeyModifiers(QWaylandClient *client, uint32_t serial) +{ + Q_EMIT modifiersCalled(); + QWaylandKeyboard::sendKeyModifiers(client, serial); +} diff --git a/tests/auto/compositor/testkeyboardgrabber.h b/tests/auto/compositor/testkeyboardgrabber.h index 0ce56b1a7..ca5f51628 100644 --- a/tests/auto/compositor/testkeyboardgrabber.h +++ b/tests/auto/compositor/testkeyboardgrabber.h @@ -1,56 +1,48 @@ /**************************************************************************** ** -** Copyright (C) 2014 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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 "QtCompositor/private/qwlkeyboard_p.h" -#include "QtCompositor/private/qwlsurface_p.h" +#include "qwaylandkeyboard.h" -class TestKeyboardGrabber : public QObject, public QtWayland::KeyboardGrabber +class TestKeyboardGrabber : public QWaylandKeyboard { Q_OBJECT - public: + TestKeyboardGrabber(QWaylandInputDevice *inputDevice); - TestKeyboardGrabber() {} - ~TestKeyboardGrabber() {} - - void focused(QtWayland::Surface *surface); - void key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state); - void modifiers(uint32_t serial, uint32_t mods_depressed, - uint32_t mods_latched, uint32_t mods_locked, uint32_t group); + void setFocus(QWaylandSurface *surface) Q_DECL_OVERRIDE; + void sendKeyModifiers(QWaylandClient *client, uint32_t serial) Q_DECL_OVERRIDE; + void sendKeyPressEvent(uint code) Q_DECL_OVERRIDE; + void sendKeyReleaseEvent(uint code) Q_DECL_OVERRIDE; signals: void focusedCalled(); - void keyCalled(); + void keyPressCalled(); + void keyReleaseCalled(); void modifiersCalled(); }; diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp index c30ebc02b..8405277b4 100644 --- a/tests/auto/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/tst_compositor.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -34,28 +29,25 @@ #include "mockclient.h" #include "testcompositor.h" #include "testkeyboardgrabber.h" - -#include "QtCompositor/private/qwlkeyboard_p.h" -#include "QtCompositor/private/qwlinputdevice_p.h" -#include "QtCompositor/private/qwlcompositor_p.h" #include "testinputdevice.h" +#include "qwaylandview.h" #include "qwaylandbufferref.h" +#include "qwaylandinput.h" -#include <QtTest/QtTest> +#include <QtWaylandCompositor/QWaylandXdgShell> +#include <QtWaylandCompositor/QWaylandSurface> +#include <QtWaylandCompositor/QWaylandResource> +#include <qwayland-xdg-shell.h> -#include <QtCompositor/private/qwlinputdevice_p.h> +#include <QtTest/QtTest> class tst_WaylandCompositor : public QObject { Q_OBJECT -public: - tst_WaylandCompositor() { - setenv("XDG_RUNTIME_DIR", ".", 1); - } - private slots: + void init(); void inputDeviceCapabilities(); void keyboardGrab(); void inputDeviceCreation(); @@ -65,11 +57,21 @@ private slots: void geometry(); void mapSurface(); void frameCallback(); + void advertisesXdgShellSupport(); + void createsXdgSurfaces(); + void reportsXdgSurfaceWindowGeometry(); + void setsXdgAppId(); + void sendsXdgConfigure(); }; +void tst_WaylandCompositor::init() { + qputenv("XDG_RUNTIME_DIR", "."); +} + void tst_WaylandCompositor::singleClient() { TestCompositor compositor; + compositor.create(); MockClient client; @@ -100,6 +102,7 @@ void tst_WaylandCompositor::singleClient() void tst_WaylandCompositor::multipleClients() { TestCompositor compositor; + compositor.create(); MockClient a; MockClient b; @@ -138,7 +141,8 @@ void tst_WaylandCompositor::multipleClients() void tst_WaylandCompositor::keyboardGrab() { - TestCompositor compositor((QWaylandCompositor::ExtensionFlag)0); + TestCompositor compositor; + compositor.create(); MockClient mc; mc.createSurface(); @@ -149,46 +153,47 @@ void tst_WaylandCompositor::keyboardGrab() // Set the focused surface so that key event will flow through QWaylandSurface *waylandSurface = compositor.surfaces.at(0); QWaylandInputDevice* inputDevice = compositor.defaultInputDevice(); - inputDevice->handle()->keyboardDevice()->setFocus(waylandSurface->handle()); - - TestKeyboardGrabber grab; - QSignalSpy grabFocusSpy(&grab, SIGNAL(focusedCalled())); - QSignalSpy grabKeySpy(&grab, SIGNAL(keyCalled())); - QSignalSpy grabModifierSpy(&grab, SIGNAL(modifiersCalled())); - QtWayland::Keyboard *keyboard = inputDevice->handle()->keyboardDevice(); - keyboard->startGrab(&grab); + TestKeyboardGrabber* grab = static_cast<TestKeyboardGrabber *>(inputDevice->keyboard()); + QTRY_COMPARE(grab, inputDevice->keyboard()); + QSignalSpy grabFocusSpy(grab, SIGNAL(focusedCalled())); + QSignalSpy grabKeyPressSpy(grab, SIGNAL(keyPressCalled())); + QSignalSpy grabKeyReleaseSpy(grab, SIGNAL(keyReleaseCalled())); + //QSignalSpy grabModifierSpy(grab, SIGNAL(modifiersCalled())); + inputDevice->setKeyboardFocus(waylandSurface); QTRY_COMPARE(grabFocusSpy.count(), 1); - QCOMPARE(grab.m_keyboard, inputDevice->handle()->keyboardDevice()); QKeyEvent ke(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, 30, 0, 0); QKeyEvent ke1(QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier, 30, 0, 0); inputDevice->sendFullKeyEvent(&ke); inputDevice->sendFullKeyEvent(&ke1); - QTRY_COMPARE(grabKeySpy.count(), 2); + QTRY_COMPARE(grabKeyPressSpy.count(), 1); + QTRY_COMPARE(grabKeyReleaseSpy.count(), 1); QKeyEvent ke2(QEvent::KeyPress, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0); QKeyEvent ke3(QEvent::KeyRelease, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0); inputDevice->sendFullKeyEvent(&ke2); inputDevice->sendFullKeyEvent(&ke3); - QTRY_COMPARE(grabModifierSpy.count(), 2); + //QTRY_COMPARE(grabModifierSpy.count(), 2); // Modifiers are also keys - QTRY_COMPARE(grabKeySpy.count(), 4); + QTRY_COMPARE(grabKeyPressSpy.count(), 2); + QTRY_COMPARE(grabKeyReleaseSpy.count(), 2); // Stop grabbing - keyboard->endGrab(); + inputDevice->setKeyboardFocus(Q_NULLPTR); inputDevice->sendFullKeyEvent(&ke); inputDevice->sendFullKeyEvent(&ke1); - QTRY_COMPARE(grabKeySpy.count(), 4); + QTRY_COMPARE(grabKeyPressSpy.count(), 2); } void tst_WaylandCompositor::geometry() { TestCompositor compositor; + compositor.create(); QRect geometry(0, 0, 4096, 3072); - compositor.setOutputGeometry(geometry); + compositor.defaultOutput()->setGeometry(geometry); MockClient client; @@ -198,6 +203,7 @@ void tst_WaylandCompositor::geometry() void tst_WaylandCompositor::mapSurface() { TestCompositor compositor; + compositor.create(); MockClient client; @@ -206,10 +212,10 @@ void tst_WaylandCompositor::mapSurface() QWaylandSurface *waylandSurface = compositor.surfaces.at(0); - QSignalSpy mappedSpy(waylandSurface, SIGNAL(mapped())); + QSignalSpy mappedSpy(waylandSurface, SIGNAL(mappedChanged())); QCOMPARE(waylandSurface->size(), QSize()); - QCOMPARE(waylandSurface->type(), QWaylandSurface::Invalid); + QCOMPARE(waylandSurface->isMapped(), false); QSize size(256, 256); ShmBuffer buffer(size, client.shm); @@ -221,7 +227,7 @@ void tst_WaylandCompositor::mapSurface() wl_surface_commit(surface); QTRY_COMPARE(waylandSurface->size(), size); - QTRY_COMPARE(waylandSurface->type(), QWaylandSurface::Shm); + QTRY_COMPARE(waylandSurface->isMapped(), true); QTRY_COMPARE(mappedSpy.count(), 1); wl_surface_destroy(surface); @@ -244,20 +250,18 @@ static void registerFrameCallback(wl_surface *surface, int *counter) void tst_WaylandCompositor::frameCallback() { - class BufferAttacher : public QWaylandBufferAttacher + class BufferView : public QWaylandView { public: - void attach(const QWaylandBufferRef &ref) Q_DECL_OVERRIDE + void attach(const QWaylandBufferRef &ref, const QRegion &damage) Q_DECL_OVERRIDE { + Q_UNUSED(damage); bufferRef = ref; } - void unmap() Q_DECL_OVERRIDE - { - } QImage image() const { - if (!bufferRef || !bufferRef.isShm()) + if (bufferRef.isNull() || !bufferRef.isShm()) return QImage(); return bufferRef.image(); } @@ -266,6 +270,7 @@ void tst_WaylandCompositor::frameCallback() }; TestCompositor compositor; + compositor.create(); MockClient client; @@ -275,8 +280,10 @@ void tst_WaylandCompositor::frameCallback() QTRY_COMPARE(compositor.surfaces.size(), 1); QWaylandSurface *waylandSurface = compositor.surfaces.at(0); - BufferAttacher attacher; - waylandSurface->setBufferAttacher(&attacher); + BufferView* view = new BufferView; + view->setSurface(waylandSurface); + view->setOutput(compositor.defaultOutput()); + QSignalSpy damagedSpy(waylandSurface, SIGNAL(damaged(const QRegion &))); for (int i = 0; i < 10; ++i) { @@ -289,12 +296,12 @@ void tst_WaylandCompositor::frameCallback() wl_surface_damage(surface, 0, 0, size.width(), size.height()); wl_surface_commit(surface); - QTRY_COMPARE(waylandSurface->type(), QWaylandSurface::Shm); + QTRY_COMPARE(waylandSurface->isMapped(), true); QTRY_COMPARE(damagedSpy.count(), i + 1); - QCOMPARE(static_cast<BufferAttacher *>(waylandSurface->bufferAttacher())->image(), buffer.image); - compositor.frameStarted(); - compositor.sendFrameCallbacks(QList<QWaylandSurface *>() << waylandSurface); + QCOMPARE(static_cast<BufferView*>(waylandSurface->views().first())->image(), buffer.image); + compositor.defaultOutput()->frameStarted(); + compositor.defaultOutput()->sendFrameCallbacks(); QTRY_COMPARE(frameCounter, i + 1); } @@ -305,64 +312,51 @@ void tst_WaylandCompositor::frameCallback() void tst_WaylandCompositor::inputDeviceCapabilities() { TestCompositor compositor; - QtWayland::InputDevice dev(NULL, compositor.handle(), QWaylandInputDevice::Pointer); + compositor.create(); + + MockClient client; + Q_UNUSED(client); - QTRY_VERIFY(dev.pointerDevice()); - QTRY_VERIFY(!dev.keyboardDevice()); - QTRY_VERIFY(!dev.touchDevice()); + QWaylandInputDevice dev(&compositor, QWaylandInputDevice::Pointer); - dev.setCapabilities(QWaylandInputDevice::Keyboard | QWaylandInputDevice::Touch); - QTRY_VERIFY(!dev.pointerDevice()); - QTRY_VERIFY(dev.keyboardDevice()); - QTRY_VERIFY(dev.touchDevice()); + QTRY_VERIFY(dev.pointer()); + QTRY_VERIFY(!dev.keyboard()); + QTRY_VERIFY(!dev.touch()); - // Test that existing devices do not change when another is removed - QtWayland::Keyboard *k = dev.keyboardDevice(); - dev.setCapabilities(QWaylandInputDevice::Keyboard); - QTRY_COMPARE(k, dev.keyboardDevice()); + QWaylandInputDevice dev2(&compositor, QWaylandInputDevice::Keyboard | QWaylandInputDevice::Touch); + QTRY_VERIFY(!dev2.pointer()); + QTRY_VERIFY(dev2.keyboard()); + QTRY_VERIFY(dev2.touch()); } void tst_WaylandCompositor::inputDeviceCreation() { - TestCompositor compositor; - TestInputDevice dev1(&compositor, QWaylandInputDevice::Pointer | QWaylandInputDevice::Keyboard); - TestInputDevice dev2(&compositor, QWaylandInputDevice::Pointer | QWaylandInputDevice::Keyboard); + TestCompositor compositor(true); + compositor.create(); + + MockClient client; + Q_UNUSED(client); - compositor.handle()->registerInputDevice(&dev1); - compositor.handle()->registerInputDevice(&dev2); + TestInputDevice* dev = static_cast<TestInputDevice*>(compositor.defaultInputDevice()); // The compositor will create the default input device - QTRY_COMPARE(compositor.handle()->inputDevices().count(), 3); - // Test the order - QTRY_COMPARE(compositor.handle()->inputDevices().at(0), &dev2); - QTRY_COMPARE(compositor.handle()->inputDevices().at(1), &dev1); - QTRY_COMPARE(compositor.handle()->inputDevices().at(2), compositor.defaultInputDevice()); + QTRY_COMPARE(compositor.defaultInputDevice(), dev); QList<QMouseEvent *> allEvents; - allEvents += dev1.createMouseEvents(2); - allEvents += dev2.createMouseEvents(5); + allEvents += dev->createMouseEvents(5); foreach (QMouseEvent *me, allEvents) { compositor.inputDeviceFor(me); } - // The first input device will only get called exatly the number of times it has created + // The default input device will get called exatly the number of times it has created // the events - QTRY_COMPARE(dev1.queryCount(), 2); - // The second will get called the total number of times as it sits as the first item in - // the registered input devices list - QTRY_COMPARE(dev2.queryCount(), 7); + QTRY_COMPARE(dev->queryCount(), 5); } void tst_WaylandCompositor::inputDeviceKeyboardFocus() { - TestCompositor compositor; - - - TestInputDevice dev1(&compositor, QWaylandInputDevice::Keyboard); - TestInputDevice dev2(&compositor, QWaylandInputDevice::Keyboard); - - compositor.handle()->registerInputDevice(&dev1); - compositor.handle()->registerInputDevice(&dev2); + TestCompositor compositor(true); + compositor.create(); // Create client after all the input devices have been set up as the mock client // does not dynamically listen to new seats @@ -371,24 +365,211 @@ void tst_WaylandCompositor::inputDeviceKeyboardFocus() QTRY_COMPARE(compositor.surfaces.size(), 1); QWaylandSurface *waylandSurface = compositor.surfaces.at(0); - QList<QWaylandInputDevice *> devices = compositor.handle()->inputDevices(); - foreach (QWaylandInputDevice *dev, devices) { - dev->setKeyboardFocus(waylandSurface); - } + QWaylandInputDevice* dev = compositor.defaultInputDevice(); + dev->setKeyboardFocus(waylandSurface); QTRY_COMPARE(compositor.defaultInputDevice()->keyboardFocus(), waylandSurface); - QTRY_COMPARE(dev1.keyboardFocus(), waylandSurface); - QTRY_COMPARE(dev2.keyboardFocus(), waylandSurface); wl_surface_destroy(surface); QTRY_VERIFY(compositor.surfaces.size() == 0); - // This will normally be called for example in the quick compositor - // but here call it manually to get rid of the surface and have it reset - // the focus - compositor.handle()->cleanupGraphicsResources(); - - QTRY_VERIFY(!compositor.defaultInputDevice()->keyboardFocus()); - QTRY_VERIFY(!dev1.keyboardFocus()); - QTRY_VERIFY(!dev2.keyboardFocus()); + + QTRY_VERIFY(!compositor.defaultInputDevice()->keyboardFocus()); +} + +class XdgTestCompositor: public TestCompositor { + Q_OBJECT +public: + XdgTestCompositor() : xdgShell(this) {} + QWaylandXdgShell xdgShell; +}; + +void tst_WaylandCompositor::advertisesXdgShellSupport() +{ + XdgTestCompositor compositor; + compositor.create(); + + MockClient client; + QTRY_VERIFY(&client.xdgShell); +} + +void tst_WaylandCompositor::createsXdgSurfaces() +{ + XdgTestCompositor compositor; + compositor.create(); + + MockClient client; + QTRY_VERIFY(&client.xdgShell); + + QSignalSpy xdgSurfaceCreatedSpy(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated); + QWaylandXdgSurface *xdgSurface = nullptr; + QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) { + xdgSurface = s; + }); + + wl_surface *surface = client.createSurface(); + client.createXdgSurface(surface); + QTRY_COMPARE(xdgSurfaceCreatedSpy.count(), 1); + QTRY_VERIFY(xdgSurface); + QTRY_VERIFY(xdgSurface->surface()); +} + +void tst_WaylandCompositor::reportsXdgSurfaceWindowGeometry() +{ + XdgTestCompositor compositor; + compositor.create(); + + QWaylandXdgSurface *xdgSurface = nullptr; + QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) { + xdgSurface = s; + }); + + MockClient client; + wl_surface *surface = client.createSurface(); + xdg_surface *clientXdgSurface = client.createXdgSurface(surface); + QSize size(256, 256); + ShmBuffer buffer(size, client.shm); + wl_surface_attach(surface, buffer.handle, 0, 0); + wl_surface_damage(surface, 0, 0, size.width(), size.height()); + wl_surface_commit(surface); + + QTRY_VERIFY(xdgSurface); + QTRY_COMPARE(xdgSurface->windowGeometry(), QRect(QPoint(0, 0), QSize(256, 256))); + + xdg_surface_set_window_geometry(clientXdgSurface, 10, 20, 100, 50); + wl_surface_commit(surface); + + QTRY_COMPARE(xdgSurface->windowGeometry(), QRect(QPoint(10, 20), QSize(100, 50))); +} + +void tst_WaylandCompositor::setsXdgAppId() +{ + XdgTestCompositor compositor; + compositor.create(); + + QWaylandXdgSurface *xdgSurface = nullptr; + QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) { + xdgSurface = s; + }); + + MockClient client; + wl_surface *surface = client.createSurface(); + xdg_surface *clientXdgSurface = client.createXdgSurface(surface); + + xdg_surface_set_app_id(clientXdgSurface, "org.foo.bar"); + + QTRY_VERIFY(xdgSurface); + QTRY_COMPARE(xdgSurface->appId(), QString("org.foo.bar")); +} + +void tst_WaylandCompositor::sendsXdgConfigure() +{ + class MockXdgSurface : public QtWayland::xdg_surface + { + public: + MockXdgSurface(::xdg_surface *xdgSurface) : QtWayland::xdg_surface(xdgSurface) {} + void xdg_surface_configure(int32_t width, int32_t height, wl_array *rawStates, uint32_t serial) Q_DECL_OVERRIDE + { + configureSize = QSize(width, height); + configureSerial = serial; + + uint *states = reinterpret_cast<uint*>(rawStates->data); + configureStates.clear(); + size_t numStates = rawStates->size / sizeof(uint); + for (size_t i = 0; i < numStates; ++i) { + configureStates.push_back(states[i]); + } + } + + QList<uint> configureStates; + QSize configureSize; + uint configureSerial; + }; + + XdgTestCompositor compositor; + compositor.create(); + + QWaylandXdgSurface *xdgSurface = nullptr; + QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) { + xdgSurface = s; + }); + + MockClient client; + wl_surface *surface = client.createSurface(); + xdg_surface *clientXdgSurface = client.createXdgSurface(surface); + MockXdgSurface mockXdgSurface(clientXdgSurface); + + QTRY_VERIFY(xdgSurface); + QTRY_VERIFY(!xdgSurface->activated()); + QTRY_VERIFY(!xdgSurface->maximized()); + QTRY_VERIFY(!xdgSurface->fullscreen()); + QTRY_VERIFY(!xdgSurface->resizing()); + + xdgSurface->sendConfigure(QSize(10, 20), QVector<QWaylandXdgSurface::State>{QWaylandXdgSurface::State::ActivatedState}); + compositor.flushClients(); + QTRY_COMPARE(mockXdgSurface.configureStates, QList<uint>{QWaylandXdgSurface::State::ActivatedState}); + QTRY_COMPARE(mockXdgSurface.configureSize, QSize(10, 20)); + + xdgSurface->requestMaximized(QSize(800, 600)); + compositor.flushClients(); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState)); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + QTRY_COMPARE(mockXdgSurface.configureSize, QSize(800, 600)); + + // There hasn't been any ack_configures, so state should still be unchanged + QTRY_VERIFY(!xdgSurface->activated()); + QTRY_VERIFY(!xdgSurface->maximized()); + xdg_surface_ack_configure(clientXdgSurface, mockXdgSurface.configureSerial); + wl_display_dispatch_pending(client.display); + wl_display_flush(client.display); + QTRY_VERIFY(xdgSurface->activated()); + QTRY_VERIFY(xdgSurface->maximized()); + + xdgSurface->requestUnMaximized(); + compositor.flushClients(); + QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState)); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + QTRY_COMPARE(mockXdgSurface.configureSize, QSize(0, 0)); + + // The unmaximized configure hasn't been acked, so maximized should still be true + QTRY_VERIFY(xdgSurface->maximized()); + QTRY_VERIFY(xdgSurface->activated()); + + xdgSurface->requestResizing(QSize(800, 600)); + compositor.flushClients(); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ResizingState)); + QTRY_COMPARE(mockXdgSurface.configureSize, QSize(800, 600)); + + xdgSurface->requestFullscreen(QSize(1024, 768)); + compositor.flushClients(); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::FullscreenState)); + QTRY_COMPARE(mockXdgSurface.configureSize, QSize(1024, 768)); + uint fullscreenSerial = mockXdgSurface.configureSerial; + + xdgSurface->requestUnMaximized(); + compositor.flushClients(); + QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::FullscreenState)); + + xdgSurface->sendConfigure(QSize(0, 0), QVector<QWaylandXdgSurface::State>{}); + compositor.flushClients(); + QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + + xdgSurface->requestMaximized(QSize(800, 600)); + compositor.flushClients(); + QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState)); + + xdgSurface->requestFullscreen(QSize(800, 600)); + compositor.flushClients(); + QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState)); + + // Verify that acking a configure that's not the most recently sent works + xdg_surface_ack_configure(clientXdgSurface, fullscreenSerial); + wl_display_dispatch_pending(client.display); + wl_display_flush(client.display); + QTRY_VERIFY(xdgSurface->fullscreen()); + QTRY_VERIFY(xdgSurface->activated()); + QTRY_VERIFY(!xdgSurface->maximized()); + QTRY_VERIFY(!xdgSurface->resizing()); } #include <tst_compositor.moc> diff --git a/tests/manual/subsurface/child.qml b/tests/manual/subsurface/child.qml new file mode 100644 index 000000000..b2e54054e --- /dev/null +++ b/tests/manual/subsurface/child.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Window 2.2 + +Rectangle { + width: 300 + height: 300 + + color: "darkgray" + + Rectangle { + width: 100 + height: 100 + color: "magenta" + + Text { + anchors.centerIn: parent + text: "quick" + } + + RotationAnimation on rotation { + duration: 10000 + loops: Animation.Infinite + from: 0 + to: 360 + } + } +} diff --git a/tests/manual/subsurface/main.cpp b/tests/manual/subsurface/main.cpp new file mode 100644 index 000000000..c913c32fb --- /dev/null +++ b/tests/manual/subsurface/main.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlEngine> +#include <QQmlFileSelector> +#include <QQmlContext> +#include <QQuickView> + +#include <QtPlatformHeaders/qwaylandwindowfunctions.h> + +#include "shmwindow.h" + +class Filter : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool sync READ getSync NOTIFY syncChanged) + +public: + Filter() + { + sync = false; + } + + bool eventFilter(QObject *object, QEvent *event) + { + Q_UNUSED(object); + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); + if (keyEvent->key() == Qt::Key_Space) { + toggleSync(quick); + toggleSync(shm); + } + } + return false; + } + + void toggleSync(QWindow *w) + { + sync = !QWaylandWindowFunctions::isSync(w); + if (QWaylandWindowFunctions::isSync(w)) + QWaylandWindowFunctions::setDeSync(w); + else + QWaylandWindowFunctions::setSync(w); + emit syncChanged(); + } + + bool getSync() const + { + return sync; + } + +Q_SIGNALS: + void syncChanged(); + +public: + QWindow *quick; + QWindow *shm; + bool sync; +}; + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc, argv); + QQuickView view; + view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); + view.setResizeMode(QQuickView::SizeRootObjectToView); + + Filter f; + view.rootContext()->setContextProperty("syncStatus", &f); + view.installEventFilter(&f); + + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + QQuickView child(&view); + child.connect(child.engine(), SIGNAL(quit()), &app, SLOT(quit())); + child.setSource(QUrl("qrc:/child.qml")); + child.setResizeMode(QQuickView::SizeRootObjectToView); + child.setGeometry(QRect(150, 70, 100, 100)); + child.show(); + + ShmWindow shm(&view); + shm.setGeometry(QRect(30, 30, 50, 50)); + shm.show(); + + f.quick = &child; + f.shm = &shm; + + return app.exec(); +} + +#include "main.moc" + diff --git a/tests/manual/subsurface/main.qml b/tests/manual/subsurface/main.qml new file mode 100644 index 000000000..8d221401b --- /dev/null +++ b/tests/manual/subsurface/main.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Window 2.2 + +Rectangle { + id: root + + width: 300 + height: 300 + + color: "blue" + + Rectangle { + id: r + width: 100 + height: 100 + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + color: "cyan" + + MouseArea { + anchors.fill: parent + drag.target: r + drag.axis: Drag.XAndYAxis + } + } + + Text { + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + text: syncStatus.sync ? "sync mode" : "de-sync mode" + } + + // If you can see these rectangles, something's not right + Rectangle { + //Child at (150, 70, 100, 100) + color: "yellow" + x: 150 + y: 70 + width:100 + height:100 + } + Rectangle { + //Shm at (30, 30, 50, 50) + color: "yellow" + x: 30 + y: 30 + width: 50 + height: 50 + } +} diff --git a/tests/manual/subsurface/qml.qrc b/tests/manual/subsurface/qml.qrc new file mode 100644 index 000000000..f81739af9 --- /dev/null +++ b/tests/manual/subsurface/qml.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>main.qml</file> + <file>child.qml</file> +</qresource> +</RCC> diff --git a/tests/manual/subsurface/shmwindow.cpp b/tests/manual/subsurface/shmwindow.cpp new file mode 100644 index 000000000..50452953a --- /dev/null +++ b/tests/manual/subsurface/shmwindow.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shmwindow.h" + +#include <QPainter> +#include <QDebug> + +ShmWindow::ShmWindow(QWindow *parent) + : QRasterWindow(parent) + , m_rotation(0) +{ + m_timer = startTimer(100); +} + +void ShmWindow::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == m_timer) { + m_rotation++; + update(); + } +} + +void ShmWindow::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + QPainter painter(this); + + painter.fillRect(0, 0, width(), height(), Qt::white); + + qreal xc = width() * 0.5; + qreal yc = height() * 0.5; + painter.translate(xc, yc); + painter.rotate(m_rotation); + painter.drawText(QRectF(-xc, -yc, width(), height()), Qt::AlignCenter, QStringLiteral("SHM")); +} + diff --git a/tests/manual/subsurface/shmwindow.h b/tests/manual/subsurface/shmwindow.h new file mode 100644 index 000000000..451f5fc4a --- /dev/null +++ b/tests/manual/subsurface/shmwindow.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHMWINDOW_H +#define SHMWINDOW_H + +#include <QtGui> + +class ShmWindow : public QRasterWindow +{ + Q_OBJECT +public: + explicit ShmWindow(QWindow *parent); + +protected: + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; + +private: + int m_rotation; + int m_timer; +}; +#endif // SHMWINDOW_H diff --git a/tests/manual/subsurface/subsurface.pro b/tests/manual/subsurface/subsurface.pro new file mode 100644 index 000000000..5371ac5f5 --- /dev/null +++ b/tests/manual/subsurface/subsurface.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += \ + gui gui-private core-private\ + quick \ + waylandclient \ + +HEADERS += \ + shmwindow.h \ + +SOURCES += \ + main.cpp \ + shmwindow.cpp \ + +RESOURCES += \ + qml.qrc + |