Add test for queued call of method with unregistered parameter type
Verify that this produces a warning containing the relevant typename. Change-Id: I046c02585e410a211e9175600b1027dda83bdd9c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
42545eaea0
commit
2bfdc2b540
@ -299,6 +299,8 @@ void tst_QMetaObject::connectSlotsByName()
|
||||
QCOMPARE(obj2.invokeCount2, 1);
|
||||
}
|
||||
|
||||
struct MyUnregisteredType { };
|
||||
|
||||
class QtTestObject: public QObject
|
||||
{
|
||||
friend class tst_QMetaObject;
|
||||
@ -335,6 +337,8 @@ public slots:
|
||||
void moveToThread(QThread *t)
|
||||
{ QObject::moveToThread(t); }
|
||||
|
||||
void slotWithUnregisteredParameterType(MyUnregisteredType);
|
||||
|
||||
signals:
|
||||
void sig0();
|
||||
QString sig1(QString s1);
|
||||
@ -402,6 +406,9 @@ void QtTestObject::testSender()
|
||||
slotResult.sprintf("%p", sender());
|
||||
}
|
||||
|
||||
void QtTestObject::slotWithUnregisteredParameterType(MyUnregisteredType)
|
||||
{ slotResult = "slotWithUnregisteredReturnType"; }
|
||||
|
||||
|
||||
void tst_QMetaObject::invokeMetaMember()
|
||||
{
|
||||
@ -582,6 +589,14 @@ void tst_QMetaObject::invokeQueuedMetaMember()
|
||||
Q_ARG(quint64, ll2)));
|
||||
qApp->processEvents(QEventLoop::AllEvents);
|
||||
QCOMPARE(obj.slotResult, QString("testLongLong:-1,0"));
|
||||
|
||||
obj.slotResult.clear();
|
||||
{
|
||||
MyUnregisteredType t;
|
||||
QTest::ignoreMessage(QtWarningMsg, "QMetaMethod::invoke: Unable to handle unregistered datatype 'MyUnregisteredType'");
|
||||
QVERIFY(!QMetaObject::invokeMethod(&obj, "slotWithUnregisteredParameterType", Qt::QueuedConnection, Q_ARG(MyUnregisteredType, t)));
|
||||
QVERIFY(obj.slotResult.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QMetaObject::invokeBlockingQueuedMetaMember()
|
||||
|
Loading…
Reference in New Issue
Block a user