Changeset View
Changeset View
Standalone View
Standalone View
tests/units/migrator/zanshincontextitemsmigrationtest.cpp
Show All 39 Lines | |||||
40 | #include "akonadi/akonadiserializer.h" | 40 | #include "akonadi/akonadiserializer.h" | ||
41 | 41 | | |||
42 | #include <AkonadiCore/CollectionFetchJob> | 42 | #include <AkonadiCore/CollectionFetchJob> | ||
43 | #include <AkonadiCore/ItemFetchJob> | 43 | #include <AkonadiCore/ItemFetchJob> | ||
44 | #include <AkonadiCore/ItemFetchScope> | 44 | #include <AkonadiCore/ItemFetchScope> | ||
45 | 45 | | |||
46 | #include <QProcess> | 46 | #include <QProcess> | ||
47 | 47 | | |||
48 | using Akonadi::Serializer; | ||||
49 | | ||||
48 | class ZanshinContextItemsMigrationTest : public QObject | 50 | class ZanshinContextItemsMigrationTest : public QObject | ||
49 | { | 51 | { | ||
50 | Q_OBJECT | 52 | Q_OBJECT | ||
51 | public: | 53 | public: | ||
52 | explicit ZanshinContextItemsMigrationTest(QObject *parent = nullptr) | 54 | explicit ZanshinContextItemsMigrationTest(QObject *parent = nullptr) | ||
53 | : QObject(parent) | 55 | : QObject(parent) | ||
54 | { | 56 | { | ||
55 | qRegisterMetaType<Akonadi::Collection>(); | 57 | qRegisterMetaType<Akonadi::Collection>(); | ||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 190 | if (uids.count() != expectedItems.count()) // QCOMPARE for QStringList isn't verbose enough | |||
189 | qWarning() << "Got" << uids << "expected" << expectedItems.keys(); | 191 | qWarning() << "Got" << uids << "expected" << expectedItems.keys(); | ||
190 | QCOMPARE(uids, QStringList(expectedItems.keys())); | 192 | QCOMPARE(uids, QStringList(expectedItems.keys())); | ||
191 | 193 | | |||
192 | for (auto it = expectedItems.constBegin(); it != expectedItems.constEnd(); ++it) { | 194 | for (auto it = expectedItems.constBegin(); it != expectedItems.constEnd(); ++it) { | ||
193 | const Akonadi::Item item = itemHash.value(it.key()); | 195 | const Akonadi::Item item = itemHash.value(it.key()); | ||
194 | //qDebug() << item.id() << it.key(); | 196 | //qDebug() << item.id() << it.key(); | ||
195 | auto todo = item.payload<KCalCore::Todo::Ptr>(); | 197 | auto todo = item.payload<KCalCore::Todo::Ptr>(); | ||
196 | QVERIFY(todo); | 198 | QVERIFY(todo); | ||
197 | const auto contextUids = todo->customProperty("Zanshin", "ContextList").split(',', QString::SkipEmptyParts); | 199 | const auto contextUids = todo->customProperty(Serializer::customPropertyAppName(), Serializer::customPropertyContextList()).split(',', QString::SkipEmptyParts); | ||
198 | QStringList contextNames; | 200 | QStringList contextNames; | ||
199 | std::transform(contextUids.cbegin(), contextUids.cend(), std::back_inserter(contextNames), [this](const QString &uid) { return m_contextTodos.value(uid); }); | 201 | std::transform(contextUids.cbegin(), contextUids.cend(), std::back_inserter(contextNames), [this](const QString &uid) { return m_contextTodos.value(uid); }); | ||
200 | contextNames.sort(); | 202 | contextNames.sort(); | ||
201 | if (contextNames != it.value()) // QCOMPARE for QStringList isn't verbose enough | 203 | if (contextNames != it.value()) // QCOMPARE for QStringList isn't verbose enough | ||
202 | qWarning() << it.key() << "got" << contextNames << "expected" << it.value(); | 204 | qWarning() << it.key() << "got" << contextNames << "expected" << it.value(); | ||
203 | QCOMPARE(contextNames, it.value()); | 205 | QCOMPARE(contextNames, it.value()); | ||
204 | 206 | | |||
205 | QVERIFY(!m_serializer.isContext(item)); | 207 | QVERIFY(!m_serializer.isContext(item)); | ||
Show All 24 Lines |