Remove pid changedSignal in Client::PlasmaWindow
Summary: Verified it it send before the initial_state and adjust tests and docs accordingly Test Plan: All unit tests pass Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, #frameworks Tags: #plasma_on_wayland, #frameworks Differential Revision: https://phabricator.kde.org/D5887
This commit is contained in:
parent
1154b2a6fd
commit
e182a2cc24
2 changed files with 15 additions and 23 deletions
|
@ -531,21 +531,14 @@ void PlasmaWindowModelTest::testPid()
|
||||||
QSignalSpy rowInsertedSpy(model, &PlasmaWindowModel::rowsInserted);
|
QSignalSpy rowInsertedSpy(model, &PlasmaWindowModel::rowsInserted);
|
||||||
QVERIFY(rowInsertedSpy.isValid());
|
QVERIFY(rowInsertedSpy.isValid());
|
||||||
auto w = m_pwInterface->createWindow(m_pwInterface);
|
auto w = m_pwInterface->createWindow(m_pwInterface);
|
||||||
|
w->setPid(1337);
|
||||||
QVERIFY(w);
|
QVERIFY(w);
|
||||||
QVERIFY(rowInsertedSpy.wait());
|
|
||||||
m_connection->flush();
|
m_connection->flush();
|
||||||
m_display->dispatchEvents();
|
m_display->dispatchEvents();
|
||||||
QSignalSpy dataChangedSpy(model, &PlasmaWindowModel::dataChanged);
|
QVERIFY(rowInsertedSpy.wait());
|
||||||
QVERIFY(dataChangedSpy.isValid());
|
|
||||||
|
|
||||||
|
//pid should be set as soon as the new row appears
|
||||||
const QModelIndex index = model->index(0);
|
const QModelIndex index = model->index(0);
|
||||||
QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 0);
|
|
||||||
|
|
||||||
w->setPid(1337);
|
|
||||||
QVERIFY(dataChangedSpy.wait());
|
|
||||||
QCOMPARE(dataChangedSpy.count(), 1);
|
|
||||||
QCOMPARE(dataChangedSpy.last().first().toModelIndex(), index);
|
|
||||||
QCOMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(PlasmaWindowModel::Pid)});
|
|
||||||
QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 1337);
|
QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ void TestWindowManagement::init()
|
||||||
QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *)));
|
QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *)));
|
||||||
QVERIFY(windowSpy.isValid());
|
QVERIFY(windowSpy.isValid());
|
||||||
m_windowInterface = m_windowManagementInterface->createWindow(this);
|
m_windowInterface = m_windowManagementInterface->createWindow(this);
|
||||||
|
m_windowInterface->setPid(1337);
|
||||||
|
|
||||||
QVERIFY(windowSpy.wait());
|
QVERIFY(windowSpy.wait());
|
||||||
m_window = windowSpy.first().first().value<KWayland::Client::PlasmaWindow *>();
|
m_window = windowSpy.first().first().value<KWayland::Client::PlasmaWindow *>();
|
||||||
|
@ -586,19 +587,17 @@ void TestWindowManagement::testPid()
|
||||||
{
|
{
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
QVERIFY(m_window);
|
QVERIFY(m_window);
|
||||||
QVERIFY(m_windowInterface);
|
QVERIFY(m_window->pid() == 1337);
|
||||||
QVERIFY(m_window->pid() == 0);
|
|
||||||
QSignalSpy pidChangedSpy(m_window, &PlasmaWindow::pidChanged);
|
//test server not setting a PID for whatever reason
|
||||||
QVERIFY(pidChangedSpy.isValid());
|
QScopedPointer<KWayland::Server::PlasmaWindowInterface> newWindowInterface(m_windowManagementInterface->createWindow(this));
|
||||||
// doing nothing does nothing
|
QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *)));
|
||||||
QVERIFY(!pidChangedSpy.wait(10));
|
QVERIFY(windowSpy.wait());
|
||||||
m_windowInterface->setPid(1984);
|
QScopedPointer<PlasmaWindow> newWindow( windowSpy.first().first().value<KWayland::Client::PlasmaWindow *>());
|
||||||
QVERIFY(pidChangedSpy.wait());
|
QVERIFY(newWindow);
|
||||||
QVERIFY(m_window->pid() == 1984);
|
QVERIFY(newWindow->pid() == 0);
|
||||||
// no signal when the same value is set twice
|
|
||||||
m_windowInterface->setPid(1984);
|
|
||||||
QVERIFY(!pidChangedSpy.wait(10));
|
|
||||||
QVERIFY(m_window->pid() == 1984);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestWindowManagement)
|
QTEST_MAIN(TestWindowManagement)
|
||||||
|
|
Loading…
Reference in a new issue