mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 14:36:01 +03:00
Add test for maxTags in FileTagModel
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
1bab57b176
commit
73b94bcf2f
1 changed files with 17 additions and 0 deletions
|
@ -121,6 +121,23 @@ private slots:
|
|||
QCOMPARE(tag.toString(), _expectedTags[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void testModelMaxTags()
|
||||
{
|
||||
auto fileTagModel = FileTagModel(testFilePath, _account);
|
||||
const auto fileTagModelTester = QAbstractItemModelTester(&fileTagModel);
|
||||
QSignalSpy fileTagsChanged(&fileTagModel, &FileTagModel::totalTagsChanged);
|
||||
fileTagsChanged.wait(1000);
|
||||
|
||||
constexpr auto testMaxTags = 3;
|
||||
Q_ASSERT(testMaxTags < testNumTags);
|
||||
|
||||
QSignalSpy maxTagsChangedSpy(&fileTagModel, &FileTagModel::maxTagsChanged);
|
||||
fileTagModel.setMaxTags(testMaxTags);
|
||||
QCOMPARE(maxTagsChangedSpy.count(), 1);
|
||||
QCOMPARE(fileTagModel.maxTags(), testMaxTags);
|
||||
QCOMPARE(fileTagModel.rowCount(), testMaxTags);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(TestFileTagModel)
|
||||
|
|
Loading…
Reference in a new issue