From ef057772c41e84e9813f0ed113fc55224013404c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 12 Jul 2022 16:08:17 +0200 Subject: Fix array-like methods on V4 sequences We need to properly convert value type lists on assignment and we need to add the "length" property to the own properties. Furthermore, the V4 sequence methods were confused about integer type ranges. We teach them about qsizetype, properly range check everything, and drop the artificial limitation to INT_MAX. Pick-to: 6.4 Task-number: QTBUG-82443 Change-Id: Ie5af1130c9e78e412c171e6fa26a28a6a7a5d498 Reviewed-by: Fabian Kosmale --- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp') diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 9aacb05043..033de56695 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -5948,17 +5948,19 @@ void tst_qqmlecmascript::sequenceConversionIndexes() { // ensure that we gracefully fail if unsupported index values are specified. // Qt container classes only support non-negative, signed integer index values. + + // Since Qt6, on 64bit the maximum length is beyond what we can encode in a 32bit integer. + // Therefore we cannot test the overflow anymore. + QUrl qmlFile = testFileUrl("sequenceConversion.indexes.qml"); QQmlEngine engine; QQmlComponent component(&engine, qmlFile); QScopedPointer object(component.create()); QVERIFY2(object, qPrintable(component.errorString())); - QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set"); - QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set"); - QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get"); - QTest::ignoreMessage(QtWarningMsg, qPrintable(w1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(w2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(w3)); + + const QString w = qmlFile.toString() + QLatin1String(":59: Index out of range during length set"); + QTest::ignoreMessage(QtWarningMsg, qPrintable(w)); + QMetaObject::invokeMethod(object.data(), "indexedAccess"); QVERIFY(object->property("success").toBool()); QMetaObject::invokeMethod(object.data(), "indexOf"); -- cgit v1.2.3