summaryrefslogtreecommitdiffstats
path: root/tests/auto/moc/tst_moc.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-02-28 11:55:26 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-02-28 11:55:42 (GMT)
commit8190ee79bdaebd8aaa985442c60268c1fcabe719 (patch)
tree4f44e85e50bb6120f241338754669db57be7071c /tests/auto/moc/tst_moc.cpp
parentf8ca41ab91748a4b847892af642c1a5a1cdeb105 (diff)
parent242585ec2671b5c7ac6ef451cc1f5a38ee739df2 (diff)
downloadQt-8190ee79bdaebd8aaa985442c60268c1fcabe719.zip
Qt-8190ee79bdaebd8aaa985442c60268c1fcabe719.tar.gz
Qt-8190ee79bdaebd8aaa985442c60268c1fcabe719.tar.bz2
Merge remote branch 'earth/master' into master
Diffstat (limited to 'tests/auto/moc/tst_moc.cpp')
-rw-r--r--tests/auto/moc/tst_moc.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 20fade1..bbfa91f 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -493,6 +493,7 @@ private slots:
void QTBUG5590_dummyProperty();
void QTBUG12260_defaultTemplate();
void notifyError();
+ void QTBUG17635_invokableAndProperty();
void revisions();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -1386,6 +1387,31 @@ void tst_Moc::notifyError()
#endif
}
+class QTBUG_17635_InvokableAndProperty : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(int numberOfEggs READ numberOfEggs)
+ Q_PROPERTY(int numberOfChickens READ numberOfChickens)
+ Q_INVOKABLE QString getEgg(int index) { return QString::fromLatin1("Egg"); }
+ Q_INVOKABLE QString getChicken(int index) { return QString::fromLatin1("Chicken"); }
+ int numberOfEggs() { return 2; }
+ int numberOfChickens() { return 4; }
+};
+
+void tst_Moc::QTBUG17635_invokableAndProperty()
+{
+ //Moc used to fail parsing Q_INVOKABLE if they were dirrectly following a Q_PROPERTY;
+ QTBUG_17635_InvokableAndProperty mc;
+ QString val;
+ QMetaObject::invokeMethod(&mc, "getEgg", Q_RETURN_ARG(QString, val), Q_ARG(int, 10));
+ QCOMPARE(val, QString::fromLatin1("Egg"));
+ QMetaObject::invokeMethod(&mc, "getChicken", Q_RETURN_ARG(QString, val), Q_ARG(int, 10));
+ QCOMPARE(val, QString::fromLatin1("Chicken"));
+ QVERIFY(mc.metaObject()->indexOfProperty("numberOfEggs") != -1);
+ QVERIFY(mc.metaObject()->indexOfProperty("numberOfChickens") != -1);
+}
+
// If changed, update VersionTestNotify below
class VersionTest : public QObject
{