Enhance tst_qmltc::componentTypes() by verifying that ids are correct

We can in fact check that the ids match to correct objects

Pick-to: 6.3
Change-Id: I46ed1a3d0a9ef429670fdc0438a5d717971c459c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Andrei Golubev 2021-12-23 13:24:00 +01:00
parent ebcdde7128
commit feaed5f7aa
1 changed files with 9 additions and 0 deletions

View File

@ -582,6 +582,15 @@ void tst_qmltc::componentTypes()
QScopedPointer<QObject> enclosed(normalComponent->create());
QVERIFY(enclosed);
QCOMPARE(enclosed->objectName(), u"enclosed"_qs);
QQmlListReference children(&created, "data");
QCOMPARE(children.size(), 4);
QCOMPARE(ctx->objectForName(u"normal"_qs), children.at(0));
QCOMPARE(ctx->objectForName(u"accessibleNormal"_qs), children.at(1));
QCOMPARE(ctx->objectForName(u"accessible"_qs), created.p2());
QQuickTableView *table = qobject_cast<QQuickTableView *>(children.at(3));
QVERIFY(table);
QCOMPARE(ctx->objectForName(u"accessibleDelegate"_qs), table->delegate());
}
}