diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-06-15 14:16:11 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-07-07 19:33:39 +0200 |
| commit | 38fdf2717d9c2432a9cd7de605f2e1c1517ff744 (patch) | |
| tree | a24150dae1eb8715750048e0d605c88e16e1caab /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 3f3e961a5afe2e62f436f946c521ea4afab76dde (diff) | |
QmlCompiler: Handle trivial signal handler constructions
If the signal handler does nothing but return a closure, we have to
compile the closure using the same signature as the outer signal
handler.
In order for this to work, we also have to detect unresolved argument
types for signal handlers. Those are just as bad as unresolved argument
types for other functions.
Fixes: QTBUG-101531
Change-Id: Idb5b3994809d91a4b4ce936282685435eb75e670
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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 6d397f2060..a41e723cda 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -131,6 +131,7 @@ private slots: void argumentConversion(); void badSequence(); void enumLookup(); + void trivialSignalHandler(); }; void tst_QmlCppCodegen::simpleBinding() @@ -2413,6 +2414,23 @@ void tst_QmlCppCodegen::enumLookup() QCOMPARE(o->property("ready").toBool(), true); } +void tst_QmlCppCodegen::trivialSignalHandler() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/trivialSignalHandler.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + + QCOMPARE(o->property("a").toString(), u"no"_s); + QCOMPARE(o->property("b").toInt(), -1); + QCOMPARE(o->property("b").toDouble(), -1.0); + + o->setObjectName(u"yes"_s); + QCOMPARE(o->property("a").toString(), u"yes"_s); + QCOMPARE(o->property("b").toInt(), 5); + QCOMPARE(o->property("c").toDouble(), 2.5); +} + void tst_QmlCppCodegen::runInterpreted() { #ifdef Q_OS_ANDROID |
