summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-10-21 22:47:10 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-10-22 16:48:26 +0000
commitd206d04b7c368754bca9c43d8a67895b4baa8893 (patch)
tree0ea784d0b234e46983753ad36668dba49d43f7c4 /tests/auto/tools
parentf57afda69fd9fdf9444d13e3461d556fae1dfcdf (diff)
moc: fix Q_PROPERTY with parentheses in their MEMBER clause
This was never a documented feature, but happended to work before Qt 5.5. It broke because the peoperty access went into the static function and are now prefixed with '_t->' So restore the behavior as it was by not including the parentheses in the member name. Task-number: QTBUG-47695 Change-Id: Ic3509ddea7ac9abc871e71f5bfbe81d04d08e9bc Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 4fa98b6ecb..c113b7cd60 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -513,6 +513,8 @@ class tst_Moc : public QObject
Q_PROPERTY(QString member4 MEMBER sMember NOTIFY member4Changed)
Q_PROPERTY(QString member5 MEMBER sMember NOTIFY member5Changed)
Q_PROPERTY(QString member6 MEMBER sConst CONSTANT)
+ Q_PROPERTY(QString sub1 MEMBER (sub.m_string))
+ Q_PROPERTY(QString sub2 READ (sub.string) WRITE (sub.setString))
public:
inline tst_Moc() : sConst("const") {}
@@ -626,6 +628,13 @@ private:
QString sMember;
const QString sConst;
PrivatePropertyTest *pPPTest;
+
+ struct {
+ QString m_string;
+ void setString(const QString &s) { m_string = s; }
+ QString string() { return m_string; }
+ } sub;
+
};
void tst_Moc::initTestCase()
@@ -2044,6 +2053,10 @@ void tst_Moc::memberProperties_data()
<< 1 << "blub5" << "blub5Changed(const QString&)" << "mno" << true << "mno";
QTest::newRow("private MEMBER property with CONSTANT")
<< 1 << "blub6" << "" << "test" << false << "const";
+ QTest::newRow("sub1")
+ << 0 << "sub1" << "" << "helloSub1" << true << "helloSub1";
+ QTest::newRow("sub2")
+ << 0 << "sub2" << "" << "helloSub2" << true << "helloSub2";
}
void tst_Moc::memberProperties()