diff options
| author | Travis CI Bot <[email protected]> | 2018-08-16 13:05:29 +0200 |
|---|---|---|
| committer | Travis CI Bot <[email protected]> | 2018-08-16 13:06:06 +0200 |
| commit | 2104d18a6760d28d24665a3281ef090c198c44e7 (patch) | |
| tree | 5f776d78c1c882e4dff7471d9c135d00cb5afdee | |
| parent | 496ba56f42a5ca7f5315f069aef153d32344300b (diff) | |
Make this test work again with new uds implementation
Summary:
With the new uds implementation, when some data is meant to replace an old one, it has to use replace() instead of insert() to avoid an assert of data already exists.
Use 3 different entries and only insert().
Test Plan:
before: crash in the uds assert
after: passes the test
Reviewers: #dolphin, #frameworks, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D13813
| -rw-r--r-- | src/tests/kfileitemmodeltest.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index b455c521d..2f258d17d 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -1551,25 +1551,26 @@ void KFileItemModelTest::testChangeSortRoleWhileFiltering() { KFileItemList items; - KIO::UDSEntry entry; - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, 0100000); // S_IFREG might not be defined on non-Unix platforms. - entry.insert(KIO::UDSEntry::UDS_ACCESS, 07777); - entry.insert(KIO::UDSEntry::UDS_SIZE, 0); - entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, 0); - entry.insert(KIO::UDSEntry::UDS_GROUP, "group"); - entry.insert(KIO::UDSEntry::UDS_ACCESS_TIME, 0); + KIO::UDSEntry entry[3]; - entry.insert(KIO::UDSEntry::UDS_NAME, "a.txt"); - entry.insert(KIO::UDSEntry::UDS_USER, "user-b"); - items.append(KFileItem(entry, m_testDir->url(), false, true)); + entry[0].insert(KIO::UDSEntry::UDS_NAME, "a.txt"); + entry[0].insert(KIO::UDSEntry::UDS_USER, "user-b"); - entry.insert(KIO::UDSEntry::UDS_NAME, "b.txt"); - entry.insert(KIO::UDSEntry::UDS_USER, "user-c"); - items.append(KFileItem(entry, m_testDir->url(), false, true)); + entry[1].insert(KIO::UDSEntry::UDS_NAME, "b.txt"); + entry[1].insert(KIO::UDSEntry::UDS_USER, "user-c"); - entry.insert(KIO::UDSEntry::UDS_NAME, "c.txt"); - entry.insert(KIO::UDSEntry::UDS_USER, "user-a"); - items.append(KFileItem(entry, m_testDir->url(), false, true)); + entry[2].insert(KIO::UDSEntry::UDS_NAME, "c.txt"); + entry[2].insert(KIO::UDSEntry::UDS_USER, "user-a"); + + for (int i = 0; i < 3; ++i) { + entry[i].insert(KIO::UDSEntry::UDS_FILE_TYPE, 0100000); // S_IFREG might not be defined on non-Unix platforms. + entry[i].insert(KIO::UDSEntry::UDS_ACCESS, 07777); + entry[i].insert(KIO::UDSEntry::UDS_SIZE, 0); + entry[i].insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, 0); + entry[i].insert(KIO::UDSEntry::UDS_GROUP, "group"); + entry[i].insert(KIO::UDSEntry::UDS_ACCESS_TIME, 0); + items.append(KFileItem(entry[i], m_testDir->url(), false, true)); + } m_model->slotItemsAdded(m_testDir->url(), items); m_model->slotCompleted(); |
