From ce266fbcddc48edd63c4ba8c4a6f43fb2df48153 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 3 Sep 2025 13:47:48 +0200 Subject: QtQml: Avoid double-wrapping when converting to QVariantList Amends commit 1b89c1edcae68351632c2755e5408410c2ff98e3 Fixes: QTBUG-139764 Pick-to: 6.10 6.9 6.8 Change-Id: I1488527a235d74fc0352c72b9bfb69589c2f3d93 Reviewed-by: Sami Shalayel --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 406bcb1da8..579f279e93 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -5086,6 +5087,19 @@ void tst_QmlCppCodegen::sequenceToIterable() QVERIFY(match.hasMatch()); QCOMPARE(match.captured(1), QString::number(i)); } + + QQmlComponent component2(&engine, QUrl(u"qrc:/qt/qml/TestTypes/sequenceToIterable2.qml"_s)); + QVERIFY2(!component2.isError(), component.errorString().toUtf8()); + QScopedPointer object2(component2.create()); + QVERIFY(!object2.isNull()); + + QQmlListReference converted(object2.data(), "converted"); + QCOMPARE(converted.count(), 10); + for (int i = 0; i < 10; ++i) { + Entry *e = qobject_cast(converted.at(i)); + QVERIFY(e); + QCOMPARE(e->objectName(), QStringLiteral("Item %1").arg(i)); + } } void tst_QmlCppCodegen::setLookupConversion() -- cgit v1.2.3