diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-02 13:55:16 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-04 17:11:27 +0100 |
| commit | b7b5127747e3be2b12a70bf9c460e96d7a711496 (patch) | |
| tree | 88334443eb66154c6e235f913bdecfa32b71853e /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | ccd61929923affb8830b6cb95250144fc55e6a8c (diff) | |
Test that we can retrieve attached types from "recursive" names
This is what the various SelectionRectangle.qml types in qqc2 do. Amends
commit e6c44662cdc8acfbdbf1c7ed071e1253ff0c1321.
Change-Id: Icb98f262d669ed165a3b3ab1be79b150b6cedc44
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.cpp | 14 |
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 11c70f2c72..4ccac7bb5b 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -107,6 +107,7 @@ private slots: void listIndices(); void jsMathObject(); void intEnumCompare(); + void attachedSelf(); }; void tst_QmlCppCodegen::simpleBinding() @@ -1599,6 +1600,19 @@ void tst_QmlCppCodegen::intEnumCompare() } } +void tst_QmlCppCodegen::attachedSelf() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/TestTypes/SelectionRectangle.qml"_qs)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + QObject *handle = qvariant_cast<QObject *>(o->property("aa")); + QVERIFY(handle); + QVERIFY(qvariant_cast<QObject *>(handle->property("rect")) != nullptr); +} + void tst_QmlCppCodegen::runInterpreted() { if (qEnvironmentVariableIsSet("QV4_FORCE_INTERPRETER")) |
