Make previous patch to properly apply

epel9
Jan Grulich 6 years ago
parent 0c250d30bc
commit cf8db35033

@ -1,21 +1,22 @@
ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_remote_access.cpp
diff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_remote_access.cpp
index 9a17ac8..f97629f 100644
--- a/autotests/client/test_remote_access.cpp
+++ b/autotests/client/test_remote_access.cpp
@@ -1,5 +1,6 @@
/********************************************************************
Copyright 2016 Oleg Chernovskiy <kanedias@xaker.ru>
+Copyright 2018 Roman Gilg <subdiff@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -48,22 +49,108 @@
@@ -48,22 +49,108 @@ private Q_SLOTS:
void testSendReleaseSingle();
void testSendReleaseMultiple();
+ void testSendReleaseCrossScreen();
void testSendClientGone();
void testSendReceiveClientGone();
private:
Display *m_display = nullptr;
- OutputInterface *m_outputInterface = nullptr;
@ -44,9 +45,9 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
+ RemoteAccessManager *remoteAccess = nullptr;
+ Output *outputs[2] = {nullptr};
};
static const QString s_socketName = QStringLiteral("kwayland-test-remote-access-0");
+MockupClient::MockupClient(QObject *parent)
+ : QObject(parent)
+{
@ -123,7 +124,7 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
void RemoteAccessTest::init()
{
qRegisterMetaType<const BufferHandle *>();
@@ -76,42 +163,18 @@
@@ -76,42 +163,18 @@ void RemoteAccessTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
@ -172,9 +173,9 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
- m_registry->interface(Registry::Interface::Output).version,
- this);
}
void RemoteAccessTest::cleanup()
@@ -121,22 +184,8 @@
@@ -121,22 +184,8 @@ void RemoteAccessTest::cleanup()
delete variable; \
variable = nullptr; \
}
@ -199,8 +200,8 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
CLEANUP(m_remoteAccessInterface)
CLEANUP(m_display)
#undef CLEANUP
@@ -148,16 +197,13 @@
@@ -148,16 +197,13 @@ void RemoteAccessTest::testSendReleaseSingle()
// setup
QVERIFY(!m_remoteAccessInterface->isBound());
- auto client = m_registry->createRemoteAccessManager(
@ -213,23 +214,23 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
+ client->bindOutput(0);
+
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
- QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
+ QSignalSpy bufferReadySpy(client->remoteAccess, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
@@ -168,7 +214,7 @@
@@ -168,7 +214,7 @@ void RemoteAccessTest::testSendReleaseSingle()
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
- m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
+ m_remoteAccessInterface->sendBufferReady(m_outputInterface[0], buf);
// receive buffer
QVERIFY(bufferReadySpy.wait());
@@ -193,7 +239,6 @@
@@ -193,7 +239,6 @@ void RemoteAccessTest::testSendReleaseSingle()
// cleanup
delete buf;
delete client;
@ -237,8 +238,8 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
@@ -204,23 +249,16 @@
@@ -204,23 +249,16 @@ void RemoteAccessTest::testSendReleaseMultiple()
// setup
QVERIFY(!m_remoteAccessInterface->isBound());
- auto client1 = m_registry->createRemoteAccessManager(
@ -266,24 +267,24 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
- QSignalSpy bufferReadySpy2(client2, &RemoteAccessManager::bufferReady);
+ QSignalSpy bufferReadySpy2(client2->remoteAccess, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy2.isValid());
BufferHandle *buf = new BufferHandle();
@@ -231,10 +269,13 @@
@@ -231,10 +269,13 @@ void RemoteAccessTest::testSendReleaseMultiple()
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
- m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
+ m_remoteAccessInterface->sendBufferReady(m_outputInterface[0], buf);
// wait for event loop
QVERIFY(bufferReadySpy1.wait());
+ if (bufferReadySpy2.size() == 0) {
+ QVERIFY(bufferReadySpy2.wait());
+ }
// receive buffer at client 1
QCOMPARE(bufferReadySpy1.size(), 1);
@@ -251,6 +292,9 @@
@@ -251,6 +292,9 @@ void RemoteAccessTest::testSendReleaseMultiple()
// wait for event loop
QVERIFY(paramsObtainedSpy1.wait());
QCOMPARE(paramsObtainedSpy1.size(), 1);
@ -291,9 +292,9 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
+ QVERIFY(paramsObtainedSpy2.wait());
+ }
QCOMPARE(paramsObtainedSpy2.size(), 1);
// release
@@ -266,25 +310,106 @@
@@ -266,7 +310,92 @@ void RemoteAccessTest::testSendReleaseMultiple()
delete buf;
delete client1;
delete client2;
@ -387,8 +388,7 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
void RemoteAccessTest::testSendClientGone()
@@ -275,16 +404,12 @@ void RemoteAccessTest::testSendClientGone()
{
// this test verifies that when buffer is sent and client is gone, server will release buffer correctly
QVERIFY(!m_remoteAccessInterface->isBound());
@ -401,32 +401,32 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
+ auto *client = new MockupClient(this);
+ client->bindOutput(0);
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
- QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
+ QSignalSpy bufferReadySpy(client->remoteAccess, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
@@ -295,7 +420,7 @@
@@ -295,7 +420,7 @@ void RemoteAccessTest::testSendClientGone()
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
- m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
+ m_remoteAccessInterface->sendBufferReady(m_outputInterface[0], buf);
// release forcefully
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
@@ -305,7 +430,6 @@
@@ -305,7 +430,6 @@ void RemoteAccessTest::testSendClientGone()
// cleanup
delete buf;
- m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
@@ -315,16 +439,12 @@
// this test verifies that when buffer is sent, received and client is gone,
@@ -315,16 +439,12 @@ void RemoteAccessTest::testSendReceiveClientGone()
// this test verifies that when buffer is sent, received and client is gone,
// both client and server will release buffer correctly
QVERIFY(!m_remoteAccessInterface->isBound());
- auto client = m_registry->createRemoteAccessManager(
@ -438,45 +438,46 @@ ndiff --git a/autotests/client/test_remote_access.cpp b/autotests/client/test_re
+ auto *client = new MockupClient(this);
+ client->bindOutput(0);
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
- QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
+ QSignalSpy bufferReadySpy(client->remoteAccess, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
@@ -335,7 +455,7 @@
@@ -335,7 +455,7 @@ void RemoteAccessTest::testSendReceiveClientGone()
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
- m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
+ m_remoteAccessInterface->sendBufferReady(m_outputInterface[0], buf);
// receive buffer
QVERIFY(bufferReadySpy.wait());
@@ -359,11 +479,9 @@
@@ -359,11 +479,9 @@ void RemoteAccessTest::testSendReceiveClientGone()
// cleanup
delete buf;
- m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
-
QTEST_GUILESS_MAIN(RemoteAccessTest)
#include "test_remote_access.moc"
diff --git a/src/server/remote_access_interface.cpp b/src/server/remote_access_interface.cpp
index f8610f6..8b96f38 100644
--- a/src/server/remote_access_interface.cpp
+++ b/src/server/remote_access_interface.cpp
@@ -204,13 +204,18 @@
@@ -204,13 +204,18 @@ void RemoteAccessManagerInterface::Private::sendBufferReady(const OutputInterfac
// clients don't necessarily bind outputs
if (boundScreens.isEmpty()) {
- return;
+ continue;
}
// no reason for client to bind wl_output multiple times, send only to first one
org_kde_kwin_remote_access_manager_send_buffer_ready(res, buf->fd(), boundScreens[0]);
holder.counter++;

Loading…
Cancel
Save