QCOMPARE(m_model->count(), m_expectedModelCount);
for (int r = 0; r < m_model->count(); r++) {
QCOMPARE(m_model->placesItem(r)->isSystemItem(), !m_model->placesItem(r)->device().isValid());
QCOMPARE(m_model->count(), m_expectedModelCount);
for (int r = 0; r < m_model->count(); r++) {
QCOMPARE(m_model->placesItem(r)->isSystemItem(), !m_model->placesItem(r)->device().isValid());
QTRY_COMPARE(itemsInsertedSpy.count(), 1);
// make sure the new place get removed
QTRY_COMPARE(itemsInsertedSpy.count(), 1);
// make sure the new place get removed
QList<QVariant> args = itemsInsertedSpy.takeFirst();
KItemRangeList range = args.at(0).value<KItemRangeList>();
QList<QVariant> args = itemsInsertedSpy.takeFirst();
KItemRangeList range = args.at(0).value<KItemRangeList>();
- QVERIFY(!m_model->placesItem(5)->isSystemItem());
- QCOMPARE(m_model->count(), 18);
+ QVERIFY(!m_model->placesItem(tempDirIndex)->isSystemItem());
+ QCOMPARE(m_model->count(), m_expectedModelCount + 1);
QTest::qWait(300);
// check if the removal signal is correct
QSignalSpy itemsRemovedSpy(m_model, &PlacesItemModel::itemsRemoved);
QTest::qWait(300);
// check if the removal signal is correct
QSignalSpy itemsRemovedSpy(m_model, &PlacesItemModel::itemsRemoved);
QTRY_COMPARE(itemsRemovedSpy.count(), 1);
args = itemsRemovedSpy.takeFirst();
range = args.at(0).value<KItemRangeList>();
QTRY_COMPARE(itemsRemovedSpy.count(), 1);
args = itemsRemovedSpy.takeFirst();
range = args.at(0).value<KItemRangeList>();
QCOMPARE(range.first().count, 1);
QTRY_COMPARE(m_model->count(), m_expectedModelCount);
//cancel removal (it was removed above)
QCOMPARE(range.first().count, 1);
QTRY_COMPARE(m_model->count(), m_expectedModelCount);
//cancel removal (it was removed above)