Fix check whether there is already a ShellSurface for a given Surface
Incorrect logic prevented that more than one ShellSurface could be created.
This commit is contained in:
parent
bf4c5ef26b
commit
34af4b1cf8
2 changed files with 39 additions and 1 deletions
|
@ -43,6 +43,7 @@ private Q_SLOTS:
|
||||||
void init();
|
void init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
void testCreateMultiple();
|
||||||
void testFullscreen();
|
void testFullscreen();
|
||||||
void testPing();
|
void testPing();
|
||||||
void testTitle();
|
void testTitle();
|
||||||
|
@ -169,6 +170,43 @@ void TestWaylandShell::cleanup()
|
||||||
m_display = nullptr;
|
m_display = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestWaylandShell::testCreateMultiple()
|
||||||
|
{
|
||||||
|
using namespace KWayland::Server;
|
||||||
|
using namespace KWayland::Client;
|
||||||
|
|
||||||
|
QScopedPointer<Surface> s1(m_compositor->createSurface());
|
||||||
|
QScopedPointer<Surface> s2(m_compositor->createSurface());
|
||||||
|
QVERIFY(!s1.isNull());
|
||||||
|
QVERIFY(s1->isValid());
|
||||||
|
QVERIFY(!s2.isNull());
|
||||||
|
QVERIFY(s2->isValid());
|
||||||
|
|
||||||
|
QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*)));
|
||||||
|
QVERIFY(serverSurfaceSpy.isValid());
|
||||||
|
QScopedPointer<ShellSurface> surface1(m_shell->createSurface(s1.data()));
|
||||||
|
QVERIFY(!surface1.isNull());
|
||||||
|
QVERIFY(surface1->isValid());
|
||||||
|
|
||||||
|
QVERIFY(serverSurfaceSpy.wait());
|
||||||
|
QCOMPARE(serverSurfaceSpy.count(), 1);
|
||||||
|
|
||||||
|
QScopedPointer<ShellSurface> surface2(m_shell->createSurface(s2.data()));
|
||||||
|
QVERIFY(!surface2.isNull());
|
||||||
|
QVERIFY(surface2->isValid());
|
||||||
|
|
||||||
|
QVERIFY(serverSurfaceSpy.wait());
|
||||||
|
QCOMPARE(serverSurfaceSpy.count(), 2);
|
||||||
|
|
||||||
|
// try creating for one which already exist should not be possible
|
||||||
|
QScopedPointer<ShellSurface> surface3(m_shell->createSurface(s2.data()));
|
||||||
|
QVERIFY(!surface3.isNull());
|
||||||
|
QVERIFY(surface3->isValid());
|
||||||
|
|
||||||
|
QVERIFY(!serverSurfaceSpy.wait(100));
|
||||||
|
QCOMPARE(serverSurfaceSpy.count(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
void TestWaylandShell::testFullscreen()
|
void TestWaylandShell::testFullscreen()
|
||||||
{
|
{
|
||||||
using namespace KWayland::Server;
|
using namespace KWayland::Server;
|
||||||
|
|
|
@ -176,7 +176,7 @@ void ShellInterface::Private::createSurface(wl_client *client, uint32_t version,
|
||||||
return surface == s->surface();
|
return surface == s->surface();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (it != surfaces.constBegin()) {
|
if (it != surfaces.constEnd()) {
|
||||||
wl_resource_post_error(surface->surface(), WL_DISPLAY_ERROR_INVALID_OBJECT, "ShellSurface already created");
|
wl_resource_post_error(surface->surface(), WL_DISPLAY_ERROR_INVALID_OBJECT, "ShellSurface already created");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue