Paste P295

Fix testShellClient
ActivePublic

Authored by zzag on Jan 29 2019, 9:42 AM.
From 8d8d938500ed6a77a8d063d9da8683b3aa5baebb Mon Sep 17 00:00:00 2001
From: Vlad Zagorodniy <vladzzag@gmail.com>
Date: Tue, 29 Jan 2019 11:36:58 +0200
Subject: [PATCH] Foobar
This commit foobars tests.
---
autotests/integration/kwin_wayland_test.h | 5 +++++
autotests/integration/shell_client_test.cpp | 10 +++++++++-
autotests/integration/test_helpers.cpp | 14 ++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h
index 105d9bc2a..d95148445 100644
--- a/autotests/integration/kwin_wayland_test.h
+++ b/autotests/integration/kwin_wayland_test.h
@@ -149,6 +149,11 @@ enum class CreationSetup {
*/
QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent = nullptr);
+KWayland::Client::XdgShellSurface *createXdgShellSurface(ShellSurfaceType type,
+ KWayland::Client::Surface *surface,
+ QObject *parent = nullptr,
+ CreationSetup creationSetup = CreationSetup::CreateAndConfigure);
+
KWayland::Client::ShellSurface *createShellSurface(KWayland::Client::Surface *surface,
QObject *parent = nullptr);
KWayland::Client::XdgShellSurface *createXdgShellV5Surface(KWayland::Client::Surface *surface,
diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp
index 6ae402559..7d25cc775 100644
--- a/autotests/integration/shell_client_test.cpp
+++ b/autotests/integration/shell_client_test.cpp
@@ -575,10 +575,18 @@ void TestShellClient::testUserSetFullscreenXdgShell()
{
QScopedPointer<Surface> surface(Test::createSurface());
QFETCH(Test::ShellSurfaceType, type);
- QScopedPointer<XdgShellSurface> shellSurface(dynamic_cast<XdgShellSurface*>(Test::createShellSurface(type, surface.data())));
+ QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellSurface(
+ type, surface.data(), surface.data(), Test::CreationSetup::CreateOnly));
QVERIFY(!shellSurface.isNull());
+
+ // wait for the initial configure event
QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested);
QVERIFY(configureRequestedSpy.isValid());
+ surface->commit();
+ QVERIFY(configureRequestedSpy.wait());
+ QCOMPARE(configureRequestedSpy.count(), 1);
+
+ shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value<quint32>());
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
QVERIFY(c);
QVERIFY(c->isActive());
diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp
index 257919064..105f3511f 100644
--- a/autotests/integration/test_helpers.cpp
+++ b/autotests/integration/test_helpers.cpp
@@ -579,6 +579,20 @@ QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *su
}
}
+KWayland::Client::XdgShellSurface *createXdgShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup)
+{
+ switch (type) {
+ case ShellSurfaceType::XdgShellV5:
+ return createXdgShellV5Surface(surface, parent, creationSetup);
+ case ShellSurfaceType::XdgShellV6:
+ return createXdgShellV6Surface(surface, parent, creationSetup);
+ case ShellSurfaceType::XdgShellStable:
+ return createXdgShellStableSurface(surface, parent, creationSetup);
+ default:
+ return nullptr;
+ }
+}
+
bool waitForWindowDestroyed(AbstractClient *client)
{
QSignalSpy destroyedSpy(client, &QObject::destroyed);
--
2.20.1
zzag created this paste.Jan 29 2019, 9:42 AM
zzag created this object in space S1 KDE Community.