summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
index d7a2e88..5b90a25 100644
--- a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
+++ b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
@@ -357,6 +357,7 @@ private Q_SLOTS:
void testFetchMore_data();
void testFetchMore();
void testDataChangedMode();
+ void testReload();
void testDataChangedMode_jump();
void testNavigation_data();
void testNavigation();
@@ -607,6 +608,35 @@ void tst_QIviSearchAndBrowseModel::testDataChangedMode()
QCOMPARE(fetchDataSpy.at(0).at(2).toInt(), testIndex + 1);
}
+void tst_QIviSearchAndBrowseModel::testReload()
+{
+ TestServiceObject *service = new TestServiceObject();
+ manager->registerService(service, service->interfaces());
+ service->testBackend()->setCapabilities(QIviSearchAndBrowseModel::SupportsGetSize);
+ service->testBackend()->initializeSimpleData();
+
+ QIviSearchAndBrowseModel model;
+ model.setServiceObject(service);
+
+ QVERIFY(model.serviceObject());
+
+ QVERIFY(model.availableContentTypes().contains("simple"));
+ QSignalSpy countChangedSpy(&model, SIGNAL(countChanged()));
+ model.setContentType("simple");
+ countChangedSpy.wait(100);
+ QVERIFY(countChangedSpy.count());
+
+ QCOMPARE(model.rowCount(), model.chunkSize());
+ countChangedSpy.clear();
+
+ QSignalSpy resetSpy(&model, SIGNAL(modelReset()));
+ model.reload();
+ countChangedSpy.wait(100);
+ QCOMPARE(resetSpy.count(), 1);
+ QCOMPARE(countChangedSpy.count(), 2);
+ QCOMPARE(model.rowCount(), model.chunkSize());
+}
+
void tst_QIviSearchAndBrowseModel::testDataChangedMode_jump()
{
TestServiceObject *service = new TestServiceObject();