aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index bb9789d63d..37865b8c33 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -178,6 +178,7 @@ private slots:
void ambiguousAs();
void boolPointerMerge();
void mergedObjectReadWrite();
+ void listConversion();
};
void tst_QmlCppCodegen::initTestCase()
@@ -3584,6 +3585,24 @@ void tst_QmlCppCodegen::mergedObjectReadWrite()
}
}
+void tst_QmlCppCodegen::listConversion()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, QUrl(u"qrc:/qt/qml/TestTypes/listConversion.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QQmlListProperty<QObject> list = o->property("o").value<QQmlListProperty<QObject>>();
+ QCOMPARE(list.count(&list), 3);
+ for (int i = 0; i < 3; ++i) {
+ QObject *entry = list.at(&list, i);
+ Person *person = qobject_cast<Person *>(entry);
+ QVERIFY(person);
+ QCOMPARE(person->name(), u"Horst %1"_s.arg(i + 1));
+ }
+}
+
QTEST_MAIN(tst_QmlCppCodegen)
#include "tst_qmlcppcodegen.moc"