diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-05-12 14:00:10 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-05-12 23:45:01 +0200 |
commit | e6bc19d518b92d47639de871e255bfe73118cd17 (patch) | |
tree | 1b09adc9d2c76677bdb40885469fc52e0a4510ba /tests | |
parent | c0ab31470275d99f483e7342da3235b9a28072c6 (diff) |
Pass "final" attribute of properties through qmltypes
We want to know about that in QQmlJSScope.
Task-number: QTBUG-93662
Change-Id: Ie4b15fa06cb921d48074ae39d1057ead439ebc45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp | 10 | ||||
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp index 4de68ed7d8..8f7e0efb40 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp @@ -79,8 +79,8 @@ void tst_qmltyperegistrar::superAndForeignTypes() QVERIFY(qmltypesData.contains("values: [\"Pixel\", \"Centimeter\", \"Inch\", \"Point\"]")); QVERIFY(qmltypesData.contains("name: \"SizeGadget\"")); QVERIFY(qmltypesData.contains("prototype: \"SizeEnums\"")); - QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\"; read: \"height\"; write: \"setHeight\" }")); - QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\"; read: \"width\"; write: \"setWidth\" }")); + QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\"; read: \"height\"; write: \"setHeight\"; isFinal: true }")); + QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\"; read: \"width\"; write: \"setWidth\"; isFinal: true }")); QVERIFY(qmltypesData.contains("Method { name: \"sizeToString\"; type: \"QString\" }")); QCOMPARE(qmltypesData.count("extension: \"SizeValueType\""), 1); } @@ -212,4 +212,10 @@ void tst_qmltyperegistrar::hiddenAccessor() "Property { name: \"hiddenRead\"; type: \"QString\"; isReadonly: true }")); } +void tst_qmltyperegistrar::finalProperty() +{ + QCOMPARE(qmltypesData.count("name: \"FinalProperty\""), 1); + QCOMPARE(qmltypesData.count("Property { name: \"fff\"; type: \"int\"; isFinal: true }"), 1); +} + QTEST_MAIN(tst_qmltyperegistrar) diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h index c0657eaf56..94b4d3b3a2 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h @@ -46,7 +46,6 @@ Q_DECLARE_INTERFACE(Interface2, "io.qt.bugreports.Interface2"); Q_DECLARE_INTERFACE(Interface3, "io.qt.bugreports.Interface3"); QT_END_NAMESPACE - class ImplementsInterfaces : public QObject, public Interface { Q_OBJECT @@ -248,6 +247,15 @@ private: int m_foo; }; +class FinalProperty : public QObject +{ + Q_OBJECT + QML_ELEMENT + Q_PROPERTY(int fff MEMBER fff FINAL) +public: + int fff = 0; +}; + class MultiExtension : public MultiExtensionParent { Q_OBJECT @@ -306,6 +314,7 @@ private slots: void localDefault(); void requiredProperty(); void hiddenAccessor(); + void finalProperty(); private: QByteArray qmltypesData; |