diff options
| author | Frank Reininghaus <[email protected]> | 2013-01-27 15:25:47 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-01-27 15:25:47 +0100 |
| commit | 1bd91417dbb7752795ca763d221a7e39c99985aa (patch) | |
| tree | 67c691ccc1fc1d21c9bc75d006d8d91ef1e0ee6c /src/tests/kfileitemmodeltest.cpp | |
| parent | f76f3a165419b048f9f8bcdfcb40042397b9af9b (diff) | |
| parent | 891ee0c41a3b2e80aa8191a6f8152c6095ce0351 (diff) | |
Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
dolphin/src/tests/kfileitemmodeltest.cpp
Diffstat (limited to 'src/tests/kfileitemmodeltest.cpp')
| -rw-r--r-- | src/tests/kfileitemmodeltest.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index 3fc2b7c9a..d0f2e1eaa 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -72,10 +72,9 @@ private slots: void testExpandItems(); void testExpandParentItems(); void testSorting(); - void testIndexForKeyboardSearch(); - void testNameFilter(); + void testEmptyPath(); private: QStringList itemsInModel() const; @@ -773,6 +772,31 @@ void KFileItemModelTest::testNameFilter() QCOMPARE(m_model->count(), 5); } +/** + * Verifies that we do not crash when adding a KFileItem with an empty path. + * Before this issue was fixed, KFileItemModel::expandedParentsCountCompare() + * tried to always read the first character of the path, even if the path is empty. + */ +void KFileItemModelTest::testEmptyPath() +{ + QSet<QByteArray> roles; + roles.insert("text"); + roles.insert("isExpanded"); + roles.insert("isExpandable"); + roles.insert("expandedParentsCount"); + m_model->setRoles(roles); + + const KUrl emptyUrl; + QVERIFY(emptyUrl.path().isEmpty()); + + const KUrl url("file:///test/"); + + KFileItemList items; + items << KFileItem(emptyUrl, QString(), KFileItem::Unknown) << KFileItem(url, QString(), KFileItem::Unknown); + m_model->slotNewItems(items); + m_model->slotCompleted(); +} + QStringList KFileItemModelTest::itemsInModel() const { QStringList items; |
