mirror of https://github.com/qt/qtbase.git
QRM: add tree test case for defaultRoleNames
Amends f101e9931b
.
Pick-to: 6.10
Change-Id: Ib46b7f59b2a96a91dea1e4c263c2a54247cb31e1
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
This commit is contained in:
parent
cadb4c2317
commit
5981c50aa4
|
@ -612,6 +612,13 @@ void tst_QRangeModel::defaultRoleNames()
|
|||
}();
|
||||
|
||||
[]{
|
||||
using Tree = QList<MultiRoleGadget>;
|
||||
struct EmptyTreeProtocol
|
||||
{
|
||||
const MultiRoleGadget *parentRow(const MultiRoleGadget &) const { return nullptr; }
|
||||
const Tree &childRows(const MultiRoleGadget &) const { return empty; }
|
||||
Tree empty;
|
||||
};
|
||||
const QHash<int, QByteArray> expectedRoleNames = {
|
||||
{Qt::DisplayRole, "display"},
|
||||
{Qt::DecorationRole, "decoration"},
|
||||
|
@ -622,6 +629,8 @@ void tst_QRangeModel::defaultRoleNames()
|
|||
expectedRoleNames);
|
||||
QCOMPARE(QRangeModel(std::vector<std::array<MultiRoleGadget, 5>>{}).roleNames(),
|
||||
expectedRoleNames);
|
||||
QCOMPARE(QRangeModel(Tree{}, EmptyTreeProtocol{}).roleNames(),
|
||||
expectedRoleNames);
|
||||
}();
|
||||
|
||||
[]{
|
||||
|
|
Loading…
Reference in New Issue