aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-05-04 15:39:57 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-05-04 18:59:34 +0200
commit96ac9c2599113b045b4f3ea71c4f20ead93a4c41 (patch)
tree248f8b24b43c8034da0755e53cbcc6746f8b7a96 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent80ed6679cd31165c2bbd2c612e37c2f61e9075a3 (diff)
QmlCompiler: Convert thisObject to correct type
Amends commit 365b781599993aef933228599eaeb6eb909d9a93. Change-Id: I5775d634ef4e5204cdec2f440b1992b7272866d2 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.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 20a1bac8af..8f6fdbb004 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -158,6 +158,7 @@ private slots:
void shifts();
void signalHandler();
void signalIndexMismatch();
+ void signalsWithLists();
void signatureIgnored();
void simpleBinding();
void storeElementSideEffects();
@@ -3310,6 +3311,29 @@ void tst_QmlCppCodegen::signalIndexMismatch()
QCOMPARE(visualIndexAfterMoveList, QList<QVariant>({ 0, 1, 2 }));
}
+void tst_QmlCppCodegen::signalsWithLists()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/signalsWithLists.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+
+ QVariantList varlist = o->property("varlist").toList();
+ QCOMPARE(varlist.size(), 5);
+ QCOMPARE(varlist[0], QVariant::fromValue(1));
+ QCOMPARE(varlist[1], QVariant::fromValue(u"foo"_s));
+ QCOMPARE(varlist[2], QVariant::fromValue(o.data()));
+ QCOMPARE(varlist[3], QVariant());
+ QCOMPARE(varlist[4], QVariant::fromValue(true));
+
+ QQmlListProperty<QObject> objlist = o->property("objlist").value<QQmlListProperty<QObject>>();
+ QCOMPARE(objlist.count(&objlist), 3);
+ QCOMPARE(objlist.at(&objlist, 0), o.data());
+ QCOMPARE(objlist.at(&objlist, 1), nullptr);
+ QCOMPARE(objlist.at(&objlist, 2), o.data());
+}
+
void tst_QmlCppCodegen::signatureIgnored()
{
QQmlEngine engine;