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);
|
||||
QVERIFY(rowInsertedSpy.isValid());
|
||||
auto w = m_pwInterface->createWindow(m_pwInterface);
|
||||
w->setPid(1337);
|
||||
QVERIFY(w);
|
||||
QVERIFY(rowInsertedSpy.wait());
|
||||
m_connection->flush();
|
||||
m_display->dispatchEvents();
|
||||
QSignalSpy dataChangedSpy(model, &PlasmaWindowModel::dataChanged);
|
||||
QVERIFY(dataChangedSpy.isValid());
|
||||
QVERIFY(rowInsertedSpy.wait());
|
||||
|
||||
//pid should be set as soon as the new row appears
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ void TestWindowManagement::init()
|
|||
QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *)));
|
||||
QVERIFY(windowSpy.isValid());
|
||||
m_windowInterface = m_windowManagementInterface->createWindow(this);
|
||||
m_windowInterface->setPid(1337);
|
||||
|
||||
QVERIFY(windowSpy.wait());
|
||||
m_window = windowSpy.first().first().value<KWayland::Client::PlasmaWindow *>();
|
||||
|
@ -586,19 +587,17 @@ void TestWindowManagement::testPid()
|
|||
{
|
||||
using namespace KWayland::Client;
|
||||
QVERIFY(m_window);
|
||||
QVERIFY(m_windowInterface);
|
||||
QVERIFY(m_window->pid() == 0);
|
||||
QSignalSpy pidChangedSpy(m_window, &PlasmaWindow::pidChanged);
|
||||
QVERIFY(pidChangedSpy.isValid());
|
||||
// doing nothing does nothing
|
||||
QVERIFY(!pidChangedSpy.wait(10));
|
||||
m_windowInterface->setPid(1984);
|
||||
QVERIFY(pidChangedSpy.wait());
|
||||
QVERIFY(m_window->pid() == 1984);
|
||||
// no signal when the same value is set twice
|
||||
m_windowInterface->setPid(1984);
|
||||
QVERIFY(!pidChangedSpy.wait(10));
|
||||
QVERIFY(m_window->pid() == 1984);
|
||||
QVERIFY(m_window->pid() == 1337);
|
||||
|
||||
//test server not setting a PID for whatever reason
|
||||
QScopedPointer<KWayland::Server::PlasmaWindowInterface> newWindowInterface(m_windowManagementInterface->createWindow(this));
|
||||
QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *)));
|
||||
QVERIFY(windowSpy.wait());
|
||||
QScopedPointer<PlasmaWindow> newWindow( windowSpy.first().first().value<KWayland::Client::PlasmaWindow *>());
|
||||
QVERIFY(newWindow);
|
||||
QVERIFY(newWindow->pid() == 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestWindowManagement)
|
||||
|
|
Loading…
Reference in a new issue