aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-01-17 11:40:44 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-01-18 12:51:38 +0100
commit6a54c6013d9037f5c75d47f5e03d6871591e53b2 (patch)
tree182beb64c826e5e30ff782ee7196ad22a7ff0f93 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent3833e9291186ccd944e8b7c8c90116d1c2596f77 (diff)
QmlCompiler: Handle context push/pop in dead code
Otherwise we end up with unmatched curly braces in the generated code. Pick-to: 6.2 6.3 Change-Id: I4c24d4062a8ed54cd6a9ecb43dfd2b5d0a26c9e1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 5366224fd5..97344ceeb3 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -113,6 +113,7 @@ private slots:
void flushBeforeCapture();
void unknownAttached();
void variantlist();
+ void popContextAfterRet();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -1696,6 +1697,23 @@ void tst_QmlCppCodegen::variantlist()
QCOMPARE(things[1].toInt(), 30);
}
+void tst_QmlCppCodegen::popContextAfterRet()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/popContextAfterRet.qml"_qs));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(o);
+
+ QCOMPARE(o->objectName(), QString());
+ o->setProperty("stackViewDepth", 1);
+ QCOMPARE(o->objectName(), u"backgroundImage"_qs);
+ o->setProperty("stackViewDepth", 2);
+ QCOMPARE(o->objectName(), u"backgroundBlur"_qs);
+ o->setProperty("stackViewDepth", 1);
+ QCOMPARE(o->objectName(), u"backgroundImage"_qs);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER"))