diff options
| author | Frank Reininghaus <[email protected]> | 2013-09-09 21:13:38 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-09-09 21:13:38 +0200 |
| commit | 2d8872c3accbf4a6f07e3ce4d220c9f87057545a (patch) | |
| tree | 1fba6f242a55322b6b5dcce79be3f0925fa632bd /src/tests | |
| parent | e1d88c4d69ba0fb38951954dceab937741528eab (diff) | |
Test if the groups are updated correctly when items are refreshed
This unit test will hopefully prevent regressions in the future. It is
the first part of https://git.reviewboard.kde.org/r/112561/.
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/kfileitemmodeltest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index f8439789b..b0a27cd01 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -1246,6 +1246,24 @@ void KFileItemModelTest::testNameRoleGroups() expectedGroups << QPair<int, QVariant>(2, QLatin1String("D")); expectedGroups << QPair<int, QVariant>(3, QLatin1String("E")); QCOMPARE(m_model->groups(), expectedGroups); + + // Change d.txt back to c.txt, but this time using the dir lister's refreshItems() signal. + const KFileItem fileItemD = m_model->fileItem(2); + KFileItem fileItemC = fileItemD; + KUrl urlC = fileItemC.url(); + urlC.setFileName("c.txt"); + fileItemC.setUrl(urlC); + + m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemC)); + QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)), DefaultTimeout)); + QCOMPARE(itemsInModel(), QStringList() << "a.txt" << "b.txt" << "c.txt" << "e.txt"); + + expectedGroups.clear(); + expectedGroups << QPair<int, QVariant>(0, QLatin1String("A")); + expectedGroups << QPair<int, QVariant>(1, QLatin1String("B")); + expectedGroups << QPair<int, QVariant>(2, QLatin1String("C")); + expectedGroups << QPair<int, QVariant>(3, QLatin1String("E")); + QCOMPARE(m_model->groups(), expectedGroups); } QStringList KFileItemModelTest::itemsInModel() const |
