aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
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)