summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-08-21 11:29:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-22 16:03:28 +0200
commit2bd40c53ef54ff2c11ddb3b3acbd443a6429a8db (patch)
treef3ee235938bf9169078d9febef5b9b79dcee9c0c /tests/auto
parentc20b3587038c8834e439057c791684c5f636cd07 (diff)
moc: Fix related objects containing itself
This may happen when we have namespaces and the qualified name is used to scope an enum. Task-number: QTBUG-32933 Change-Id: Ic4923bbfb138387bae1e3694172661ace8342089 Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 612ce3cd7e..0728533c6b 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -565,6 +565,7 @@ private slots:
void parseDefines();
void preprocessorOnly();
void unterminatedFunctionMacro();
+ void QTBUG32933_relatedObjectsDontIncludeItself();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -3005,6 +3006,31 @@ void tst_Moc::unterminatedFunctionMacro()
#endif
}
+namespace QTBUG32933_relatedObjectsDontIncludeItself {
+ namespace NS {
+ class Obj : QObject {
+ Q_OBJECT
+ Q_PROPERTY(MyEnum p1 MEMBER member)
+ Q_PROPERTY(Obj::MyEnum p2 MEMBER member)
+ Q_PROPERTY(NS::Obj::MyEnum p3 MEMBER member)
+ Q_PROPERTY(QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::MyEnum p4 MEMBER member)
+ Q_ENUMS(MyEnum);
+ public:
+ enum MyEnum { Something, SomethingElse };
+ MyEnum member;
+ };
+ }
+}
+
+void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself()
+{
+ const QMetaObject *mo = &QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::staticMetaObject;
+ const QMetaObject **objects = mo->d.relatedMetaObjects;
+ // the related objects should be empty because the enums is in the same object.
+ QVERIFY(!objects);
+
+}
+
QTEST_MAIN(tst_Moc)
#include "tst_moc.moc"