diff --git a/src/wayland/autotests/client/test_plasma_window_model.cpp b/src/wayland/autotests/client/test_plasma_window_model.cpp index 640f61ca57..c3809a0d69 100644 --- a/src/wayland/autotests/client/test_plasma_window_model.cpp +++ b/src/wayland/autotests/client/test_plasma_window_model.cpp @@ -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(PlasmaWindowModel::Pid)}); QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 1337); } diff --git a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp index 662f7dc8ac..22679ac2ad 100644 --- a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp +++ b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp @@ -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(); @@ -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 newWindowInterface(m_windowManagementInterface->createWindow(this)); + QSignalSpy windowSpy(m_windowManagement, SIGNAL(windowCreated(KWayland::Client::PlasmaWindow *))); + QVERIFY(windowSpy.wait()); + QScopedPointer newWindow( windowSpy.first().first().value()); + QVERIFY(newWindow); + QVERIFY(newWindow->pid() == 0); + + } QTEST_MAIN(TestWindowManagement)