diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-03-02 09:51:21 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-03-03 16:40:05 +0100 |
commit | 7f3692f5ce08a772c2e31c65325a430169711d61 (patch) | |
tree | ee8bbf1db82998619a254a51f50e581fa0ff61a0 /tests/auto/qml/qmltyperegistrar | |
parent | 25ae86d1d98dbf3900eefea152b072939be8ea71 (diff) |
qmlcompiler: Add support for required properties
Change-Id: I2687de04120ab224c5ccc409930526c29d8915bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltyperegistrar')
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp index 9f49387a8f..798aab03b1 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp @@ -199,4 +199,10 @@ void tst_qmltyperegistrar::localDefault() QVERIFY(foreign > defaultProp || foreign < local); } +void tst_qmltyperegistrar::requiredProperty() +{ + QCOMPARE(qmltypesData.count("name: \"RequiredProperty\""), 1); + QCOMPARE(qmltypesData.count("isRequired: 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 eb3b680e82..8d934d4996 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h @@ -234,6 +234,19 @@ public: int p() const { return 'p'; } }; +class RequiredProperty : public QObject +{ + Q_OBJECT + QML_ELEMENT + Q_PROPERTY(int foo READ foo WRITE setFoo REQUIRED) +public: + RequiredProperty(QObject *parent = nullptr) : QObject(parent) {} + int foo() { return m_foo; } + void setFoo(int foo) { m_foo = foo; } +private: + int m_foo; +}; + class MultiExtension : public MultiExtensionParent { Q_OBJECT @@ -267,6 +280,7 @@ private slots: void metaTypesRegistered(); void multiExtensions(); void localDefault(); + void requiredProperty(); private: QByteArray qmltypesData; |