aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-06-27 12:54:47 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-06-29 13:26:07 +0200
commit0e3d42c840e2afacaae1eea9c422ecfebe3bbbe7 (patch)
tree1eec20298efefd6ee89a613c10263bf3a6c4a394 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent589d83bc9bc1da32a4f26934c54075ddb78b47b9 (diff)
QmlCompiler: Don't generate invalid code for storing undefined
We don't actually have to store the retrieved value if it's not storable. Pick-to: 6.4 Fixes: QTBUG-104508 Change-Id: Ib091eabf4f4034a577b94e0d5761c5307815599e 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.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 33a330de2d..3c5cb9f792 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -126,6 +126,7 @@ private slots:
void translation();
void stringArg();
void conversionDecrement();
+ void unstoredUndefined();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -2308,6 +2309,15 @@ void tst_QmlCppCodegen::conversionDecrement()
QCOMPARE(o->property("currentPageIndex").toInt(), 3);
}
+void tst_QmlCppCodegen::unstoredUndefined()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/unstoredUndefined.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QCOMPARE(o->objectName(), u"NaN"_s);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
#ifdef Q_OS_ANDROID