aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllistreference
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-03-21 11:20:32 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-03-28 12:40:51 +0100
commitfff113b4a3259ed558e97bc66ecdacd7455dc490 (patch)
tree87dd1a378582dd1415d21e77faea44147cbd6919 /tests/auto/qml/qqmllistreference
parent280a3372fd76acd662fc116f9794d2452b770fee (diff)
QQmlListWrapper: Don't use QQmlListReference for virtualGetLength()
We cannot use QQmlListReference on detached list properties. Also, it's wasteful. Pick-to: 6.7 Fixes: QTBUG-118076 Change-Id: I754f19ed8c3f6eae1b3613f6866f3cf792cee8cf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllistreference')
-rw-r--r--tests/auto/qml/qqmllistreference/data/consoleLogSyntheticList.qml8
-rw-r--r--tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp12
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllistreference/data/consoleLogSyntheticList.qml b/tests/auto/qml/qqmllistreference/data/consoleLogSyntheticList.qml
new file mode 100644
index 0000000000..9d2fd3e0b2
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/data/consoleLogSyntheticList.qml
@@ -0,0 +1,8 @@
+import QtQml
+
+QtObject {
+ id: self
+
+ function createList() : list<QtObject> { return [self] }
+ Component.onCompleted: console.log(createList())
+}
diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp
index 25c3f9e5f4..76711a00e6 100644
--- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp
+++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp
@@ -60,6 +60,7 @@ private slots:
void jsArrayMethodsWithParams();
void listIgnoresNull_data() { modeData(); }
void listIgnoresNull();
+ void consoleLogSyntheticList();
};
class TestType : public QObject
@@ -1082,6 +1083,17 @@ void tst_qqmllistreference::listIgnoresNull()
QVERIFY(object != nullptr);
}
+void tst_qqmllistreference::consoleLogSyntheticList()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("consoleLogSyntheticList.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QTest::ignoreMessage(
+ QtDebugMsg, QRegularExpression("\\[QObject_QML_[0-9]+\\(0x[0-9a-f]+\\)\\]"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+}
+
QTEST_MAIN(tst_qqmllistreference)
#include "tst_qqmllistreference.moc"