QTestLib: Introduce nullptr
Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I620e40a277dc2b20b0ec26fc32577e66b0456bb3 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
2d8d738657
commit
225dd568af
@ -87,7 +87,7 @@ QAbstractTestLogger::~QAbstractTestLogger()
|
|||||||
if (stream != stdout) {
|
if (stream != stdout) {
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
}
|
}
|
||||||
stream = 0;
|
stream = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAbstractTestLogger::filterUnprintable(char *str) const
|
void QAbstractTestLogger::filterUnprintable(char *str) const
|
||||||
|
@ -73,7 +73,7 @@ void QBenchmarkGlobalData::setMode(Mode mode)
|
|||||||
|
|
||||||
QBenchmarkMeasurerBase * QBenchmarkGlobalData::createMeasurer()
|
QBenchmarkMeasurerBase * QBenchmarkGlobalData::createMeasurer()
|
||||||
{
|
{
|
||||||
QBenchmarkMeasurerBase *measurer = 0;
|
QBenchmarkMeasurerBase *measurer = nullptr;
|
||||||
if (0) {
|
if (0) {
|
||||||
#if QT_CONFIG(valgrind)
|
#if QT_CONFIG(valgrind)
|
||||||
} else if (mode_ == CallgrindChildProcess || mode_ == CallgrindParentProcess) {
|
} else if (mode_ == CallgrindChildProcess || mode_ == CallgrindParentProcess) {
|
||||||
@ -112,7 +112,7 @@ QBenchmarkTestMethodData::QBenchmarkTestMethodData() = default;
|
|||||||
|
|
||||||
QBenchmarkTestMethodData::~QBenchmarkTestMethodData()
|
QBenchmarkTestMethodData::~QBenchmarkTestMethodData()
|
||||||
{
|
{
|
||||||
QBenchmarkTestMethodData::current = 0;
|
QBenchmarkTestMethodData::current = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBenchmarkTestMethodData::beginDataRun()
|
void QBenchmarkTestMethodData::beginDataRun()
|
||||||
|
@ -147,7 +147,7 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable()
|
|||||||
{
|
{
|
||||||
// this generates an EFAULT because attr == NULL if perf_event_open is available
|
// this generates an EFAULT because attr == NULL if perf_event_open is available
|
||||||
// if the kernel is too old, it generates ENOSYS
|
// if the kernel is too old, it generates ENOSYS
|
||||||
return perf_event_open(0, 0, 0, 0, 0) == -1 && errno != ENOSYS;
|
return perf_event_open(nullptr, 0, 0, 0, 0) == -1 && errno != ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Event list structure
|
/* Event list structure
|
||||||
|
@ -56,7 +56,7 @@ namespace QTest
|
|||||||
|
|
||||||
inline static void qPrintMessage(const QByteArray &ba)
|
inline static void qPrintMessage(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
QTestLog::info(ba.constData(), 0, 0);
|
QTestLog::info(ba.constData(), nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QList<QByteArray>, ignoreClasses)
|
Q_GLOBAL_STATIC(QList<QByteArray>, ignoreClasses)
|
||||||
@ -169,7 +169,7 @@ static void qSignalDumperCallbackEndSignal(QObject *caller, int /*signal_index*/
|
|||||||
void QSignalDumper::startDump()
|
void QSignalDumper::startDump()
|
||||||
{
|
{
|
||||||
static QSignalSpyCallbackSet set = { QTest::qSignalDumperCallback,
|
static QSignalSpyCallbackSet set = { QTest::qSignalDumperCallback,
|
||||||
QTest::qSignalDumperCallbackSlot, QTest::qSignalDumperCallbackEndSignal, 0 };
|
QTest::qSignalDumperCallbackSlot, QTest::qSignalDumperCallbackEndSignal, nullptr };
|
||||||
qt_register_signal_spy_callbacks(&set);
|
qt_register_signal_spy_callbacks(&set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ static bool checkCondition(const QByteArray &condition)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool ignoreAll = false;
|
static bool ignoreAll = false;
|
||||||
static std::set<QByteArray> *ignoredTests = 0;
|
static std::set<QByteArray> *ignoredTests = nullptr;
|
||||||
|
|
||||||
namespace QTestPrivate {
|
namespace QTestPrivate {
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ namespace QTest
|
|||||||
{
|
{
|
||||||
class WatchDog;
|
class WatchDog;
|
||||||
|
|
||||||
static QObject *currentTestObject = 0;
|
static QObject *currentTestObject = nullptr;
|
||||||
static QString mainSourcePath;
|
static QString mainSourcePath;
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
@ -423,7 +423,7 @@ Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
|
|||||||
Q_TESTLIB_EXPORT QStringList testFunctions;
|
Q_TESTLIB_EXPORT QStringList testFunctions;
|
||||||
Q_TESTLIB_EXPORT QStringList testTags;
|
Q_TESTLIB_EXPORT QStringList testTags;
|
||||||
|
|
||||||
static void qPrintTestSlots(FILE *stream, const char *filter = 0)
|
static void qPrintTestSlots(FILE *stream, const char *filter = nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
|
||||||
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
||||||
@ -516,7 +516,7 @@ static int qToInt(const char *str)
|
|||||||
Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool qml)
|
Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool qml)
|
||||||
{
|
{
|
||||||
int logFormat = -1; // Not set
|
int logFormat = -1; // Not set
|
||||||
const char *logFilename = 0;
|
const char *logFilename = nullptr;
|
||||||
|
|
||||||
QTest::testFunctions.clear();
|
QTest::testFunctions.clear();
|
||||||
QTest::testTags.clear();
|
QTest::testTags.clear();
|
||||||
@ -897,7 +897,7 @@ struct QTestDataSetter
|
|||||||
}
|
}
|
||||||
~QTestDataSetter()
|
~QTestDataSetter()
|
||||||
{
|
{
|
||||||
QTestResult::setCurrentTestData(0);
|
QTestResult::setCurrentTestData(nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -974,11 +974,11 @@ void TestMethods::invokeTestOnData(int index) const
|
|||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
QTestLog::info(qPrintable(
|
QTestLog::info(qPrintable(
|
||||||
QString::fromLatin1("warmup stage result : %1")
|
QString::fromLatin1("warmup stage result : %1")
|
||||||
.arg(QBenchmarkTestMethodData::current->result.value)), 0, 0);
|
.arg(QBenchmarkTestMethodData::current->result.value)), nullptr, 0);
|
||||||
} else {
|
} else {
|
||||||
QTestLog::info(qPrintable(
|
QTestLog::info(qPrintable(
|
||||||
QString::fromLatin1("accumulation stage result: %1")
|
QString::fromLatin1("accumulation stage result: %1")
|
||||||
.arg(QBenchmarkTestMethodData::current->result.value)), 0, 0);
|
.arg(QBenchmarkTestMethodData::current->result.value)), nullptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1115,7 +1115,7 @@ bool TestMethods::invokeTest(int index, const char *data, WatchDog *watchDog) co
|
|||||||
if (data && !dataCount) {
|
if (data && !dataCount) {
|
||||||
// Let empty data tag through.
|
// Let empty data tag through.
|
||||||
if (!*data)
|
if (!*data)
|
||||||
data = 0;
|
data = nullptr;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Unknown testdata for function %s(): '%s'\n", name.constData(), data);
|
fprintf(stderr, "Unknown testdata for function %s(): '%s'\n", name.constData(), data);
|
||||||
fprintf(stderr, "Function has no testdata.\n");
|
fprintf(stderr, "Function has no testdata.\n");
|
||||||
@ -1130,10 +1130,9 @@ bool TestMethods::invokeTest(int index, const char *data, WatchDog *watchDog) co
|
|||||||
if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) {
|
if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) {
|
||||||
foundFunction = true;
|
foundFunction = true;
|
||||||
|
|
||||||
QTestPrivate::checkBlackLists(name.constData(), dataCount ? table.testData(curDataIndex)->dataTag() : 0);
|
QTestPrivate::checkBlackLists(name.constData(), dataCount ? table.testData(curDataIndex)->dataTag() : nullptr);
|
||||||
|
|
||||||
QTestDataSetter s(curDataIndex >= dataCount ? static_cast<QTestData *>(0)
|
QTestDataSetter s(curDataIndex >= dataCount ? nullptr : table.testData(curDataIndex));
|
||||||
: table.testData(curDataIndex));
|
|
||||||
|
|
||||||
QTestPrivate::qtestMouseButtons = Qt::NoButton;
|
QTestPrivate::qtestMouseButtons = Qt::NoButton;
|
||||||
if (watchDog)
|
if (watchDog)
|
||||||
@ -1156,14 +1155,14 @@ bool TestMethods::invokeTest(int index, const char *data, WatchDog *watchDog) co
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestResult::setCurrentGlobalTestData(0);
|
QTestResult::setCurrentGlobalTestData(nullptr);
|
||||||
++curGlobalDataIndex;
|
++curGlobalDataIndex;
|
||||||
} while (curGlobalDataIndex < globalDataCount);
|
} while (curGlobalDataIndex < globalDataCount);
|
||||||
|
|
||||||
QTestResult::finishedCurrentTestFunction();
|
QTestResult::finishedCurrentTestFunction();
|
||||||
QTestResult::setSkipCurrentTest(false);
|
QTestResult::setSkipCurrentTest(false);
|
||||||
QTestResult::setBlacklistCurrentTest(false);
|
QTestResult::setBlacklistCurrentTest(false);
|
||||||
QTestResult::setCurrentTestData(0);
|
QTestResult::setCurrentTestData(nullptr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1241,7 +1240,7 @@ char *toHexRepresentation(const char *ba, int length)
|
|||||||
* */
|
* */
|
||||||
const int maxLen = 50;
|
const int maxLen = 50;
|
||||||
const int len = qMin(maxLen, length);
|
const int len = qMin(maxLen, length);
|
||||||
char *result = 0;
|
char *result = nullptr;
|
||||||
|
|
||||||
if (length > maxLen) {
|
if (length > maxLen) {
|
||||||
const int size = len * 3 + 4;
|
const int size = len * 3 + 4;
|
||||||
@ -1497,7 +1496,7 @@ void TestMethods::invokeTests(QObject *testObject) const
|
|||||||
QTestResult::finishedCurrentTestDataCleanup();
|
QTestResult::finishedCurrentTestDataCleanup();
|
||||||
}
|
}
|
||||||
QTestResult::finishedCurrentTestFunction();
|
QTestResult::finishedCurrentTestFunction();
|
||||||
QTestResult::setCurrentTestFunction(0);
|
QTestResult::setCurrentTestFunction(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
@ -1567,7 +1566,7 @@ FatalSignalHandler::FatalSignalHandler()
|
|||||||
stack.ss_flags = 0;
|
stack.ss_flags = 0;
|
||||||
stack.ss_size = sizeof alternate_stack;
|
stack.ss_size = sizeof alternate_stack;
|
||||||
stack.ss_sp = alternate_stack;
|
stack.ss_sp = alternate_stack;
|
||||||
sigaltstack(&stack, 0);
|
sigaltstack(&stack, nullptr);
|
||||||
act.sa_flags |= SA_ONSTACK;
|
act.sa_flags |= SA_ONSTACK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1586,7 +1585,7 @@ FatalSignalHandler::FatalSignalHandler()
|
|||||||
oldact.sa_flags & SA_SIGINFO ||
|
oldact.sa_flags & SA_SIGINFO ||
|
||||||
#endif
|
#endif
|
||||||
oldact.sa_handler != SIG_DFL) {
|
oldact.sa_handler != SIG_DFL) {
|
||||||
sigaction(fatalSignals[i], &oldact, 0);
|
sigaction(fatalSignals[i], &oldact, nullptr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sigaddset(&handledSignals, fatalSignals[i]);
|
sigaddset(&handledSignals, fatalSignals[i]);
|
||||||
@ -1611,7 +1610,7 @@ FatalSignalHandler::~FatalSignalHandler()
|
|||||||
|
|
||||||
// If someone overwrote it in the mean time, put it back
|
// If someone overwrote it in the mean time, put it back
|
||||||
if (oldact.sa_handler != FatalSignalHandler::signal)
|
if (oldact.sa_handler != FatalSignalHandler::signal)
|
||||||
sigaction(i, &oldact, 0);
|
sigaction(i, &oldact, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1927,7 +1926,7 @@ int QTest::qRun()
|
|||||||
QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__);
|
QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__);
|
||||||
if (QTestResult::currentTestFunction()) {
|
if (QTestResult::currentTestFunction()) {
|
||||||
QTestResult::finishedCurrentTestFunction();
|
QTestResult::finishedCurrentTestFunction();
|
||||||
QTestResult::setCurrentTestFunction(0);
|
QTestResult::setCurrentTestFunction(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestLog::stopLogging();
|
QTestLog::stopLogging();
|
||||||
@ -1936,7 +1935,7 @@ int QTest::qRun()
|
|||||||
IOPMAssertionRelease(powerID);
|
IOPMAssertionRelease(powerID);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
currentTestObject = 0;
|
currentTestObject = nullptr;
|
||||||
|
|
||||||
// Rethrow exception to make debugging easier.
|
// Rethrow exception to make debugging easier.
|
||||||
throw;
|
throw;
|
||||||
@ -1957,13 +1956,13 @@ int QTest::qRun()
|
|||||||
*/
|
*/
|
||||||
void QTest::qCleanup()
|
void QTest::qCleanup()
|
||||||
{
|
{
|
||||||
currentTestObject = 0;
|
currentTestObject = nullptr;
|
||||||
|
|
||||||
QTestTable::clearGlobalTestTable();
|
QTestTable::clearGlobalTestTable();
|
||||||
QTestLog::stopLogging();
|
QTestLog::stopLogging();
|
||||||
|
|
||||||
delete QBenchmarkGlobalData::current;
|
delete QBenchmarkGlobalData::current;
|
||||||
QBenchmarkGlobalData::current = 0;
|
QBenchmarkGlobalData::current = nullptr;
|
||||||
|
|
||||||
QSignalDumper::endDump();
|
QSignalDumper::endDump();
|
||||||
|
|
||||||
@ -2727,7 +2726,7 @@ template <> Q_TESTLIB_EXPORT char *QTest::toString<char>(const char &t)
|
|||||||
char *QTest::toString(const char *str)
|
char *QTest::toString(const char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
if (!str)
|
||||||
return 0;
|
return nullptr;
|
||||||
char *msg = new char[strlen(str) + 1];
|
char *msg = new char[strlen(str) + 1];
|
||||||
return qstrcpy(msg, str);
|
return qstrcpy(msg, str);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ const char *QTestElementAttribute::name() const
|
|||||||
if (attributeIndex != QTest::AI_Undefined)
|
if (attributeIndex != QTest::AI_Undefined)
|
||||||
return AttributeNames[attributeIndex];
|
return AttributeNames[attributeIndex];
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTest::AttributeIndex QTestElementAttribute::index() const
|
QTest::AttributeIndex QTestElementAttribute::index() const
|
||||||
@ -164,7 +164,7 @@ bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *val
|
|||||||
attributeIndex = index;
|
attributeIndex = index;
|
||||||
attributeValue = qstrdup(value);
|
attributeValue = qstrdup(value);
|
||||||
|
|
||||||
return attributeValue != 0;
|
return attributeValue != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -166,7 +166,7 @@ namespace QTest {
|
|||||||
IgnoreResultList *next = nullptr;
|
IgnoreResultList *next = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static IgnoreResultList *ignoreResultList = 0;
|
static IgnoreResultList *ignoreResultList = nullptr;
|
||||||
|
|
||||||
static QVector<QAbstractTestLogger*> loggers;
|
static QVector<QAbstractTestLogger*> loggers;
|
||||||
static bool loggerUsingStdout = false;
|
static bool loggerUsingStdout = false;
|
||||||
@ -181,7 +181,7 @@ namespace QTest {
|
|||||||
{
|
{
|
||||||
if (!ignoreResultList)
|
if (!ignoreResultList)
|
||||||
return false;
|
return false;
|
||||||
IgnoreResultList *last = 0;
|
IgnoreResultList *last = nullptr;
|
||||||
IgnoreResultList *list = ignoreResultList;
|
IgnoreResultList *list = ignoreResultList;
|
||||||
while (list) {
|
while (list) {
|
||||||
if (list->matches(type, message)) {
|
if (list->matches(type, message)) {
|
||||||
@ -191,7 +191,7 @@ namespace QTest {
|
|||||||
else if (list->next)
|
else if (list->next)
|
||||||
ignoreResultList = list->next;
|
ignoreResultList = list->next;
|
||||||
else
|
else
|
||||||
ignoreResultList = 0;
|
ignoreResultList = nullptr;
|
||||||
|
|
||||||
delete list;
|
delete list;
|
||||||
return true;
|
return true;
|
||||||
@ -438,11 +438,11 @@ void QTestLog::stopLogging()
|
|||||||
void QTestLog::addLogger(LogMode mode, const char *filename)
|
void QTestLog::addLogger(LogMode mode, const char *filename)
|
||||||
{
|
{
|
||||||
if (filename && strcmp(filename, "-") == 0)
|
if (filename && strcmp(filename, "-") == 0)
|
||||||
filename = 0;
|
filename = nullptr;
|
||||||
if (!filename)
|
if (!filename)
|
||||||
QTest::loggerUsingStdout = true;
|
QTest::loggerUsingStdout = true;
|
||||||
|
|
||||||
QAbstractTestLogger *logger = 0;
|
QAbstractTestLogger *logger = nullptr;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case QTestLog::Plain:
|
case QTestLog::Plain:
|
||||||
logger = new QPlainTestLogger(filename);
|
logger = new QPlainTestLogger(filename);
|
||||||
|
@ -49,33 +49,33 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const char *currentAppName = 0;
|
static const char *currentAppName = nullptr;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QTest
|
namespace QTest
|
||||||
{
|
{
|
||||||
static QTestData *currentTestData = 0;
|
static QTestData *currentTestData = nullptr;
|
||||||
static QTestData *currentGlobalTestData = 0;
|
static QTestData *currentGlobalTestData = nullptr;
|
||||||
static const char *currentTestFunc = 0;
|
static const char *currentTestFunc = nullptr;
|
||||||
static const char *currentTestObjectName = 0;
|
static const char *currentTestObjectName = nullptr;
|
||||||
static bool failed = false;
|
static bool failed = false;
|
||||||
static bool skipCurrentTest = false;
|
static bool skipCurrentTest = false;
|
||||||
static bool blacklistCurrentTest = false;
|
static bool blacklistCurrentTest = false;
|
||||||
|
|
||||||
static const char *expectFailComment = 0;
|
static const char *expectFailComment = nullptr;
|
||||||
static int expectFailMode = 0;
|
static int expectFailMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestResult::reset()
|
void QTestResult::reset()
|
||||||
{
|
{
|
||||||
QTest::currentTestData = 0;
|
QTest::currentTestData = nullptr;
|
||||||
QTest::currentGlobalTestData = 0;
|
QTest::currentGlobalTestData = nullptr;
|
||||||
QTest::currentTestFunc = 0;
|
QTest::currentTestFunc = nullptr;
|
||||||
QTest::currentTestObjectName = 0;
|
QTest::currentTestObjectName = nullptr;
|
||||||
QTest::failed = false;
|
QTest::failed = false;
|
||||||
|
|
||||||
QTest::expectFailComment = 0;
|
QTest::expectFailComment = nullptr;
|
||||||
QTest::expectFailMode = 0;
|
QTest::expectFailMode = 0;
|
||||||
QTest::blacklistCurrentTest = false;
|
QTest::blacklistCurrentTest = false;
|
||||||
|
|
||||||
@ -127,18 +127,18 @@ static void clearExpectFail()
|
|||||||
{
|
{
|
||||||
QTest::expectFailMode = 0;
|
QTest::expectFailMode = 0;
|
||||||
delete [] const_cast<char *>(QTest::expectFailComment);
|
delete [] const_cast<char *>(QTest::expectFailComment);
|
||||||
QTest::expectFailComment = 0;
|
QTest::expectFailComment = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestResult::finishedCurrentTestData()
|
void QTestResult::finishedCurrentTestData()
|
||||||
{
|
{
|
||||||
if (QTest::expectFailMode)
|
if (QTest::expectFailMode)
|
||||||
addFailure("QEXPECT_FAIL was called without any subsequent verification statements", 0, 0);
|
addFailure("QEXPECT_FAIL was called without any subsequent verification statements", nullptr, 0);
|
||||||
clearExpectFail();
|
clearExpectFail();
|
||||||
|
|
||||||
if (!QTest::failed && QTestLog::unhandledIgnoreMessages()) {
|
if (!QTest::failed && QTestLog::unhandledIgnoreMessages()) {
|
||||||
QTestLog::printUnhandledIgnoreMessages();
|
QTestLog::printUnhandledIgnoreMessages();
|
||||||
addFailure("Not all expected messages were received", 0, 0);
|
addFailure("Not all expected messages were received", nullptr, 0);
|
||||||
}
|
}
|
||||||
QTestLog::clearIgnoreMessages();
|
QTestLog::clearIgnoreMessages();
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void QTestResult::finishedCurrentTestDataCleanup()
|
|||||||
|
|
||||||
void QTestResult::finishedCurrentTestFunction()
|
void QTestResult::finishedCurrentTestFunction()
|
||||||
{
|
{
|
||||||
QTest::currentTestFunc = 0;
|
QTest::currentTestFunc = nullptr;
|
||||||
QTest::failed = false;
|
QTest::failed = false;
|
||||||
|
|
||||||
QTestLog::leaveTestFunction();
|
QTestLog::leaveTestFunction();
|
||||||
@ -171,14 +171,12 @@ const char *QTestResult::currentTestFunction()
|
|||||||
|
|
||||||
const char *QTestResult::currentDataTag()
|
const char *QTestResult::currentDataTag()
|
||||||
{
|
{
|
||||||
return QTest::currentTestData ? QTest::currentTestData->dataTag()
|
return QTest::currentTestData ? QTest::currentTestData->dataTag() : nullptr;
|
||||||
: static_cast<const char *>(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *QTestResult::currentGlobalDataTag()
|
const char *QTestResult::currentGlobalDataTag()
|
||||||
{
|
{
|
||||||
return QTest::currentGlobalTestData ? QTest::currentGlobalTestData->dataTag()
|
return QTest::currentGlobalTestData ? QTest::currentGlobalTestData->dataTag() : nullptr;
|
||||||
: static_cast<const char *>(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isExpectFailData(const char *dataIndex)
|
static bool isExpectFailData(const char *dataIndex)
|
||||||
|
@ -78,8 +78,8 @@ public:
|
|||||||
static QTestTable *gTable;
|
static QTestTable *gTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
QTestTable *QTestTablePrivate::currentTestTable = 0;
|
QTestTable *QTestTablePrivate::currentTestTable = nullptr;
|
||||||
QTestTable *QTestTablePrivate::gTable = 0;
|
QTestTable *QTestTablePrivate::gTable = nullptr;
|
||||||
|
|
||||||
void QTestTable::addColumn(int type, const char *name)
|
void QTestTable::addColumn(int type, const char *name)
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ QTestTable::QTestTable()
|
|||||||
|
|
||||||
QTestTable::~QTestTable()
|
QTestTable::~QTestTable()
|
||||||
{
|
{
|
||||||
QTestTablePrivate::currentTestTable = 0;
|
QTestTablePrivate::currentTestTable = nullptr;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ QTestTable *QTestTable::globalTestTable()
|
|||||||
void QTestTable::clearGlobalTestTable()
|
void QTestTable::clearGlobalTestTable()
|
||||||
{
|
{
|
||||||
delete QTestTablePrivate::gTable;
|
delete QTestTablePrivate::gTable;
|
||||||
QTestTablePrivate::gTable = 0;
|
QTestTablePrivate::gTable = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestTable *QTestTable::currentTestTable()
|
QTestTable *QTestTable::currentTestTable()
|
||||||
|
@ -129,7 +129,7 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* key = 0;
|
char const* key = nullptr;
|
||||||
if (attrindex == QTest::AI_Description)
|
if (attrindex == QTest::AI_Description)
|
||||||
key = "message";
|
key = "message";
|
||||||
else if (attrindex != QTest::AI_File && attrindex != QTest::AI_Line)
|
else if (attrindex != QTest::AI_File && attrindex != QTest::AI_Line)
|
||||||
|
@ -148,7 +148,7 @@ void QXunitTestLogger::leaveTestFunction()
|
|||||||
void QXunitTestLogger::addIncident(IncidentTypes type, const char *description,
|
void QXunitTestLogger::addIncident(IncidentTypes type, const char *description,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
{
|
{
|
||||||
const char *typeBuf = 0;
|
const char *typeBuf = nullptr;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -292,7 +292,7 @@ void QXunitTestLogger::addTag(QTestElement* element)
|
|||||||
void QXunitTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line)
|
void QXunitTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line)
|
||||||
{
|
{
|
||||||
QTestElement *errorElement = new QTestElement(QTest::LET_Error);
|
QTestElement *errorElement = new QTestElement(QTest::LET_Error);
|
||||||
const char *typeBuf = 0;
|
const char *typeBuf = nullptr;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QAbstractTestLogger::Warn:
|
case QAbstractTestLogger::Warn:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user