diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-01 11:40:33 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-01 14:37:22 (GMT) |
commit | 31f2d97e28dff1a72511ab1ef7737e5f78d4cf66 (patch) | |
tree | 2c6667c7aa525981541f38b70849e7bedfcc9b40 /tests/auto/qmetaobject | |
parent | a76c8424dab298c2fa36226f47bf7ac6f7e4014a (diff) | |
download | Qt-31f2d97e28dff1a72511ab1ef7737e5f78d4cf66.zip Qt-31f2d97e28dff1a72511ab1ef7737e5f78d4cf66.tar.gz Qt-31f2d97e28dff1a72511ab1ef7737e5f78d4cf66.tar.bz2 |
QMetaObject::invokeMethod: print a warning if the method is not found.
Also adapt QTestLib not to call invokeMethod on unexisting method to
avoid warnings
Task-number: QTBUG-7331
Reviewed-by: Brad
Diffstat (limited to 'tests/auto/qmetaobject')
-rw-r--r-- | tests/auto/qmetaobject/tst_qmetaobject.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 15b6204..bd54975 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -513,6 +513,19 @@ void tst_QMetaObject::invokeMetaMember() QVERIFY(QMetaObject::invokeMethod(&obj, "sig1", Q_RETURN_ARG(QString, exp), Q_ARG(QString, "hehe"))); QCOMPARE(exp, QString("yessir")); QCOMPARE(obj.slotResult, QString("sl1:hehe")); + + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::doesNotExist()"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "doesNotExist")); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString)(QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1(QString)", Q_ARG(QString, "arg"))); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl3(QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl3", Q_ARG(QString, "arg"))); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString,QString,QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1", Q_ARG(QString, "arg"), Q_ARG(QString, "arg"), Q_ARG(QString, "arg"))); + + //should not have changed since last test. + QCOMPARE(exp, QString("yessir")); + QCOMPARE(obj.slotResult, QString("sl1:hehe")); } void tst_QMetaObject::invokeQueuedMetaMember() |