diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-15 21:25:00 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-16 09:12:10 (GMT) |
commit | 0414a73942272d8e863e464b3fbffeb9982964c1 (patch) | |
tree | e900bd26021e41c99133ea94efcb1978bf5815e5 /tests | |
parent | 802efaf0b20e08bcc04763a288a05551121493e8 (diff) | |
download | Qt-0414a73942272d8e863e464b3fbffeb9982964c1.zip Qt-0414a73942272d8e863e464b3fbffeb9982964c1.tar.gz Qt-0414a73942272d8e863e464b3fbffeb9982964c1.tar.bz2 |
Fix moc generated code with dummy Q_PROPERTY
If there is properties, we cannot skip the code that substract
the property number from the id
Task-number: QTBUG-5590
Reviewed-by: Brad
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/moc/tst_moc.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 2316ba2..1ca2b3a 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -489,6 +489,7 @@ private slots: void constructors(); void typenameWithUnsigned(); void warnOnVirtualSignal(); + void QTBUG5590_dummyProperty(); signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); @@ -1216,6 +1217,40 @@ void tst_Moc::warnOnVirtualSignal() #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" |