diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-25 11:01:17 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-25 14:08:22 +0100 |
| commit | 23ab2e0f5552bb54fef5a6c57f5f82f430d0956c (patch) | |
| tree | a8bfdf0ea4cc6d1c6caa2da8b8f225185efb5103 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 15ff88f0f16cf5a4a5452e3f8ef93e72cbd66e00 (diff) | |
QmlCompiler: Correctly label arguments and return types of JS functions
Returning void from any JS function doesn't quite cut it.
Pick-to: 6.3
Fixes: QTBUG-101285
Change-Id: I199813627614061ec25139277e8ea23cb844aac5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index bad7271d5a..db30705efc 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -124,6 +124,7 @@ private slots: void functionLookup(); void objectInVar(); void functionTakingVar(); + void isnan(); }; void tst_QmlCppCodegen::simpleBinding() @@ -1847,6 +1848,27 @@ void tst_QmlCppCodegen::functionTakingVar() QCOMPARE(o->property("c"), QVariant::fromValue<int>(11)); } +void tst_QmlCppCodegen::isnan() +{ + QQmlEngine engine; + const QUrl document(u"qrc:/TestTypes/isnan.qml"_qs); + QQmlComponent c(&engine, document); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + QCOMPARE(o->property("good").toDouble(), 10.1); + QVERIFY(qIsNaN(o->property("bad").toDouble())); + + const QVariant a = o->property("a"); + QCOMPARE(a.metaType(), QMetaType::fromType<bool>()); + QVERIFY(!a.toBool()); + + const QVariant b = o->property("b"); + QCOMPARE(b.metaType(), QMetaType::fromType<bool>()); + QVERIFY(b.toBool()); +} + void tst_QmlCppCodegen::runInterpreted() { if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER")) |
