From f816f2e3c9dc7735eff35175c05a50446d389935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 24 Jan 2018 16:38:43 +0100 Subject: Allow log messages to be grouped by activity on Apple OSes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Useful for making sense of the event dispatcher, especially when running tests. Change-Id: Iea84bcfb40d4954439c2e31ffc0197c64907e800 Reviewed-by: Morten Johan Sørvig --- src/testlib/qappletestlogger.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/testlib/qappletestlogger.cpp') 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 IncidentClassification; static IncidentClassification incidentTypeToClassification(QAbstractTestLogger::IncidentTypes type) { -- cgit v1.2.3