From: Claudio Cambra Date: Mon, 24 Apr 2023 11:07:42 +0000 (+0800) Subject: Add test for tags in filetagmodel X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~49^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6c683414225d28f93acf1b57acaa68e55a062164;p=nextcloud-desktop.git Add test for tags in filetagmodel Signed-off-by: Claudio Cambra --- diff --git a/test/testfiletagmodel.cpp b/test/testfiletagmodel.cpp index 59cab8e87..5633b642c 100644 --- a/test/testfiletagmodel.cpp +++ b/test/testfiletagmodel.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "accountmanager.h" #include "syncenginetestutils.h" @@ -102,6 +103,24 @@ private slots: "two" }; } + + void testModelTagFetch() + { + auto fileTagModel = FileTagModel(testFilePath, _account); + const auto fileTagModelTester = QAbstractItemModelTester(&fileTagModel); + QSignalSpy fileTagsChanged(&fileTagModel, &FileTagModel::totalTagsChanged); + fileTagsChanged.wait(1000); + + const auto modelTotalTags = fileTagModel.totalTags(); + QCOMPARE(modelTotalTags, testNumTags); + + for (auto i = 0; i < modelTotalTags; ++i) { + const auto index = fileTagModel.index(i); + const auto tag = index.data(); + + QCOMPARE(tag.toString(), _expectedTags[i]); + } + } }; QTEST_MAIN(TestFileTagModel)