summaryrefslogtreecommitdiffstats
path: root/tests/querytest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r--tests/querytest.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp
index 47d977b..e4f1d0d 100644
--- a/tests/querytest.cpp
+++ b/tests/querytest.cpp
@@ -55,8 +55,10 @@ private Q_SLOTS:
55 Akonadi2::Query query; 55 Akonadi2::Query query;
56 query.resources << "org.kde.dummy.instance1"; 56 query.resources << "org.kde.dummy.instance1";
57 query.syncOnDemand = false; 57 query.syncOnDemand = false;
58 query.processAll = true; 58 query.processAll = false;
59 query.liveQuery = true;
59 60
61 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
60 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 62 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
61 model->fetchMore(QModelIndex()); 63 model->fetchMore(QModelIndex());
62 QTRY_COMPARE(model->rowCount(), 1); 64 QTRY_COMPARE(model->rowCount(), 1);
@@ -75,10 +77,14 @@ private Q_SLOTS:
75 query.resources << "org.kde.dummy.instance1"; 77 query.resources << "org.kde.dummy.instance1";
76 query.syncOnDemand = false; 78 query.syncOnDemand = false;
77 query.processAll = true; 79 query.processAll = true;
78 query.liveQuery = true; 80 query.liveQuery = false;
79 81
82 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data
80 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 83 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
81 QTest::qWait(200); 84
85 //Ensure all local data is processed
86 Akonadi2::Store::synchronize(query).exec().waitForFinished();
87
82 model->fetchMore(QModelIndex()); 88 model->fetchMore(QModelIndex());
83 QVERIFY(model->rowCount() < 2); 89 QVERIFY(model->rowCount() < 2);
84 QTRY_COMPARE(model->rowCount(), 1); 90 QTRY_COMPARE(model->rowCount(), 1);