aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-05-13 15:22:07 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-05-24 15:44:16 +0200
commit4d71091a198fbbd3f84c61af0f2915493f2dad1a (patch)
tree28b337e45731b79fc8e3ef77df05d0ed5f32eb69 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentff0b9ec6bf817f741e3c9fefbfcd55592e9b2542 (diff)
qmlcompiler: Evaluate pragma ComponentBehavior
If components are bound we can assume the IDs of outer components are reachable. Fixes: QTBUG-102806 Fixes: QTBUG-101012 Change-Id: Ia26d3963d6c2fb9698debb12f9c655c5522f81ea 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.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index cbcd1afd21..1ccbd81745 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -135,6 +135,7 @@ private slots:
void invisibleTypes();
void invalidPropertyType();
void valueTypeLists();
+ void boundComponents();
};
void tst_QmlCppCodegen::simpleBinding()
@@ -2120,6 +2121,22 @@ void tst_QmlCppCodegen::valueTypeLists()
QVERIFY(!o->property("intOutOfBounds").isValid());
}
+void tst_QmlCppCodegen::boundComponents()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/boundComponents.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+
+ QObject *c1o = o->property("o").value<QObject *>();
+ QVERIFY(c1o != nullptr);
+ QCOMPARE(c1o->objectName(), u"bar"_s);
+
+ QObject *c2o = c1o->property("o").value<QObject *>();
+ QVERIFY(c2o != nullptr);
+ QCOMPARE(c2o->objectName(), u"bar12"_s);
+}
+
void tst_QmlCppCodegen::runInterpreted()
{
#ifdef Q_OS_ANDROID