diff options
| author | Renato Araujo Oliveira Filho <[email protected]> | 2017-12-14 12:35:44 -0300 |
|---|---|---|
| committer | Renato Araujo Oliveira Filho <[email protected]> | 2018-01-26 11:07:59 -0300 |
| commit | 3bf68fd71492f02bffb6cf040e9471c5e997180e (patch) | |
| tree | ca38766a077c5dc4677b57a2571e7009f94f3f1f /src/tests | |
| parent | ea6a2424fb454eafb80a731e5fdce4e4a50cb606 (diff) | |
Make sure that old URLs do not appear duplicated in places model
Summary:
BUG: 389401
KIO model now provides Baloo URLs; we need to remove the old ones
created by Dolphin places model
BUG: 387888
Depends on D9332
Test Plan: unit test
Reviewers: mwolff, #dolphin, ngraham, elvisangelaccio
Reviewed By: #dolphin, ngraham, elvisangelaccio
Subscribers: elvisangelaccio, broulik, ervin, ngraham, #dolphin
Differential Revision: https://phabricator.kde.org/D9333
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/placesitemmodeltest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index ef24292ed..8fb01676a 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -83,6 +83,7 @@ private slots: void testIcons(); void testDragAndDrop(); void testHideDevices(); + void testDuplicatedEntries(); private: PlacesItemModel* m_model; @@ -780,6 +781,31 @@ void PlacesItemModelTest::testHideDevices() m_model = new PlacesItemModel(); QTRY_COMPARE(m_model->count(), urls.count()); CHECK_PLACES_URLS(urls); + + // revert changes + m_model->setGroupHidden(KFilePlacesModel::RemovableDevicesType, false); + urls = initialUrls(); + QTRY_COMPARE(m_model->count(), urls.count()); + CHECK_PLACES_URLS(urls); +} + +void PlacesItemModelTest::testDuplicatedEntries() +{ + QStringList urls = initialUrls(); + // create a duplicated entry on bookmark + KBookmarkManager *bookmarkManager = KBookmarkManager::managerForFile(bookmarksFile(), QStringLiteral("kfilePlaces")); + KBookmarkGroup root = bookmarkManager->root(); + KBookmark bookmark = root.addBookmark(QStringLiteral("Duplicated Search Videos"), QUrl("search:/videos"), {}); + + const QString id = QUuid::createUuid().toString(); + bookmark.setMetaDataItem(QStringLiteral("ID"), id); + bookmark.setMetaDataItem(QStringLiteral("OnlyInApp"), KAboutData::applicationData().componentName()); + bookmarkManager->emitChanged(bookmarkManager->root()); + + PlacesItemModel *newModel = new PlacesItemModel(); + QTRY_COMPARE(placesUrls(newModel).count(QStringLiteral("search:/videos")), 1); + QTRY_COMPARE(urls, placesUrls(newModel)); + delete newModel; } QTEST_MAIN(PlacesItemModelTest) |
