tests/auto/moc/tst_moc.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/tests/auto/moc/tst_moc.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/tests/auto/moc/tst_moc.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -489,7 +489,7 @@
     void constructors();
     void typenameWithUnsigned();
     void warnOnVirtualSignal();
-
+    void QTBUG5590_dummyProperty();
 signals:
     void sigWithUnsignedArg(unsigned foo);
     void sigWithSignedArg(signed foo);
@@ -817,6 +817,8 @@
 
 #include "namespaced-flags.h"
 
+Q_DECLARE_METATYPE(QList<Foo::Bar::Flags>);
+
 void tst_Moc::namespacedFlags()
 {
     Foo::Baz baz;
@@ -829,6 +831,12 @@
     QVERIFY(v.isValid());
     QVERIFY(baz.setProperty("flags", v));
     QVERIFY(baz.flags() == bar.flags());
+
+    QList<Foo::Bar::Flags> l;
+    l << baz.flags();
+    QVariant v2 = baz.setProperty("flagsList", QVariant::fromValue(l));
+    QCOMPARE(l, baz.flagsList());
+    QCOMPARE(l, qvariant_cast<QList<Foo::Bar::Flags> >(baz.property("flagsList")));
 }
 
 void tst_Moc::warnOnMultipleInheritance()
@@ -1209,6 +1217,40 @@
 #endif
 }
 
+
+class QTBUG5590_DummyObject: public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(bool dummy)
+};
+
+class QTBUG5590_PropertyObject: public QTBUG5590_DummyObject
+{
+    Q_OBJECT
+    Q_PROPERTY(int value READ value WRITE setValue)
+    Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+
+    public:
+        QTBUG5590_PropertyObject() :  m_value(85), m_value2(40) { }
+        int value() const { return m_value; }
+        void setValue(int value) { m_value = value; }
+        int value2() const { return m_value2; }
+        void setValue2(int value) { m_value2 = value; }
+    private:
+        int m_value, m_value2;
+};
+
+void tst_Moc::QTBUG5590_dummyProperty()
+{
+    QTBUG5590_PropertyObject o;
+    QCOMPARE(o.property("value").toInt(), 85);
+    QCOMPARE(o.property("value2").toInt(), 40);
+    o.setProperty("value", 32);
+    QCOMPARE(o.value(), 32);
+    o.setProperty("value2", 82);
+    QCOMPARE(o.value2(), 82);
+}
+
 QTEST_APPLESS_MAIN(tst_Moc)
 #include "tst_moc.moc"