Changeset View
Changeset View
Standalone View
Standalone View
tests/units/akonadi/akonadilivequeryhelperstest.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <testlib/qtest_zanshin.h> | 24 | #include <testlib/qtest_zanshin.h> | ||
25 | 25 | | |||
26 | #include "akonadi/akonadilivequeryhelpers.h" | 26 | #include "akonadi/akonadilivequeryhelpers.h" | ||
27 | 27 | | |||
28 | #include <functional> | 28 | #include <functional> | ||
29 | 29 | | |||
30 | #include <KCalCore/Todo> | 30 | #include <KCalCore/Todo> | ||
31 | #include <KMime/Message> | | |||
32 | #include <Akonadi/Notes/NoteUtils> | | |||
33 | 31 | | |||
34 | #include "akonadi/akonadiserializer.h" | 32 | #include "akonadi/akonadiserializer.h" | ||
35 | 33 | | |||
36 | #include "testlib/akonadifakedata.h" | 34 | #include "testlib/akonadifakedata.h" | ||
37 | #include "testlib/gencollection.h" | 35 | #include "testlib/gencollection.h" | ||
38 | #include "testlib/gentag.h" | 36 | #include "testlib/gentag.h" | ||
39 | #include "testlib/gentodo.h" | 37 | #include "testlib/gentodo.h" | ||
40 | #include "testlib/testhelpers.h" | 38 | #include "testlib/testhelpers.h" | ||
41 | 39 | | |||
42 | using namespace Testlib; | 40 | using namespace Testlib; | ||
43 | 41 | | |||
44 | using namespace std::placeholders; | 42 | using namespace std::placeholders; | ||
45 | 43 | | |||
46 | static QString titleFromItem(const Akonadi::Item &item) | 44 | static QString titleFromItem(const Akonadi::Item &item) | ||
47 | { | 45 | { | ||
48 | if (item.hasPayload<KCalCore::Todo::Ptr>()) { | 46 | if (item.hasPayload<KCalCore::Todo::Ptr>()) { | ||
49 | const auto todo = item.payload<KCalCore::Todo::Ptr>(); | 47 | const auto todo = item.payload<KCalCore::Todo::Ptr>(); | ||
50 | return todo->summary(); | 48 | return todo->summary(); | ||
51 | | ||||
52 | } else if (item.hasPayload<KMime::Message::Ptr>()) { | | |||
53 | const auto message = item.payload<KMime::Message::Ptr>(); | | |||
54 | const Akonadi::NoteUtils::NoteMessageWrapper note(message); | | |||
55 | return note.title(); | | |||
56 | | ||||
57 | } else { | 49 | } else { | ||
58 | return QString(); | 50 | return QString(); | ||
59 | } | 51 | } | ||
60 | } | 52 | } | ||
61 | 53 | | |||
62 | class AkonadiLiveQueryHelpersTest : public QObject | 54 | class AkonadiLiveQueryHelpersTest : public QObject | ||
63 | { | 55 | { | ||
64 | Q_OBJECT | 56 | Q_OBJECT | ||
▲ Show 20 Lines • Show All 510 Lines • Show Last 20 Lines |