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.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 4ccac7bb5b..68f7102ecb 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -108,6 +108,7 @@ private slots:
void jsMathObject();
void intEnumCompare();
void attachedSelf();
+ void functionReturningVoid();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -1613,6 +1614,22 @@ void tst_QmlCppCodegen::attachedSelf()
QVERIFY(qvariant_cast<QObject *>(handle->property("rect")) != nullptr);
}
+void tst_QmlCppCodegen::functionReturningVoid()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/functionReturningVoid.qml"_qs));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(o);
+
+ // It should be able to call the methods and wrap the void values into invalid QVariants,
+ // without crashing.
+ QVERIFY(o->metaObject()->indexOfProperty("aa") >= 0);
+ QVERIFY(o->metaObject()->indexOfProperty("bb") >= 0);
+ QVERIFY(!o->property("aa").isValid());
+ QVERIFY(!o->property("bb").isValid());
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER"))