diff options
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 2e316e571b..e1f36b69db 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -157,6 +157,7 @@ private slots: void lengthAccessArraySequenceCompat(); void storeElementSideEffects(); void numbersInJsPrimitive(); + void infinitiesToInt(); }; void tst_QmlCppCodegen::initTestCase() @@ -3024,6 +3025,25 @@ void tst_QmlCppCodegen::numbersInJsPrimitive() QCOMPARE(asStrings, convertToStrings(stored)); } +void tst_QmlCppCodegen::infinitiesToInt() +{ + QQmlEngine engine; + + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/infinitiesToInt.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + + const char *props[] = {"a", "b", "c"}; + for (const char *prop : props) { + const QVariant i = o->property(prop); + QCOMPARE(i.metaType(), QMetaType::fromType<int>()); + bool ok = false; + QCOMPARE(i.toInt(&ok), 0); + QVERIFY(ok); + } +} + QTEST_MAIN(tst_QmlCppCodegen) #include "tst_qmlcppcodegen.moc" |
