[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-baseapps/KDE/4.11] dolphin/src/tests: Test if the groups are updated correctly when items are r
From:       Frank Reininghaus <frank78ac () googlemail ! com>
Date:       2013-09-09 19:16:56
Message-ID: E1VJ6xE-0002x6-Et () scm ! kde ! org
[Download RAW message or body]

Git commit 6a5658d30b184a5dc3d343d195b62cb5d5ffc7f9 by Frank Reininghaus.
Committed on 09/09/2013 at 19:13.
Pushed by freininghaus into branch 'KDE/4.11'.

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/.

M  +18   -0    dolphin/src/tests/kfileitemmodeltest.cpp

http://commits.kde.org/kde-baseapps/6a5658d30b184a5dc3d343d195b62cb5d5ffc7f9

diff --git a/dolphin/src/tests/kfileitemmodeltest.cpp b/dolphin/src/tests/kfileitemmodeltest.cpp
index f843978..b0a27cd 100644
--- a/dolphin/src/tests/kfileitemmodeltest.cpp
+++ b/dolphin/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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic