diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-08 21:45:21 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-10 02:42:47 +0100 |
| commit | af356e3bc87f8029026d1eaa345f7197c0705ffa (patch) | |
| tree | 6355f1205627931c69ef59a20df92fd63d3ae658 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 25333a6af2647545f770b2df34e4cb4f7f6217bd (diff) | |
qmlcachegen: Don't generate bad code if we cannot resolve a return type
If we cannot resolve a return type, we need to refrain from calling the
method.
Pick-to: 6.2
Task-number: QTBUG-99042
Change-Id: Ie5ba0367c83c178f7e5c112072ca97d3c1c1fb1f
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.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index ae9f1b7600..99c70f1be5 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -1634,12 +1634,21 @@ void tst_QmlCppCodegen::functionReturningVoid() void tst_QmlCppCodegen::functionCallOnNamespaced() { QQmlEngine engine; - QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/themergood.qml"_qs)); - QVERIFY2(c.isReady(), qPrintable(c.errorString())); - QScopedPointer<QObject> o(c.create()); - QVERIFY(o); + { + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/themergood.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + QCOMPARE(o->property("i").toInt(), 12); + } - QCOMPARE(o->property("i").toInt(), 12); + { + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/themerbad.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + QCOMPARE(o->property("r"), QVariant::fromValue(QRectF(5.0, 10.0, 1.0, 1.0))); + } } void tst_QmlCppCodegen::runInterpreted() |
