Remove potential endless loop from XClipboardSyncTest

Summary:
We need to wait till the helper process created the datadevice. For this
we used a while loop. On build.kde.org the test gets stuck in this loop
and times out after 10 minutes.

This change introduces a dedicated signal and we just wait for it. So if
something fails we wait only 5 sec instead of endless. This should help
investigate why the test doesn't work on build.kde.org.

Test Plan: Test works locally

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16741
This commit is contained in:
Martin Flöser 2018-11-07 17:44:38 +01:00
parent f466307277
commit e637d43211
3 changed files with 6 additions and 2 deletions

View file

@ -56,6 +56,8 @@ void XClipboardSyncTest::initTestCase()
QVERIFY(workspaceCreatedSpy.isValid());
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
QSignalSpy clipboardSyncDevicedCreated{waylandServer(), &WaylandServer::xclipboardSyncDataDeviceCreated};
QVERIFY(clipboardSyncDevicedCreated.isValid());
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
kwinApp()->start();
@ -65,8 +67,8 @@ void XClipboardSyncTest::initTestCase()
QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
waylandServer()->initWorkspace();
// wait till the xclipboard sync data device is created
while (waylandServer()->xclipboardSyncDataDevice().isNull()) {
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
if (clipboardSyncDevicedCreated.empty()) {
QVERIFY(clipboardSyncDevicedCreated.wait());
}
QVERIFY(!waylandServer()->xclipboardSyncDataDevice().isNull());
}

View file

@ -246,6 +246,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
[this] (DataDeviceInterface *ddi) {
if (ddi->client() == m_xclipbaordSync.client && m_xclipbaordSync.client != nullptr) {
m_xclipbaordSync.ddi = QPointer<DataDeviceInterface>(ddi);
emit xclipboardSyncDataDeviceCreated();
connect(m_xclipbaordSync.ddi.data(), &DataDeviceInterface::selectionChanged, this,
[this] {
// testing whether the active client inherits Client

View file

@ -210,6 +210,7 @@ Q_SIGNALS:
void terminatingInternalClientConnection();
void initialized();
void foreignTransientChanged(KWayland::Server::SurfaceInterface *child);
void xclipboardSyncDataDeviceCreated();
private:
void setupX11ClipboardSync();