diff options
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 1fb153ac09..7f4b431c81 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -362,6 +362,8 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wignored-qualifiers") QT_WARNING_DISABLE_GCC("-Wignored-qualifiers") +using ObjectCRef = const QObject &; + class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct), public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored) { @@ -557,6 +559,7 @@ signals: // public slots: void const slotWithSillyConst() {} + void slotTakingCRefViaTypedef(ObjectCRef o) { this->setObjectName(o.objectName()); } public: Q_INVOKABLE void const slotWithSillyConst2() {} @@ -686,6 +689,7 @@ private slots: void preprocessorConditionals(); void blackslashNewlines(); void slotWithSillyConst(); + void slotTakingCRefViaTypedef(); void testExtraData(); void testExtraDataForEnum(); void namespaceTypeProperty(); @@ -1074,6 +1078,15 @@ void tst_Moc::slotWithSillyConst() QVERIFY(mobj->indexOfSlot("slotWithVoidStar(void*)") != -1); } +void tst_Moc::slotTakingCRefViaTypedef() +{ + TestClass tst; + QObject obj; + obj.setObjectName("works"); + QMetaObject::invokeMethod(&tst, "slotTakingCRefViaTypedef", Q_ARG(ObjectCRef, obj)); + QCOMPARE(obj.objectName(), "works"); +} + void tst_Moc::testExtraData() { const QMetaObject *mobj = &PropertyTestClass::staticMetaObject; |