diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-03 10:41:07 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-03 10:41:07 +0100 |
commit | 067bdf2c55d6459ed7bd93e295fdf32deae12158 (patch) | |
tree | dbfa3ab44d9c7e6c4a0766c4046eaec5b61b99ce /tests | |
parent | 3e0458dda3c12a9a619a86258d586a0542e0c630 (diff) | |
download | sink-067bdf2c55d6459ed7bd93e295fdf32deae12158.tar.gz sink-067bdf2c55d6459ed7bd93e295fdf32deae12158.zip |
Add a working model signal test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clientapitest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 80cf2c4..2ebef5f 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -175,6 +175,26 @@ private slots: | |||
175 | QTRY_COMPARE(model->rowCount(), 1); | 175 | QTRY_COMPARE(model->rowCount(), 1); |
176 | } | 176 | } |
177 | 177 | ||
178 | void testModelSignals() | ||
179 | { | ||
180 | auto facade = setupFacade<Sink::ApplicationDomain::Folder>("dummyresource.instance1"); | ||
181 | facade->runAsync = true; | ||
182 | auto folder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
183 | auto subfolder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
184 | subfolder->setParent("id"); | ||
185 | facade->results << folder << subfolder; | ||
186 | |||
187 | // Test | ||
188 | Sink::Query query; | ||
189 | query.resourceFilter("dummyresource.instance1"); | ||
190 | query.requestTree("parent"); | ||
191 | |||
192 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | ||
193 | QSignalSpy spy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); | ||
194 | QVERIFY(spy.isValid()); | ||
195 | QTRY_VERIFY(spy.count() == 2); | ||
196 | } | ||
197 | |||
178 | void testModelNested() | 198 | void testModelNested() |
179 | { | 199 | { |
180 | auto facade = setupFacade<Sink::ApplicationDomain::Folder>("dummyresource.instance1"); | 200 | auto facade = setupFacade<Sink::ApplicationDomain::Folder>("dummyresource.instance1"); |