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

Loading…
Cancel
Save