summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/moc/parse-defines.h22
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp19
2 files changed, 38 insertions, 3 deletions
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index eb47253587..60415ac69a 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -52,6 +52,7 @@
#define PD_CLASSNAME ParseDefine
#define PD_STRINGIFY(a) #a
+#define PD_XSTRINGIFY(a) PD_STRINGIFY(a)
#define PD_SCOPED_STRING(a, b) PD_STRINGIFY(a) "::" PD_STRINGIFY(b)
#define PD_DEFINE1(a,b) a##b
#define PD_DEFINE2(a,b) a comb##b
@@ -81,7 +82,8 @@ class PD_CLASSNAME : public QObject
{
Q_OBJECT
Q_CLASSINFO("TestString", PD_STRINGIFY(PD_CLASSNAME))
- PD_CLASSINFO("TestString2", "TestValue")
+ Q_CLASSINFO("TestString2", PD_XSTRINGIFY(PD_CLASSNAME))
+ PD_CLASSINFO("TestString3", "TestValue")
public:
PD_CLASSNAME() {}
@@ -108,6 +110,24 @@ public slots:
PD_VARARGEXT(void vararg5, int) {}
PD_VARARGEXT(void vararg6, int, int) {}
#endif
+
+#define OUTERFUNCTION(x) x
+#define INNERFUNCTION(x) OUTERFUNCTION(x)
+#define INNER INNERFUNCTION
+
+ void INNERFUNCTION(INNERFUNCTION)(int) {}
+ void OUTERFUNCTION(INNERFUNCTION)(inner_expanded(int)) {}
+ void expanded_method OUTERFUNCTION(INNER)((int)) {}
+
+#undef INNERFUNCTION
+
+#define cond1() 0x1
+#define cond2() 0x2
+
+#if !(cond1() & cond2())
+ void conditionSlot() {}
+#endif
+
};
#undef QString
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index d861b84e00..e3ed473978 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -2752,19 +2752,34 @@ void tst_Moc::parseDefines()
QVERIFY(index != -1);
#endif
+ index = mo->indexOfSlot("INNERFUNCTION(int)");
+ QVERIFY(index != -1);
+ index = mo->indexOfSlot("inner_expanded(int)");
+ QVERIFY(index != -1);
+ index = mo->indexOfSlot("expanded_method(int)");
+ QVERIFY(index != -1);
+
+ index = mo->indexOfSlot("conditionSlot()");
+ QVERIFY(index != -1);
+
int count = 0;
for (int i = 0; i < mo->classInfoCount(); ++i) {
QMetaClassInfo mci = mo->classInfo(i);
if (!qstrcmp(mci.name(), "TestString")) {
++count;
- QVERIFY(!qstrcmp(mci.value(), "ParseDefine"));
+ QVERIFY(!qstrcmp(mci.value(), "PD_CLASSNAME"));
}
if (!qstrcmp(mci.name(), "TestString2")) {
++count;
+ qDebug() << mci.value();
+ QVERIFY(!qstrcmp(mci.value(), "ParseDefine"));
+ }
+ if (!qstrcmp(mci.name(), "TestString3")) {
+ ++count;
QVERIFY(!qstrcmp(mci.value(), "TestValue"));
}
}
- QVERIFY(count == 2);
+ QVERIFY(count == 3);
}
void tst_Moc::preprocessorOnly()