diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2019-06-07 14:39:32 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2019-06-11 10:59:24 +0200 |
commit | 18712f14d6fd2809d2c73ede2871e3b0855aa6b6 (patch) | |
tree | 2cb51300898a924264769e7008630a7377e12d20 /tests/auto/core/qivisearchandbrowsemodel | |
parent | 0b9baa982ae430f72150204ad4ee6d7ea78bba2e (diff) | |
download | qtivi-18712f14d6fd2809d2c73ede2871e3b0855aa6b6.tar.gz |
Correctly emit change signals when clearing the ServiceObject
When the serviceObject of a feature is set to null, the feature
is responsible to reset its state to the default again. This
commit will make sure that not just the state is fixed, but also
reflected to the outside by emitting the change signals.
Task-number: AUTOSUITE-1000
Change-Id: I4bc696f0179975a2d719ad420718b574010f5a5e
Reviewed-by: Kavindra Palaraja <kpalaraja@luxoft.com>
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'tests/auto/core/qivisearchandbrowsemodel')
-rw-r--r-- | tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp index 98dcb9d..65882e0 100644 --- a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp +++ b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp @@ -455,29 +455,43 @@ void tst_QIviSearchAndBrowseModel::testClearServiceObject() QIviSearchAndBrowseModel model; model.setServiceObject(service); - //TODO enable when fixed - //model.setLoadingType(QIviSearchAndBrowseModel::DataChanged); + model.setLoadingType(QIviSearchAndBrowseModel::DataChanged); model.setChunkSize(20); model.setContentType("simple"); model.setFetchMoreThreshold(20); + QSignalSpy chunkSizeSpy(&model, &QIviSearchAndBrowseModel::chunkSizeChanged); QVERIFY(model.chunkSize() != defaultModel.chunkSize()); + QSignalSpy contentTypeSpy(&model, &QIviSearchAndBrowseModel::contentTypeChanged); QVERIFY(model.contentType() != defaultModel.contentType()); + QSignalSpy thresholdSpy(&model, &QIviSearchAndBrowseModel::fetchMoreThresholdChanged); QVERIFY(model.fetchMoreThreshold() != defaultModel.fetchMoreThreshold()); + QSignalSpy availableContentTypeSpy(&model, &QIviSearchAndBrowseModel::availableContentTypesChanged); QVERIFY(model.availableContentTypes() != defaultModel.availableContentTypes()); + QSignalSpy capabilitiesSpy(&model, &QIviSearchAndBrowseModel::capabilitiesChanged); QVERIFY(model.capabilities() != defaultModel.capabilities()); - //QVERIFY(model.loadingType() != defaultModel.loadingType()); + QSignalSpy loadingTypeSpy(&model, &QIviSearchAndBrowseModel::loadingTypeChanged); + QVERIFY(model.loadingType() != defaultModel.loadingType()); + QSignalSpy resetSpy(&model, &QAbstractItemModel::modelReset); QVERIFY(model.rowCount() != defaultModel.rowCount()); QVERIFY(model.setServiceObject(nullptr)); + QVERIFY(model.chunkSize() == defaultModel.chunkSize()); + QCOMPARE(chunkSizeSpy.count(), 1); QVERIFY(model.contentType() == defaultModel.contentType()); + QCOMPARE(contentTypeSpy.count(), 1); QVERIFY(model.fetchMoreThreshold() == defaultModel.fetchMoreThreshold()); + QCOMPARE(thresholdSpy.count(), 1); QVERIFY(model.availableContentTypes() == defaultModel.availableContentTypes()); + QCOMPARE(availableContentTypeSpy.count(), 1); QVERIFY(model.capabilities() == defaultModel.capabilities()); + QCOMPARE(capabilitiesSpy.count(), 1); QVERIFY(model.loadingType() == defaultModel.loadingType()); + QCOMPARE(loadingTypeSpy.count(), 1); QVERIFY(model.rowCount() == defaultModel.rowCount()); + QCOMPARE(resetSpy.count(), 1); } void tst_QIviSearchAndBrowseModel::testBasic_qml() |