summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 08:13:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 08:13:24 (GMT)
commit567a18967b4d656b9f12a505f3146732d96eb935 (patch)
treecc4780bc2f11c9e874daa651849bf78b21cc1784 /tests
parent0eaa3466077839b0cef2ad6c326d80f398eccae7 (diff)
downloadQt-567a18967b4d656b9f12a505f3146732d96eb935.zip
Qt-567a18967b4d656b9f12a505f3146732d96eb935.tar.gz
Qt-567a18967b4d656b9f12a505f3146732d96eb935.tar.bz2
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.
Diffstat (limited to 'tests')
-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 dea0ffb..f4cff2b 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