Client tests: Fix tst_xdgShell::pongs when run as the only test

The shell integration is initialized lazily, so it's not possible to send ping
events to the client before the first window has been initialized.

This adds a simple window to the pong test.

Change-Id: I13b4a9cb802b7abe18bfc23cf8c75eb873ded3ca
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-04-10 12:44:06 +02:00 committed by Johan Helsing
parent 95469e731c
commit 1751270076

View File

@ -423,9 +423,16 @@ void tst_xdgshell::switchPopups()
void tst_xdgshell::pongs() void tst_xdgshell::pongs()
{ {
QSignalSpy pongSpy(exec([=] { return get<XdgWmBase>(); }), &XdgWmBase::pong); // Create and show a window to trigger shell integration initialzation,
// otherwise we don't have anything to send ping events to.
QRasterWindow window;
window.resize(200, 200);
window.show();
// Verify that the client has bound to the global // Verify that the client has bound to the global
QCOMPOSITOR_TRY_COMPARE(get<XdgWmBase>()->resourceMap().size(), 1); QCOMPOSITOR_TRY_COMPARE(get<XdgWmBase>()->resourceMap().size(), 1);
QSignalSpy pongSpy(exec([=] { return get<XdgWmBase>(); }), &XdgWmBase::pong);
const uint serial = exec([=] { return nextSerial(); }); const uint serial = exec([=] { return nextSerial(); });
exec([=] { exec([=] {
auto *base = get<XdgWmBase>(); auto *base = get<XdgWmBase>();