commit e41eddbbe447a03cb095de51c5fe0b8b0fcf1f57 Author: David Edmundson Date: Sat Apr 11 16:27:19 2020 +0100 asdf diff --git a/autotests/client/test_wayland_blur.cpp b/autotests/client/test_wayland_blur.cpp index f6cd202..dd2d5d4 100644 --- a/autotests/client/test_wayland_blur.cpp +++ b/autotests/client/test_wayland_blur.cpp @@ -31,6 +31,7 @@ private Q_SLOTS: void testCreate(); void testSurfaceDestroy(); + void testGlobalDestroy(); private: KWayland::Server::Display *m_display; @@ -157,6 +158,7 @@ void TestBlur::testCreate() QVERIFY(blurChanged.wait()); QCOMPARE(serverSurface->blur()->region(), QRegion(0, 0, 10, 20)); + // and destroy QSignalSpy destroyedSpy(serverSurface->blur().data(), &QObject::destroyed); QVERIFY(destroyedSpy.isValid()); @@ -197,5 +199,27 @@ void TestBlur::testSurfaceDestroy() QVERIFY(blurDestroyedSpy.wait()); } +void TestBlur::testGlobalDestroy() +{ + QSignalSpy serverSurfaceCreated(m_compositorInterface, &KWayland::Server::CompositorInterface::surfaceCreated); + QScopedPointer surface(m_compositor->createSurface()); + QVERIFY(serverSurfaceCreated.wait()); + + auto serverSurface = serverSurfaceCreated.first().first().value(); + QSignalSpy blurChanged(serverSurface, &KWayland::Server::SurfaceInterface::blurChanged); + + delete m_blurManagerInterface; + m_blurManagerInterface = nullptr; + + //this will be an sync operation, we've deleted our global, but the clients have some operations in flight as they haven't processed this yet + + QScopedPointer blur(m_blurManager->createBlur(surface.data())); + blur->setRegion(m_compositor->createRegion(QRegion(0, 0, 10, 20), nullptr)); + blur->commit(); + surface->commit(KWayland::Client::Surface::CommitFlag::None); + + blurChanged.wait(10); +} + QTEST_GUILESS_MAIN(TestBlur) #include "test_wayland_blur.moc"