summaryrefslogtreecommitdiffstats
path: root/tests/auto/compositor/compositor/mockclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/compositor/compositor/mockclient.cpp')
-rw-r--r--tests/auto/compositor/compositor/mockclient.cpp46
1 files changed, 27 insertions, 19 deletions
diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp
index 33847da7d..9b6d327a9 100644
--- a/tests/auto/compositor/compositor/mockclient.cpp
+++ b/tests/auto/compositor/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);