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/qjunittestlogger.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/qjunittestlogger.cpp')
| -rw-r--r-- | src/testlib/qjunittestlogger.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/testlib/qjunittestlogger.cpp b/src/testlib/qjunittestlogger.cpp index 9352cc21804..34cb8b9a758 100644 --- a/src/testlib/qjunittestlogger.cpp +++ b/src/testlib/qjunittestlogger.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 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. @@ -238,6 +238,10 @@ void QJUnitTestLogger::addIncident(IncidentTypes type, const char *description, // Since XFAIL does not add a failure to the testlog in JUnit XML we add a // message, so we still have some information about the expected failure. addMessage(QAbstractTestLogger::Info, QString::fromUtf8(description), file, line); + } else if (type == QAbstractTestLogger::Skip) { + auto skippedElement = new QTestElement(QTest::LET_Skipped); + skippedElement->addAttribute(QTest::AI_Message, description); + currentTestCase->addChild(skippedElement); } } @@ -283,12 +287,7 @@ void QJUnitTestLogger::addMessage(MessageTypes type, const QString &message, con Q_UNUSED(file); Q_UNUSED(line); - if (type == QAbstractTestLogger::Skip) { - auto skippedElement = new QTestElement(QTest::LET_Skipped); - skippedElement->addAttribute(QTest::AI_Message, message.toUtf8().constData()); - currentTestCase->addChild(skippedElement); - return; - } else if (type == QAbstractTestLogger::QFatal) { + if (type == QAbstractTestLogger::QFatal) { addFailure(QTest::LET_Error, "qfatal", message); return; } |
