diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-17 14:15:02 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-23 11:17:06 +0200 |
| commit | 9035d1cb2a474a6df52ca395e6c185964ec94de0 (patch) | |
| tree | 7a6181b7422b1b42c68901890f9aad4f5b3900bc /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | b303e0624d2ea2ab1c124961e7510a64d0ca1412 (diff) | |
QmlCompiler: Restore support for writing to temporary arrays
We use the JavaScript extension as "read" type to signify that the code
generator will accept any type with such an extension. This requires
some adjustments in the type resolver.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: Ia34ca0a24c417c5372852268ba2f55825484639d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index ffd18f09a7..b322f870fa 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -288,6 +288,7 @@ private slots: void voidFunction(); void writeBack(); void writeVariantMap(); + void writeAndReturnTempArray(); }; static QByteArray arg1() @@ -5838,6 +5839,20 @@ void tst_QmlCppCodegen::writeVariantMap() } +void tst_QmlCppCodegen::writeAndReturnTempArray() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/Categorizer.qml"_s)); + + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + const QVariant nnn = object->property("nnn"); + QCOMPARE(nnn.metaType(), QMetaType::fromType<QList<double>>()); + QCOMPARE(nnn.value<QList<double>>(), QList<double>{10}); +} + QTEST_MAIN(tst_QmlCppCodegen) #include "tst_qmlcppcodegen.moc" |
