aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 47822eb663..7ea6f622ad 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -128,6 +128,7 @@ private slots:
void conversionDecrement();
void unstoredUndefined();
void registerPropagation();
+ void argumentConversion();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -2347,6 +2348,28 @@ void tst_QmlCppCodegen::registerPropagation()
QCOMPARE(result, 1);
}
+void tst_QmlCppCodegen::argumentConversion()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/argumentConversion.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+
+ auto checkNaN = [&](const char *propName) {
+ const QVariant prop = o->property(propName);
+ QCOMPARE(prop.metaType(), QMetaType::fromType<double>());
+ QVERIFY(qIsNaN(prop.toDouble()));
+ };
+
+ checkNaN("a");
+ checkNaN("b");
+ checkNaN("e");
+
+ QCOMPARE(o->property("c").toDouble(), 3.0);
+ QCOMPARE(o->property("d").toDouble(), -1.0);
+ QCOMPARE(o->property("f").toDouble(), 10.0);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
#ifdef Q_OS_ANDROID