From ce22c409e14a4098d8dd3cdcf9c6c770d55bd5fd Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 25 Apr 2023 22:18:36 +0800 Subject: [PATCH] Test important properties in testfiletagmodel Signed-off-by: Claudio Cambra --- test/testfiletagmodel.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); -- 2.30.2