diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 15:27:52 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 15:27:52 +0200 |
commit | f38554ad4c7ff918bf7792413e6599e69d30cf3a (patch) | |
tree | 8f971c3c5349166e6f2b488c7983bc868627e524 /examples/imapresource/tests/imapresourcetest.cpp | |
parent | 1613964dd195a21eb7ff28699b76db8d41fb8408 (diff) | |
download | sink-f38554ad4c7ff918bf7792413e6599e69d30cf3a.tar.gz sink-f38554ad4c7ff918bf7792413e6599e69d30cf3a.zip |
Support for folder hierarchies
Diffstat (limited to 'examples/imapresource/tests/imapresourcetest.cpp')
-rw-r--r-- | examples/imapresource/tests/imapresourcetest.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/examples/imapresource/tests/imapresourcetest.cpp b/examples/imapresource/tests/imapresourcetest.cpp index d8fc46e..8ce32c2 100644 --- a/examples/imapresource/tests/imapresourcetest.cpp +++ b/examples/imapresource/tests/imapresourcetest.cpp | |||
@@ -100,7 +100,32 @@ private slots: | |||
100 | names << folder->getName(); | 100 | names << folder->getName(); |
101 | } | 101 | } |
102 | QVERIFY(names.contains("INBOX")); | 102 | QVERIFY(names.contains("INBOX")); |
103 | QVERIFY(names.contains("INBOX.test")); | 103 | QVERIFY(names.contains("test")); |
104 | }); | ||
105 | VERIFYEXEC(job); | ||
106 | } | ||
107 | |||
108 | void testListFolderHierarchy() | ||
109 | { | ||
110 | Sink::Query query; | ||
111 | query.resources << "org.kde.imap.instance1"; | ||
112 | query.request<Folder::Name>().request<Folder::Parent>(); | ||
113 | |||
114 | Imap::ImapServerProxy imap("localhost", 993); | ||
115 | VERIFYEXEC(imap.login("doe", "doe")); | ||
116 | VERIFYEXEC(imap.create("INBOX.test.sub")); | ||
117 | |||
118 | // Ensure all local data is processed | ||
119 | VERIFYEXEC(Store::synchronize(query)); | ||
120 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
121 | |||
122 | auto job = Store::fetchAll<Folder>(query).then<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | ||
123 | QCOMPARE(folders.size(), 3); | ||
124 | QHash<QString, Folder::Ptr> map; | ||
125 | for (const auto &folder : folders) { | ||
126 | map.insert(folder->getName(), folder); | ||
127 | } | ||
128 | QCOMPARE(map.value("sub")->getParent(), map.value("test")->identifier()); | ||
104 | }); | 129 | }); |
105 | VERIFYEXEC(job); | 130 | VERIFYEXEC(job); |
106 | } | 131 | } |