diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-16 02:35:08 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-31 01:17:15 (GMT) |
commit | 7ebd2024f49bdaf798f0beaaa35946dfa890f276 (patch) | |
tree | f68cad7641b1f0aa6242acadb480a6cb6969002e /tests/auto/qmetaobject/tst_qmetaobject.cpp | |
parent | 29202f033c87b5efe305e606805a26c59886875b (diff) | |
download | Qt-7ebd2024f49bdaf798f0beaaa35946dfa890f276.zip Qt-7ebd2024f49bdaf798f0beaaa35946dfa890f276.tar.gz Qt-7ebd2024f49bdaf798f0beaaa35946dfa890f276.tar.bz2 |
Add FINAL attribute to Q_PROPERTY()
This will be used by the declarative module to optimize property bindings.
Reviewed-by: Roberto Raggi
Diffstat (limited to 'tests/auto/qmetaobject/tst_qmetaobject.cpp')
-rw-r--r-- | tests/auto/qmetaobject/tst_qmetaobject.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index f4cff2b..ac2858c 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -109,6 +109,7 @@ class tst_QMetaObject : public QObject Q_PROPERTY(MyStruct value7 READ value7 WRITE setVal7 NOTIFY value7Changed) Q_PROPERTY(int value8 READ value8 NOTIFY value8Changed) Q_PROPERTY(int value9 READ value9 CONSTANT) + Q_PROPERTY(int value10 READ value10 FINAL) public: enum EnumType { EnumType1 }; @@ -140,6 +141,8 @@ public: int value9() const { return 1; } + int value10() const { return 1; } + QList<QVariant> value4; QVariantList value5; @@ -163,6 +166,7 @@ private slots: void checkScope(); void propertyNotify(); void propertyConstant(); + void propertyFinal(); void stdSet(); void classInfo(); @@ -802,6 +806,19 @@ void tst_QMetaObject::propertyConstant() QVERIFY(prop.isConstant()); } +void tst_QMetaObject::propertyFinal() +{ + const QMetaObject *mo = metaObject(); + + QMetaProperty prop = mo->property(mo->indexOfProperty("value10")); + QVERIFY(prop.isValid()); + QVERIFY(prop.isFinal()); + + prop = mo->property(mo->indexOfProperty("value9")); + QVERIFY(prop.isValid()); + QVERIFY(!prop.isFinal()); +} + class ClassInfoTestObjectA : public QObject { Q_OBJECT |