aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-11-11 16:30:36 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-11-22 17:39:29 +0100
commitbf7261d67dd1f29764ed0cc2a6392e3782770115 (patch)
treeb1d9477281a8256c227f8a63017f826360712f4f /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentb2e7b2a289d1ad57383d4d41bc30f864a111b603 (diff)
QmlCompiler: Implement calling of methods on value types
Define a pair of lookup methods for this and generate code that uses them. Write back after calling a non-const method. Task-number: QTBUG-127174 Change-Id: I6de22e76b63390fd7159d9c14ea2c908d961ec97 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.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index ad7d9f39b4..5ed4eb8d0c 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -4240,10 +4240,12 @@ void tst_QmlCppCodegen::qmlUsing()
QCOMPARE(u->val().a(), 24);
QCOMPARE(u->val().getB(), 25);
QCOMPARE(u->property("valA").toInt(), 24);
+ QCOMPARE(u->property("valB").toInt(), 25);
QCOMPARE(u->property("myA").toInt(), 7);
QCOMPARE(u->property("myB").toInt(), 5);
QCOMPARE(u->property("myA2").toInt(), 7);
QCOMPARE(u->property("myB2").toInt(), 5);
+ QCOMPARE(u->setValCalls(), 0); // getters do not cause write back
QCOMPARE(u->u(), 9u);
QCOMPARE(u->val().u(), 26u);
@@ -4277,8 +4279,9 @@ void tst_QmlCppCodegen::qmlUsing()
QCOMPARE(u->a(), 59);
QCOMPARE(u->getB(), 60);
QCOMPARE(u->val().a(), 55);
- QCOMPARE(u->val().getB(), 25);
+ QCOMPARE(u->val().getB(), 56);
QCOMPARE(u->property("valA").toInt(), 55);
+ QCOMPARE(u->property("valB").toInt(), 56); // Updated, because val changes
QCOMPARE(u->property("myA").toInt(), 59);
QCOMPARE(u->property("myB").toInt(), 5); // Remains 5, due to lack of signaling
QCOMPARE(u->property("myA2").toInt(), 59);
@@ -4290,6 +4293,7 @@ void tst_QmlCppCodegen::qmlUsing()
QCOMPARE(u->property("myU").toUInt(), 63u);
QCOMPARE(u->property("myU2").toUInt(), 63u);
+ QCOMPARE(u->setValCalls(), 3); // assignment to val.a and val.u, and call of val.setB()
QMetaObject::invokeMethod(object.data(), "burn");