aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-04-09 11:02:44 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-04-11 15:47:39 +0200
commit1087977a9a967dc4058eda7303ddd9f59874e21e (patch)
tree75c896ded22c423c7baf75389b24e8741d712596 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent6c99431170129c106cd8f0dd302b556642815a64 (diff)
QmlCompiler: Correctly mark side effects for list operations
The contents of a QQmlListProperty are mutable even if the property is not. This is because QQmlListProperty is only a view on a different container. Pick-to: 6.7 Fixes: QTBUG-123196 Change-Id: Id6309b1e1ddc219bf35e8d9888b8415dcc0f9d43 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 980ff1986b..fb1ab69c71 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -194,6 +194,7 @@ private slots:
void propertyOfParent();
void reduceWithNullThis();
void readEnumFromInstance();
+ void readonlyListProperty();
void registerElimination();
void registerPropagation();
void renameAdjust();
@@ -4025,6 +4026,17 @@ void tst_QmlCppCodegen::readEnumFromInstance()
QCOMPARE(result, 0);
}
+void tst_QmlCppCodegen::readonlyListProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/readonlyListProperty.qml"_s));
+ QVERIFY2(component.isReady(), component.errorString().toUtf8());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ QCOMPARE(object->property("l").toInt(), 4);
+}
+
void tst_QmlCppCodegen::registerElimination()
{
QQmlEngine engine;