aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-11-04 10:19:19 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-04 19:03:09 +0100
commit43d0eae81e30ae8c8502e68d56c6c8b7e2c30215 (patch)
tree9939e66970f5af4192a0d41c50aa73588a587adf /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parent35c2974f69fa28c96701e102ae36fc4d7f4053cf (diff)
QML engine: fix conversion scores for sequences in CallOverloaded
A QV4Sequence can be converted back to its underlying container; we therefore should give the conversion of QV4Sequence to container a high score if metaTypeForSequence and the target metatype agree. This has a larger effect in Qt 6 than in Qt 5, as we now can have new sequence types for any (QMeta)Container. Fixes: QTBUG-87616 Change-Id: I2bf02ebadbf9b707719d09edaf14b112eb2caf4f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 8778a1e1ac..96fdd012e2 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -391,6 +391,7 @@ private slots:
void urlSearchParamsConstruction();
void urlSearchParamsMethods();
void variantConversionMethod();
+ void sequenceConversionMethod();
void gcCrashRegressionTest();
@@ -9497,6 +9498,19 @@ void tst_qqmlecmascript::variantConversionMethod()
QCOMPARE(obj.funcCalled, QLatin1String("QModelIndex"));
}
+void tst_qqmlecmascript::sequenceConversionMethod()
+{
+ QQmlEngine qmlengine;
+
+ SequenceConvertObject obj;
+ qmlRegisterSingletonInstance("qt.test", 1, 0, "SequenceConvertObject", &obj);
+
+ QQmlComponent component(&qmlengine, testFileUrl("sequenceConvert.qml"));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != nullptr);
+ QCOMPARE(obj.funcCalled, QLatin1String("stringlist"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"