┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kfileitemmodeltest.cpp
diff options
context:
space:
mode:
authorJaime Torres Amate <[email protected]>2018-08-16 13:50:04 +0200
committerJaime Torres Amate <[email protected]>2018-08-16 13:50:52 +0200
commite03cbe25840fa5ad7569750a0d8020b1c046898f (patch)
tree5f776d78c1c882e4dff7471d9c135d00cb5afdee /src/tests/kfileitemmodeltest.cpp
parentadc5f6d3ac036a018ffc94eb9ca624a2453b09ee (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: bcooksley, bshah, nalvarez, cfeck, dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D13813
Diffstat (limited to 'src/tests/kfileitemmodeltest.cpp')
-rw-r--r--src/tests/kfileitemmodeltest.cpp33
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();