From 9ca24efc073d69e24f635caada4176b34f6e7339 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 15 Oct 2018 15:02:53 +0100 Subject: [PATCH] [autotests] Hook up some missing tests for XDGShellStable Summary: No kwin changes Test Plan: Compiles More tests pass Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16148 --- autotests/integration/kwin_wayland_test.h | 1 + autotests/integration/shell_client_test.cpp | 3 +++ autotests/integration/test_helpers.cpp | 22 +++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index db3593b0b8..fc3926ef6a 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -137,6 +137,7 @@ QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *su KWayland::Client::ShellSurface *createShellSurface(KWayland::Client::Surface *surface, QObject *parent = nullptr); KWayland::Client::XdgShellSurface *createXdgShellV5Surface(KWayland::Client::Surface *surface, QObject *parent = nullptr); KWayland::Client::XdgShellSurface *createXdgShellV6Surface(KWayland::Client::Surface *surface, QObject *parent = nullptr); +KWayland::Client::XdgShellSurface *createXdgShellStableSurface(KWayland::Client::Surface *surface, QObject *parent = nullptr); /** diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp index e369f88516..fd4bdb96fb 100644 --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -414,6 +414,7 @@ void TestShellClient::testFullscreen() break; case Test::ShellSurfaceType::XdgShellV5: case Test::ShellSurfaceType::XdgShellV6: + case Test::ShellSurfaceType::XdgShellStable: xdgShellSurface = qobject_cast(shellSurface.data()); break; default: @@ -626,6 +627,7 @@ void TestShellClient::testMaximizedToFullscreen() break; case Test::ShellSurfaceType::XdgShellV5: case Test::ShellSurfaceType::XdgShellV6: + case Test::ShellSurfaceType::XdgShellStable: xdgShellSurface = qobject_cast(shellSurface.data()); break; default: @@ -722,6 +724,7 @@ void TestShellClient::testMaximizedToFullscreen() break; case Test::ShellSurfaceType::XdgShellV5: case Test::ShellSurfaceType::XdgShellV6: + case Test::ShellSurfaceType::XdgShellStable: qobject_cast(shellSurface.data())->setFullscreen(false); break; default: diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index 7df2970374..e6972af668 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -67,6 +67,7 @@ static struct { Shell *shell = nullptr; XdgShell *xdgShellV5 = nullptr; XdgShell *xdgShellV6 = nullptr; + XdgShell *xdgShellStable = nullptr; ShmPool *shm = nullptr; Seat *seat = nullptr; PlasmaShell *plasmaShell = nullptr; @@ -159,6 +160,10 @@ bool setupWaylandConnection(AdditionalWaylandInterfaces flags) if (!s_waylandConnection.xdgShellV6->isValid()) { return false; } + s_waylandConnection.xdgShellStable = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellStable).name, registry->interface(Registry::Interface::XdgShellStable).version); + if (!s_waylandConnection.xdgShellStable->isValid()) { + return false; + } if (flags.testFlag(AdditionalWaylandInterface::Seat)) { s_waylandConnection.seat = registry->createSeat(registry->interface(Registry::Interface::Seat).name, registry->interface(Registry::Interface::Seat).version); if (!s_waylandConnection.seat->isValid()) { @@ -237,6 +242,8 @@ void destroyWaylandConnection() s_waylandConnection.xdgShellV5 = nullptr; delete s_waylandConnection.xdgShellV6; s_waylandConnection.xdgShellV6 = nullptr; + delete s_waylandConnection.xdgShellStable; + s_waylandConnection.xdgShellStable = nullptr; delete s_waylandConnection.shell; s_waylandConnection.shell = nullptr; delete s_waylandConnection.shadowManager; @@ -460,6 +467,19 @@ XdgShellSurface *createXdgShellV6Surface(Surface *surface, QObject *parent) return s; } +XdgShellSurface *createXdgShellStableSurface(Surface *surface, QObject *parent) +{ + if (!s_waylandConnection.xdgShellStable) { + return nullptr; + } + auto s = s_waylandConnection.xdgShellStable->createSurface(surface, parent); + if (!s->isValid()) { + delete s; + return nullptr; + } + return s; +} + QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent) { switch (type) { @@ -469,6 +489,8 @@ QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *su return createXdgShellV5Surface(surface, parent); case ShellSurfaceType::XdgShellV6: return createXdgShellV6Surface(surface, parent); + case ShellSurfaceType::XdgShellStable: + return createXdgShellStableSurface(surface, parent); default: Q_UNREACHABLE(); return nullptr;