diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-09-23 15:59:32 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-12-09 20:54:26 +0100 |
commit | 77a93e6df331e5ed22aef4335d8de38abe2ca586 (patch) | |
tree | ace152ec3685282a07f890e4c95aac057693b5e5 /src/testlib/qappletestlogger.cpp | |
parent | 1c24b4b8d9fe16eaa4bc1598df117593d814bf50 (diff) |
Make Skip an incident in test logging
Skip ends the test (albeit inconclusively). Rearrange the enums in
the abstract logger, move code to handle skip between relevant
function and tidy up various things that became simpler as a result.
Also reorder the message enum, and its switches, to separate testlib's
internals from the usual Qt messages, and put each group in ascending
order of severity.
Task-number: QTBUG-96844
Change-Id: I2c7a634b9f849830d64eafa750155e66e244b729
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qappletestlogger.cpp')
-rw-r--r-- | src/testlib/qappletestlogger.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp index 95798c5361..8764e84aed 100644 --- a/src/testlib/qappletestlogger.cpp +++ b/src/testlib/qappletestlogger.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -103,6 +103,8 @@ void QAppleTestLogger::addIncident(IncidentTypes type, const char *description, { MessageData messageData = [=]() { switch (type) { + case QAbstractTestLogger::Skip: + return MessageData{QtInfoMsg, "skip"}; case QAbstractTestLogger::Pass: return MessageData{QtInfoMsg, "pass"}; case QAbstractTestLogger::XFail: @@ -153,8 +155,6 @@ void QAppleTestLogger::addMessage(MessageTypes type, const QString &message, con return MessageData{QtWarningMsg, "critical"}; case QAbstractTestLogger::QFatal: return MessageData{QtFatalMsg, nullptr}; - case QAbstractTestLogger::Skip: - return MessageData{QtInfoMsg, "skip"}; case QAbstractTestLogger::Info: case QAbstractTestLogger::QInfo: return MessageData{QtInfoMsg, nullptr}; @@ -166,16 +166,8 @@ void QAppleTestLogger::addMessage(MessageTypes type, const QString &message, con messageData.generateCategory(&category); QMessageLogContext context(file, line, /* function = */ nullptr, category.data()); - QString msg = message; - if (type == Skip) { - if (!message.isNull()) - msg.prepend(testIdentifier() + QLatin1Char('\n')); - else - msg = testIdentifier(); - } - - AppleUnifiedLogger::messageHandler(messageData.messageType, context, msg, subsystem()); + AppleUnifiedLogger::messageHandler(messageData.messageType, context, message, subsystem()); } QString QAppleTestLogger::subsystem() const |