summaryrefslogtreecommitdiffstats
path: root/tests/auto/compositor/compositor/tst_compositor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/compositor/compositor/tst_compositor.cpp')
-rw-r--r--tests/auto/compositor/compositor/tst_compositor.cpp401
1 files changed, 291 insertions, 110 deletions
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index c30ebc02b..8405277b4 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/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>