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

List:       kde-commits
Subject:    [kdepim-runtime] resources/mixedmaildir/autotests: Fix unstable storecompacttest
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2015-09-30 15:13:55
Message-ID: E1ZhJ4t-00071a-FA () scm ! kde ! org
[Download RAW message or body]

Git commit 55bdb414c0d005567240a6907b97466bc0979230 by Dan Vrátil.
Committed on 30/09/2015 at 15:13.
Pushed by dvratil into branch 'master'.

Fix unstable storecompacttest

The test depends on QHash iteration order, which can be arbitrary. To compensate
for that, we always ensure that the list is order the way the test expects it
(does not affect test scope)

BUG: 353365
FIXED-IN: 15.12.0

M  +8    -0    resources/mixedmaildir/autotests/storecompacttest.cpp

http://commits.kde.org/kdepim-runtime/55bdb414c0d005567240a6907b97466bc0979230

diff --git a/resources/mixedmaildir/autotests/storecompacttest.cpp \
b/resources/mixedmaildir/autotests/storecompacttest.cpp index c768bbe..bd0e78a 100644
--- a/resources/mixedmaildir/autotests/storecompacttest.cpp
+++ b/resources/mixedmaildir/autotests/storecompacttest.cpp
@@ -363,6 +363,14 @@ void StoreCompactTest::testCompact()
     QVERIFY(mbox3.load(mbox3.fileName()));
     entryList = mbox3.entries();
 
+    // The order of items depends on the order of iteration of a QHash in \
MixedMaildirStore. +    // This makes sure that the items are always sorted by \
collection and offset +    qSort(items.begin(), items.end(),
+          [](const Akonadi::Item &left, const Akonadi::Item &right) {
+            return left.parentCollection().remoteId().compare(right.parentCollection().remoteId()) \
< 0 || +                    (left.parentCollection().remoteId() == \
right.parentCollection().remoteId() && changedOffset(left) < changedOffset(right)); + \
}); +
     entryList3.pop_front();
     for (int i = 0; i < entryList3.count(); ++i) {
         entryList3[ i ] = MBoxEntry(changedOffset(items.first()));


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

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