From c4ec8fbc9f95a67079bc011c6455c3de72fa8266 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 14 Jan 2016 18:13:56 +0100 Subject: Ensure that we only emit ChildrenFetched once. ...Once all resource are done, and not only one. --- tests/clientapitest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') 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: Akonadi2::Query query; query.liveQuery = false; + int childrenFetchedCount = 0; auto model = Akonadi2::Store::loadModel(query); + QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [&childrenFetchedCount](const QModelIndex &, const QModelIndex &, const QVector &roles) { + if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) { + childrenFetchedCount++; + } + }); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); QCOMPARE(model->rowCount(QModelIndex()), 2); + //Ensure children fetched is only emitted once (when all resources are done) + QTest::qWait(50); + QCOMPARE(childrenFetchedCount, 1); } -- cgit v1.2.3