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:
parent
ebee8a1336
commit
0ac8722d25
@ -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 ForwardDeclaredStruct;
|
||||||
|
|
||||||
struct StructQObject : public QObject
|
struct StructQObject : public QObject
|
||||||
@ -655,6 +663,7 @@ private slots:
|
|||||||
void task87883();
|
void task87883();
|
||||||
void multilineComments();
|
void multilineComments();
|
||||||
void classinfoWithEscapes();
|
void classinfoWithEscapes();
|
||||||
|
void classinfoFromVaArgs();
|
||||||
void trNoopInClassInfo();
|
void trNoopInClassInfo();
|
||||||
void ppExpressionEvaluation();
|
void ppExpressionEvaluation();
|
||||||
void arrayArguments();
|
void arrayArguments();
|
||||||
@ -977,6 +986,15 @@ void tst_Moc::classinfoWithEscapes()
|
|||||||
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
|
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()
|
void tst_Moc::trNoopInClassInfo()
|
||||||
{
|
{
|
||||||
TestClass t;
|
TestClass t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user