aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-10-03 19:11:56 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-10-07 19:00:06 +0200
commitbb698b7f2e974a23b688dd15393f6a550448a5a8 (patch)
tree98d8c85a1b4311ddd27a2065d7da8bf3dd80f145 /tests/auto/qml/qjsengine
parent3f8861dc42d20e8c67fe60dd6ea34dbe57aeb4fc (diff)
QtQml: Correctly convert to QQmlListProperty<QObject>
If we have a QQmlListWrapper, we can extract its property. Fixes: QTBUG-117829 Pick-to: 6.6 6.5 6.2 Change-Id: I46ae8db1aabf7c1b617a22f371ce4f060cf4bb38 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qjsengine')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 5b5fc0262a..09eaa0edc4 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -17,6 +17,7 @@
#include <QScopeGuard>
#include <QUrl>
#include <QModelIndex>
+#include <QtQml/qqmllist.h>
#ifdef Q_CC_MSVC
#define NO_INLINE __declspec(noinline)
@@ -1702,6 +1703,13 @@ void tst_QJSEngine::valueConversion_basic()
QCOMPARE(eng.fromScriptValue<QChar>(eng.toScriptValue(c)), c);
}
+ {
+ QList<QObject *> list = {this};
+ QQmlListProperty<QObject> prop(this, &list);
+ QJSValue jsVal = eng.toScriptValue(prop);
+ QCOMPARE(eng.fromScriptValue<QQmlListProperty<QObject>>(jsVal), prop);
+ }
+
QVERIFY(eng.toScriptValue(static_cast<void *>(nullptr)).isNull());
}