diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:13:56 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-14 18:13:56 +0100 |
commit | c4ec8fbc9f95a67079bc011c6455c3de72fa8266 (patch) | |
tree | ed73a0a771206e808d37cedf0f82e1b44fb9ca9d /tests/clientapitest.cpp | |
parent | f56e945d7615043bcf5605e9e7dd5b4a4861f83b (diff) | |
download | sink-c4ec8fbc9f95a67079bc011c6455c3de72fa8266.tar.gz sink-c4ec8fbc9f95a67079bc011c6455c3de72fa8266.zip |
Ensure that we only emit ChildrenFetched once.
...Once all resource are done, and not only one.
Diffstat (limited to 'tests/clientapitest.cpp')
-rw-r--r-- | tests/clientapitest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 78e1d1e..ff79c82 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -265,9 +265,18 @@ private Q_SLOTS: | |||
265 | Akonadi2::Query query; | 265 | Akonadi2::Query query; |
266 | query.liveQuery = false; | 266 | query.liveQuery = false; |
267 | 267 | ||
268 | int childrenFetchedCount = 0; | ||
268 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 269 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
270 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [&childrenFetchedCount](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { | ||
271 | if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) { | ||
272 | childrenFetchedCount++; | ||
273 | } | ||
274 | }); | ||
269 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 275 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
270 | QCOMPARE(model->rowCount(QModelIndex()), 2); | 276 | QCOMPARE(model->rowCount(QModelIndex()), 2); |
277 | //Ensure children fetched is only emitted once (when all resources are done) | ||
278 | QTest::qWait(50); | ||
279 | QCOMPARE(childrenFetchedCount, 1); | ||
271 | } | 280 | } |
272 | 281 | ||
273 | 282 | ||