From: Claudio Cambra Date: Tue, 25 Apr 2023 14:18:36 +0000 (+0800) Subject: Test important properties in testfiletagmodel X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~49^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ce22c409e14a4098d8dd3cdcf9c6c770d55bd5fd;p=nextcloud-desktop.git Test important properties in testfiletagmodel Signed-off-by: Claudio Cambra --- diff --git a/test/testfiletagmodel.cpp b/test/testfiletagmodel.cpp index 2cc7f28eb..581dec61e 100644 --- a/test/testfiletagmodel.cpp +++ b/test/testfiletagmodel.cpp @@ -104,6 +104,28 @@ private slots: }; } + void testModelMainProps() + { + auto fileTagModel = FileTagModel(testFilePath, _account); + const auto fileTagModelTester = QAbstractItemModelTester(&fileTagModel); + QSignalSpy fileTagsChanged(&fileTagModel, &FileTagModel::totalTagsChanged); + fileTagsChanged.wait(1000); + + QCOMPARE(fileTagModel.serverRelativePath(), testFilePath); + QCOMPARE(fileTagModel.account(), _account); + + QSignalSpy serverRelativePathChangedSpy(&fileTagModel, &FileTagModel::serverRelativePathChanged); + fileTagModel.setServerRelativePath(""); + QCOMPARE(serverRelativePathChangedSpy.count(), 1); + QCOMPARE(fileTagModel.serverRelativePath(), ""); + + QSignalSpy accountChangedSpy(&fileTagModel, &FileTagModel::accountChanged); + const AccountPtr testAccount; + fileTagModel.setAccount(testAccount); + QCOMPARE(accountChangedSpy.count(), 1); + QCOMPARE(fileTagModel.account(), testAccount); + } + void testModelTagFetch() { auto fileTagModel = FileTagModel(testFilePath, _account);