summaryrefslogtreecommitdiffstats
path: root/tests/clientapitest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 11:41:09 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 11:41:09 +0100
commit32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c (patch)
treed89e5c63b7692282a8f2d0d2c3a8c8dc52a53a4a /tests/clientapitest.cpp
parentb5648af02ea7246b41d24e242c5f94e43e43980e (diff)
downloadsink-32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c.tar.gz
sink-32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c.zip
Use the ChildrenFetchedRole
Diffstat (limited to 'tests/clientapitest.cpp')
-rw-r--r--tests/clientapitest.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp
index bd1cccd..5d8cd9f 100644
--- a/tests/clientapitest.cpp
+++ b/tests/clientapitest.cpp
@@ -30,7 +30,6 @@ public:
30 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE 30 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE
31 { 31 {
32 // capturedResultProvider = &resultProvider; 32 // capturedResultProvider = &resultProvider;
33 Trace() << "lkjsdflkjsdfljsdfljsdlfj";
34 33
35 auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>(); 34 auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>();
36 resultProvider->onDone([resultProvider]() { 35 resultProvider->onDone([resultProvider]() {
@@ -40,7 +39,7 @@ public:
40 //We have to do it this way, otherwise we're not setting the fetcher right 39 //We have to do it this way, otherwise we're not setting the fetcher right
41 auto emitter = resultProvider->emitter(); 40 auto emitter = resultProvider->emitter();
42 41
43 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &) { 42 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) {
44 Trace() << "Running the fetcher"; 43 Trace() << "Running the fetcher";
45 for (const auto &res : results) { 44 for (const auto &res : results) {
46 qDebug() << "Parent filter " << query.propertyFilter.value("parent").toByteArray() << res->identifier(); 45 qDebug() << "Parent filter " << query.propertyFilter.value("parent").toByteArray() << res->identifier();
@@ -48,6 +47,7 @@ public:
48 resultProvider->add(res); 47 resultProvider->add(res);
49 } 48 }
50 } 49 }
50 resultProvider->initialResultSetComplete(parent);
51 }); 51 });
52 auto job = KAsync::start<void>([query, resultProvider]() { 52 auto job = KAsync::start<void>([query, resultProvider]() {
53 }); 53 });
@@ -87,7 +87,8 @@ private Q_SLOTS:
87 query.liveQuery = false; 87 query.liveQuery = false;
88 88
89 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); 89 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query);
90 QTRY_COMPARE(model->rowCount(QModelIndex()), 1); 90 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
91 QCOMPARE(model->rowCount(QModelIndex()), 1);
91 } 92 }
92 93
93 // //The query provider is supposed to delete itself 94 // //The query provider is supposed to delete itself
@@ -168,9 +169,11 @@ private Q_SLOTS:
168 query.parentProperty = "parent"; 169 query.parentProperty = "parent";
169 170
170 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 171 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
171 QTRY_COMPARE(model->rowCount(), 1); 172 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
173 QCOMPARE(model->rowCount(), 1);
172 model->fetchMore(model->index(0, 0)); 174 model->fetchMore(model->index(0, 0));
173 QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); 175 QTRY_VERIFY(model->data(model->index(0, 0), Akonadi2::Store::ChildrenFetchedRole).toBool());
176 QCOMPARE(model->rowCount(model->index(0, 0)), 1);
174 } 177 }
175 178
176 void testModelSignals() 179 void testModelSignals()