diff --git a/src/wayland/autotests/client/test_wayland_registry.cpp b/src/wayland/autotests/client/test_wayland_registry.cpp index f109d7ded5..7e050ed755 100644 --- a/src/wayland/autotests/client/test_wayland_registry.cpp +++ b/src/wayland/autotests/client/test_wayland_registry.cpp @@ -537,24 +537,37 @@ void TestWaylandRegistry::testDestroy() QVERIFY(connectedSpy.wait()); Registry registry; + QSignalSpy shellAnnouncedSpy(®istry, SIGNAL(shellAnnounced(quint32,quint32))); + QVERIFY(!registry.isValid()); - registry.create(connection.display()); + registry.create(&connection); registry.setup(); QVERIFY(registry.isValid()); - connect(&connection, &ConnectionThread::connectionDied, ®istry, &Registry::destroy); + //create some arbitrary Interface + shellAnnouncedSpy.wait(); + QScopedPointer shell(registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version, ®istry)); + QSignalSpy connectionDiedSpy(&connection, SIGNAL(connectionDied())); + QSignalSpy registryDiedSpy(®istry, SIGNAL(registryDestroyed())); + QVERIFY(connectionDiedSpy.isValid()); + QVERIFY(registryDiedSpy.isValid()); + delete m_display; m_display = nullptr; QVERIFY(connectionDiedSpy.wait()); + QVERIFY(connectionDiedSpy.count() == 1); + QVERIFY(registryDiedSpy.count() == 1); + // now the registry should be destroyed; QVERIFY(!registry.isValid()); // calling destroy again should not fail registry.destroy(); + shell->destroy(); } void TestWaylandRegistry::testGlobalSync()