Hopefully fix flaky remote access test

Summary:
We have 4 events:

buffer1 created
buffer2 created
buffer1 paramters sent
buffer2 paramters sent

Some are batched

We should connect to buffer 1's parameters being sent after the first
buffer is recieved, not in the potential event loop waiting for buffer
2.

Test Plan:
Passes locally
Haven't tested on build.k.o

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19476
This commit is contained in:
David Edmundson 2019-03-02 15:06:12 +00:00
parent 58af3e8200
commit 6dd0e17759

View file

@ -273,16 +273,15 @@ void RemoteAccessTest::testSendReleaseMultiple()
// wait for event loop
QVERIFY(bufferReadySpy1.wait());
if (bufferReadySpy2.size() == 0) {
QVERIFY(bufferReadySpy2.wait());
}
// receive buffer at client 1
QCOMPARE(bufferReadySpy1.size(), 1);
auto rbuf1 = bufferReadySpy1.takeFirst()[1].value<const RemoteBuffer *>();
QSignalSpy paramsObtainedSpy1(rbuf1, &RemoteBuffer::parametersObtained);
QVERIFY(paramsObtainedSpy1.isValid());
if (bufferReadySpy2.size() == 0) {
QVERIFY(bufferReadySpy2.wait());
}
// receive buffer at client 2
QCOMPARE(bufferReadySpy2.size(), 1);
auto rbuf2 = bufferReadySpy2.takeFirst()[1].value<const RemoteBuffer *>();
@ -290,7 +289,7 @@ void RemoteAccessTest::testSendReleaseMultiple()
QVERIFY(paramsObtainedSpy2.isValid());
// wait for event loop
QVERIFY(paramsObtainedSpy1.wait());
QVERIFY(paramsObtainedSpy1.size() == 1 || paramsObtainedSpy1.wait());
QCOMPARE(paramsObtainedSpy1.size(), 1);
if (paramsObtainedSpy2.size() == 0) {
QVERIFY(paramsObtainedSpy2.wait());