diff options
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r-- | tests/querytest.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 3bb0427..2531c25 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -305,16 +305,22 @@ private slots: | |||
305 | query.propertyFilter.insert("folder", folderEntity->identifier()); | 305 | query.propertyFilter.insert("folder", folderEntity->identifier()); |
306 | query.sortProperty = "date"; | 306 | query.sortProperty = "date"; |
307 | query.limit = 1; | 307 | query.limit = 1; |
308 | query.liveQuery = false; | ||
308 | 309 | ||
309 | //Ensure all local data is processed | 310 | //Ensure all local data is processed |
310 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 311 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
311 | 312 | ||
312 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | ||
313 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 313 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
314 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 314 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
315 | //The model is not sorted, but the limited set is sorted, so we can only test for the latest result. | 315 | //The model is not sorted, but the limited set is sorted, so we can only test for the latest result. |
316 | QCOMPARE(model->rowCount(), 1); | 316 | QCOMPARE(model->rowCount(), 1); |
317 | QCOMPARE(model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->getProperty("uid").toByteArray(), QByteArray("testLatest")); | 317 | QCOMPARE(model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->getProperty("uid").toByteArray(), QByteArray("testLatest")); |
318 | |||
319 | model->fetchMore(QModelIndex()); | ||
320 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | ||
321 | QCOMPARE(model->rowCount(), 2); | ||
322 | //We can't make any assumptions about the order of the indexes | ||
323 | // QCOMPARE(model->index(1, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->getProperty("uid").toByteArray(), QByteArray("testSecond")); | ||
318 | } | 324 | } |
319 | }; | 325 | }; |
320 | 326 | ||