aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-07-12 16:08:17 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-07-19 10:52:31 +0200
commitef057772c41e84e9813f0ed113fc55224013404c (patch)
tree80d1a7247825bcfccb577ce2ab6c0f248d435439 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parentb335d8311f7c0be9261305d5b41bbcbf94cd3d27 (diff)
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 <fabian.kosmale@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, 8 insertions, 6 deletions
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<QObject> 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");