From 6d0cc3743e494e55b0f224cee011fc63eb64b414 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 27 Dec 2017 22:54:29 +0100 Subject: Demonstrate that the folderlistmodel doesn't react to new folders --- framework/src/tests/folderlistmodeltest.cpp | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'framework/src/tests/folderlistmodeltest.cpp') diff --git a/framework/src/tests/folderlistmodeltest.cpp b/framework/src/tests/folderlistmodeltest.cpp index da84d432..97987e74 100644 --- a/framework/src/tests/folderlistmodeltest.cpp +++ b/framework/src/tests/folderlistmodeltest.cpp @@ -1,6 +1,9 @@ #include #include #include +#include +#include +#include #include "krecursivefilterproxymodel.h" #include "folderlistmodel.h" @@ -50,6 +53,7 @@ private slots: void initTestCase() { + Sink::Test::initTest(); } void testRecursiveFilterModel() @@ -64,6 +68,34 @@ private slots: QVERIFY(contains(model, {}, "accept1")); QVERIFY(contains(model, {}, "accept11")); } + + void testFolderListModel() + { + Sink::ApplicationDomain::DummyResource::create("account1"); + + using namespace Sink::ApplicationDomain; + auto account = ApplicationDomainType::createEntity(); + Sink::Store::create(account).exec().waitForFinished(); + + auto resource = Sink::ApplicationDomain::DummyResource::create(account.identifier()); + Sink::Store::create(resource).exec().waitForFinished(); + + auto folder = ApplicationDomainType::createEntity(resource.identifier()); + Sink::Store::create(folder).exec().waitForFinished(); + + Sink::ResourceControl::flushMessageQueue(resource.identifier()).exec().waitForFinished(); + + FolderListModel model; + model.setAccountId(account.identifier()); + QTRY_COMPARE(model.rowCount({}), 1); + { + auto subfolder = ApplicationDomainType::createEntity(resource.identifier()); + subfolder.setParent(folder); + Sink::Store::create(subfolder).exec().waitForFinished(); + Sink::ResourceControl::flushMessageQueue(resource.identifier()).exec().waitForFinished(); + } + QTRY_COMPARE(model.rowCount(model.index(0, 0, {})), 1); + } }; QTEST_MAIN(FolderlistModelTest) -- cgit v1.2.3