47 #if !defined(Q_CC_GNU) || defined(Q_OS_WIN)
48 #define SKIP_NEWLINE_TEST
50 #if !defined(SKIP_NEWLINE_TEST)
59 #if defined(PARSE_BOOST)
86 #define STRING_HASH_HASH(x) ("foo" ## x ## "bar")
87 const char *string_hash_hash = STRING_HASH_HASH(
"baz");
92 #define TESTEXPORTMACRO Q_DECL_EXPORT
192 #if defined(Q_MOC_RUN)
193 class QTBUG_45790 : Bug() { };
196 class CreatableGadget
200 Q_INVOKABLE CreatableGadget()
202 CreatableGadget::qt_static_metacall((QObject*)this, QMetaObject::ReadProperty, -1, nullptr);
206 CreatableGadget creatableGadget;
211 struct SuperClass {};
215 const char* test_multiple_number_of_escapes = "\\\"";
216 namespace MyNamespace
218 class TestSuperClass : public QObject
222 inline TestSuperClass() {}
228 typedef QString Type;
242 class GadgetInUnnamedNS
245 Q_PROPERTY(int x READ x WRITE setX)
246 Q_PROPERTY(int y READ y WRITE setY)
248 explicit GadgetInUnnamedNS(int x, int y) : m_x(x), m_y(y) {}
249 int x() const { return m_x; }
250 int y() const { return m_y; }
251 void setX(int x) { m_x = x; }
252 void setY(int y) { m_y = y; }
258 class ObjectInUnnamedNS : public QObject
262 explicit ObjectInUnnamedNS(QObject *parent = nullptr) : QObject(parent) {}
267 class Sender : public QObject
272 void sendValue(const String::Type& value)
276 void sendValue(const Int::Type& value)
281 bool operator< ( const Sender & ) const { return true;}
283 void send(const String::Type&);
284 void send(const Int::Type&);
287 class Receiver : public QObject
291 Receiver() : stringCallCount(0), intCallCount(0) {}
297 void receive(const String::Type&) { stringCallCount++; }
298 void receive(const Int::Type&) { intCallCount++; }
301 #define MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES
303 #define DONT_CONFUSE_MOC(klass) klass
304 #define DONT_CONFUSE_MOC_EVEN_MORE(klass, dummy, dummy2) klass
306 Q_DECLARE_METATYPE(MyStruct)
307 Q_DECLARE_METATYPE(MyStruct*)
312 Points() : p1(0xBEEF), p2(0xBABE) { }
317 Q_DECLARE_METATYPE(myNS::Points)
319 class TestClassinfoWithEscapes: public QObject
322 Q_CLASSINFO("escaped", "\"bar\"")
323 Q_CLASSINFO("\"escaped\"", "foo")
324 Q_CLASSINFO("cpp c*/omment", "f/*oo")
325 Q_CLASSINFO("endswith\\", "Or?\?/")
326 Q_CLASSINFO("newline\n inside\n", "Or \r")
328 void slotWithAReallyLongName(int)
332 #define CLASSINFO_VAARGS(...) Q_CLASSINFO("classinfo_va_args", #__VA_ARGS__)
333 class TestClassinfoFromVaArgs : public QObject
336 CLASSINFO_VAARGS(a, b, c, d)
338 #undef CLASSINFO_VAARGS
340 struct ForwardDeclaredStruct;
342 struct StructQObject : public QObject
346 void foo(struct ForwardDeclaredStruct *);
350 QT_WARNING_DISABLE_GCC("-Wunused-variable")
351 void StructQObject::foo(struct ForwardDeclaredStruct *)
357 Q_DECL_UNUSED_MEMBER struct Inner unusedVariable;
362 QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers")
363 QT_WARNING_DISABLE_GCC("-Wignored-qualifiers")
365 using ObjectCRef = const QObject &;
367 class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct),
368 public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored)
371 Q_CLASSINFO("help", QT_TR_NOOP("Opening this will let you configure something"))
372 Q_PROPERTY(short int shortIntProperty READ shortIntProperty)
373 Q_PROPERTY(unsigned short int unsignedShortIntProperty READ unsignedShortIntProperty)
374 Q_PROPERTY(signed short int signedShortIntProperty READ signedShortIntProperty)
375 Q_PROPERTY(long int longIntProperty READ longIntProperty)
376 Q_PROPERTY(unsigned long int unsignedLongIntProperty READ unsignedLongIntProperty)
377 Q_PROPERTY(signed long int signedLongIntProperty READ signedLongIntProperty)
378 Q_PROPERTY(long double longDoubleProperty READ longDoubleProperty)
379 Q_PROPERTY(myNS::Points points READ points WRITE setPoints)
385 "multiline Q_CLASSINFO"
390 Q_CLASSINFO("D-Bus Introspection", ""
391 " <interface name=\"org.kde.KCookieServer\" >\n"
392 " <method name=\"findCookies\" >\n"
393 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
394 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
395 " <arg direction=\"out\" type=\"s\" name=\"cookies\" />\n"
397 " <method name=\"findDomains\" >\n"
398 " <arg direction=\"out\" type=\"as\" name=\"domains\" />\n"
400 " <method name=\"findCookies\" >\n"
401 " <arg direction=\"in\" type=\"ai\" name=\"fields\" />\n"
402 " <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
403 " <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
404 " <arg direction=\"in\" type=\"s\" name=\"path\" />\n"
405 " <arg direction=\"in\" type=\"s\" name=\"name\" />\n"
406 " <arg direction=\"out\" type=\"as\" name=\"cookies\" />\n"
407 " <annotation value=\"QList<int>\" name=\"com.trolltech.QtDBus.QtTypeName.In0\" />\n"
409 " <method name=\"findDOMCookies\" >\n"
410 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
411 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
412 " <arg direction=\"out\" type=\"s\" name=\"cookies\" />\n"
414 " <method name=\"addCookies\" >\n"
415 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
416 " <arg direction=\"in\" type=\"ay\" name=\"cookieHeader\" />\n"
417 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
419 " <method name=\"deleteCookie\" >\n"
420 " <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
421 " <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
422 " <arg direction=\"in\" type=\"s\" name=\"path\" />\n"
423 " <arg direction=\"in\" type=\"s\" name=\"name\" />\n"
425 " <method name=\"deleteCookiesFromDomain\" >\n"
426 " <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
428 " <method name=\"deleteSessionCookies\" >\n"
429 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
431 " <method name=\"deleteSessionCookiesFor\" >\n"
432 " <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
433 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
435 " <method name=\"deleteAllCookies\" />\n"
436 " <method name=\"addDOMCookies\" >\n"
437 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
438 " <arg direction=\"in\" type=\"ay\" name=\"cookieHeader\" />\n"
439 " <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
441 " <method name=\"setDomainAdvice\" >\n"
442 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
443 " <arg direction=\"in\" type=\"s\" name=\"advice\" />\n"
445 " <method name=\"getDomainAdvice\" >\n"
446 " <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
447 " <arg direction=\"out\" type=\"s\" name=\"advice\" />\n"
449 " <method name=\"reloadPolicy\" />\n"
450 " <method name=\"shutdown\" />\n"
455 inline TestClass() {}
458 inline void dummy1() MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES {}
459 inline void dummy2() MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES const {}
460 inline void dummy3() const MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES {}
462 void slotWithULongLong(unsigned long long) {}
463 void slotWithULongLongP(unsigned long long*) {}
464 void slotWithULong(unsigned long) {}
465 void slotWithLongLong(long long) {}
466 void slotWithLong(long) {}
468 void slotWithColonColonType(::Int::Type) {}
470 TestClass &slotWithReferenceReturnType() { return *this; }
473 void expressionEvaluationShortcut1() {}
477 void expressionEvaluationShortcut2() {}
481 void slotWithArray(const double[3]) {}
482 void slotWithNamedArray(const double namedArray[3]) { Q_UNUSED(namedArray); }
483 void slotWithMultiArray(const double[3][4]) {}
485 short int shortIntProperty() { return 0; }
486 unsigned short int unsignedShortIntProperty() { return 0; }
487 signed short int signedShortIntProperty() { return 0; }
488 long int longIntProperty() { return 0; }
489 unsigned long int unsignedLongIntProperty() { return 0; }
490 signed long int signedLongIntProperty() { return 0; }
491 long double longDoubleProperty() { return 0.0; }
493 myNS::Points points() { return m_points; }
494 void setPoints(myNS::Points points) { m_points = points; }
497 void signalWithArray(const double[3]);
498 void signalWithNamedArray(const double namedArray[3]);
499 void signalWithIterator(QList<QUrl>::iterator);
500 void signalWithListPointer(QList<QUrl>*);
505 void invalidSlot() {}
513 void invalidSlot() {}
517 void invalidSlot() {}
520 void slotInLastElse() {}
524 void invalidSlot() {}
528 void invalidSlot() {}
531 friend class Receiver;
535 #define MACRO_DEFINED
537 #if !(defined MACRO_UNDEF || defined MACRO_DEFINED) || 1
542 #if !(!defined MACRO_UNDEF || !defined MACRO_DEFINED) && 1
547 #if !(!defined (MACRO_DEFINED) || !defined (MACRO_UNDEF)) && 1
561 void const slotWithSillyConst() {}
562 void slotTakingCRefViaTypedef(ObjectCRef o) { this->setObjectName(o.objectName()); }
565 Q_INVOKABLE void const slotWithSillyConst2() {}
566 Q_INVOKABLE QObject& myInvokableReturningRef()
568 Q_INVOKABLE const QObject& myInvokableReturningConstRef() const
574 void slotWithVoidStar(void *) {}
577 myNS::Points m_points;
580 int xx = 11'11; // digit separator must not confuse moc (QTBUG-59351)
585 inline virtual void blub1() {}
586 virtual inline void blub2() {}
591 class PropertyTestClass : public QObject
596 enum TestEnum { One, Two, Three };
601 class PropertyUseClass : public QObject
604 Q_PROPERTY(PropertyTestClass::TestEnum foo READ foo)
607 inline PropertyTestClass::TestEnum foo() const { return PropertyTestClass::One; }
610 class EnumSourceClass : public QObject
615 enum TestEnum { Value = 37 };
620 class EnumUserClass : public QObject
625 Q_ENUMS(EnumSourceClass::TestEnum)
628 class CtorTestClass : public QObject
632 Q_INVOKABLE CtorTestClass(QObject *parent = nullptr);
634 CtorTestClass(int foo);
636 inline Q_INVOKABLE CtorTestClass(const QString &str)
642 CtorTestClass(int foo, int bar, int baz);
644 CtorTestClass(float, float) {}
647 CtorTestClass::CtorTestClass(QObject *parent)
650 CtorTestClass::CtorTestClass(int, int, int) {}
652 class PrivatePropertyTest;
654 class tst_Moc : public QObject
658 Q_PROPERTY(bool user1 READ user1 USER true )
659 Q_PROPERTY(bool user2 READ user2 USER false)
660 Q_PROPERTY(QString member1 MEMBER sMember)
661 Q_PROPERTY(QString member2 MEMBER sMember READ member2)
662 Q_PROPERTY(QString member3 MEMBER sMember WRITE setMember3)
663 Q_PROPERTY(QString member4 MEMBER sMember NOTIFY member4Changed)
664 Q_PROPERTY(QString member5 MEMBER sMember NOTIFY member5Changed)
665 Q_PROPERTY(QString member6 MEMBER sConst CONSTANT)
666 Q_PROPERTY(QString sub1 MEMBER (sub.m_string))
667 Q_PROPERTY(QString sub2 READ (sub.string) WRITE (sub.setString))
670 inline tst_Moc() : sConst("const") {}
675 void dontStripNamespaces();
676 void oldStyleCasts();
677 void warnOnExtraSignalSlotQualifiaction();
679 void inputFileNameWithDotsButNoExtension();
680 void userProperties();
681 void supportConstSignals();
683 void multilineComments();
684 void classinfoWithEscapes();
685 void classinfoFromVaArgs();
686 void trNoopInClassInfo();
687 void ppExpressionEvaluation();
688 void arrayArguments();
689 void preprocessorConditionals();
690 void blackslashNewlines();
691 void slotWithSillyConst();
692 void slotTakingCRefViaTypedef();
693 void testExtraData();
694 void testExtraDataForEnum();
695 void namespaceTypeProperty();
696 void slotsWithVoidTemplate();
697 void structQObject();
698 void namespacedFlags();
699 void warnOnMultipleInheritance();
700 void ignoreOptionClashes();
701 void forgottenQInterface();
704 void escapesInStringLiterals();
705 void frameworkSearchPath();
707 void defineMacroViaCmdline();
708 void defineMacroViaForcedInclude();
709 void defineMacroViaForcedIncludeRelative();
710 void environmentIncludePaths_data();
711 void environmentIncludePaths();
712 void specifyMetaTagsFromCmdline();
714 void singleFunctionKeywordSignalAndSlot();
716 void qprivateslots();
717 void qprivateproperties();
718 void warnOnPropertyWithoutREAD();
720 void typenameWithUnsigned();
721 void warnOnVirtualSignal();
722 void QTBUG5590_dummyProperty();
723 void QTBUG12260_defaultTemplate();
725 void QTBUG17635_invokableAndProperty();
727 void warnings_data();
730 void cxx11Enums_data();
732 void cxx11TrailingReturn();
734 void memberProperties_data();
735 void memberProperties();
736 void memberProperties2();
737 void privateSignalConnection();
738 void finalClasses_data();
740 void explicitOverrideControl_data();
741 void explicitOverrideControl();
742 void overloadedAddressOperator();
743 void autoPropertyMetaTypeRegistration();
744 void autoMethodArgumentMetaTypeRegistration();
745 void autoSignalSpyMetaTypeRegistration();
747 void preprocessorOnly();
748 void unterminatedFunctionMacro();
749 void QTBUG32933_relatedObjectsDontIncludeItself();
750 void writeEnumFromUnrelatedClass();
751 void relatedMetaObjectsWithinNamespaces();
752 void relatedMetaObjectsInGadget();
753 void relatedMetaObjectsNameConflict_data();
754 void relatedMetaObjectsNameConflict();
755 void strignLiteralsInMacroExtension();
756 void unnamedNamespaceObjectsAndGadgets();
757 void veryLongStringData();
758 void gadgetHierarchy();
759 void optionsFileError_data();
760 void optionsFileError();
761 void testQNamespace();
762 void cxx17Namespaces();
763 void cxxAttributes();
764 void mocJsonOutput();
766 void requiredProperties();
767 void qpropertyMembers();
768 void observerMetaCall();
769 void setQPRopertyBinding();
770 void privateQPropertyShim();
773 void sigWithUnsignedArg(unsigned foo);
774 void sigWithSignedArg(signed foo);
775 void sigWithConstSignedArg(const signed foo);
776 void sigWithVolatileConstSignedArg(volatile const signed foo);
777 void sigWithCustomType(const MyStruct);
778 void constSignal1() const;
779 void constSignal2(int arg) const;
780 void member4Changed();
781 void member5Changed(const QString &newVal);
784 bool user1() { return true; };
785 bool user2() { return false; };
786 template <class T> void revisions_T();
787 QString member2() const { return sMember; }
788 void setMember3( const QString &sVal ) { sMember = sVal; }
792 QString m_sourceDirectory;
793 QString qtIncludePath;
796 const QString sConst;
797 PrivatePropertyTest *pPPTest;
801 void setString(const QString &s) { m_string = s; }
802 QString string() { return m_string; }
807 void tst_Moc::initTestCase()
809 QString binpath = QLibraryInfo::path(QLibraryInfo::BinariesPath);
810 QString qtpaths = QString("%1/qtpaths").arg(binpath);
811 QString libexecPath = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath);
812 m_moc = QString("%1/moc").arg(libexecPath);
814 const QString testHeader = QFINDTESTDATA("backslash-newlines.h");
815 QVERIFY(!testHeader.isEmpty());
816 m_sourceDirectory = QFileInfo(testHeader).absolutePath();
817 #if defined(Q_OS_UNIX) && QT_CONFIG(process)
819 proc.start(qtpaths, QStringList() << "-query" << "QT_INSTALL_HEADERS");
820 QVERIFY(proc.waitForFinished());
821 QCOMPARE(proc.exitCode(), 0);
822 QByteArray output = proc.readAllStandardOutput();
823 QVERIFY(!output.isEmpty());
824 QCOMPARE(proc.readAllStandardError(), QByteArray());
825 qtIncludePath = QString::fromLocal8Bit(output).trimmed();
826 QFileInfo fi(qtIncludePath);
827 QVERIFY(fi.exists());
832 void tst_Moc::dontStripNamespaces()
837 connect(&sender, SIGNAL(send(const String::Type &)),
838 &receiver, SLOT(receive(const String::Type &)));
839 connect(&sender, SIGNAL(send(const Int::Type &)),
840 &receiver, SLOT(receive(const Int::Type &)));
842 sender.sendValue(String::Type("Hello"));
843 QCOMPARE(receiver.stringCallCount, 1);
844 QCOMPARE(receiver.intCallCount, 0);
845 sender.sendValue(Int::Type(42));
846 QCOMPARE(receiver.stringCallCount, 1);
847 QCOMPARE(receiver.intCallCount, 1);
850 void tst_Moc::oldStyleCasts()
852 #ifdef MOC_CROSS_COMPILED
853 QSKIP("Not tested when cross-compiled");
855 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
857 proc.start(m_moc, QStringList(m_sourceDirectory + QStringLiteral("/oldstyle-casts.h")));
858 QVERIFY(proc.waitForFinished());
859 QCOMPARE(proc.exitCode(), 0);
860 QByteArray mocOut = proc.readAllStandardOutput();
861 QVERIFY(!mocOut.isEmpty());
862 QCOMPARE(proc.readAllStandardError(), QByteArray());
865 args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
866 << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-";
867 proc.start("gcc", args);
868 QVERIFY(proc.waitForStarted());
870 proc.closeWriteChannel();
872 QVERIFY(proc.waitForFinished());
873 QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
874 QCOMPARE(proc.exitCode(), 0);
876 QSKIP("Only tested on linux/gcc");
880 void tst_Moc::warnOnExtraSignalSlotQualifiaction()
882 #ifdef MOC_CROSS_COMPILED
883 QSKIP("Not tested when cross-compiled");
885 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
887 const QString header = m_sourceDirectory + QStringLiteral("/extraqualification.h");
888 proc.start(m_moc, QStringList(header));
889 QVERIFY(proc.waitForFinished());
890 QCOMPARE(proc.exitCode(), 0);
891 QByteArray mocOut = proc.readAllStandardOutput();
892 QVERIFY(!mocOut.isEmpty());
893 QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
894 QCOMPARE(mocWarning, header +
895 QString(":43:1: warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
896 header + QString(":46:1: warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
898 QSKIP("Only tested on unix/gcc");
902 void tst_Moc::uLongLong()
905 const QMetaObject *mobj = tst.metaObject();
906 int idx = mobj->indexOfSlot("slotWithULong(ulong)");
908 idx = mobj->indexOfSlot("slotWithULongLong(unsigned long long)");
910 idx = mobj->indexOfSlot("slotWithULongLong(qulonglong)");
912 idx = mobj->indexOfSlot("slotWithULongLongP(qulonglong*)");
915 idx = mobj->indexOfSlot("slotWithLong(long)");
917 idx = mobj->indexOfSlot("slotWithLongLong(long long)");
921 void tst_Moc::inputFileNameWithDotsButNoExtension()
923 #ifdef MOC_CROSS_COMPILED
924 QSKIP("Not tested when cross-compiled");
926 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
928 proc.setWorkingDirectory(m_sourceDirectory + QStringLiteral("/task71021"));
929 proc.start(m_moc, QStringList("../Header"));
930 QVERIFY(proc.waitForFinished());
931 QCOMPARE(proc.exitCode(), 0);
932 QByteArray mocOut = proc.readAllStandardOutput();
933 QVERIFY(!mocOut.isEmpty());
934 QCOMPARE(proc.readAllStandardError(), QByteArray());
937 args << "-c" << "-x" << "c++" << "-I" << ".."
938 << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-";
939 proc.start("gcc", args);
940 QVERIFY(proc.waitForStarted());
942 proc.closeWriteChannel();
944 QVERIFY(proc.waitForFinished());
945 QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
946 QCOMPARE(proc.exitCode(), 0);
948 QSKIP("Only tested on linux/gcc");
952 void tst_Moc::userProperties()
954 const QMetaObject *mobj = metaObject();
955 QMetaProperty property = mobj->property(mobj->indexOfProperty("user1"));
956 QVERIFY(property.isValid());
957 QVERIFY(property.isUser());
959 property = mobj->property(mobj->indexOfProperty("user2"));
960 QVERIFY(property.isValid());
961 QVERIFY(!property.isUser());
964 void tst_Moc::supportConstSignals()
966 QSignalSpy spy1(this, SIGNAL(constSignal1()));
967 QVERIFY(spy1.isEmpty());
969 QCOMPARE(spy1.count(), 1);
971 QSignalSpy spy2(this, SIGNAL(constSignal2(int)));
972 QVERIFY(spy2.isEmpty());
973 emit constSignal2(42);
974 QCOMPARE(spy2.count(), 1);
975 QCOMPARE(spy2.at(0).at(0).toInt(), 42);
978 #include "task87883.h"
980 void tst_Moc::task87883()
982 QVERIFY(Task87883::staticMetaObject.className());
985 #include "c-comments.h"
987 void tst_Moc::multilineComments()
989 QVERIFY(IfdefedClass::staticMetaObject.className());
992 void tst_Moc::classinfoWithEscapes()
994 const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject;
995 QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
997 QCOMPARE(mobj->classInfoCount(), 5);
998 QCOMPARE(mobj->classInfo(2).name(), "cpp c*/omment");
999 QCOMPARE(mobj->classInfo(2).value(), "f/*oo");
1000 QCOMPARE(mobj->classInfo(3).name(), "endswith\\");
1001 QCOMPARE(mobj->classInfo(3).value(), "Or?\?/");
1002 QCOMPARE(mobj->classInfo(4).name(), "newline\n inside\n");
1003 QCOMPARE(mobj->classInfo(4).value(), "Or \r");
1005 QMetaMethod mm = mobj->method(mobj->methodOffset());
1006 QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
1009 void tst_Moc::classinfoFromVaArgs()
1011 const QMetaObject *mobj = &TestClassinfoFromVaArgs::staticMetaObject;
1013 QCOMPARE(mobj->classInfoCount(), 1);
1014 QCOMPARE(mobj->classInfo(0).name(), "classinfo_va_args");
1015 QCOMPARE(mobj->classInfo(0).value(), "a,b,c,d");
1018 void tst_Moc::trNoopInClassInfo()
1021 const QMetaObject *mobj = t.metaObject();
1023 QCOMPARE(mobj->classInfoCount(), 3);
1024 QCOMPARE(mobj->indexOfClassInfo("help"), 0);
1025 QCOMPARE(QString(mobj->classInfo(0).value()), QString("Opening this will let you configure something"));
1028 void tst_Moc::ppExpressionEvaluation()
1031 const QMetaObject *mobj = tst.metaObject();
1032 int idx = mobj->indexOfSlot("expressionEvaluationShortcut1()");
1035 idx = mobj->indexOfSlot("expressionEvaluationShortcut2()");
1039 void tst_Moc::arrayArguments()
1042 const QMetaObject *mobj = tst.metaObject();
1043 QVERIFY(mobj->indexOfSlot("slotWithArray(const double[3])") != -1);
1044 QVERIFY(mobj->indexOfSlot("slotWithNamedArray(const double[3])") != -1);
1045 QVERIFY(mobj->indexOfSlot("slotWithMultiArray(const double[3][4])") != -1);
1046 QVERIFY(mobj->indexOfSignal("signalWithArray(const double[3])") != -1);
1047 QVERIFY(mobj->indexOfSignal("signalWithNamedArray(const double[3])") != -1);
1050 void tst_Moc::preprocessorConditionals()
1053 const QMetaObject *mobj = tst.metaObject();
1054 QVERIFY(mobj->indexOfSlot("slotInElse()") != -1);
1055 QVERIFY(mobj->indexOfSlot("slotInIf()") != -1);
1056 QVERIFY(mobj->indexOfSlot("slotInLastElse()") != -1);
1057 QVERIFY(mobj->indexOfSlot("slotInElif()") != -1);
1058 QVERIFY(mobj->indexOfSignal("signalInIf1()") != -1);
1059 QVERIFY(mobj->indexOfSignal("signalInIf2()") != -1);
1060 QVERIFY(mobj->indexOfSignal("signalInIf3()") != -1);
1061 QCOMPARE(mobj->indexOfSignal("doNotExist()"), -1);
1064 void tst_Moc::blackslashNewlines()
1066 BackslashNewlines tst;
1067 const QMetaObject *mobj = tst.metaObject();
1068 QVERIFY(mobj->indexOfSlot("works()") != -1);
1069 QCOMPARE(mobj->indexOfSlot("buggy()"), -1);
1072 void tst_Moc::slotWithSillyConst()
1075 const QMetaObject *mobj = tst.metaObject();
1076 QVERIFY(mobj->indexOfSlot("slotWithSillyConst()") != -1);
1077 QVERIFY(mobj->indexOfMethod("slotWithSillyConst2()") != -1);
1078 QVERIFY(mobj->indexOfSlot("slotWithVoidStar(void*)") != -1);
1081 void tst_Moc::slotTakingCRefViaTypedef()
1085 obj.setObjectName("works");
1086 QMetaObject::invokeMethod(&tst, "slotTakingCRefViaTypedef", Q_ARG(ObjectCRef, obj));
1087 QCOMPARE(obj.objectName(), "works");
1090 void tst_Moc::testExtraData()
1092 const QMetaObject *mobj = &PropertyTestClass::staticMetaObject;
1093 QCOMPARE(mobj->enumeratorCount(), 1);
1094 QCOMPARE(QByteArray(mobj->enumerator(0).name()), QByteArray("TestEnum"));
1096 mobj = &PropertyUseClass::staticMetaObject;
1097 const int idx = mobj->indexOfProperty("foo");
1099 const QMetaProperty prop = mobj->property(idx);
1100 QVERIFY(prop.isValid());
1101 QVERIFY(prop.isEnumType());
1102 const QMetaEnum en = prop.enumerator();
1103 QCOMPARE(QByteArray(en.name()), QByteArray("TestEnum"));
1107 void tst_Moc::testExtraDataForEnum()
1109 const QMetaObject *mobjSource = &EnumSourceClass::staticMetaObject;
1110 QCOMPARE(mobjSource->enumeratorCount(), 1);
1111 QCOMPARE(QByteArray(mobjSource->enumerator(0).name()), QByteArray("TestEnum"));
1113 const QMetaObject *mobjUser = &EnumUserClass::staticMetaObject;
1114 QCOMPARE(mobjUser->enumeratorCount(), 0);
1116 const auto *objects = mobjUser->
d.relatedMetaObjects;
1122 void tst_Moc::namespaceTypeProperty()
1124 qRegisterMetaType<myNS::Points>(
"myNS::Points");
1129 myNS::Points
p = qvariant_cast<myNS::Points>(
v);
1135 myNS::Points pp = qvariant_cast<myNS::Points>(tst.property(
ba));
1140 void tst_Moc::slotsWithVoidTemplate()
1144 &test,
SLOT(dummySlot(
void))));
1148 &test,
SLOT(dummySlot2())));
1151 void tst_Moc::structQObject()
1161 void tst_Moc::namespacedFlags()
1181 void tst_Moc::warnOnMultipleInheritance()
1183 #ifdef MOC_CROSS_COMPILED
1184 QSKIP(
"Not tested when cross-compiled");
1186 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1190 args <<
"-I" << qtIncludePath +
"/QtGui" <<
header;
1191 proc.start(m_moc,
args);
1192 QVERIFY(proc.waitForFinished());
1194 QByteArray mocOut = proc.readAllStandardOutput();
1198 QString(
":43:1: warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
1200 QSKIP(
"Only tested on linux/gcc");
1204 void tst_Moc::ignoreOptionClashes()
1206 #ifdef MOC_CROSS_COMPILED
1207 QSKIP(
"Not tested when cross-compiled");
1209 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1213 const QString includeDir = m_sourceDirectory +
"/Test.framework/Headers";
1215 args <<
"--ignore-option-clashes" <<
"-pthread" <<
"-I" << includeDir <<
"-fno-builtin" <<
header;
1216 proc.start(m_moc,
args);
1217 bool finished = proc.waitForFinished();
1219 qWarning(
"waitForFinished failed. QProcess error: %d", (
int)proc.error());
1221 if (proc.exitCode() != 0) {
1222 qDebug() << proc.readAllStandardError();
1226 QByteArray mocOut = proc.readAllStandardOutput();
1230 gccArgs <<
"-c" <<
"-x" <<
"c++" <<
"-I" <<
".."
1231 <<
"-I" << qtIncludePath <<
"-I" << includeDir <<
"-o" <<
"/dev/null"
1232 <<
"-fPIC" <<
"-std=c++1z" <<
"-";
1233 proc.start(
"gcc", gccArgs);
1234 QVERIFY(proc.waitForStarted());
1236 proc.closeWriteChannel();
1238 QVERIFY(proc.waitForFinished());
1241 QSKIP(
"Only tested on linux/gcc");
1245 void tst_Moc::forgottenQInterface()
1247 #ifdef MOC_CROSS_COMPILED
1248 QSKIP(
"Not tested when cross-compiled");
1250 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1254 args <<
"-I" << qtIncludePath +
"/QtCore" <<
header;
1255 proc.start(m_moc,
args);
1256 QVERIFY(proc.waitForFinished());
1258 QByteArray mocOut = proc.readAllStandardOutput();
1262 QString(
":45:1: warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
1264 QSKIP(
"Only tested on linux/gcc");
1268 void tst_Moc::os9Newline()
1270 #if !defined(SKIP_NEWLINE_TEST)
1271 const QMetaObject &
mo = Os9Newlines::staticMetaObject;
1272 QVERIFY(
mo.indexOfSlot(
"testSlot()") != -1);
1282 void tst_Moc::winNewline()
1284 #if !defined(SKIP_NEWLINE_TEST)
1285 const QMetaObject &
mo = WinNewlines::staticMetaObject;
1286 QVERIFY(
mo.indexOfSlot(
"testSlot()") != -1);
1291 for (
int i = 0;
i <
data.count(); ++
i) {
1303 void tst_Moc::escapesInStringLiterals()
1305 const QMetaObject &
mo = StringLiterals::staticMetaObject;
1308 int idx =
mo.indexOfClassInfo(
"Test");
1312 QByteArray(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\x53"));
1315 idx =
mo.indexOfClassInfo(
"Test2");
1318 QByteArray(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123"));
1321 idx =
mo.indexOfClassInfo(
"Test3");
1324 QByteArray(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb"));
1327 void tst_Moc::frameworkSearchPath()
1329 #ifdef MOC_CROSS_COMPILED
1330 QSKIP(
"Not tested when cross-compiled");
1332 #if defined(Q_OS_UNIX) && QT_CONFIG(process)
1335 << m_sourceDirectory +
QStringLiteral(
"/interface-from-framework.h")
1339 proc.start(m_moc,
args);
1340 bool finished = proc.waitForFinished();
1342 qWarning(
"waitForFinished failed. QProcess error: %d", (
int)proc.error());
1344 if (proc.exitCode() != 0) {
1345 qDebug() << proc.readAllStandardError();
1350 QSKIP(
"Only tested/relevant on unixy platforms");
1354 void tst_Moc::cstyleEnums()
1356 const QMetaObject &
obj = CStyleEnums::staticMetaObject;
1371 void tst_Moc::templateGtGt()
1373 #ifdef MOC_CROSS_COMPILED
1374 QSKIP(
"Not tested when cross-compiled");
1376 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1379 QVERIFY(proc.waitForFinished());
1381 QByteArray mocOut = proc.readAllStandardOutput();
1386 QSKIP(
"Only tested on unix/gcc");
1390 void tst_Moc::defineMacroViaCmdline()
1392 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1399 proc.start(m_moc,
args);
1400 QVERIFY(proc.waitForFinished());
1403 QByteArray mocOut = proc.readAllStandardOutput();
1406 QSKIP(
"Only tested on unix/gcc");
1410 void tst_Moc::defineMacroViaForcedInclude()
1412 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1416 args <<
"--include" << m_sourceDirectory +
QLatin1String(
"/subdir/extradefines.h");
1419 proc.start(m_moc,
args);
1420 QVERIFY(proc.waitForFinished());
1423 QByteArray mocOut = proc.readAllStandardOutput();
1426 QSKIP(
"Only tested on unix/gcc");
1430 void tst_Moc::defineMacroViaForcedIncludeRelative()
1432 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1436 args <<
"--include" <<
QStringLiteral(
"extradefines.h") <<
"-I" + m_sourceDirectory +
"/subdir";
1439 proc.start(m_moc,
args);
1440 QVERIFY(proc.waitForFinished());
1443 QByteArray mocOut = proc.readAllStandardOutput();
1446 QSKIP(
"Only tested on unix/gcc");
1451 void tst_Moc::environmentIncludePaths_data()
1453 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1454 QTest::addColumn<QString>(
"cmdline");
1455 QTest::addColumn<QString>(
"varname");
1457 QTest::newRow(
"INCLUDE") <<
"--compiler-flavor=msvc" <<
"INCLUDE";
1459 QTest::newRow(
"CPATH2") <<
"--compiler-flavor=unix" <<
"CPATH";
1461 QTest::newRow(
"CPLUS_INCLUDE_PATH2") <<
"--compiler-flavor=unix" <<
"CPLUS_INCLUDE_PATH";
1465 void tst_Moc::environmentIncludePaths()
1467 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1472 if (!cmdline.isEmpty())
1480 env.
remove(
"CPLUS_INCLUDE_PATH");
1481 env.
insert(varname, m_sourceDirectory +
"/subdir");
1484 proc.setProcessEnvironment(env);
1485 proc.start(m_moc,
args);
1486 QVERIFY(proc.waitForFinished());
1489 QByteArray mocOut = proc.readAllStandardOutput();
1492 QSKIP(
"Only tested on unix/gcc");
1510 void tst_Moc::specifyMetaTagsFromCmdline() {
1514 const QJsonArray metaTagsUriList =
plugin.metaData().value(
"uri").toArray();
1524 QFAIL(
"Could not find plugin with IID 'test.meta.tags'");
1527 void tst_Moc::invokable()
1530 const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
1536 const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
1543 void tst_Moc::singleFunctionKeywordSignalAndSlot()
1546 const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
1553 const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
1560 const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
1569 void tst_Moc::qprivateslots()
1572 const QMetaObject *mobj = tst.metaObject();
1573 QVERIFY(mobj->indexOfSlot(
"_q_privateslot()") != -1);
1574 QVERIFY(mobj->indexOfMethod(
"method1()") != -1);
1590 Q_PRIVATE_PROPERTY(PrivatePropertyTest::d,
int zap READ zap WRITE setZap BINDABLE bindableZap)
1593 MyDPointer() : mConst(
"const"), mBar(0), mPlop(0) {}
1594 int bar() {
return mBar ; }
1596 int plop() {
return mPlop ; }
1598 int baz() {
return mBaz ; }
1600 QString blub()
const {
return mBlub; }
1602 int zap() {
return mZap; }
1603 void setZap(
int zap) { mZap = zap; }
1628 void tst_Moc::qprivateproperties()
1632 test.setProperty(
"foo", 1);
1635 test.setProperty(
"bar", 2);
1638 test.setProperty(
"plop", 3);
1641 test.setProperty(
"baz", 4);
1644 QMetaProperty zap = test.metaObject()->property(test.metaObject()->indexOfProperty(
"zap"));
1647 auto zapBindable = zap.
bindable(&test);
1648 QVERIFY(zapBindable.isBindable());
1651 void tst_Moc::warnOnPropertyWithoutREAD()
1653 #ifdef MOC_CROSS_COMPILED
1654 QSKIP(
"Not tested when cross-compiled");
1656 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1660 QVERIFY(proc.waitForFinished());
1662 QByteArray mocOut = proc.readAllStandardOutput();
1666 QString(
":36:1: warning: Property declaration foo has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.\n"));
1668 QSKIP(
"Only tested on unix/gcc");
1672 void tst_Moc::constructors()
1674 const QMetaObject *
mo = &CtorTestClass::staticMetaObject;
1712 QCOMPARE(
mo->indexOfConstructor(
"CtorTestClass(QObject*)"), 0);
1713 QCOMPARE(
mo->indexOfConstructor(
"CtorTestClass()"), 1);
1714 QCOMPARE(
mo->indexOfConstructor(
"CtorTestClass(QString)"), 2);
1715 QCOMPARE(
mo->indexOfConstructor(
"CtorTestClass2(QObject*)"), -1);
1716 QCOMPARE(
mo->indexOfConstructor(
"CtorTestClass(float,float)"), -1);
1720 QCOMPARE(o1->parent(), (QObject*)0);
1721 QVERIFY(qobject_cast<CtorTestClass*>(o1.data()) != 0);
1723 QObject *o2 =
mo->newInstance(
Q_ARG(QObject*, o1.data()));
1730 QCOMPARE(qobject_cast<CtorTestClass*>(o3.data())->m_str,
str);
1734 QObject *
o = QObject::staticMetaObject.newInstance();
1744 void tst_Moc::typenameWithUnsigned()
1747 const QMetaObject *mobj = tst.metaObject();
1748 QVERIFY(mobj->indexOfSlot(
"a(uint)") != -1);
1749 QVERIFY(mobj->indexOfSlot(
"b(uint)") != -1);
1750 QVERIFY(mobj->indexOfSlot(
"c(uint*)") != -1);
1751 QVERIFY(mobj->indexOfSlot(
"d(uint*)") != -1);
1752 QVERIFY(mobj->indexOfSlot(
"e(uint&)") != -1);
1753 QVERIFY(mobj->indexOfSlot(
"f(uint&)") != -1);
1754 QVERIFY(mobj->indexOfSlot(
"g(unsigned1)") != -1);
1755 QVERIFY(mobj->indexOfSlot(
"h(unsigned1)") != -1);
1756 QVERIFY(mobj->indexOfSlot(
"i(uint,unsigned1)") != -1);
1757 QVERIFY(mobj->indexOfSlot(
"j(unsigned1,uint)") != -1);
1758 QVERIFY(mobj->indexOfSlot(
"k(unsignedQImage)") != -1);
1759 QVERIFY(mobj->indexOfSlot(
"l(unsignedQImage)") != -1);
1762 void tst_Moc::warnOnVirtualSignal()
1764 #ifdef MOC_CROSS_COMPILED
1765 QSKIP(
"Not tested when cross-compiled");
1767 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1771 QVERIFY(proc.waitForFinished());
1773 QByteArray mocOut = proc.readAllStandardOutput();
1777 header +
QString(
":40:1: warning: Signals cannot be declared virtual\n"));
1779 QSKIP(
"Only tested on unix/gcc");
1802 int m_value, m_value2;
1805 void tst_Moc::QTBUG5590_dummyProperty()
1808 QCOMPARE(
o.property(
"value").toInt(), 85);
1809 QCOMPARE(
o.property(
"value2").toInt(), 40);
1810 o.setProperty(
"value", 32);
1812 o.setProperty(
"value2", 82);
1846 template<
typename T1,
typename T2>
1877 void tst_Moc::QTBUG12260_defaultTemplate()
1879 QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot(
"doSomething(QHash<QString,QVariant>)") != -1);
1880 QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot(
"doAnotherThing(bool,bool)") != -1);
1881 QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot(
"doSomethingElse(QSharedPointer<QVarLengthArray<QString,(16>>2)>>)") != -1);
1882 QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot(
"performSomething(QList<QList<QString>>,QHash<int,QList<QString>>)") != -1);
1885 void tst_Moc::notifyError()
1887 #ifdef MOC_CROSS_COMPILED
1888 QSKIP(
"Not tested when cross-compiled");
1890 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
1894 QVERIFY(proc.waitForFinished());
1896 QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
1897 QByteArray mocOut = proc.readAllStandardOutput();
1902 args <<
"-c" <<
"-x" <<
"c++" <<
"-I" <<
"."
1903 <<
"-I" << qtIncludePath <<
"-o" <<
"/dev/null" <<
"-fPIC" <<
"-std=c++1z" <<
"-";
1904 proc.start(
"gcc",
args);
1905 QVERIFY(proc.waitForStarted());
1907 proc.closeWriteChannel();
1909 QVERIFY(proc.waitForFinished());
1915 QSKIP(
"Only tested on linux/gcc");
1931 void tst_Moc::QTBUG17635_invokableAndProperty()
1940 QVERIFY(mc.metaObject()->indexOfProperty(
"numberOfEggs") != -1);
1941 QVERIFY(mc.metaObject()->indexOfProperty(
"numberOfChickens") != -1);
2033 void tst_Moc::revisions_T()
2035 int idx = T::staticMetaObject.indexOfProperty(
"prop1");
2037 idx = T::staticMetaObject.indexOfProperty(
"prop2");
2040 idx = T::staticMetaObject.indexOfProperty(
"prop514");
2044 idx = T::staticMetaObject.indexOfMethod(
"method1()");
2046 idx = T::staticMetaObject.indexOfMethod(
"method2()");
2049 idx = T::staticMetaObject.indexOfMethod(
"method60()");
2053 idx = T::staticMetaObject.indexOfSlot(
"slot1()");
2055 idx = T::staticMetaObject.indexOfSlot(
"slot2()");
2058 idx = T::staticMetaObject.indexOfSlot(
"slot61()");
2062 idx = T::staticMetaObject.indexOfSlot(
"slot3()");
2065 idx = T::staticMetaObject.indexOfSlot(
"slot4()");
2068 idx = T::staticMetaObject.indexOfSlot(
"slot512()");
2072 idx = T::staticMetaObject.indexOfSignal(
"signal1()");
2074 idx = T::staticMetaObject.indexOfSignal(
"signal2()");
2077 idx = T::staticMetaObject.indexOfSignal(
"signal62()");
2081 idx = T::staticMetaObject.indexOfSignal(
"signal3()");
2084 idx = T::staticMetaObject.indexOfSignal(
"signal4()");
2087 idx = T::staticMetaObject.indexOfSignal(
"signal515()");
2091 idx = T::staticMetaObject.indexOfEnumerator(
"TestEnum");
2092 QCOMPARE(T::staticMetaObject.enumerator(
idx).keyCount(), 2);
2097 void tst_Moc::revisions()
2099 revisions_T<VersionTest>();
2100 revisions_T<VersionTestNotify>();
2103 void tst_Moc::warnings_data()
2105 QTest::addColumn<QByteArray>(
"input");
2106 QTest::addColumn<QStringList>(
"args");
2107 QTest::addColumn<int>(
"exitCode");
2108 QTest::addColumn<QString>(
"expectedStdOut");
2109 QTest::addColumn<QString>(
"expectedStdErr");
2117 <<
QString(
"standard input:0:1: note: No relevant classes found. No output generated.");
2137 <<
QByteArray(
"class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
2140 <<
QString(
"IGNORE_ALL_STDOUT")
2141 <<
QString(
"standard input:1:1: warning: Property declaration x has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.");
2145 <<
QByteArray(
"class X : public QObject { Q_OBJECT Q_PROPERTY(int x READ x) Q_PROPERTY(int x READ y) };")
2148 <<
QString(
"IGNORE_ALL_STDOUT")
2149 <<
QString(
"standard input:1:1: warning: The property 'x' is defined multiple times in class X.");
2153 <<
QByteArray(
"class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
2156 <<
QString(
"IGNORE_ALL_STDOUT")
2157 <<
QString(
"standard input:1:1: warning: Property declaration x has neither an associated QProperty<> member, nor a READ accessor function nor an associated MEMBER variable. The property will be invalid.");
2161 <<
QByteArray(
"class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
2164 <<
QString(
"IGNORE_ALL_STDOUT")
2173 <<
QString(
"standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject");
2181 <<
QString(
"standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject");
2189 <<
QString(
"standard input:1:1: error: Class contains Q_OBJECT macro but does not inherit from QObject");
2192 <<
QByteArray(
"#define Foo(a, b)\n class X : public QObject { Q_OBJECT }; \n Foo(a) \n Foo(a,b,c) \n")
2195 <<
QString(
"IGNORE_ALL_STDOUT")
2199 <<
QByteArray(
"class X : public QObject \n { \n public slots: \n void foo() {} \n };")
2203 <<
QString(
"standard input:5:1: error: Class declaration lacks Q_OBJECT macro.");
2205 QTest::newRow(
"Namespace declaration lacks Q_NAMESPACE macro.")
2206 <<
QByteArray(
"namespace X {\nQ_CLASSINFO(\"key\",\"value\")\nenum class MyEnum {Key1 = 1}\nQ_ENUMS(MyEnum)\n}\n")
2210 <<
QString(
"standard input:1:1: error: Namespace declaration lacks Q_NAMESPACE macro.");
2213 <<
QByteArray(
"namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM(MyEnum)\n}\n")
2217 <<
QString(
"standard input:5:1: error: Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead");
2220 <<
QByteArray(
"namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG(MyEnum)\n}\n")
2224 <<
QString(
"standard input:5:1: error: Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead");
2227 <<
QByteArray(
"class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM_NS(MyEnum)\n};\n")
2231 <<
QString(
"standard input:5:1: error: Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead");
2234 <<
QByteArray(
"class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG_NS(MyEnum)\n};\n")
2238 <<
QString(
"standard input:5:1: error: Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead");
2241 <<
QByteArray(
"#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45, 42, 39);")
2244 <<
QString(
"IGNORE_ALL_STDOUT")
2245 <<
QString(
":2:1: error: '#' is not followed by a macro parameter");
2247 QTest::newRow(
"QTBUG-46210: crash on invalid macro invocation")
2248 <<
QByteArray(
"#define Foo(a, b, c) a b c #a #b #c a##b##c\n Foo(45);")
2251 <<
QString(
"IGNORE_ALL_STDOUT")
2252 <<
QString(
":2:1: error: Macro invoked with too few parameters for a use of '#'");
2258 <<
QString(
"IGNORE_ALL_STDOUT")
2259 <<
QString(
":-1:1: error: Unexpected character in macro argument list.");
2262 <<
QByteArray(
"class X : public QObject { Q_OBJECT };")
2265 <<
QString(
"IGNORE_ALL_STDOUT")
2266 <<
QStringLiteral(
"Warning: Failed to resolve include \"doesnotexist.h\" for moc file <standard input>");
2269 <<
QByteArray(
"class M{(})F<{}d000000000000000#0")
2273 <<
QString(
"standard input:1:1: note: No relevant classes found. No output generated.");
2276 <<
QByteArray(
"class X { \n Q_PLUGIN_METADATA(FILE \"does.not.exists\") \n };")
2280 <<
QString(
"standard input:2:1: error: Plugin Metadata file \"does.not.exists\" does not exist. Declaration will be ignored");
2283 <<
QByteArray(
"class X { \n public slots: \n auto fun() { return 1; } };")
2287 <<
QString(
"standard input:3:1: error: Function declared with auto as return type but missing trailing return type. Return type deduction is not supported.");
2289 QTest::newRow(
"Auto-declared, volatile auto as trailing return type")
2290 <<
QByteArray(
"class X { \n public slots: \n auto fun() -> volatile auto { return 1; } };")
2294 <<
QString(
"standard input:3:1: error: Function declared with auto as return type but missing trailing return type. Return type deduction is not supported.");
2299 QTest::newRow(
"Auto-declared, decltype in trailing return type")
2300 <<
QByteArray(
"class X { \n public slots: \n auto fun() -> decltype(0+1) { return 1; } };")
2304 <<
QString(
"standard input:3:1: error: Parse error at \"decltype\"");
2308 <<
QByteArray(
"class X { \n Q_PLUGIN_METADATA(FILE \".\") \n };")
2312 <<
QString(
"standard input:2:1: error: Plugin Metadata file \".\" could not be opened: file to open is a directory");
2316 void tst_Moc::warnings()
2318 #ifdef MOC_CROSS_COMPILED
2319 QSKIP(
"Not tested when cross-compiled");
2330 expectedStdErr.replace(lineNumberRe,
"(\\1:\\2)");
2333 #if QT_CONFIG(process)
2337 env.
insert(
"QT_MESSAGE_PATTERN",
"no qDebug or qWarning please");
2338 proc.setProcessEnvironment(env);
2340 proc.start(m_moc,
args);
2341 QVERIFY(proc.waitForStarted());
2345 proc.closeWriteChannel();
2347 QVERIFY(proc.waitForFinished());
2349 QCOMPARE(proc.exitCode(), exitCode);
2350 QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
2353 if (expectedStdOut !=
"IGNORE_ALL_STDOUT")
2357 QSKIP(
"Only tested if QProcess is available");
2373 void tst_Moc::privateClass()
2375 QCOMPARE(PrivateClass::staticMetaObject.indexOfConstructor(
"PrivateClass()"), 0);
2376 QVERIFY(PrivateClass::staticMetaObject.indexOfSignal(
"someSignal()") > 0);
2379 void tst_Moc::cxx11Enums_data()
2381 QTest::addColumn<const QMetaObject *>(
"meta");
2382 QTest::addColumn<QByteArray>(
"typeName");
2383 QTest::addColumn<QByteArray>(
"enumName");
2384 QTest::addColumn<char>(
"prefix");
2385 QTest::addColumn<bool>(
"isScoped");
2387 const QMetaObject *meta1 = &CXX11Enums::staticMetaObject;
2388 const QMetaObject *meta2 = &CXX11Enums2::staticMetaObject;
2405 void tst_Moc::cxx11Enums()
2407 QFETCH(
const QMetaObject *,meta);
2408 QCOMPARE(meta->enumeratorOffset(), 0);
2419 QCOMPARE(meta->enumerator(
idx).enclosingMetaObject(), meta);
2423 QCOMPARE(meta->enumerator(
idx).enumName(), enumName.constData());
2424 bool isFlag = meta->enumerator(
idx).isFlag();
2425 for (
int i = 0;
i < 4;
i++) {
2427 const int value = isFlag ? (1 <<
i) :
i;
2431 QCOMPARE(meta->enumerator(
idx).isScoped(), isScoped);
2434 void tst_Moc::cxx11TrailingReturn()
2437 const QMetaObject *mobj = retClass.metaObject();
2438 QVERIFY(mobj->indexOfSlot(
"fun()") != -1);
2439 QVERIFY(mobj->indexOfSlot(
"arguments(int,char)") != -1);
2440 QVERIFY(mobj->indexOfSlot(
"inlineFunc(int)") != -1);
2441 QVERIFY(mobj->indexOfSlot(
"constRefReturn()") != -1);
2442 QVERIFY(mobj->indexOfSlot(
"constConstRefReturn()") != -1);
2443 QVERIFY(mobj->indexOfSignal(
"trailingSignalReturn(int)") != -1);
2446 void tst_Moc::returnRefs()
2449 const QMetaObject *mobj = tst.metaObject();
2450 QVERIFY(mobj->indexOfMethod(
"myInvokableReturningRef()") != -1);
2451 QVERIFY(mobj->indexOfMethod(
"myInvokableReturningConstRef()") != -1);
2456 void tst_Moc::memberProperties_data()
2458 QTest::addColumn<int>(
"object");
2459 QTest::addColumn<QString>(
"property");
2460 QTest::addColumn<QString>(
"signal");
2461 QTest::addColumn<QString>(
"writeValue");
2462 QTest::addColumn<bool>(
"expectedWriteResult");
2463 QTest::addColumn<QString>(
"expectedReadResult");
2468 << 0 <<
"member1" <<
"" <<
"abc" <<
true <<
"abc";
2470 << 0 <<
"member2" <<
"" <<
"def" <<
true <<
"def";
2472 << 0 <<
"member3" <<
"" <<
"ghi" <<
true <<
"ghi";
2474 << 0 <<
"member4" <<
"member4Changed()" <<
"lmn" <<
true <<
"lmn";
2476 << 0 <<
"member5" <<
"member5Changed(const QString&)" <<
"opq" <<
true <<
"opq";
2478 << 0 <<
"member6" <<
"" <<
"test" <<
false <<
"const";
2480 << 1 <<
"blub" <<
"" <<
"abc" <<
true <<
"abc";
2482 << 1 <<
"blub2" <<
"" <<
"def" <<
true <<
"def";
2483 QTest::newRow(
"private MEMBER property with WRITE function")
2484 << 1 <<
"blub3" <<
"" <<
"ghi" <<
true <<
"ghi";
2486 << 1 <<
"blub4" <<
"blub4Changed()" <<
"jkl" <<
true <<
"jkl";
2488 << 1 <<
"blub5" <<
"blub5Changed(const QString&)" <<
"mno" <<
true <<
"mno";
2490 << 1 <<
"blub6" <<
"" <<
"test" <<
false <<
"const";
2492 << 0 <<
"sub1" <<
"" <<
"helloSub1" <<
true <<
"helloSub1";
2494 << 0 <<
"sub2" <<
"" <<
"helloSub2" <<
true <<
"helloSub2";
2497 void tst_Moc::memberProperties()
2503 QFETCH(
bool, expectedWriteResult);
2506 QObject *pObj = (
object == 0) ?
this :
static_cast<QObject*
>(pPPTest);
2515 int index = pObj->metaObject()->indexOfProperty(
property.toLatin1().constData());
2519 QCOMPARE(prop.
write(pObj, writeValue), expectedWriteResult);
2535 QCOMPARE(prop.
write(pObj, writeValue), expectedWriteResult);
2548 void tst_Moc::memberProperties2()
2552 QCOMPARE(
o.property(
"member").toInt(), 442);
2553 QVERIFY(
o.setProperty(
"member", 6666));
2656 void tst_Moc::privateSignalConnection()
3027 void tst_Moc::finalClasses_data()
3029 QTest::addColumn<QString>(
"className");
3030 QTest::addColumn<QString>(
"expected");
3032 QTest::newRow(
"FinalTestClassQt") << FinalTestClassQt::staticMetaObject.className() <<
"FinalTestClassQt";
3033 QTest::newRow(
"ExportedFinalTestClassQt") << ExportedFinalTestClassQt::staticMetaObject.className() <<
"ExportedFinalTestClassQt";
3034 QTest::newRow(
"ExportedFinalTestClassQtX") << ExportedFinalTestClassQtX::staticMetaObject.className() <<
"ExportedFinalTestClassQtX";
3036 QTest::newRow(
"FinalTestClassCpp11") << FinalTestClassCpp11::staticMetaObject.className() <<
"FinalTestClassCpp11";
3037 QTest::newRow(
"ExportedFinalTestClassCpp11") << ExportedFinalTestClassCpp11::staticMetaObject.className() <<
"ExportedFinalTestClassCpp11";
3038 QTest::newRow(
"ExportedFinalTestClassCpp11X") << ExportedFinalTestClassCpp11X::staticMetaObject.className() <<
"ExportedFinalTestClassCpp11X";
3040 QTest::newRow(
"SealedTestClass") << SealedTestClass::staticMetaObject.className() <<
"SealedTestClass";
3041 QTest::newRow(
"ExportedSealedTestClass") << ExportedSealedTestClass::staticMetaObject.className() <<
"ExportedSealedTestClass";
3042 QTest::newRow(
"ExportedSealedTestClassX") << ExportedSealedTestClassX::staticMetaObject.className() <<
"ExportedSealedTestClassX";
3045 void tst_Moc::finalClasses()
3053 void tst_Moc::explicitOverrideControl_data()
3055 QTest::addColumn<const QMetaObject*>(
"mo");
3057 #define ADD(x) QTest::newRow(#x) << &x::staticMetaObject
3069 void tst_Moc::explicitOverrideControl()
3074 QCOMPARE(
mo->indexOfMethod(
"pureSlot0()"),
mo->methodOffset() + 0);
3075 QCOMPARE(
mo->indexOfMethod(
"pureSlot1()"),
mo->methodOffset() + 1);
3076 QCOMPARE(
mo->indexOfMethod(
"pureSlot2()"),
mo->methodOffset() + 2);
3077 QCOMPARE(
mo->indexOfMethod(
"pureSlot3()"),
mo->methodOffset() + 3);
3079 QCOMPARE(
mo->indexOfMethod(
"pureSlot4()"),
mo->methodOffset() + 4);
3080 QCOMPARE(
mo->indexOfMethod(
"pureSlot5()"),
mo->methodOffset() + 5);
3081 QCOMPARE(
mo->indexOfMethod(
"pureSlot6()"),
mo->methodOffset() + 6);
3082 QCOMPARE(
mo->indexOfMethod(
"pureSlot7()"),
mo->methodOffset() + 7);
3083 QCOMPARE(
mo->indexOfMethod(
"pureSlot8()"),
mo->methodOffset() + 8);
3084 QCOMPARE(
mo->indexOfMethod(
"pureSlot9()"),
mo->methodOffset() + 9);
3105 void tst_Moc::overloadedAddressOperator()
3184 explicit NamespacedQObject2(QObject *
parent =
nullptr)
3221 Q_PROPERTY(QObject*
object READ
object CONSTANT)
3335 void tst_Moc::autoPropertyMetaTypeRegistration()
3339 static const int numPropertiesUnderTest = 15;
3341 propertyMetaTypeIds.
reserve(numPropertiesUnderTest);
3343 const QMetaObject *
metaObject = aro.metaObject();
3355 << QMetaType::QObjectStar
3356 << qMetaTypeId<CustomQObject *>()
3357 << qMetaTypeId<QSharedPointer<CustomQObject>>()
3362 << qMetaTypeId<CustomQObjectStar>() << qMetaTypeId<SomeNamespace::NamespacedQObject *>()
3363 << qMetaTypeId<SomeNamespace::NamespacedNonQObject>();
3365 QCOMPARE(propertyMetaTypeIds, expectedMetaTypeIds);
3368 template<
typename T>
3374 template<
typename T>
3380 void tst_Moc::autoMethodArgumentMetaTypeRegistration()
3386 const QMetaObject *
metaObject = aro.metaObject();
3390 while (i < metaObject->methodCount()) {
3400 #define TYPE_LOOP(TYPE) \
3402 const QMetaMethod method = metaObject->method(i); \
3403 for (int j = 0; j < method.parameterCount(); ++j) \
3404 methodArgMetaTypeIds.append(method.parameterType(j)); \
3405 QVERIFY(method.invoke(&aro, Q_ARG(TYPE, DefaultConstructor<TYPE>::construct()))); \
3409 #define FOR_EACH_SLOT_ARG_TYPE(F) \
3411 F(CustomQObject2 *) \
3412 F(QSharedPointer<CustomQObject2>) \
3413 F(QWeakPointer<CustomQObject2>) \
3414 F(QPointer<CustomQObject2>) \
3416 F(QList<QVariant>) \
3417 F(QList<CustomQObject2 *>) \
3418 F(QList<QList<int>>) \
3419 F(QList<QList<CustomQObject2 *>>) \
3420 F(CustomQObject2::Number) \
3421 F(CustomQObject2Star) \
3422 F(SomeNamespace2::NamespacedQObject2 *) \
3423 F(SomeNamespace2::NamespacedNonQObject2)
3430 #undef FOR_EACH_SLOT_ARG_TYPE
3433 << QMetaType::QObjectStar << qMetaTypeId<CustomQObject2 *>()
3434 << qMetaTypeId<QSharedPointer<CustomQObject2>>()
3439 << qMetaTypeId<CustomQObject2::Number>() << qMetaTypeId<CustomQObject2Star>()
3440 << qMetaTypeId<SomeNamespace2::NamespacedQObject2 *>()
3441 << qMetaTypeId<SomeNamespace2::NamespacedNonQObject2>();
3443 QCOMPARE(methodArgMetaTypeIds, expectedMetaTypeIds);
3450 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3458 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3466 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3474 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3482 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3490 for (
int j = 0;
j <
method.parameterCount(); ++
j)
3497 << QMetaType::Int << qMetaTypeId<CustomObject3>() << qMetaTypeId<CustomObject4>()
3498 << QMetaType::Int << qMetaTypeId<CustomObject5>() << qMetaTypeId<CustomObject6>()
3499 << qMetaTypeId<CustomObject7>() << QMetaType::Int << qMetaTypeId<CustomObject8>()
3500 << QMetaType::Int << qMetaTypeId<CustomObject9>() << qMetaTypeId<CustomObject10>()
3501 << QMetaType::Int << qMetaTypeId<CustomObject11>() <<
QMetaType::Int;
3503 QCOMPARE(methodMultiArgMetaTypeIds, expectedMultiMetaTypeIds);
3508 void tst_Moc::autoSignalSpyMetaTypeRegistration()
3514 const QMetaObject *
metaObject = aro.metaObject();
3528 void tst_Moc::parseDefines()
3530 const QMetaObject *
mo = &PD_NAMESPACE::PD_CLASSNAME::staticMetaObject;
3532 QVERIFY(
mo->indexOfSlot(
"voidFunction()") != -1);
3534 int index =
mo->indexOfSlot(
"stringMethod()");
3538 index =
mo->indexOfSlot(
"combined1()");
3541 index =
mo->indexOfSlot(
"combined2()");
3544 index =
mo->indexOfSlot(
"combined3()");
3547 index =
mo->indexOfSlot(
"combined4(int,int)");
3550 index =
mo->indexOfSlot(
"combined5()");
3553 index =
mo->indexOfSlot(
"combined6()");
3556 index =
mo->indexOfSlot(
"vararg1()");
3558 index =
mo->indexOfSlot(
"vararg2(int)");
3560 index =
mo->indexOfSlot(
"vararg3(int,int)");
3562 index =
mo->indexOfSlot(
"vararg4()");
3564 index =
mo->indexOfSlot(
"vararg5(int)");
3566 index =
mo->indexOfSlot(
"vararg6(int,int)");
3569 index =
mo->indexOfSlot(
"INNERFUNCTION(int)");
3571 index =
mo->indexOfSlot(
"inner_expanded(int)");
3573 index =
mo->indexOfSlot(
"expanded_method(int)");
3576 index =
mo->indexOfSlot(
"conditionSlot()");
3580 for (
int i = 0;
i <
mo->classInfoCount(); ++
i) {
3597 index =
mo->indexOfSlot(
"PD_DEFINE_ITSELF_SUFFIX(int)");
3600 index =
mo->indexOfSignal(
"cmdlineSignal(QMap<int,int>)");
3603 index =
mo->indexOfSignal(
"signalQTBUG55853()");
3607 void tst_Moc::preprocessorOnly()
3609 #ifdef MOC_CROSS_COMPILED
3610 QSKIP(
"Not tested when cross-compiled");
3612 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
3615 QVERIFY(proc.waitForFinished());
3617 QByteArray mocOut = proc.readAllStandardOutput();
3623 QSKIP(
"Only tested on unix/gcc");
3628 void tst_Moc::unterminatedFunctionMacro()
3630 #ifdef MOC_CROSS_COMPILED
3631 QSKIP(
"Not tested when cross-compiled");
3633 #if defined(Q_OS_UNIX) && defined(Q_CC_GNU) && QT_CONFIG(process)
3636 QVERIFY(proc.waitForFinished());
3639 QByteArray errorOutput = proc.readAllStandardError();
3643 QSKIP(
"Only tested on linux/gcc");
3663 void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself()
3665 const QMetaObject *
mo = &QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::staticMetaObject;
3666 const auto *objects =
mo->d.relatedMetaObjects;
3696 return m_enumProperty;
3700 m_enumProperty =
arg;
3707 void tst_Moc::writeEnumFromUnrelatedClass()
3710 QString enumValueAsString(
"UnrelatedValue");
3711 obj.setProperty(
"enumProperty", enumValueAsString);
3717 void tst_Moc::relatedMetaObjectsWithinNamespaces()
3719 const QMetaObject *relatedMo = &QTBUG_2151::A::staticMetaObject;
3721 const QMetaObject *testMo = &QTBUG_2151::B::staticMetaObject;
3722 QVERIFY(testMo->d.relatedMetaObjects);
3723 QCOMPARE(testMo->d.relatedMetaObjects[0], relatedMo);
3726 void tst_Moc::relatedMetaObjectsInGadget()
3728 const QMetaObject *relatedMo = &QTBUG_35657::A::staticMetaObject;
3730 const QMetaObject *testMo = &QTBUG_35657::B::staticMetaObject;
3731 QVERIFY(testMo->d.relatedMetaObjects);
3732 QCOMPARE(testMo->d.relatedMetaObjects[0], relatedMo);
3735 void tst_Moc::relatedMetaObjectsNameConflict_data()
3738 QTest::addColumn<const QMetaObject*>(
"dependingObject");
3739 QTest::addColumn<QMetaObjects>(
"relatedMetaObjects");
3742 const QMetaObject *n1gadget = &NS1::Gadget::staticMetaObject;
3743 const QMetaObject *n1object = &NS1::Object::staticMetaObject;
3744 const QMetaObject *n1nestedGadget = &NS1::Nested::Gadget::staticMetaObject;
3745 const QMetaObject *n1nestedObject = &NS1::Nested::Object::staticMetaObject;
3747 const QMetaObject *n2gadget = &NS2::Gadget::staticMetaObject;
3748 const QMetaObject *n2object = &NS2::Object::staticMetaObject;
3749 const QMetaObject *n2nestedGadget = &NS2::Nested::Gadget::staticMetaObject;
3750 const QMetaObject *n2nestedObject = &NS2::Nested::Object::staticMetaObject;
3752 QTest::newRow(
"N1::dependingObject") << &NS1::DependingObject::staticMetaObject
3753 << (QMetaObjects() << n1gadget << n1object);
3754 QTest::newRow(
"N2::dependingObject") << &NS2::DependingObject::staticMetaObject
3755 << (QMetaObjects() << n2gadget << n2object);
3756 QTest::newRow(
"N1::dependingNestedObject") << &NS1::DependingNestedObject::staticMetaObject
3757 << (QMetaObjects() << n1nestedObject);
3758 QTest::newRow(
"N2::dependingNestedObject") << &NS2::DependingNestedObject::staticMetaObject
3759 << (QMetaObjects() << n2nestedObject);
3760 QTest::newRow(
"N1::dependingNestedGadget") << &NS1::DependingNestedGadget::staticMetaObject
3761 << (QMetaObjects() << n1nestedGadget);
3762 QTest::newRow(
"N2::dependingNestedGadget") << &NS2::DependingNestedGadget::staticMetaObject
3763 << (QMetaObjects() << n2nestedGadget);
3766 void tst_Moc::relatedMetaObjectsNameConflict()
3769 QFETCH(
const QMetaObject*, dependingObject);
3770 QFETCH(QMetaObjects, relatedMetaObjects);
3774 const auto *
i = dependingObject->d.relatedMetaObjects;
3781 foreach (
const QMetaObject *
mo, relatedMetaObjects)
3785 QCOMPARE(dependency.
size(), relatedMetaObjects.size());
3791 #define Macro(F) F " " F
3792 Q_CLASSINFO(
Macro(
"String"),
Macro(
"Literal"))
3796 Q_CLASSINFO(
"String" Macro(
"!"),
"Literal" Macro(
"!"))
3797 Q_CLASSINFO(
Macro("!") "String",
Macro("!") "Literal")
3806 void tst_Moc::strignLiteralsInMacroExtension()
3808 const QMetaObject *mobj = &StringLiteralsInMacroExtension::staticMetaObject;
3809 QCOMPARE(mobj->classInfoCount(), 5);
3811 QCOMPARE(mobj->classInfo(0).name(),
"String String");
3812 QCOMPARE(mobj->classInfo(0).value(),
"Literal Literal");
3814 QCOMPARE(mobj->classInfo(1).name(),
"String!");
3815 QCOMPARE(mobj->classInfo(1).value(),
"Literal!");
3817 QCOMPARE(mobj->classInfo(2).name(),
"!String");
3818 QCOMPARE(mobj->classInfo(2).value(),
"!Literal");
3820 QCOMPARE(mobj->classInfo(3).name(),
"Stringfoo");
3821 QCOMPARE(mobj->classInfo(3).value(),
"Literalfoo");
3823 QCOMPARE(mobj->classInfo(4).name(),
"fooString");
3824 QCOMPARE(mobj->classInfo(4).value(),
"fooLiteral");
3831 #define repeat2(V) V V
3832 #define repeat4(V) repeat2(V) repeat2(V)
3833 #define repeat8(V) repeat4(V) repeat4(V)
3834 #define repeat16(V) repeat8(V) repeat8(V)
3835 #define repeat32(V) repeat16(V) repeat16(V)
3836 #define repeat64(V) repeat32(V) repeat32(V)
3837 #define repeat128(V) repeat64(V) repeat64(V)
3838 #define repeat256(V) repeat128(V) repeat128(V)
3839 #define repeat512(V) repeat256(V) repeat256(V)
3840 #define repeat1024(V) repeat512(V) repeat512(V)
3841 #define repeat2048(V) repeat1024(V) repeat1024(V)
3842 #define repeat4096(V) repeat2048(V) repeat2048(V)
3843 #define repeat8192(V) repeat4096(V) repeat4096(V)
3844 #define repeat16384(V) repeat8192(V) repeat8192(V)
3845 #define repeat32768(V) repeat16384(V) repeat16384(V)
3846 #define repeat65534(V) repeat32768(V) repeat16384(V) repeat8192(V) repeat4096(V) repeat2048(V) repeat1024(V) repeat512(V) repeat256(V) repeat128(V) repeat64(V) repeat32(V) repeat16(V) repeat8(V) repeat4(V) repeat2(V)
3848 Q_CLASSINFO(repeat65534(
"n"), repeat65534(
"i"))
3849 Q_CLASSINFO(repeat65534("
e"), repeat65534("
r"))
3851 Q_CLASSINFO(":", ")")
3871 void tst_Moc::unnamedNamespaceObjectsAndGadgets()
3876 GadgetInUnnamedNS gadget(21, 42);
3879 gadget.staticMetaObject.property(0).writeOnGadget(&gadget, 12);
3880 gadget.staticMetaObject.property(1).writeOnGadget(&gadget, 24);
3886 ObjectInUnnamedNS
object;
3887 QObject *qObject = &
object;
3888 QCOMPARE(
static_cast<ObjectInUnnamedNS *
>(qObject),
3889 qobject_cast<ObjectInUnnamedNS *>(qObject));
3893 void tst_Moc::veryLongStringData()
3895 const QMetaObject *mobj = &VeryLongStringData::staticMetaObject;
3896 QCOMPARE(mobj->classInfoCount(), 4);
3898 QCOMPARE(mobj->classInfo(0).name()[0],
'n');
3899 QCOMPARE(mobj->classInfo(0).value()[0],
'i');
3900 QCOMPARE(mobj->classInfo(1).name()[0],
'e');
3901 QCOMPARE(mobj->classInfo(1).value()[0],
'r');
3902 QCOMPARE(mobj->classInfo(2).name()[0],
'o');
3903 QCOMPARE(mobj->classInfo(2).value()[0],
'b');
3904 QCOMPARE(mobj->classInfo(3).name()[0],
':');
3905 QCOMPARE(mobj->classInfo(3).value()[0],
')');
3907 QCOMPARE(
strlen(mobj->classInfo(0).name()),
static_cast<size_t>(65534));
3908 QCOMPARE(
strlen(mobj->classInfo(0).value()),
static_cast<size_t>(65534));
3909 QCOMPARE(
strlen(mobj->classInfo(1).name()),
static_cast<size_t>(65534));
3910 QCOMPARE(
strlen(mobj->classInfo(1).value()),
static_cast<size_t>(65534));
3911 QCOMPARE(
strlen(mobj->classInfo(2).name()),
static_cast<size_t>(32768));
3912 QCOMPARE(
strlen(mobj->classInfo(2).value()),
static_cast<size_t>(32768));
3913 QCOMPARE(
strlen(mobj->classInfo(3).name()),
static_cast<size_t>(1));
3914 QCOMPARE(
strlen(mobj->classInfo(3).value()),
static_cast<size_t>(1));
3917 void tst_Moc::gadgetHierarchy()
3919 QCOMPARE(NonGadgetParent::Derived::staticMetaObject.superClass(),
static_cast<const QMetaObject*
>(
nullptr));
3920 QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject);
3921 QCOMPARE(GrandParentGadget::CRTPDerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject);
3924 void tst_Moc::optionsFileError_data()
3926 QTest::addColumn<QString>(
"optionsArgument");
3931 void tst_Moc::optionsFileError()
3933 #ifdef MOC_CROSS_COMPILED
3934 QSKIP(
"Not tested when cross-compiled");
3936 #if QT_CONFIG(process)
3942 QVERIFY(
p.readAllStandardOutput().isEmpty());
3968 void tst_Moc::testQNamespace()
3970 QCOMPARE(TestQNamespace::staticMetaObject.enumeratorCount(), 4);
3971 checkEnum(TestQNamespace::staticMetaObject.enumerator(0),
"TestEnum1",
3972 {{
"Key1", 11}, {
"Key2", 12}});
3973 checkEnum(TestQNamespace::staticMetaObject.enumerator(1),
"TestEnum2",
3974 {{
"Key1", 17}, {
"Key2", 18}});
3975 checkEnum(TestQNamespace::staticMetaObject.enumerator(2),
"TestFlag1",
3976 {{
"None", 0}, {
"Flag1", 1}, {
"Flag2", 2}, {
"Any", 1 | 2}});
3977 checkEnum(TestQNamespace::staticMetaObject.enumerator(3),
"TestFlag2",
3978 {{
"None", 0}, {
"Flag1", 4}, {
"Flag2", 8}, {
"Any", 4 | 8}});
3980 QCOMPARE(TestQNamespace::TestGadget::staticMetaObject.enumeratorCount(), 2);
3981 checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(0),
"TestGEnum1",
3982 {{
"Key1", 13}, {
"Key2", 14}});
3983 checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(1),
"TestGEnum2",
3984 {{
"Key1", 23}, {
"Key2", 24}});
3986 QCOMPARE(TestQNamespace::TestGadgetExport::staticMetaObject.enumeratorCount(), 2);
3987 checkEnum(TestQNamespace::TestGadgetExport::staticMetaObject.enumerator(0),
"TestGeEnum1",
3988 {{
"Key1", 20}, {
"Key2", 21}});
3989 checkEnum(TestQNamespace::TestGadgetExport::staticMetaObject.enumerator(1),
"TestGeEnum2",
3990 {{
"Key1", 23}, {
"Key2", 24}});
3992 QMetaEnum meta = QMetaEnum::fromType<TestQNamespace::TestEnum1>();
3994 QCOMPARE(meta.name(),
"TestEnum1");
3995 QCOMPARE(meta.enclosingMetaObject(), &TestQNamespace::staticMetaObject);
3998 QCOMPARE(TestExportNamespace::staticMetaObject.enumeratorCount(), 1);
3999 checkEnum(TestExportNamespace::staticMetaObject.enumerator(0),
"MyEnum",
4000 {{
"Key1", 0}, {
"Key2", 1}});
4002 QCOMPARE(FooNamespace::staticMetaObject.enumeratorCount(), 1);
4003 QCOMPARE(FooNamespace::FooNestedNamespace::staticMetaObject.enumeratorCount(), 2);
4004 QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1);
4008 QCOMPARE(prop.
userType(), QMetaType::fromType<FooNamespace::Enum1>().id());
4012 void tst_Moc::cxx17Namespaces()
4015 "CXX17Namespace::A::B::C::D");
4016 QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumeratorCount(), 1);
4017 QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumerator(0).
name(),
"NamEn");
4018 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().
name(),
"NamEn");
4019 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().keyCount(), 1);
4020 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().
value(0), 4);
4022 QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.
className(),
4023 "CXX17Namespace::A::B::C::D::ClassInNamespace");
4024 QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumeratorCount(), 1);
4025 QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumerator(0).
name(),
"GadEn");
4026 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().
name(),
"GadEn");
4027 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().keyCount(), 1);
4028 QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().
value(0), 3);
4031 void tst_Moc::cxxAttributes()
4033 auto so = CppAttribute::staticMetaObject;
4034 QCOMPARE(so.className(),
"CppAttribute");
4036 QVERIFY(so.indexOfSignal(
"deprecatedSignal") != 1);
4037 for (
auto a: {
"deprecatedSlot",
"deprecatedSlot2",
"deprecatedReason",
"deprecatedReasonWithLBRACK",
4038 "deprecatedReasonWith2LBRACK",
"deprecatedReasonWithRBRACK",
"deprecatedReasonWith2RBRACK",
4040 #if !defined(_MSC_VER) || _MSC_VER >= 1912
4041 ,
"noreturnSlot",
"noreturnSlot2",
"returnInt",
"noreturnDeprecatedSlot",
4048 QCOMPARE(TestQNamespaceDeprecated::staticMetaObject.enumeratorCount(), 2);
4049 checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(0),
"TestEnum1",
4050 {{
"Key1", 11}, {
"Key2", 12}, {
"Key3", 13}, {
"Key4", 14}, {
"Key5", 15}, {
"Key6", 16},
4052 checkEnum(TestQNamespaceDeprecated::staticMetaObject.enumerator(1),
"TestFlag1",
4053 {{
"None", 0}, {
"Flag1", 1}, {
"Flag2", 2}, {
"Flag3", 3}, {
"Any", 1 | 2 | 3}});
4055 QCOMPARE(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumeratorCount(), 1);
4056 checkEnum(TestQNamespaceDeprecated::TestGadget::staticMetaObject.enumerator(0),
"TestGEnum1",
4057 {{
"Key1", 13}, {
"Key2", 14}, {
"Key3", 15}});
4059 QMetaEnum meta = QMetaEnum::fromType<TestQNamespaceDeprecated::TestEnum1>();
4061 QCOMPARE(meta.name(),
"TestEnum1");
4062 QCOMPARE(meta.enclosingMetaObject(), &TestQNamespaceDeprecated::staticMetaObject);
4066 void tst_Moc::mocJsonOutput()
4090 #if defined(Q_OS_UNIX)
4095 if (!actualFile.
open())
4096 return "Error opening actual temp file";
4097 actualFile.
write(actualStr);
4101 if (!expectedFile.
open())
4102 return "Error opening expected temp file";
4103 expectedFile.
write(expectedStr);
4104 expectedFile.
flush();
4107 diffProc.setProgram(
"diff");
4110 if (!diffProc.waitForStarted())
4111 return "Error waiting for diff process to start.";
4112 if (!diffProc.waitForFinished())
4113 return "Error waiting for diff process to finish.";
4114 return diffProc.readAllStandardOutput();
4116 return "Cannot launch diff. Please check allmocs.json and allmocs_baseline.json on disk.";
4120 QVERIFY2(actualOutput == expectedOutput, showPotentialDiff(actualOutput, expectedOutput).constData());
4139 void tst_Moc::mocInclude()
4158 void tst_Moc::requiredProperties()
4160 QMetaObject
mo = RequiredTest::staticMetaObject;
4194 void tst_Moc::qpropertyMembers()
4196 const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject;
4209 prop.
write(&instance, 42);
4225 void tst_Moc::observerMetaCall()
4227 const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject;
4233 int observerCallCount = 0;
4236 auto observer = [&observerCallCount]() {
4237 ++observerCallCount;
4240 auto bindable = prop.
bindable(&instance);
4241 QVERIFY(bindable.isBindable());
4243 auto handler = bindable.onValueChanged(observer);
4254 void tst_Moc::setQPRopertyBinding()
4256 const auto metaObject = &ClassWithQPropertyMembers::staticMetaObject;
4262 bool bindingCalled =
false;
4264 bindingCalled =
true;
4268 auto bindable = prop.
bindable(&instance);
4269 QVERIFY(bindable.isBindable());
4270 bindable.setBinding(binding);
4320 return &
o->bindingStorage;
4324 return &
o->bindingStorage;
4327 void tst_Moc::privateQPropertyShim()
4332 auto metaObject = &ClassWithPrivateQPropertyShim::staticMetaObject;
4343 testObject.bindableTestProperty().setBinding([]() {
return 100; });
4364 #include "tst_moc.moc"
small capitals from c petite p scientific i
[1]
CustomQObject::Number enumValue() const
QList< QVariant > listVariant() const
void bu1(int, CustomObject3)
QList< QList< int > > listListInt() const
void ref4(QSharedPointer< CustomQObject2 > &)
void bu6(int, CustomObject11, int)
void weakPointerSlot(QWeakPointer< CustomQObject2 >)
void sharedPointerSlot(QSharedPointer< CustomQObject2 >)
void trackingPointerSlot(QPointer< CustomQObject2 >)
QSharedPointer< CustomQObject > customObjectP() const
void namespacedNonQObjectSlot(SomeNamespace2::NamespacedNonQObject2)
void listListIntSlot(QList< QList< int >>)
QPointer< CustomQObject > customObjectTP() const
void namespacedQObjectSlot(SomeNamespace2::NamespacedQObject2 *)
void enumSlot(CustomQObject2::Number)
QList< int > listInt() const
CustomQObject * customObject() const
QList< QList< CustomQObject * > > listListObject() const
QList< CustomQObject * > listObject() const
void someSignal(CustomObject12)
QWeakPointer< CustomQObject > customObjectWP() const
void bu5(int, CustomObject9, CustomObject10)
SomeNamespace::NamespacedQObject * customObjectNamespaced() const
void bu2(CustomObject4, int)
void objectSlot(QObject *)
void listListCustomObjectSlot(QList< QList< CustomQObject2 * >>)
void listVariantSlot(QList< QVariant >)
void listIntSlot(QList< int >)
void ref3(CustomQObject2 &)
void listCustomObjectSlot(QList< CustomQObject2 * >)
void customObjectSlot(CustomQObject2 *)
void typedefSlot(CustomQObject2Star)
SomeNamespace::NamespacedNonQObject customNonQObjectNamespaced() const
void bu3(CustomObject5, CustomObject6)
void bu4(CustomObject7, int, CustomObject8)
AutoRegistrationObject(QObject *parent=nullptr)
CustomQObjectStar customObjectTypedef() const
void ref2(QList< int > &)
const Private * d_func() const
QBindable< int > bindableTestProperty()
void testPropertyChanged()
int testProperty2() const
void lazyTestPropertyChanged()
void setTestProperty(int val)
void setTestProperty2(int val)
QBindable< int > bindableTestProperty2()
void overloadedMaybePrivate()
void privateSignal1(QPrivateSignal)
void privateOverloadedSignal(QPrivateSignal)
void privateSignalWith1Arg(int arg1, QPrivateSignal)
void privateOverloadedSignal(int, QPrivateSignal)
void overloadedMaybePrivate(int, QPrivateSignal)
void emitPrivateSignals()
ClassWithPrivateSignals(QObject *parent=nullptr)
void privateSignalWith2Args(int arg1, const QString &arg2, QPrivateSignal)
QProperty< int > protectedProperty
Q_OBJECT_BINDABLE_PROPERTY(ClassWithQPropertyMembers, int, publicProperty, &ClassWithQPropertyMembers::publicPropertyChanged)
QProperty< int > notExposed
int privateExposedProperty
QBindable< int > bindablePublicProperty()
void publicPropertyChanged()
CustomQObject2(QObject *parent=nullptr)
CustomQObject(QObject *parent=nullptr)
QList< Foo::Bar::Flags > flagsList
void assertSelf(OverloadedAddressOperator &o)
void self(OverloadedAddressOperator &)
const MyDPointer * d_func() const
void blub5Changed(const QString &newBlub)
PrivatePropertyTest(QObject *parent=nullptr)
QBindable is a wrapper class around binding-enabled properties. It allows type-safe operations while ...
The QByteArray class provides an array of bytes.
const char * constData() const noexcept
static QByteArray fromBase64(const QByteArray &base64, Base64Options options=Base64Encoding)
bool contains(char c) const
bool isEmpty() const noexcept
static QByteArray number(int, int base=10)
int qstrcmp(const char *str1, const char *str2)
static QString applicationDirPath()
The QFile class provides an interface for reading from and writing to files.
qint64 write(const char *data, qint64 len)
The QJsonArray class encapsulates a JSON array.
The QJsonDocument class provides a way to read and write JSON documents.
QByteArray toJson(JsonFormat format=Indented) const
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
QVariant property(const char *name) const
bool setProperty(const char *name, const QVariant &value)
static QList< QStaticPlugin > staticPlugins()
The QPointer class is a template class that provides guarded pointers to QObject.
The QProcessEnvironment class holds the environment variables that can be passed to a program.
static QProcessEnvironment systemEnvironment()
void remove(const QString &name)
void insert(const QString &name, const QString &value)
The QRegularExpression class provides pattern matching using regular expressions.
@ InvertedGreedinessOption
T * data() const noexcept
bool contains(const T &value) const
iterator insert(const T &value)
The QSharedPointer class holds a strong reference to a shared pointer.
The QString class provides a Unicode character string.
QByteArray toLatin1() const &
static QString fromLatin1(QByteArrayView ba)
static QString fromLocal8Bit(QByteArrayView ba)
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString trimmed() const &
QString & remove(qsizetype i, qsizetype len)
The QStringList class provides a list of strings.
void testSlot3(TestTemplate2< TestTemplate2< const int, const short * > const *, TestTemplate2< TestTemplate2< void, int >, unsigned char * > >)
void testSlot2(TestTemplate2< int, short const *const >)
void testSlot(TestTemplate2< const int, const short * >)
void testSignal(TestTemplate2< const int, const short * >)
void doAnotherThing(bool=(1< 3), bool=(1 > 4))
void doSomething(QHash< QString, QVariant >=QHash< QString, QVariant >())
void performSomething(QList< QList< QString >>=QList< QList< QString >>(8< 1), QHash< int, QList< QString >>=QHash< int, QList< QString >>())
void doSomethingElse(QSharedPointer< QVarLengthArray< QString,(16 >> 2)> >=QSharedPointer< QVarLengthArray< QString,(16 >> 2)> >())
void setValue2(int value)
QTBUG5590_PropertyObject()
const QString returnConstString(const QString s)
QList< int > const returnConstTemplate2()
const int returnConstInt()
QString const returnConstString2(QString const s)
const QList< int > returnConstTemplate1()
void foo(constconst const &)
void slotChooseScientificConst0(science_constant const &)
void foo(science_const const &)
Q_INVOKABLE QString getEgg(int index)
Q_INVOKABLE QString getChicken(int index)
The QTemporaryFile class is an I/O device that operates on temporary files.
QString fileName() const override
static constexpr QTypeRevision fromVersion(Major majorVersion, Minor minorVersion)
static constexpr QTypeRevision fromMinorVersion(Minor minorVersion)
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
int toInt(bool *ok=nullptr) const
The QWeakPointer class holds a weak reference to a shared pointer.
void testSlotWith2Args(int i, const QString &s)
SignalConnectionTester(QObject *parent=nullptr)
void testSlotWith1Arg(int i)
NamespacedQObject(QObject *parent=nullptr)
void emitProtectedSignals()
SubClassFromPrivateSignals(QObject *parent=nullptr)
void setProp3(const FwdClass3 &val)
void setProp2(const FwdClass2 &val)
void setProp1(const FwdClass1 &val)
signals Q_REVISION(7) void signal4()
Q_REVISION(3) void slot2()
public slots Q_REVISION(5, 12)
Q_INVOKABLE void method1()
Q_INVOKABLE Q_REVISION(6, 0) void method60()
Q_INVOKABLE Q_REVISION(4) void method2()
Q_REVISION(5) void signal2()
Q_REVISION(6, 1) void slot61()
Q_REVISION(5) void signal2()
signals Q_REVISION(7) void signal4()
Q_INVOKABLE Q_REVISION(6, 0) void method60()
Q_INVOKABLE void method1()
Q_REVISION(3) void slot2()
public slots Q_REVISION(5, 12)
Q_INVOKABLE Q_REVISION(4) void method2()
Q_REVISION(6, 1) void slot61()
Q_INVOKABLE PrivateClass()
QSignalSpy spy(myCustomObject, SIGNAL(mySignal(int, QString, double)))
[0]
QList< QVariant > arguments
backing_store_ptr info
[4]
void slot3(const QString &a, const QString &b, const QString &c)
void slot2(const QString &a, const QString &b)
void toString(QString &appendTo, IPv4Address address)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message)
auto makePropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION, std::enable_if_t< std::is_invocable_v< Functor >> *=nullptr)
typing.Tuple[int, int] test(str binary_directory, *debug=False)
QString enumValue(const QString &value)
#define PD_SCOPED_STRING(a, b)
PCRE2_SIZE PRIV() strlen(PCRE2_SPTR str)
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_DISABLE_CLANG(text)
std::pair< T1, T2 > QPair
QList< QString > QStringList
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
#define Q_ARG(type, data)
#define Q_RETURN_ARG(type, data)
GLint GLfloat GLfloat GLfloat v2
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLenum input
void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin)
#define QStringLiteral(str)
#define QTEST_MAIN(TestObject)
#define QSKIP(statement,...)
#define QFETCH(Type, name)
#define QVERIFY2(statement, description)
T qvariant_cast(const QVariant &)
const char className[16]
[1]
obj metaObject() -> className()
QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html"))
[1]
QProperty< int > testProperty2
Private(ClassWithPrivateQPropertyShim *pub)
QBindingStorage bindingStorage
Q_OBJECT_BINDABLE_PROPERTY(Private, int, testProperty, &Private::onTestPropertyChanged)
void onTestPropertyChanged()
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QStaticPlugin is a struct containing a reference to a static plugin instance together with its meta d...
QThreadStorage< int * > dummy[8]
const QBindingStorage * qGetBindingStorage(const ClassWithPrivateQPropertyShim::Private *o)
QObject * qt_plugin_instance()
QPluginMetaData qt_plugin_query_metadata_v2()
Q_DECLARE_METATYPE(const QMetaObject *)
#define FOR_EACH_SLOT_ARG_TYPE(F)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent