diff options
| author | Elvis Angelaccio <[email protected]> | 2018-10-07 17:41:54 +0200 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2018-10-07 17:41:54 +0200 |
| commit | 0abba76eea63d3939e9942c92a3377d401d3c9b5 (patch) | |
| tree | 13fd16bf955db00cf881954feb50db855604de1e | |
| parent | 9204f3272bf7232df86d5da1824f7355c9c0b9c4 (diff) | |
[PlacesItemModelTest] Fix testDeletePlace()
If the Desktop or Downloads folder is missing, using 5 as index would be
wrong.
| -rw-r--r-- | src/tests/placesitemmodeltest.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index 8415a58d0..c47575c46 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -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); |
