qtestlog.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/testlib/qtestlog.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtTest module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include <QtTest/qtestassert.h>-
41-
42#include <QtTest/private/qtestlog_p.h>-
43#include <QtTest/private/qtestresult_p.h>-
44#include <QtTest/private/qabstracttestlogger_p.h>-
45#include <QtTest/private/qplaintestlogger_p.h>-
46#include <QtTest/private/qcsvbenchmarklogger_p.h>-
47#include <QtTest/private/qxunittestlogger_p.h>-
48#include <QtTest/private/qxmltestlogger_p.h>-
49#include <QtTest/private/qteamcitylogger_p.h>-
50#if defined(HAVE_XCTEST)-
51#include <QtTest/private/qxctestlogger_p.h>-
52#endif-
53-
54#include <QtCore/qatomic.h>-
55#include <QtCore/qbytearray.h>-
56#include <QtCore/QElapsedTimer>-
57#include <QtCore/QVariant>-
58#include <QtCore/QRegularExpression>-
59-
60#include <stdlib.h>-
61#include <string.h>-
62#include <limits.h>-
63-
64QT_BEGIN_NAMESPACE-
65-
66static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage)-
67{-
68#ifdef __COVERAGESCANNER__-
69 if (!installedTestCoverage)-
70 return;-
71 // install again to make sure the filename is correct.-
72 // without this, a plugin or similar may have changed the filename.-
73 __coveragescanner_install(appname);-
74 __coveragescanner_teststate(testfailed ? "FAILED" : "PASSED");-
75 __coveragescanner_save();-
76 __coveragescanner_testname("");-
77 __coveragescanner_clear();-
78 unsetenv("QT_TESTCOCOON_ACTIVE");-
79#else-
80 Q_UNUSED(appname);-
81 Q_UNUSED(testfailed);-
82 Q_UNUSED(installedTestCoverage);-
83#endif-
84}-
85-
86static QElapsedTimer elapsedFunctionTime;-
87static QElapsedTimer elapsedTotalTime;-
88-
89namespace QTest {-
90-
91 int fails = 0;-
92 int passes = 0;-
93 int skips = 0;-
94 int blacklists = 0;-
95-
96 struct IgnoreResultList-
97 {-
98 inline IgnoreResultList(QtMsgType tp, const QVariant &patternIn)-
99 : type(tp), pattern(patternIn), next(0) {}-
100-
101 static inline void clearList(IgnoreResultList *&list)-
102 {-
103 while (list) {-
104 IgnoreResultList *current = list;-
105 list = list->next;-
106 delete current;-
107 }-
108 }-
109-
110 static void append(IgnoreResultList *&list, QtMsgType type, const QVariant &patternIn)-
111 {-
112 QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, patternIn);-
113-
114 if (!list) {-
115 list = item;-
116 return;-
117 }-
118 IgnoreResultList *last = list;-
119 for ( ; last->next; last = last->next) ;-
120 last->next = item;-
121 }-
122-
123 static bool stringsMatch(const QString &expected, const QString &actual)-
124 {-
125 if (expected == actual)-
126 return true;-
127-
128 // ignore an optional whitespace at the end of str-
129 // (the space was added automatically by ~QDebug() until Qt 5.3,-
130 // so autotests still might expect it)-
131 if (expected.endsWith(QLatin1Char(' ')))-
132 return actual == expected.leftRef(expected.length() - 1);-
133-
134 return false;-
135 }-
136-
137 inline bool matches(QtMsgType tp, const QString &message) const-
138 {-
139 return tp == type-
140 && (pattern.type() == QVariant::String ?-
141 stringsMatch(pattern.toString(), message) :-
142#ifndef QT_NO_REGULAREXPRESSION-
143 pattern.toRegularExpression().match(message).hasMatch());-
144#else-
145 false);-
146#endif-
147 }-
148-
149 QtMsgType type;-
150 QVariant pattern;-
151 IgnoreResultList *next;-
152 };-
153-
154 static IgnoreResultList *ignoreResultList = 0;-
155-
156 struct LoggerList-
157 {-
158 QAbstractTestLogger *logger;-
159 LoggerList *next;-
160 };-
161-
162 class TestLoggers-
163 {-
164 public:-
165 static void addLogger(QAbstractTestLogger *logger)-
166 {-
167 LoggerList *l = new LoggerList;-
168 l->logger = logger;-
169 l->next = loggers;-
170 loggers = l;-
171 }-
172-
173 static void destroyLoggers()-
174 {-
175 while (loggers) {-
176 LoggerList *l = loggers;-
177 loggers = loggers->next;-
178 delete l->logger;-
179 delete l;-
180 }-
181 }-
182-
183#define FOREACH_LOGGER(operation) \-
184 LoggerList *l = loggers; \-
185 while (l) { \-
186 QAbstractTestLogger *logger = l->logger; \-
187 Q_UNUSED(logger); \-
188 operation; \-
189 l = l->next; \-
190 }-
191-
192 static void startLogging()-
193 {-
194 FOREACH_LOGGER(logger->startLogging());-
195 }-
196-
197 static void stopLogging()-
198 {-
199 FOREACH_LOGGER(logger->stopLogging());-
200 }-
201-
202 static void enterTestFunction(const char *function)-
203 {-
204 FOREACH_LOGGER(logger->enterTestFunction(function));-
205 }-
206-
207 static void leaveTestFunction()-
208 {-
209 FOREACH_LOGGER(logger->leaveTestFunction());-
210 }-
211-
212 static void addIncident(QAbstractTestLogger::IncidentTypes type, const char *description,-
213 const char *file = 0, int line = 0)-
214 {-
215 FOREACH_LOGGER(logger->addIncident(type, description, file, line));-
216 }-
217-
218 static void addBenchmarkResult(const QBenchmarkResult &result)-
219 {-
220 FOREACH_LOGGER(logger->addBenchmarkResult(result));-
221 }-
222-
223 static void addMessage(QAbstractTestLogger::MessageTypes type, const QString &message,-
224 const char *file = 0, int line = 0)-
225 {-
226 FOREACH_LOGGER(logger->addMessage(type, message, file, line));-
227 }-
228-
229 static void outputString(const char *msg)-
230 {-
231 FOREACH_LOGGER(logger->outputString(msg));-
232 }-
233-
234 static int loggerCount()-
235 {-
236 int count = 0;-
237 FOREACH_LOGGER(++count);-
238 return count;-
239 }-
240-
241 private:-
242 static LoggerList *loggers;-
243 };-
244-
245#undef FOREACH_LOGGER-
246-
247 LoggerList *TestLoggers::loggers = 0;-
248 static bool loggerUsingStdout = false;-
249-
250 static int verbosity = 0;-
251 static int maxWarnings = 2002;-
252 static bool installedTestCoverage = true;-
253-
254 static QtMessageHandler oldMessageHandler;-
255-
256 static bool handleIgnoredMessage(QtMsgType type, const QString &message)-
257 {-
258 if (!ignoreResultList)-
259 return false;-
260 IgnoreResultList *last = 0;-
261 IgnoreResultList *list = ignoreResultList;-
262 while (list) {-
263 if (list->matches(type, message)) {-
264 // remove the item from the list-
265 if (last)-
266 last->next = list->next;-
267 else if (list->next)-
268 ignoreResultList = list->next;-
269 else-
270 ignoreResultList = 0;-
271-
272 delete list;-
273 return true;-
274 }-
275-
276 last = list;-
277 list = list->next;-
278 }-
279 return false;-
280 }-
281-
282 static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message)-
283 {-
284 static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);-
285-
286 if (QTest::TestLoggers::loggerCount() == 0) {-
287 // if this goes wrong, something is seriously broken.-
288 qInstallMessageHandler(oldMessageHandler);-
289 QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0);-
290 }-
291-
292 if (handleIgnoredMessage(type, message))-
293 // the message is expected, so just swallow it.-
294 return;-
295-
296 QString msg = qFormatLogMessage(type, context, message);-
297-
298 if (type != QtFatalMsg) {-
299 if (counter.load() <= 0)-
300 return;-
301-
302 if (!counter.deref()) {-
303 QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem,-
304 QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override."));-
305 return;-
306 }-
307 }-
308-
309 switch (type) {-
310 case QtDebugMsg:-
311 QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);-
312 break;-
313 case QtInfoMsg:-
314 QTest::TestLoggers::addMessage(QAbstractTestLogger::QInfo, msg);-
315 break;-
316 case QtCriticalMsg:-
317 QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, msg);-
318 break;-
319 case QtWarningMsg:-
320 QTest::TestLoggers::addMessage(QAbstractTestLogger::QWarning, msg);-
321 break;-
322 case QtFatalMsg:-
323 QTest::TestLoggers::addMessage(QAbstractTestLogger::QFatal, msg);-
324 /* Right now, we're inside the custom message handler and we're-
325 * being qt_message_output in qglobal.cpp. After we return from-
326 * this function, it will proceed with calling exit() and abort()-
327 * and hence crash. Therefore, we call these logging functions such-
328 * that we wrap up nicely, and in particular produce well-formed XML. */-
329 QTestResult::addFailure("Received a fatal error.", "Unknown file", 0);-
330 QTestLog::leaveTestFunction();-
331 QTestLog::stopLogging();-
332 break;-
333 }-
334 }-
335}-
336-
337void QTestLog::enterTestFunction(const char* function)-
338{-
339 elapsedFunctionTime.restart();-
340 if (printAvailableTags)-
341 return;-
342-
343 QTEST_ASSERT(function);-
344-
345 QTest::TestLoggers::enterTestFunction(function);-
346}-
347-
348int QTestLog::unhandledIgnoreMessages()-
349{-
350 int i = 0;-
351 QTest::IgnoreResultList *list = QTest::ignoreResultList;-
352 while (list) {-
353 ++i;-
354 list = list->next;-
355 }-
356 return i;-
357}-
358-
359void QTestLog::leaveTestFunction()-
360{-
361 if (printAvailableTags)-
362 return;-
363-
364 QTest::TestLoggers::leaveTestFunction();-
365}-
366-
367void QTestLog::printUnhandledIgnoreMessages()-
368{-
369 QString message;-
370 QTest::IgnoreResultList *list = QTest::ignoreResultList;-
371 while (list) {-
372 if (list->pattern.type() == QVariant::String) {-
373 message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');-
374 } else {-
375#ifndef QT_NO_REGULAREXPRESSION-
376 message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');-
377#endif-
378 }-
379 QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message);-
380-
381 list = list->next;-
382 }-
383}-
384-
385void QTestLog::clearIgnoreMessages()-
386{-
387 QTest::IgnoreResultList::clearList(QTest::ignoreResultList);-
388}-
389-
390void QTestLog::addPass(const char *msg)-
391{-
392 if (printAvailableTags)-
393 return;-
394-
395 QTEST_ASSERT(msg);-
396-
397 ++QTest::passes;-
398-
399 QTest::TestLoggers::addIncident(QAbstractTestLogger::Pass, msg);-
400}-
401-
402void QTestLog::addFail(const char *msg, const char *file, int line)-
403{-
404 QTEST_ASSERT(msg);-
405-
406 ++QTest::fails;-
407-
408 QTest::TestLoggers::addIncident(QAbstractTestLogger::Fail, msg, file, line);-
409}-
410-
411void QTestLog::addXFail(const char *msg, const char *file, int line)-
412{-
413 QTEST_ASSERT(msg);-
414 QTEST_ASSERT(file);-
415-
416 QTest::TestLoggers::addIncident(QAbstractTestLogger::XFail, msg, file, line);-
417}-
418-
419void QTestLog::addXPass(const char *msg, const char *file, int line)-
420{-
421 QTEST_ASSERT(msg);-
422 QTEST_ASSERT(file);-
423-
424 ++QTest::fails;-
425-
426 QTest::TestLoggers::addIncident(QAbstractTestLogger::XPass, msg, file, line);-
427}-
428-
429void QTestLog::addBPass(const char *msg)-
430{-
431 QTEST_ASSERT(msg);-
432-
433 ++QTest::blacklists;-
434-
435 QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedPass, msg);-
436}-
437-
438void QTestLog::addBFail(const char *msg, const char *file, int line)-
439{-
440 QTEST_ASSERT(msg);-
441 QTEST_ASSERT(file);-
442-
443 ++QTest::blacklists;-
444-
445 QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedFail, msg, file, line);-
446}-
447-
448void QTestLog::addSkip(const char *msg, const char *file, int line)-
449{-
450 QTEST_ASSERT(msg);-
451 QTEST_ASSERT(file);-
452-
453 ++QTest::skips;-
454-
455 QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, QString::fromUtf8(msg), file, line);-
456}-
457-
458void QTestLog::addBenchmarkResult(const QBenchmarkResult &result)-
459{-
460 QTest::TestLoggers::addBenchmarkResult(result);-
461}-
462-
463void QTestLog::startLogging()-
464{-
465 elapsedTotalTime.start();-
466 elapsedFunctionTime.start();-
467 QTest::TestLoggers::startLogging();-
468 QTest::oldMessageHandler = qInstallMessageHandler(QTest::messageHandler);-
469}-
470-
471void QTestLog::stopLogging()-
472{-
473 qInstallMessageHandler(QTest::oldMessageHandler);-
474 QTest::TestLoggers::stopLogging();-
475 QTest::TestLoggers::destroyLoggers();-
476 QTest::loggerUsingStdout = false;-
477 saveCoverageTool(QTestResult::currentAppName(), failCount() != 0, QTestLog::installedTestCoverage());-
478}-
479-
480void QTestLog::addLogger(LogMode mode, const char *filename)-
481{-
482 if (filename && strcmp(filename, "-") == 0)
filenameDescription
TRUEevaluated 900 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 693 times by 506 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
strcmp(filename, "-") == 0Description
TRUEevaluated 291 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEevaluated 609 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
291-900
483 filename = 0;
executed 291 times by 1 test: filename = 0;
Executed by:
  • tst_selftests - unknown status
291
484 if (!filename)
!filenameDescription
TRUEevaluated 984 times by 506 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEevaluated 609 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
609-984
485 QTest::loggerUsingStdout = true;
executed 984 times by 506 tests: QTest::loggerUsingStdout = true;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
984
486-
487 QAbstractTestLogger *logger = 0;-
488 switch (mode) {-
489 case QTestLog::Plain:
executed 855 times by 506 tests: case QTestLog::Plain:
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
855
490 logger = new QPlainTestLogger(filename);-
491 break;
executed 855 times by 506 tests: break;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
855
492 case QTestLog::CSV:
executed 8 times by 1 test: case QTestLog::CSV:
Executed by:
  • tst_selftests - unknown status
8
493 logger = new QCsvBenchmarkLogger(filename);-
494 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
8
495 case QTestLog::XML:
executed 184 times by 1 test: case QTestLog::XML:
Executed by:
  • tst_selftests - unknown status
184
496 logger = new QXmlTestLogger(QXmlTestLogger::Complete, filename);-
497 break;
executed 184 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
184
498 case QTestLog::LightXML:
executed 185 times by 1 test: case QTestLog::LightXML:
Executed by:
  • tst_selftests - unknown status
185
499 logger = new QXmlTestLogger(QXmlTestLogger::Light, filename);-
500 break;
executed 185 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
185
501 case QTestLog::XunitXML:
executed 215 times by 1 test: case QTestLog::XunitXML:
Executed by:
  • tst_selftests - unknown status
215
502 logger = new QXunitTestLogger(filename);-
503 break;
executed 215 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
215
504 case QTestLog::TeamCity:
executed 146 times by 1 test: case QTestLog::TeamCity:
Executed by:
  • tst_selftests - unknown status
146
505 logger = new QTeamCityLogger(filename);-
506 break;
executed 146 times by 1 test: break;
Executed by:
  • tst_selftests - unknown status
146
507#if defined(HAVE_XCTEST)-
508 case QTestLog::XCTest:-
509 logger = new QXcodeTestLogger;-
510 break;-
511#endif-
512 }-
513 QTEST_ASSERT(logger);
never executed: qt_assert("logger",__FILE__,513);
!(logger)Description
TRUEnever evaluated
FALSEevaluated 1593 times by 506 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-1593
514 QTest::TestLoggers::addLogger(logger);-
515}
executed 1593 times by 506 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1593
516-
517int QTestLog::loggerCount()-
518{-
519 return QTest::TestLoggers::loggerCount();-
520}-
521-
522bool QTestLog::loggerUsingStdout()-
523{-
524 return QTest::loggerUsingStdout;-
525}-
526-
527void QTestLog::warn(const char *msg, const char *file, int line)-
528{-
529 QTEST_ASSERT(msg);-
530-
531 if (QTest::TestLoggers::loggerCount() > 0)-
532 QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, QString::fromUtf8(msg), file, line);-
533}-
534-
535void QTestLog::info(const char *msg, const char *file, int line)-
536{-
537 QTEST_ASSERT(msg);-
538-
539 QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, QString::fromUtf8(msg), file, line);-
540}-
541-
542void QTestLog::setVerboseLevel(int level)-
543{-
544 QTest::verbosity = level;-
545}-
546-
547int QTestLog::verboseLevel()-
548{-
549 return QTest::verbosity;-
550}-
551-
552void QTestLog::ignoreMessage(QtMsgType type, const char *msg)-
553{-
554 QTEST_ASSERT(msg);-
555-
556 QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg));-
557}-
558-
559#ifndef QT_NO_REGULAREXPRESSION-
560void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)-
561{-
562 QTEST_ASSERT(expression.isValid());-
563-
564 QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));-
565}-
566#endif // QT_NO_REGULAREXPRESSION-
567-
568void QTestLog::setMaxWarnings(int m)-
569{-
570 QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2;-
571}-
572-
573bool QTestLog::printAvailableTags = false;-
574-
575void QTestLog::setPrintAvailableTagsMode()-
576{-
577 printAvailableTags = true;-
578}-
579-
580int QTestLog::passCount()-
581{-
582 return QTest::passes;-
583}-
584-
585int QTestLog::failCount()-
586{-
587 return QTest::fails;-
588}-
589-
590int QTestLog::skipCount()-
591{-
592 return QTest::skips;-
593}-
594-
595int QTestLog::blacklistCount()-
596{-
597 return QTest::blacklists;-
598}-
599-
600void QTestLog::resetCounters()-
601{-
602 QTest::passes = 0;-
603 QTest::fails = 0;-
604 QTest::skips = 0;-
605}-
606-
607void QTestLog::setInstalledTestCoverage(bool installed)-
608{-
609 QTest::installedTestCoverage = installed;-
610}-
611-
612bool QTestLog::installedTestCoverage()-
613{-
614 return QTest::installedTestCoverage;-
615}-
616-
617qint64 QTestLog::nsecsTotalTime()-
618{-
619 return elapsedTotalTime.nsecsElapsed();-
620}-
621-
622qint64 QTestLog::nsecsFunctionTime()-
623{-
624 return elapsedFunctionTime.nsecsElapsed();-
625}-
626-
627QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9