Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTestResult Class Reference

#include <qtestresult_p.h>

+ Collaboration diagram for QTestResult:

Static Public Member Functions

static const char * currentTestObjectName ()
 
static bool currentTestFailed ()
 
static QTestDatacurrentTestData ()
 
static QTestDatacurrentGlobalTestData ()
 
static const char * currentTestFunction ()
 
static const char * currentDataTag ()
 
static const char * currentGlobalDataTag ()
 
static void finishedCurrentTestData ()
 This function is called after completing each test function, including test functions that are not data-driven.
 
static void finishedCurrentTestDataCleanup ()
 This function is called after completing each test function, including test functions that are not data-driven.
 
static void finishedCurrentTestFunction ()
 This function is called after completing each test function, including test functions that are data-driven.
 
static void reset ()
 
static void setBlacklistCurrentTest (bool b)
 
static void addFailure (const char *message, const char *file=nullptr, int line=0)
 
static bool compare (bool success, const char *failureMsg, char *val1, char *val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, double val1, double val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, float val1, float val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, int val1, int val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, unsigned val1, unsigned val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, QStringView val1, QStringView val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, const QLatin1StringView &val1, QStringView val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, QStringView val1, const QLatin1StringView &val2, const char *actual, const char *expected, const char *file, int line)
 
static bool compare (bool success, const char *failureMsg, const char *actual, const char *expeceted, const char *file, int line)
 
static void setCurrentGlobalTestData (QTestData *data)
 
static void setCurrentTestData (QTestData *data)
 
static void setCurrentTestFunction (const char *func)
 
static void setCurrentTestObject (const char *name)
 
static void addSkip (const char *message, const char *file, int line)
 
static bool expectFail (const char *dataIndex, const char *comment, QTest::TestFailMode mode, const char *file, int line)
 
static void fail (const char *message, const char *file, int line)
 
static bool verify (bool statement, const char *statementStr, const char *extraInfo, const char *file, int line)
 
static void setSkipCurrentTest (bool value)
 
static bool skipCurrentTest ()
 
static void setCurrentAppName (const char *appName)
 
static const char * currentAppName ()
 
static bool reportResult (bool success, const void *lhs, const void *rhs, const char *(*lhsFormatter)(const void *), const char *(*rhsFormatter)(const void *), const char *lhsExpr, const char *rhsExpr, QTest::ComparisonOperation op, const char *file, int line, const char *failureMessage=nullptr)
 

Detailed Description

Definition at line 27 of file qtestresult_p.h.

Member Function Documentation

◆ addFailure()

void QTestResult::addFailure ( const char * message,
const char * file = nullptr,
int line = 0 )
static

Definition at line 537 of file qtestresult.cpp.

References QTestLog::addBFail(), QTestLog::addFail(), QTest::blacklistCurrentTest, clearExpectFail(), QThread::currentThread(), file, QTestEventLoop::instance(), line, qApp, and QTest::setFailed().

Referenced by checkStatement(), expectFail(), QuickTestResult::fail(), finishedCurrentTestData(), finishedCurrentTestDataCleanup(), QTest::handleFailOnWarning(), QTest::messageHandler(), and QTest::qRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSkip()

void QTestResult::addSkip ( const char * message,
const char * file,
int line )
static

Definition at line 550 of file qtestresult.cpp.

References QTestLog::addSkip(), clearExpectFail(), file, and line.

Referenced by QTest::qSkip(), and QuickTestResult::skip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare() [1/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
char * val1,
char * val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 444 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

Referenced by QuickTestResult::compare(), QTest::compare_helper(), QTest::qCompare(), QTest::qCompare(), QTest::qCompare(), QTest::qCompare(), QTest::qCompare(), QTest::qCompare(), and QTest::qCompare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare() [2/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
const char * actual,
const char * expeceted,
const char * file,
int line )
static

Definition at line 530 of file qtestresult.cpp.

References compareHelper(), file, and line.

+ Here is the call graph for this function:

◆ compare() [3/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
const QLatin1StringView & val1,
QStringView val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 520 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [4/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
double val1,
double val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 462 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [5/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
float val1,
float val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 470 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [6/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
int val1,
int val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 478 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [7/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
QStringView val1,
const QLatin1StringView & val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 512 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [8/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
QStringView val1,
QStringView val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 504 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare() [9/9]

bool QTestResult::compare ( bool success,
const char * failureMsg,
unsigned val1,
unsigned val2,
const char * actual,
const char * expected,
const char * file,
int line )
static

Definition at line 496 of file qtestresult.cpp.

References compareHelper(), expected, file, and line.

+ Here is the call graph for this function:

◆ currentAppName()

const char * QTestResult::currentAppName ( )
static

Definition at line 582 of file qtestresult.cpp.

Referenced by QTest::currentAppName(), QTest::qRun(), QTest::qtest_qParseArgs(), setCurrentAppName(), and QTestLog::stopLogging().

+ Here is the caller graph for this function:

◆ currentDataTag()

const char * QTestResult::currentDataTag ( )
static

Definition at line 210 of file qtestresult.cpp.

References QTest::currentTestData.

Referenced by QCsvBenchmarkLogger::addBenchmarkResult(), QXmlTestLogger::addIncident(), QXmlTestLogger::addMessage(), QTest::currentDataTag(), QuickTestResult::dataTag(), and QTestPrivate::generateTestIdentifier().

+ Here is the caller graph for this function:

◆ currentGlobalDataTag()

const char * QTestResult::currentGlobalDataTag ( )
static

Definition at line 215 of file qtestresult.cpp.

References QTest::currentGlobalTestData.

Referenced by QCsvBenchmarkLogger::addBenchmarkResult(), QXmlTestLogger::addIncident(), QXmlTestLogger::addMessage(), and QTestPrivate::generateTestIdentifier().

+ Here is the caller graph for this function:

◆ currentGlobalTestData()

QTestData * QTestResult::currentGlobalTestData ( )
static

Definition at line 92 of file qtestresult.cpp.

References QTest::currentGlobalTestData.

Referenced by QTest::qGlobalData().

+ Here is the caller graph for this function:

◆ currentTestData()

QTestData * QTestResult::currentTestData ( )
static

Definition at line 97 of file qtestresult.cpp.

References QTest::currentTestData.

Referenced by QTest::qData(), and QTest::qElementData().

+ Here is the caller graph for this function:

◆ currentTestFailed()

bool QTestResult::currentTestFailed ( )
static

Definition at line 87 of file qtestresult.cpp.

References QTest::hasFailed().

Referenced by QTest::currentTestFailed(), QTest::currentTestResolved(), QTest::TestMethods::invokeTests(), and QuickTestResult::isFailed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentTestFunction()

const char * QTestResult::currentTestFunction ( )
static

Definition at line 205 of file qtestresult.cpp.

References QTest::currentTestFunc.

Referenced by QCsvBenchmarkLogger::addBenchmarkResult(), QTapTestLogger::addIncident(), QTest::currentTestFunction(), QJUnitTestLogger::enterTestData(), QTestPrivate::generateTestIdentifier(), and QTest::qRun().

+ Here is the caller graph for this function:

◆ currentTestObjectName()

const char * QTestResult::currentTestObjectName ( )
static

◆ expectFail()

bool QTestResult::expectFail ( const char * dataIndex,
const char * comment,
QTest::TestFailMode mode,
const char * file,
int line )
static

Definition at line 231 of file qtestresult.cpp.

References addFailure(), QTest::expectFailComment, QTest::expectFailMode, file, isExpectFailData(), line, and QTEST_ASSERT.

Referenced by QuickTestResult::expectFail(), QuickTestResult::expectFailContinue(), and QTest::qExpectFail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fail()

void QTestResult::fail ( const char * message,
const char * file,
int line )
static

Definition at line 285 of file qtestresult.cpp.

References checkStatement(), file, and line.

Referenced by QTest::qFail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finishedCurrentTestData()

void QTestResult::finishedCurrentTestData ( )
static

This function is called after completing each test function, including test functions that are not data-driven.

For data-driven functions, this is called after each call to the test function, with distinct data. Otherwise, this function is called once, with currentTestData() and currentGlobalTestData() set to \nullptr.

The function is called before the test's cleanup(), if it has one.

For benchmarks, this will be called after each repeat of a function (with the same data row), when the benchmarking code decides to re-run one to get sufficient data.

See also
finishedCurrentTestDataCleanup()

Definition at line 146 of file qtestresult.cpp.

References addFailure(), clearExpectFail(), and QTest::expectFailMode.

Referenced by QuickTestResult::finishTestData(), and QTest::TestMethods::invokeTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finishedCurrentTestDataCleanup()

void QTestResult::finishedCurrentTestDataCleanup ( )
static

This function is called after completing each test function, including test functions that are not data-driven.

For data-driven functions, this is called after each call to the test function, with distinct data. Otherwise, this function is called once, with currentTestData() and currentGlobalTestData() set to \nullptr.

The function is called after the test's cleanup(), if it has one.

For benchmarks, this is called after all repeat calls to the function (with a given data row).

See also
finishedCurrentTestData()

Definition at line 169 of file qtestresult.cpp.

References QTestLog::addBPass(), addFailure(), QTestLog::addPass(), QTest::blacklistCurrentTest, QTestLog::clearCurrentTestState(), QTest::hasFailed(), QTestLog::printUnhandledIgnoreMessages(), QTest::resetFailed(), QTest::skipCurrentTest, and QTestLog::unhandledIgnoreMessages().

Referenced by QuickTestResult::finishTestDataCleanup(), and QTest::TestMethods::invokeTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finishedCurrentTestFunction()

void QTestResult::finishedCurrentTestFunction ( )
static

This function is called after completing each test function, including test functions that are data-driven.

For data-driven functions, this is called after after all data rows have been tested, and the data table has been cleared, so both currentTestData() and currentGlobalTestData() will be \nullptr.

Definition at line 196 of file qtestresult.cpp.

References QTestLog::clearCurrentTestState(), QTest::currentTestFunc, QTestLog::leaveTestFunction(), and QTest::resetFailed().

Referenced by QuickTestResult::finishTestFunction(), QTest::TestMethods::invokeTests(), and QTest::qRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reportResult()

bool QTestResult::reportResult ( bool success,
const void * lhs,
const void * rhs,
const char *(*)(const void *) lhsFormatter,
const char *(*)(const void *) rhsFormatter,
const char * lhsExpr,
const char * rhsExpr,
QTest::ComparisonOperation op,
const char * file,
int line,
const char * failureMessage = nullptr )
static

Definition at line 631 of file qtestresult.cpp.

References checkStatement(), QTest::expectFailMode, failureMessageForOp(), file, formatFailMessage(), QTestLog::info(), line, macroNameForOp(), maxMsgLen, qsnprintf(), QTEST_ASSERT, and QTestLog::verboseLevel().

Referenced by QTest::compare_helper(), and reportResult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

void QTestResult::reset ( )
static

Definition at line 67 of file qtestresult.cpp.

References QTest::blacklistCurrentTest, QTest::currentGlobalTestData, QTest::currentTestData, QTest::currentTestFunc, QTest::currentTestObjectName, QTest::expectFailComment, QTest::expectFailMode, QTestLog::resetCounters(), and QTest::resetFailed().

Referenced by QTest::qInit(), QuickTestResult::reset(), and QuickTestResult::setProgramName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlacklistCurrentTest()

void QTestResult::setBlacklistCurrentTest ( bool b)
static

Definition at line 82 of file qtestresult.cpp.

References QTest::blacklistCurrentTest.

Referenced by QTest::TestMethods::invokeTests(), QuickTestResult::setDataTag(), QuickTestResult::setFunctionName(), and QuickTestResult::setSkipped().

+ Here is the caller graph for this function:

◆ setCurrentAppName()

void QTestResult::setCurrentAppName ( const char * appName)
static

Definition at line 577 of file qtestresult.cpp.

References currentAppName().

Referenced by QTest::qInit(), and QuickTestResult::setCurrentAppname().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentGlobalTestData()

void QTestResult::setCurrentGlobalTestData ( QTestData * data)
static

Definition at line 102 of file qtestresult.cpp.

References QTest::currentGlobalTestData.

◆ setCurrentTestData()

void QTestResult::setCurrentTestData ( QTestData * data)
static

Definition at line 107 of file qtestresult.cpp.

References QTest::currentTestData, QTestLog::enterTestData(), and QTest::resetFailed().

Referenced by QTest::QTestDataSetter::QTestDataSetter(), QTest::QTestDataSetter::~QTestDataSetter(), and QuickTestResult::setDataTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentTestFunction()

void QTestResult::setCurrentTestFunction ( const char * func)
static

Definition at line 115 of file qtestresult.cpp.

References QTest::currentTestFunc, QTestLog::enterTestFunction(), and QTest::resetFailed().

Referenced by QTest::TestMethods::invokeTests(), QTest::qRun(), and QuickTestResult::setFunctionName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentTestObject()

void QTestResult::setCurrentTestObject ( const char * name)
static

Definition at line 557 of file qtestresult.cpp.

References QTest::currentTestObjectName.

Referenced by QTest::qInit(), runTests(), QuickTestResult::setProgramName(), and QuickTestResult::stopLogging().

+ Here is the caller graph for this function:

◆ setSkipCurrentTest()

void QTestResult::setSkipCurrentTest ( bool value)
static

Definition at line 567 of file qtestresult.cpp.

References QTest::skipCurrentTest.

Referenced by QTest::TestMethods::invokeTests(), QTest::qSkip(), QuickTestResult::setSkipped(), and QuickTestResult::skip().

+ Here is the caller graph for this function:

◆ skipCurrentTest()

bool QTestResult::skipCurrentTest ( )
static

Definition at line 572 of file qtestresult.cpp.

References QTest::skipCurrentTest.

Referenced by QTest::currentTestResolved(), QTest::TestMethods::invokeTests(), and QuickTestResult::isSkipped().

+ Here is the caller graph for this function:

◆ verify()

bool QTestResult::verify ( bool statement,
const char * statementStr,
const char * extraInfo,
const char * file,
int line )
static

Definition at line 296 of file qtestresult.cpp.

References checkStatement(), QTest::expectFailMode, file, QTestLog::info(), line, maxMsgLen, qsnprintf(), QTEST_ASSERT, and QTestLog::verboseLevel().

Referenced by QTest::qVerify(), and QuickTestResult::verify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: