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>
This commit is contained in:
Andrei Golubev 2021-07-07 17:09:47 +02:00
parent ebee8a1336
commit 0ac8722d25

View File

@ -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;