aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-12-07 14:04:12 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-12-10 10:06:28 +0100
commit2aa118c118500c98a9caec76624877e27994acaf (patch)
treea4fb8865b9a38afbfe8f07271fc660d90f8137d6 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent5b57aae8ba7896281c616e547f3d1f7604c9a5f5 (diff)
QQmlJSAotContext: flushPendingBinding() before capturing a property
This avoids duplicate evaluation and binding loops. Pick-to: 6.2 Change-Id: I5eba42d9dca0782dd964bd64c088c2e158faa9b3 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.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 99c70f1be5..03784a028a 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -110,6 +110,7 @@ private slots:
void attachedSelf();
void functionReturningVoid();
void functionCallOnNamespaced();
+ void flushBeforeCapture();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -1651,6 +1652,19 @@ void tst_QmlCppCodegen::functionCallOnNamespaced()
}
}
+void tst_QmlCppCodegen::flushBeforeCapture()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/noBindingLoop.qml"_qs));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(o);
+
+ QCOMPARE(o->property("deviation").toDouble(), 9.0 / 3.3333);
+ QCOMPARE(o->property("samples").toInt(), 16);
+ QCOMPARE(o->property("radius").toDouble(), 8.0);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER"))