diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-12-27 22:54:29 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-12-27 22:54:29 +0100 |
commit | 6d0cc3743e494e55b0f224cee011fc63eb64b414 (patch) | |
tree | 6761e4fc690eb563be45ef205f055b8973413a4b | |
parent | 42818140ac7e24679f9dddfd59b2d9542250eb40 (diff) | |
download | kube-6d0cc3743e494e55b0f224cee011fc63eb64b414.tar.gz kube-6d0cc3743e494e55b0f224cee011fc63eb64b414.zip |
Demonstrate that the folderlistmodel doesn't react to new folders
-rw-r--r-- | framework/src/tests/folderlistmodeltest.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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 @@ | |||
1 | #include <QTest> | 1 | #include <QTest> |
2 | #include <QDebug> | 2 | #include <QDebug> |
3 | #include <QStandardItemModel> | 3 | #include <QStandardItemModel> |
4 | #include <sink/test.h> | ||
5 | #include <sink/store.h> | ||
6 | #include <sink/resourcecontrol.h> | ||
4 | #include "krecursivefilterproxymodel.h" | 7 | #include "krecursivefilterproxymodel.h" |
5 | #include "folderlistmodel.h" | 8 | #include "folderlistmodel.h" |
6 | 9 | ||
@@ -50,6 +53,7 @@ private slots: | |||
50 | 53 | ||
51 | void initTestCase() | 54 | void initTestCase() |
52 | { | 55 | { |
56 | Sink::Test::initTest(); | ||
53 | } | 57 | } |
54 | 58 | ||
55 | void testRecursiveFilterModel() | 59 | void testRecursiveFilterModel() |
@@ -64,6 +68,34 @@ private slots: | |||
64 | QVERIFY(contains(model, {}, "accept1")); | 68 | QVERIFY(contains(model, {}, "accept1")); |
65 | QVERIFY(contains(model, {}, "accept11")); | 69 | QVERIFY(contains(model, {}, "accept11")); |
66 | } | 70 | } |
71 | |||
72 | void testFolderListModel() | ||
73 | { | ||
74 | Sink::ApplicationDomain::DummyResource::create("account1"); | ||
75 | |||
76 | using namespace Sink::ApplicationDomain; | ||
77 | auto account = ApplicationDomainType::createEntity<SinkAccount>(); | ||
78 | Sink::Store::create(account).exec().waitForFinished(); | ||
79 | |||
80 | auto resource = Sink::ApplicationDomain::DummyResource::create(account.identifier()); | ||
81 | Sink::Store::create(resource).exec().waitForFinished(); | ||
82 | |||
83 | auto folder = ApplicationDomainType::createEntity<Folder>(resource.identifier()); | ||
84 | Sink::Store::create(folder).exec().waitForFinished(); | ||
85 | |||
86 | Sink::ResourceControl::flushMessageQueue(resource.identifier()).exec().waitForFinished(); | ||
87 | |||
88 | FolderListModel model; | ||
89 | model.setAccountId(account.identifier()); | ||
90 | QTRY_COMPARE(model.rowCount({}), 1); | ||
91 | { | ||
92 | auto subfolder = ApplicationDomainType::createEntity<Folder>(resource.identifier()); | ||
93 | subfolder.setParent(folder); | ||
94 | Sink::Store::create(subfolder).exec().waitForFinished(); | ||
95 | Sink::ResourceControl::flushMessageQueue(resource.identifier()).exec().waitForFinished(); | ||
96 | } | ||
97 | QTRY_COMPARE(model.rowCount(model.index(0, 0, {})), 1); | ||
98 | } | ||
67 | }; | 99 | }; |
68 | 100 | ||
69 | QTEST_MAIN(FolderlistModelTest) | 101 | QTEST_MAIN(FolderlistModelTest) |