summaryrefslogtreecommitdiff
path: root/tests/auto/qmetaobject
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 18:13:24 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-31 11:16:34 +1000
commit29202f033c87b5efe305e606805a26c59886875b (patch)
tree6d0b770e58a67648f64fd90c6be9f5e2ee45c5f6 /tests/auto/qmetaobject
parentf5acc7b83f79c0bce554a6e4fe2d9e6ebb4b582b (diff)
downloadqt4-tools-29202f033c87b5efe305e606805a26c59886875b.tar.gz
Add CONSTANT attribute to Q_PROPERTY()
This will be used by the declarative module to determine if a property lacking a NOTIFY signal is truly constant, or just missing a NOTIFY signal. Reviewed-by: Roberto Raggi
Diffstat (limited to 'tests/auto/qmetaobject')
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index dea0ffbab2..f4cff2be06 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -108,6 +108,7 @@ class tst_QMetaObject : public QObject
Q_PROPERTY(int value6 READ value6 NOTIFY value6Changed)
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)
public:
enum EnumType { EnumType1 };
@@ -137,6 +138,8 @@ public:
int value8() const { return 1; }
+ int value9() const { return 1; }
+
QList<QVariant> value4;
QVariantList value5;
@@ -159,6 +162,7 @@ private slots:
void customPropertyType();
void checkScope();
void propertyNotify();
+ void propertyConstant();
void stdSet();
void classInfo();
@@ -785,6 +789,19 @@ void tst_QMetaObject::propertyNotify()
QCOMPARE(signal.signature(), (const char *)0);
}
+void tst_QMetaObject::propertyConstant()
+{
+ const QMetaObject *mo = metaObject();
+
+ QMetaProperty prop = mo->property(mo->indexOfProperty("value8"));
+ QVERIFY(prop.isValid());
+ QVERIFY(!prop.isConstant());
+
+ prop = mo->property(mo->indexOfProperty("value9"));
+ QVERIFY(prop.isValid());
+ QVERIFY(prop.isConstant());
+}
+
class ClassInfoTestObjectA : public QObject
{
Q_OBJECT