Test important properties in testfiletagmodel

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-04-25 22:18:36 +08:00
parent 73b94bcf2f
commit ce22c409e1

View file

@ -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);