tst_qlogging: fix preprocessor directives

Reorganize them and fix the comment.

Change-Id: I69ecc04064514f939896fffd1732dd57203cb21f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5aa66034c2c81e62bdd159e32a3226f8971089a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-12-21 13:56:17 -03:00 committed by Qt Cherry-pick Bot
parent 5b938f7725
commit 90d340a071

View File

@ -716,17 +716,17 @@ void tst_qmessagehandler::qMessagePattern_data()
#define BACKTRACE_HELPER_NAME "qlogging_helper" #define BACKTRACE_HELPER_NAME "qlogging_helper"
#ifdef __GLIBC__
#ifdef QT_NAMESPACE #ifdef QT_NAMESPACE
#define QT_NAMESPACE_STR QT_STRINGIFY(QT_NAMESPACE::) #define QT_NAMESPACE_STR QT_STRINGIFY(QT_NAMESPACE::)
#else #else
#define QT_NAMESPACE_STR "" #define QT_NAMESPACE_STR ""
#endif #endif
#if QT_CONFIG(static) #ifdef __GLIBC__
# if QT_CONFIG(static)
QSKIP("These test cases don't work with static Qt builds"); QSKIP("These test cases don't work with static Qt builds");
#else # else
#ifndef QT_NO_DEBUG # ifndef QT_NO_DEBUG
QList<QByteArray> expectedBacktrace = { QList<QByteArray> expectedBacktrace = {
// MyClass::qt_static_metacall is explicitly marked as hidden in the // MyClass::qt_static_metacall is explicitly marked as hidden in the
// Q_OBJECT macro hence the ?helper? frame // Q_OBJECT macro hence the ?helper? frame
@ -740,14 +740,13 @@ void tst_qmessagehandler::qMessagePattern_data()
"|" QT_NAMESPACE_STR "QMetaObject::invokeMethodImpl] from_a_function 34" "|" QT_NAMESPACE_STR "QMetaObject::invokeMethodImpl] from_a_function 34"
}; };
QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << expectedBacktrace; QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << expectedBacktrace;
#endif # endif
QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>() QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>()
<< "[MyClass::myFunction\nMyClass::mySlot1] from_a_function 34" << "[MyClass::myFunction\nMyClass::mySlot1] from_a_function 34"
<< "[T::T\n"); << "[T::T\n");
#endif // #if !QT_CONFIG(process) # endif // #if !QT_CONFIG(static)
#endif // #ifdef __GLIBC__ #endif // #ifdef __GLIBC__
} }