summaryrefslogtreecommitdiffstats
path: root/tests/querytest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-06 19:01:03 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-06 19:01:03 +0100
commit303a3cf5ba48dd9857a1fb9600cedd604c71de8d (patch)
treeb7607eb58b7fbda5dbd49133bb316fe109edc44a /tests/querytest.cpp
parent46570dd9684990846cfd4c3dc5be71498c5a6278 (diff)
downloadsink-303a3cf5ba48dd9857a1fb9600cedd604c71de8d.tar.gz
sink-303a3cf5ba48dd9857a1fb9600cedd604c71de8d.zip
Added TypeIndex
A central location for all types to specify what properties are indexed, and how to query them.
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r--tests/querytest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp
index 669bf58..516af35 100644
--- a/tests/querytest.cpp
+++ b/tests/querytest.cpp
@@ -154,6 +154,31 @@ private Q_SLOTS:
154 QTRY_COMPARE(model->rowCount(), 1); 154 QTRY_COMPARE(model->rowCount(), 1);
155 model->fetchMore(model->index(0, 0)); 155 model->fetchMore(model->index(0, 0));
156 QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); 156 QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1);
157 void testMailByUid()
158 {
159 //Setup
160 {
161 Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1");
162 mail.setProperty("uid", "test1");
163 mail.setProperty("sender", "doe@example.org");
164 Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished();
165 }
166
167 //Test
168 Akonadi2::Query query;
169 query.resources << "org.kde.dummy.instance1";
170 query.syncOnDemand = false;
171 query.processAll = true;
172 query.liveQuery = false;
173 query.propertyFilter.insert("uid", "test1");
174
175 //Ensure all local data is processed
176 Akonadi2::Store::synchronize(query).exec().waitForFinished();
177
178 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
179 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
180 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
181 QCOMPARE(model->rowCount(), 1);
157 } 182 }
158}; 183};
159 184