diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-01-24 16:38:43 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-03-15 23:01:03 +0000 |
commit | f816f2e3c9dc7735eff35175c05a50446d389935 (patch) | |
tree | c0acf73447fc6b3df5d235b9c98c5255c4af143f /src/testlib/qappletestlogger.cpp | |
parent | 8264e495fa9220c101a8a913701a0b8834a6d58b (diff) |
Allow log messages to be grouped by activity on Apple OSes
Useful for making sense of the event dispatcher, especially when running
tests.
Change-Id: Iea84bcfb40d4954439c2e31ffc0197c64907e800
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/testlib/qappletestlogger.cpp')
-rw-r--r-- | src/testlib/qappletestlogger.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp index 2009595904..c8778fe207 100644 --- a/src/testlib/qappletestlogger.cpp +++ b/src/testlib/qappletestlogger.cpp @@ -62,8 +62,13 @@ QAppleTestLogger::QAppleTestLogger(QAbstractTestLogger *logger) { } +static QAppleLogActivity testFunctionActivity; + void QAppleTestLogger::enterTestFunction(const char *function) { + // Re-create activity each time + testFunctionActivity = QT_APPLE_LOG_ACTIVITY("Running test function").enter(); + if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) { QTestCharBuffer testIdentifier; QTestPrivate::generateTestIdentifier(&testIdentifier); @@ -77,6 +82,12 @@ void QAppleTestLogger::enterTestFunction(const char *function) m_logger->enterTestFunction(function); } +void QAppleTestLogger::leaveTestFunction() +{ + m_logger->leaveTestFunction(); + testFunctionActivity.leave(); +} + typedef QPair<QtMsgType, const char *> IncidentClassification; static IncidentClassification incidentTypeToClassification(QAbstractTestLogger::IncidentTypes type) { |