[autotests] Make PlasmaWindowModel Test a little bit more stable
This change ensures that when the PlasmaWindow got created on client side is also processed on the server side before we go into unmap.
This commit is contained in:
parent
0b19734dd0
commit
92c379d474
1 changed files with 13 additions and 1 deletions
|
@ -282,10 +282,13 @@ void PlasmaWindowModelTest::testAddRemoveRows()
|
||||||
// that index doesn't have children
|
// that index doesn't have children
|
||||||
QCOMPARE(model->rowCount(model->index(0)), 0);
|
QCOMPARE(model->rowCount(model->index(0)), 0);
|
||||||
|
|
||||||
|
// process events in order to ensure that the resource is created on server side before we unmap the window
|
||||||
|
QCoreApplication::instance()->processEvents(QEventLoop::WaitForMoreEvents);
|
||||||
|
|
||||||
// now let's remove that again
|
// now let's remove that again
|
||||||
QSignalSpy rowRemovedSpy(model, &PlasmaWindowModel::rowsRemoved);
|
QSignalSpy rowRemovedSpy(model, &PlasmaWindowModel::rowsRemoved);
|
||||||
QVERIFY(rowRemovedSpy.isValid());
|
QVERIFY(rowRemovedSpy.isValid());
|
||||||
delete w;
|
w->unmap();
|
||||||
QVERIFY(rowRemovedSpy.wait());
|
QVERIFY(rowRemovedSpy.wait());
|
||||||
QCOMPARE(rowRemovedSpy.count(), 1);
|
QCOMPARE(rowRemovedSpy.count(), 1);
|
||||||
QVERIFY(!rowRemovedSpy.first().at(0).toModelIndex().isValid());
|
QVERIFY(!rowRemovedSpy.first().at(0).toModelIndex().isValid());
|
||||||
|
@ -295,6 +298,10 @@ void PlasmaWindowModelTest::testAddRemoveRows()
|
||||||
// now the model is empty again
|
// now the model is empty again
|
||||||
QCOMPARE(model->rowCount(), 0);
|
QCOMPARE(model->rowCount(), 0);
|
||||||
QVERIFY(!model->index(0).isValid());
|
QVERIFY(!model->index(0).isValid());
|
||||||
|
|
||||||
|
QSignalSpy wDestroyedSpy(w, &QObject::destroyed);
|
||||||
|
QVERIFY(wDestroyedSpy.isValid());
|
||||||
|
QVERIFY(wDestroyedSpy.wait());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmaWindowModelTest::testDefaultData_data()
|
void PlasmaWindowModelTest::testDefaultData_data()
|
||||||
|
@ -708,6 +715,9 @@ void PlasmaWindowModelTest::testCreateWithUnmappedWindow()
|
||||||
QVERIFY(windowCreatedSpy.wait());
|
QVERIFY(windowCreatedSpy.wait());
|
||||||
PlasmaWindow *window = windowCreatedSpy.first().first().value<PlasmaWindow*>();
|
PlasmaWindow *window = windowCreatedSpy.first().first().value<PlasmaWindow*>();
|
||||||
QVERIFY(window);
|
QVERIFY(window);
|
||||||
|
// make sure the resource is properly created on server side
|
||||||
|
QCoreApplication::instance()->processEvents(QEventLoop::WaitForMoreEvents);
|
||||||
|
|
||||||
QSignalSpy unmappedSpy(window, &PlasmaWindow::unmapped);
|
QSignalSpy unmappedSpy(window, &PlasmaWindow::unmapped);
|
||||||
QVERIFY(unmappedSpy.isValid());
|
QVERIFY(unmappedSpy.isValid());
|
||||||
QSignalSpy destroyedSpy(window, &PlasmaWindow::destroyed);
|
QSignalSpy destroyedSpy(window, &PlasmaWindow::destroyed);
|
||||||
|
@ -769,6 +779,8 @@ void PlasmaWindowModelTest::testChangeWindowAfterModelDestroy()
|
||||||
auto w = m_pwInterface->createWindow(m_pwInterface);
|
auto w = m_pwInterface->createWindow(m_pwInterface);
|
||||||
QVERIFY(windowCreatedSpy.wait());
|
QVERIFY(windowCreatedSpy.wait());
|
||||||
PlasmaWindow *window = windowCreatedSpy.first().first().value<PlasmaWindow*>();
|
PlasmaWindow *window = windowCreatedSpy.first().first().value<PlasmaWindow*>();
|
||||||
|
// make sure the resource is properly created on server side
|
||||||
|
QCoreApplication::instance()->processEvents(QEventLoop::WaitForMoreEvents);
|
||||||
QCOMPARE(model->rowCount(), 1);
|
QCOMPARE(model->rowCount(), 1);
|
||||||
delete model;
|
delete model;
|
||||||
QFETCH(ClientWindowSignal, changedSignal);
|
QFETCH(ClientWindowSignal, changedSignal);
|
||||||
|
|
Loading…
Reference in a new issue