From 6f755bf680a60b2993d55302d3acdccbd019b023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martina=20Fl=C3=B6ser?= Date: Sun, 18 Jan 2015 16:09:37 +0100 Subject: [PATCH] Implementation of setToplevel on client side --- .../autotests/client/test_wayland_shell.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/wayland/autotests/client/test_wayland_shell.cpp b/src/wayland/autotests/client/test_wayland_shell.cpp index 34d0459050..b8990d1f2e 100644 --- a/src/wayland/autotests/client/test_wayland_shell.cpp +++ b/src/wayland/autotests/client/test_wayland_shell.cpp @@ -46,6 +46,7 @@ private Q_SLOTS: void testCreateMultiple(); void testFullscreen(); void testMaximize(); + void testToplevel(); void testPing(); void testTitle(); void testWindowClass(); @@ -288,6 +289,46 @@ void TestWaylandShell::testMaximize() QVERIFY(!maximizedSpy.first().first().toBool()); } +void TestWaylandShell::testToplevel() +{ + using namespace KWayland::Server; + QScopedPointer s(m_compositor->createSurface()); + QVERIFY(!s.isNull()); + QVERIFY(s->isValid()); + KWayland::Client::ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); + QSignalSpy sizeSpy(surface, SIGNAL(sizeChanged(QSize))); + QVERIFY(sizeSpy.isValid()); + QCOMPARE(surface->size(), QSize()); + + QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*))); + QVERIFY(serverSurfaceSpy.isValid()); + QVERIFY(serverSurfaceSpy.wait()); + ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); + QVERIFY(serverSurface); + QVERIFY(serverSurface->parentResource()); + + QSignalSpy toplevelSpy(serverSurface, SIGNAL(toplevelChanged(bool))); + QVERIFY(toplevelSpy.isValid()); + + surface->setToplevel(); + QVERIFY(toplevelSpy.wait()); + QCOMPARE(toplevelSpy.count(), 1); + QVERIFY(toplevelSpy.first().first().toBool()); + serverSurface->requestSize(QSize(1024, 768)); + + QVERIFY(sizeSpy.wait()); + QCOMPARE(sizeSpy.count(), 1); + QCOMPARE(sizeSpy.first().first().toSize(), QSize(1024, 768)); + QCOMPARE(surface->size(), QSize(1024, 768)); + + // set back to fullscreen + toplevelSpy.clear(); + surface->setFullscreen(); + QVERIFY(toplevelSpy.wait()); + QCOMPARE(toplevelSpy.count(), 1); + QVERIFY(!toplevelSpy.first().first().toBool()); +} + void TestWaylandShell::testPing() { using namespace KWayland::Server;