Properly wait for client activated in XClipboardSyncTest::testSync

Test was failing on build.kde.org, though passing locally. This change
tries to make the test more robust to timing issues which makes it
hopefully pass on build.kde.org again.
This commit is contained in:
Martin Gräßlin 2016-06-29 12:38:02 +02:00
parent e91f34f925
commit 83dca5b524

View file

@ -166,9 +166,11 @@ void XClipboardSyncTest::testSync()
QCOMPARE(clientAddedSpy.count(), 1);
QCOMPARE(shellClientAddedSpy.count(), 1);
QVERIFY(pasteClient);
qDebug() << pasteClient;
if (workspace()->activeClient() != pasteClient) {
QSignalSpy clientActivatedSpy(workspace(), &Workspace::clientActivated);
QVERIFY(clientActivatedSpy.isValid());
workspace()->activateClient(pasteClient);
QVERIFY(clientActivatedSpy.wait());
}
QTRY_COMPARE(workspace()->activeClient(), pasteClient);
QVERIFY(finishedSpy.wait());