From 0f76e55bc440a70f5d9530a192c9ce6334a8f069 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 15 Jul 2022 13:26:16 -0700 Subject: QMetaObject: rewrite invokeMethod() Use the QMetaMethodPrivate::invokeImpl() function we added in the last commit, without recreating the method signature. Instead, only do a comparison on the method name and allow invokeImpl() to decide whether this method can be called with the given arguments. This will allow invokeImpl() to have more flexibility in deciding if the arguments match, using the stored metatype information. Change-Id: I36b24183fbd041179f2ffffd17021a86484bfab6 Reviewed-by: Fabian Kosmale --- tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib/global/qlogging') diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 5de7830113..df0cb5ae77 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -727,9 +727,19 @@ void tst_qmessagehandler::qMessagePattern_data() QSKIP("These test cases don't work with static Qt builds"); #else #ifndef QT_NO_DEBUG - QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << (QList() - // MyClass::qt_static_metacall is explicitly marked as hidden in the Q_OBJECT macro - << "[MyClass::myFunction|MyClass::mySlot1|?" BACKTRACE_HELPER_NAME "?|" QT_NAMESPACE_STR "QMetaMethod::invoke|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34"); + QList expectedBacktrace = { + // MyClass::qt_static_metacall is explicitly marked as hidden in the + // Q_OBJECT macro hence the ?helper? frame + "[MyClass::myFunction|MyClass::mySlot1|?" BACKTRACE_HELPER_NAME "?|", + + // QMetaObject::invokeMethod calls internal function + // (QMetaMethodPrivate::invokeImpl, at the tims of this writing), which + // will usually show only as ?libQt6Core.so? or equivalent, so we skip + + // end of backtrace, actual message + "|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34" + }; + QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << expectedBacktrace; #endif QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList() -- cgit v1.2.3