mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
[PlacesItemModelTest] Fix testDeletePlace()
If the Desktop or Downloads folder is missing, using 5 as index would be wrong.
This commit is contained in:
parent
9204f3272b
commit
0abba76eea
|
@ -378,9 +378,17 @@ void PlacesItemModelTest::testDeletePlace()
|
|||
|
||||
PlacesItemModel *model = new PlacesItemModel();
|
||||
|
||||
int tempDirIndex = 3;
|
||||
if (m_hasDesktopFolder) {
|
||||
tempDirIndex++;
|
||||
}
|
||||
if (m_hasDownloadsFolder) {
|
||||
tempDirIndex++;
|
||||
}
|
||||
|
||||
// create a new place
|
||||
createPlaceItem(QStringLiteral("Temporary Dir"), tempUrl, QString());
|
||||
urls.insert(5, tempUrl.toLocalFile());
|
||||
urls.insert(tempDirIndex, tempUrl.toLocalFile());
|
||||
|
||||
// check if the new entry was created
|
||||
QTRY_COMPARE(itemsInsertedSpy.count(), 1);
|
||||
|
@ -388,7 +396,7 @@ void PlacesItemModelTest::testDeletePlace()
|
|||
QTRY_COMPARE(model->count(), m_model->count());
|
||||
|
||||
// delete item
|
||||
m_model->deleteItem(5);
|
||||
m_model->deleteItem(tempDirIndex);
|
||||
|
||||
// make sure that the new item is removed
|
||||
QTRY_COMPARE(itemsRemovedSpy.count(), 1);
|
||||
|
|
Loading…
Reference in a new issue