From 0ac8722d25503a74fe8aed3e6129bc5fd5de9447 Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Wed, 7 Jul 2021 17:09:47 +0200 Subject: 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 --- tests/auto/tools/moc/tst_moc.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/auto/tools') 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; -- cgit v1.2.3