[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [akonadi-next/develop] tests: Use the ChildrenFetchedRole
From:       Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date:       2015-11-30 17:52:53
Message-ID: E1a3SdB-0003TI-T3 () scm ! kde ! org
[Download RAW message or body]

Git commit 32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c by Christian Mollekopf.
Committed on 30/11/2015 at 10:41.
Pushed by cmollekopf into branch 'develop'.

Use the ChildrenFetchedRole

M  +8    -5    tests/clientapitest.cpp

http://commits.kde.org/akonadi-next/32a6d2f881bb6d12a4ab685b7bb3fb10c3bdf72c

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:
     QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr \
> load(const Akonadi2::Query &query) Q_DECL_OVERRIDE  {
         // capturedResultProvider = &resultProvider;
-        Trace() << "lkjsdflkjsdfljsdfljsdlfj";
 
         auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>();
         resultProvider->onDone([resultProvider]() {
@@ -40,7 +39,7 @@ public:
         //We have to do it this way, otherwise we're not setting the fetcher right
         auto emitter = resultProvider->emitter();
 
-        resultProvider->setFetcher([query, resultProvider, this](const typename \
T::Ptr &) { +        resultProvider->setFetcher([query, resultProvider, this](const \
typename T::Ptr &parent) {  Trace() << "Running the fetcher";
             for (const auto &res : results) {
                 qDebug() << "Parent filter " << \
query.propertyFilter.value("parent").toByteArray() << res->identifier(); @@ -48,6 \
+47,7 @@ public:  resultProvider->add(res);
                 }
             }
+            resultProvider->initialResultSetComplete(parent);
         });
         auto job = KAsync::start<void>([query, resultProvider]() {
         });
@@ -87,7 +87,8 @@ private Q_SLOTS:
         query.liveQuery = false;
 
         auto model = \
                Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query);
                
-        QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
+        QTRY_VERIFY(model->data(QModelIndex(), \
Akonadi2::Store::ChildrenFetchedRole).toBool()); +        \
QCOMPARE(model->rowCount(QModelIndex()), 1);  }
 
     // //The query provider is supposed to delete itself
@@ -168,9 +169,11 @@ private Q_SLOTS:
         query.parentProperty = "parent";
 
         auto model = \
                Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
                
-        QTRY_COMPARE(model->rowCount(), 1);
+        QTRY_VERIFY(model->data(QModelIndex(), \
Akonadi2::Store::ChildrenFetchedRole).toBool()); +        QCOMPARE(model->rowCount(), \
1);  model->fetchMore(model->index(0, 0));
-        QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1);
+        QTRY_VERIFY(model->data(model->index(0, 0), \
Akonadi2::Store::ChildrenFetchedRole).toBool()); +        \
QCOMPARE(model->rowCount(model->index(0, 0)), 1);  }
 
     void testModelSignals()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic