diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-02 17:42:30 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-05 19:36:07 +0100 |
| commit | 9af6d2d6d0046b3c8369e15eb4791957cdc7ab7b (patch) | |
| tree | 9f1d4f950c284c40760492c40ef3ed3f913747a4 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 687bbe86573f06eb4b247d925fd66db751501f05 (diff) | |
QtQml: Invalidate fallback lookups after each call from AOT code
Fallback property lookups are created for completely dynamic
metaobjects. Anything about them may change between any two calls.
Pick-to: 6.10 6.8 6.5
Fixes: QTBUG-142331
Change-Id: Ib732c37a6f27ab8105bea0eeae000af7eb9c36d7
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 08138e6a53..98830fc33d 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -10,6 +10,7 @@ #include <data/getOptionalLookup.h> #include <data/listprovider.h> #include <data/objectwithmethod.h> +#include <data/propertymap.h> #include <data/qmlusing.h> #include <data/refuseWrite.h> #include <data/resettable.h> @@ -237,6 +238,7 @@ private slots: void parentProperty(); void popContextAfterRet(); void prefixedType(); + void propertyMap(); void propertyOfParent(); void qmlUsing(); void qtfont(); @@ -4909,6 +4911,47 @@ void tst_QmlCppCodegen::prefixedType() QCOMPARE(o->property("countH").toInt(), 11); } +void tst_QmlCppCodegen::propertyMap() +{ + QQmlEngine engine; + + const QUrl document(u"qrc:/qt/qml/TestTypes/propertyMap.qml"_s); + QQmlComponent c(&engine, document); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + + QTest::ignoreMessage( + QtWarningMsg, qPrintable( + document.toString() + + u":5:5: QML WithPropertyMap: Unable to assign [undefined] to \"objectName\"")); + + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + WithPropertyMap *w = qobject_cast<WithPropertyMap *>(o.data()); + QVERIFY(w); + + QVERIFY(w->objectName().isEmpty()); + + w->setProperties({ + { u"foo"_s, u"aaa"_s }, + { u"bar"_s, u"bbb"_s }, + }); + + QCOMPARE(w->objectName(), u"aaa"_s); + + w->setProperties({ + { u"foo"_s, u"ccc"_s }, + }); + + QCOMPARE(w->objectName(), u"ccc"_s); + + w->setProperties({ + { u"foo"_s, 24.25 }, + }); + + QCOMPARE(w->objectName(), u"24.25"_s); +} + void tst_QmlCppCodegen::propertyOfParent() { QQmlEngine engine; |
