aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-06-20 13:17:31 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-06-23 15:44:42 +0200
commit6b14ba5c2fbc2810bb62a87008e338cca571acf6 (patch)
tree839b9faf7e13b849b8ae89618d3eecb80d8e4a84 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent32602bef7c40261cbe61d72e8cf043feb3734d3e (diff)
QmlCompiler: Discern between different kinds of side effects
A mere jump does not cause all value types and lists to be invalidated. Only calls to other functions or writes to other properties do that. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-137540 Change-Id: I069c6873455c51bbea59cf876d2bc7ecd188f81b Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 5ec98cbdaf..708e835f46 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -5870,6 +5870,25 @@ void tst_QmlCppCodegen::writeAndReturnTempArray()
QCOMPARE(numbersContent.length(), 32);
for (double number: std::as_const(numbersContent))
QVERIFY(number >= 0 && number < double(0xf0f0f0));
+
+ QList<double> expected { 0, 0, 0, 0};
+ for (int i = 0; i < 2; ++i) {
+ for (double number : std::as_const(numbersContent)) {
+ const int num = QJSNumberCoercion::toInteger((number)) & 0xabcdef;
+ if (num < 0xf0f)
+ expected[0] += num;
+ else if (num < 0xf0f0)
+ expected[1] += num;
+ else if (num < 0xf0f0f)
+ expected[2] += num;
+ else
+ expected[3] += num;
+ }
+ }
+
+ QList<double> sum;
+ QMetaObject::invokeMethod(object.data(), "sum", Q_RETURN_ARG(QList<double>, sum));
+ QCOMPARE(sum, expected);
}
QTEST_MAIN(tst_QmlCppCodegen)