Commit 282e0d1c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

autotests: Port the tests to new xdg-shell helpers

parent 4e7c6b57
......@@ -23,6 +23,10 @@ ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration-unstable-v1
)
add_library(KWinIntegrationTestFramework STATIC ${KWinIntegrationTestFramework_SOURCES})
target_link_libraries(KWinIntegrationTestFramework
Qt::Test
......
......@@ -88,13 +88,13 @@ void ActivationTest::testSwitchToWindowToLeft()
// Create several clients on the left screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
......@@ -104,13 +104,13 @@ void ActivationTest::testSwitchToWindowToLeft()
// Create several clients on the right screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......@@ -156,13 +156,13 @@ void ActivationTest::testSwitchToWindowToRight()
// Create several clients on the left screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
......@@ -172,13 +172,13 @@ void ActivationTest::testSwitchToWindowToRight()
// Create several clients on the right screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......@@ -224,13 +224,13 @@ void ActivationTest::testSwitchToWindowAbove()
// Create several clients on the top screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
......@@ -240,13 +240,13 @@ void ActivationTest::testSwitchToWindowAbove()
// Create several clients on the bottom screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......@@ -292,13 +292,13 @@ void ActivationTest::testSwitchToWindowBelow()
// Create several clients on the top screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
......@@ -308,13 +308,13 @@ void ActivationTest::testSwitchToWindowBelow()
// Create several clients on the bottom screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......@@ -361,33 +361,37 @@ void ActivationTest::testSwitchToWindowMaximized()
// Create several maximized clients on the left screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy1.wait());
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.data(), &Test::XdgToplevel::configureRequested);
QVERIFY(toplevelConfigureRequestedSpy1.isValid());
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy1.isValid());
workspace()->slotWindowMaximize();
QVERIFY(configureRequestedSpy1.wait());
QVERIFY(surfaceConfigureRequestedSpy1.wait());
QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged);
QVERIFY(frameGeometryChangedSpy1.isValid());
shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>());
Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red);
shellSurface1->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy1.last().at(0).value<quint32>());
Test::render(surface1.data(), toplevelConfigureRequestedSpy1.last().at(0).toSize(), Qt::red);
QVERIFY(frameGeometryChangedSpy1.wait());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy2.wait());
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.data(), &Test::XdgToplevel::configureRequested);
QVERIFY(toplevelConfigureRequestedSpy2.wait());
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy2.isValid());
workspace()->slotWindowMaximize();
QVERIFY(configureRequestedSpy2.wait());
QVERIFY(surfaceConfigureRequestedSpy2.wait());
QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged);
QVERIFY(frameGeometryChangedSpy2.isValid());
shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>());
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
shellSurface2->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy2.last().at(0).value<quint32>());
Test::render(surface2.data(), toplevelConfigureRequestedSpy2.last().at(0).toSize(), Qt::red);
QVERIFY(frameGeometryChangedSpy2.wait());
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
......@@ -397,13 +401,13 @@ void ActivationTest::testSwitchToWindowMaximized()
// Create several clients on the right screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......@@ -446,33 +450,37 @@ void ActivationTest::testSwitchToWindowFullScreen()
// Create several maximized clients on the top screen.
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
AbstractClient *client1 = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client1);
QVERIFY(client1->isActive());
QSignalSpy configureRequestedSpy1(shellSurface1.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy1.wait());
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.data(), &Test::XdgToplevel::configureRequested);
QVERIFY(toplevelConfigureRequestedSpy1.isValid());
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy1.isValid());
workspace()->slotWindowFullScreen();
QVERIFY(configureRequestedSpy1.wait());
QVERIFY(surfaceConfigureRequestedSpy1.wait());
QSignalSpy frameGeometryChangedSpy1(client1, &AbstractClient::frameGeometryChanged);
QVERIFY(frameGeometryChangedSpy1.isValid());
shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value<quint32>());
Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red);
shellSurface1->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy1.last().at(0).value<quint32>());
Test::render(surface1.data(), toplevelConfigureRequestedSpy1.last().at(0).toSize(), Qt::red);
QVERIFY(frameGeometryChangedSpy1.wait());
QScopedPointer<Surface> surface2(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface2(Test::createXdgShellStableSurface(surface2.data()));
QScopedPointer<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.data()));
AbstractClient *client2 = Test::renderAndWaitForShown(surface2.data(), QSize(100, 50), Qt::blue);
QVERIFY(client2);
QVERIFY(client2->isActive());
QSignalSpy configureRequestedSpy2(shellSurface2.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy2.wait());
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.data(), &Test::XdgToplevel::configureRequested);
QVERIFY(toplevelConfigureRequestedSpy2.wait());
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy2.isValid());
workspace()->slotWindowFullScreen();
QVERIFY(configureRequestedSpy2.wait());
QVERIFY(surfaceConfigureRequestedSpy2.wait());
QSignalSpy frameGeometryChangedSpy2(client2, &AbstractClient::frameGeometryChanged);
QVERIFY(frameGeometryChangedSpy2.isValid());
shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value<quint32>());
Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red);
shellSurface2->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy2.last().at(0).value<quint32>());
Test::render(surface2.data(), toplevelConfigureRequestedSpy2.last().at(0).toSize(), Qt::red);
QVERIFY(frameGeometryChangedSpy2.wait());
const QList<Toplevel *> stackingOrder = workspace()->stackingOrder();
......@@ -482,13 +490,13 @@ void ActivationTest::testSwitchToWindowFullScreen()
// Create several clients on the bottom screen.
QScopedPointer<Surface> surface3(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface3(Test::createXdgShellStableSurface(surface3.data()));
QScopedPointer<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.data()));
AbstractClient *client3 = Test::renderAndWaitForShown(surface3.data(), QSize(100, 50), Qt::blue);
QVERIFY(client3);
QVERIFY(client3->isActive());
QScopedPointer<Surface> surface4(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface4(Test::createXdgShellStableSurface(surface4.data()));
QScopedPointer<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.data()));
AbstractClient *client4 = Test::renderAndWaitForShown(surface4.data(), QSize(100, 50), Qt::blue);
QVERIFY(client4);
QVERIFY(client4->isActive());
......
......@@ -13,7 +13,6 @@
#include "scene.h"
#include "wayland_server.h"
#include <KWayland/Client/xdgshell.h>
#include <KWayland/Client/subsurface.h>
#include <KWayland/Client/surface.h>
......@@ -47,7 +46,7 @@ void BufferSizeChangeTest::testShmBufferSizeChange()
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
// set buffer size
......@@ -77,7 +76,7 @@ void BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface()
// setup parent surface
QScopedPointer<Surface> parentSurface(Test::createSurface());
QVERIFY(!parentSurface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(parentSurface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(parentSurface.data()));
QVERIFY(!shellSurface.isNull());
// setup sub surface
......
......@@ -102,9 +102,9 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient()
QVERIFY(clientAddedSpy.isValid());
QScopedPointer<Surface> surface(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
shellSurface->setAppId(QByteArrayLiteral("org.kde.foo"));
shellSurface->setTitle(QStringLiteral("Test window"));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
shellSurface->set_title(QStringLiteral("Test window"));
// now let's render
Test::render(surface.data(), QSize(100, 50), Qt::blue);
......
......@@ -310,7 +310,7 @@ void DebugConsoleTest::testWaylandClient()
using namespace KWayland::Client;
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(surface->isValid());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
Test::render(surface.data(), QSize(10, 10), Qt::red);
......
......@@ -96,7 +96,7 @@ AbstractClient *DecorationInputTest::showWindow()
Surface *surface = Test::createSurface(Test::waylandCompositor());
VERIFY(surface);
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
VERIFY(shellSurface);
auto deco = Test::waylandServerSideDecoration()->create(surface, surface);
QSignalSpy decoSpy(deco, &ServerSideDecoration::modeChanged);
......
......@@ -85,7 +85,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
// create a window
Surface *surface = Test::createSurface(Test::waylandCompositor());
QVERIFY(surface);
XdgShellSurface *shellSurface = Test::createXdgShellStableSurface(surface, surface);
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface, surface);
QVERIFY(shellSurface);
// let's render
auto c = Test::renderAndWaitForShown(surface, QSize(100, 50), Qt::blue);
......
......@@ -81,7 +81,7 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
// see BUG: 390314
QScopedPointer<Surface> surface(Test::createSurface());
Test::waylandServerSideDecoration()->create(surface.data(), surface.data());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c);
......
......@@ -90,7 +90,7 @@ void DontCrashNoBorder::testCreateWindow()
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(shellSurface);
QScopedPointer<ServerSideDecoration> deco(Test::waylandServerSideDecoration()->create(surface.data()));
QSignalSpy decoSpy(deco.data(), &ServerSideDecoration::modeChanged);
......
......@@ -22,7 +22,6 @@
#include "effect_builtins.h"
#include <KWayland/Client/surface.h>
#include <KWayland/Client/xdgshell.h>
namespace KWin
{
......@@ -119,7 +118,7 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client);
......
......@@ -80,7 +80,7 @@ void TestDontCrashUseractionsMenu::testShowHideShowUseractionsMenu()
{
// this test creates the condition of BUG 382063
QScopedPointer<Surface> surface1(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface1(Test::createXdgShellStableSurface(surface1.data()));
QScopedPointer<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.data()));
auto client = Test::renderAndWaitForShown(surface1.data(), QSize(100, 50), Qt::blue);
QVERIFY(client);
......
......@@ -21,7 +21,6 @@
#include "effect_builtins.h"
#include <KWayland/Client/surface.h>
#include <KWayland/Client/xdgshell.h>
using namespace KWin;
......@@ -113,7 +112,7 @@ void DesktopSwitchingAnimationTest::testSwitchDesktops()
using namespace KWayland::Client;
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client);
......
......@@ -21,7 +21,6 @@
#include "effect_builtins.h"
#include <KWayland/Client/surface.h>
#include <KWayland/Client/xdgshell.h>
using namespace KWin;
......@@ -92,35 +91,35 @@ void MaximizeAnimationTest::testMaximizeRestore()
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly));
// Wait for the initial configure event.
XdgShellSurface::States states;
QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
Test::XdgToplevel::States states;
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
surface->commit(Surface::CommitFlag::None);
QVERIFY(configureRequestedSpy.isValid());
QVERIFY(configureRequestedSpy.wait());
QCOMPARE(configureRequestedSpy.count(), 1);
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
QVERIFY(!states.testFlag(XdgShellSurface::State::Activated));
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
// Draw contents of the surface.
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(client);
QVERIFY(client->isActive());
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
// We should receive a configure event when the client becomes active.
QVERIFY(configureRequestedSpy.wait());
QCOMPARE(configureRequestedSpy.count(), 2);
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
// Load effect that will be tested.
const QString effectName = QStringLiteral("kwin4_effect_maximize");
......@@ -140,15 +139,15 @@ void MaximizeAnimationTest::testMaximizeRestore()
QVERIFY(maximizeChangedSpy.isValid());
workspace()->slotWindowMaximize();
QVERIFY(configureRequestedSpy.wait());
QCOMPARE(configureRequestedSpy.count(), 3);
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024));
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
QVERIFY(states.testFlag(XdgShellSurface::State::Maximized));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024));
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
// Draw contents of the maximized client.
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Test::render(surface.data(), QSize(1280, 1024), Qt::red);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(frameGeometryChangedSpy.count(), 1);
......@@ -161,15 +160,15 @@ void MaximizeAnimationTest::testMaximizeRestore()
// Restore the client.
workspace()->slotWindowMaximize();
QVERIFY(configureRequestedSpy.wait());
QCOMPARE(configureRequestedSpy.count(), 4);
QCOMPARE(configureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50));
states = configureRequestedSpy.last().at(1).value<XdgShellSurface::States>();
QVERIFY(states.testFlag(XdgShellSurface::State::Activated));
QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized));
QVERIFY(surfaceConfigureRequestedSpy.wait());
QCOMPARE(surfaceConfigureRequestedSpy.count(), 4);
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50));
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
// Draw contents of the restored client.
shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Test::render(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(frameGeometryChangedSpy.count(), 2);
......
......@@ -23,7 +23,6 @@
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/surface.h>
#include <KWayland/Client/xdgshell.h>
using namespace KWin;
......@@ -114,7 +113,7 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
const QRect panelRect = QRect(0, 0, 1280, 36);
QScopedPointer<Surface> panelSurface(Test::createSurface());
QVERIFY(!panelSurface.isNull());
QScopedPointer<XdgShellSurface> panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data()));
QScopedPointer<Test::XdgToplevel> panelShellSurface(Test::createXdgToplevelSurface(panelSurface.data()));
QVERIFY(!panelShellSurface.isNull());
QScopedPointer<PlasmaShellSurface> plasmaPanelShellSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data()));
QVERIFY(!plasmaPanelShellSurface.isNull());
......@@ -131,7 +130,7 @@ void MinimizeAnimationTest::testMinimizeUnminimize()
// Create the test client.
QScopedPointer<Surface> surface(Test::createSurface());
QVERIFY(!surface.isNull());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
QVERIFY(!shellSurface.isNull());
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::red);
QVERIFY(client);
......
......@@ -24,8 +24,6 @@
#include "effect_builtins.h"
#include <KWayland/Client/surface.h>
#include <KWayland/Client/xdgdecoration.h>
#include <KWayland/Client/xdgshell.h>
#include <linux/input.h>
......@@ -78,7 +76,7 @@ void PopupOpenCloseAnimationTest::initTestCase()
void PopupOpenCloseAnimationTest::init()
{
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecoration));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1));
}
void PopupOpenCloseAnimationTest::cleanup()
......@@ -104,7 +102,7 @@ void PopupOpenCloseAnimationTest::testAnimatePopups()