diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-12-21 15:06:28 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-11 00:42:17 +0100 |
| commit | be481412cc704c1272833712ffe7df5ce8156775 (patch) | |
| tree | ab3ea0eda81bfba0cfed397cac5516377ae79e09 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 953f0d44871b93a7a165e7026e48eaaadccf8d98 (diff) | |
QmlCompiler: Allow primitive conversion if output is stored in var
We can always convertStored() if the contained type has been fixed.
Pick-to: 6.7
Fixes: QTBUG-120322
Change-Id: I7d834fa32a12503341c863c095d578ca6e838531
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index db6e6159a0..f732998647 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -71,6 +71,7 @@ private slots: void conversionDecrement(); void conversionInDeadCode(); void conversions(); + void convertPrimitiveToVar(); void convertQJSPrimitiveValueToIntegral(); void convertToOriginalReadAcumulatorForUnaryOperators(); void cppValueTypeList(); @@ -1307,6 +1308,19 @@ void tst_QmlCppCodegen::conversions() QVERIFY(!undef.isValid()); } +void tst_QmlCppCodegen::convertPrimitiveToVar() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/convertPrimitiveToVar.qml"_s)); + + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + + QCOMPARE(o->property("offsetValue").toInt(), 41); +} + void tst_QmlCppCodegen::convertQJSPrimitiveValueToIntegral() { QQmlEngine engine; |
