diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-05 13:53:20 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-15 14:22:42 +0100 |
| commit | bd0f4459ce31b6c5f232d60e7cdc3d9e0cb84ad7 (patch) | |
| tree | def451ee9de273255915bd8bd1ab08f6a29db417 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | f988168432068f04c0f9a0c485bc1c6584f0aa5e (diff) | |
Re-allow retrieval of list properties in QQmlJSCodeGenerator
It's not particularly slow. It probably was when we were using
QQmlListReference or JavaScript arrays.
Pick-to: 6.3
Change-Id: I1a4575a5b84cdfb732a6c3615d00bbe2abaffc94
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 9bb993a740..5366224fd5 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -112,6 +112,7 @@ private slots: void functionCallOnNamespaced(); void flushBeforeCapture(); void unknownAttached(); + void variantlist(); }; void tst_QmlCppCodegen::simpleBinding() @@ -1681,6 +1682,20 @@ void tst_QmlCppCodegen::unknownAttached() QVERIFY(c.isError()); } +void tst_QmlCppCodegen::variantlist() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/variantlist.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + const QVariantList things = qvariant_cast<QVariantList>(o->property("things")); + QCOMPARE(things.length(), 2); + QCOMPARE(things[0].toString(), u"thing"_qs); + QCOMPARE(things[1].toInt(), 30); +} + void tst_QmlCppCodegen::runInterpreted() { if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER")) |
