mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Add test for tags in filetagmodel
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
ccb07af56a
commit
6c68341422
1 changed files with 19 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
|
#include <QAbstractItemModelTester>
|
||||||
|
|
||||||
#include "accountmanager.h"
|
#include "accountmanager.h"
|
||||||
#include "syncenginetestutils.h"
|
#include "syncenginetestutils.h"
|
||||||
|
@ -102,6 +103,24 @@ private slots:
|
||||||
"two"
|
"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)
|
QTEST_MAIN(TestFileTagModel)
|
||||||
|
|
Loading…
Reference in a new issue