summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc/tst_moc.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-07-07 17:09:47 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2021-07-08 08:17:34 +0200
commit0ac8722d25503a74fe8aed3e6129bc5fd5de9447 (patch)
tree4893345ed2a46c0b95e5a9078a353ceffd765bef /tests/auto/tools/moc/tst_moc.cpp
parentebee8a13364f28c40fbe7fae4cedaebc70d9d024 (diff)
Test Q_CLASSINFO("foobar", #__VA_ARGS__) in tst_moc
There's a chance that this would be used in some macro, so why not test that this thing works in general (especially since it actually works) Change-Id: Ib9d91fbd17cf16675ae89a99f010dacc5d30967a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/tools/moc/tst_moc.cpp')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 752c539964..10c6a3ebc9 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -313,6 +313,14 @@ public slots:
{ }
};
+#define CLASSINFO_VAARGS(...) Q_CLASSINFO("classinfo_va_args", #__VA_ARGS__)
+class TestClassinfoFromVaArgs : public QObject
+{
+ Q_OBJECT
+ CLASSINFO_VAARGS(a, b, c, d)
+};
+#undef CLASSINFO_VAARGS
+
struct ForwardDeclaredStruct;
struct StructQObject : public QObject
@@ -655,6 +663,7 @@ private slots:
void task87883();
void multilineComments();
void classinfoWithEscapes();
+ void classinfoFromVaArgs();
void trNoopInClassInfo();
void ppExpressionEvaluation();
void arrayArguments();
@@ -977,6 +986,15 @@ void tst_Moc::classinfoWithEscapes()
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
}
+void tst_Moc::classinfoFromVaArgs()
+{
+ const QMetaObject *mobj = &TestClassinfoFromVaArgs::staticMetaObject;
+
+ QCOMPARE(mobj->classInfoCount(), 1);
+ QCOMPARE(mobj->classInfo(0).name(), "classinfo_va_args");
+ QCOMPARE(mobj->classInfo(0).value(), "a,b,c,d");
+}
+
void tst_Moc::trNoopInClassInfo()
{
TestClass t;