![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <QtTest/qttestglobal.h>
#include <QtTest/qtesttostring.h>
#include <QtCore/qstring.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qtemporarydir.h>
#include <QtCore/qthread.h>
#include <QtCore/qxpfunctional.h>
#include <QtCore/qxptype_traits.h>
#include <QtCore/q20utility.h>
#include <string.h>
#include <exception>
Go to the source code of this file.
Namespaces | |
namespace | QTest |
[15] | |
namespace | QTest::Internal |
Macros | |
#define | QTEST_FAIL_ACTION do { QTest::Internal::maybeThrowOnFail(); return; } while (false) |
#define | QTEST_SKIP_ACTION do { QTest::Internal::maybeThrowOnSkip(); return; } while (false) |
#define | QVERIFY(statement) |
#define | QFAIL(message) |
#define | QVERIFY2(statement, description) |
#define | QCOMPARE(actual, expected) |
#define | QCOMPARE_OP_IMPL(lhs, rhs, op, opId) |
#define | QCOMPARE_EQ(computed, baseline) |
#define | QCOMPARE_NE(computed, baseline) |
#define | QCOMPARE_LT(computed, baseline) |
#define | QCOMPARE_LE(computed, baseline) |
#define | QCOMPARE_GT(computed, baseline) |
#define | QCOMPARE_GE(computed, baseline) |
#define | QVERIFY_THROWS_NO_EXCEPTION(...) |
#define | QVERIFY_THROWS_EXCEPTION(exceptiontype, ...) |
#define | QTRY_LOOP_IMPL(expr, timeoutValue, step) |
#define | QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step) |
#define | QTRY_IMPL(expr, timeoutAsGiven) |
#define | QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) |
#define | QTRY_VERIFY(expr) |
#define | QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) |
#define | QTRY_VERIFY2(expr, messageExpression) |
#define | QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) |
#define | QTRY_COMPARE(expr, expected) |
#define | QTRY_COMPARE_OP_WITH_TIMEOUT_IMPL(computed, baseline, op, opId, timeout) |
#define | QTRY_COMPARE_EQ_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_EQ(computed, baseline) |
#define | QTRY_COMPARE_NE_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_NE(computed, baseline) |
#define | QTRY_COMPARE_LT_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_LT(computed, baseline) |
#define | QTRY_COMPARE_LE_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_LE(computed, baseline) |
#define | QTRY_COMPARE_GT_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_GT(computed, baseline) |
#define | QTRY_COMPARE_GE_WITH_TIMEOUT(computed, baseline, timeout) |
#define | QTRY_COMPARE_GE(computed, baseline) |
#define | QSKIP_INTERNAL(statement) |
#define | QSKIP(statement, ...) |
#define | QEXPECT_FAIL(dataIndex, comment, mode) |
#define | QFETCH(Type, name) |
#define | QFETCH_GLOBAL(Type, name) |
#define | QTEST(actual, testElement) |
#define | QCOMPARE_3WAY(...) |
#define | QFINDTESTDATA(basepath) |
#define | QEXTRACTTESTDATA(resourcePath) |
#define | QWARN(msg) |
Functions | |
Q_TESTLIB_EXPORT void | QTest::Internal::throwOnFail () |
Q_TESTLIB_EXPORT void | QTest::Internal::throwOnSkip () |
Q_TESTLIB_EXPORT void | QTest::Internal::maybeThrowOnFail () |
Q_TESTLIB_EXPORT void | QTest::Internal::maybeThrowOnSkip () |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT QString | QTest::Internal::formatTryTimeoutDebugMessage (q_no_char8_t::QUtf8StringView expr, std::chrono::milliseconds timeout, std::chrono::milliseconds actual) |
Q_TESTLIB_EXPORT Q_DECL_COLD_FUNCTION const char * | QTest::Internal::formatPropertyTestHelperFailure (char *msg, size_t maxMsgLen, const char *actual, const char *expected, const char *actualExpr, const char *expectedExpr) |
template<typename T1> | |
const char * | QTest::Internal::genericToString (const void *arg) |
template<> | |
const char * | QTest::Internal::genericToString< char * > (const void *arg) |
template<> | |
const char * | QTest::Internal::genericToString< std::nullptr_t > (const void *) |
template<typename T> | |
const char * | QTest::Internal::pointerToString (const void *arg) |
Q_TESTLIB_EXPORT void | QTest::qInit (QObject *testObject, int argc=0, char **argv=nullptr) |
Q_TESTLIB_EXPORT int | QTest::qRun () |
Q_TESTLIB_EXPORT void | QTest::qCleanup () |
Q_TESTLIB_EXPORT int | QTest::qExec (QObject *testObject, int argc=0, char **argv=nullptr) |
Executes tests declared in testObject. | |
Q_TESTLIB_EXPORT int | QTest::qExec (QObject *testObject, const QStringList &arguments) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Q_TESTLIB_EXPORT void | QTest::setMainSourcePath (const char *file, const char *builddir=nullptr) |
void | QTest::setThrowOnFail (bool enable) noexcept |
void | QTest::setThrowOnSkip (bool enable) noexcept |
Q_TESTLIB_EXPORT bool | QTest::qVerify (bool statement, const char *statementStr, const char *description, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | QTest::qFail (const char *message, const char *file, int line) |
Q_TESTLIB_EXPORT void | QTest::qSkip (const char *message, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qExpectFail (const char *dataIndex, const char *comment, TestFailMode mode, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | QTest::qCaught (const char *expected, const char *what, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | QTest::qCaught (const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT void | QTest::ignoreMessage (QtMsgType type, const char *message) |
Ignores messages created by qDebug(), qInfo() or qWarning(). | |
Q_TESTLIB_EXPORT void | QTest::failOnWarning () |
Q_TESTLIB_EXPORT void | QTest::failOnWarning (const char *message) |
Q_TESTLIB_EXPORT QString | QTest::qFindTestData (const char *basepath, const char *file=nullptr, int line=0, const char *builddir=nullptr, const char *sourcedir=nullptr) |
Q_TESTLIB_EXPORT QString | QTest::qFindTestData (const QString &basepath, const char *file=nullptr, int line=0, const char *builddir=nullptr, const char *sourcedir=nullptr) |
Q_TESTLIB_EXPORT void * | QTest::qData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | QTest::qGlobalData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | QTest::qElementData (const char *elementName, int metaTypeId) |
Q_TESTLIB_EXPORT QObject * | QTest::testObject () |
Q_TESTLIB_EXPORT const char * | QTest::currentAppName () |
Returns the name of the binary that is currently executed. | |
Q_TESTLIB_EXPORT const char * | QTest::currentTestFunction () |
Returns the name of the test function that is currently executed. | |
Q_TESTLIB_EXPORT const char * | QTest::currentDataTag () |
Returns the name of the current test data. | |
Q_TESTLIB_EXPORT const char * | QTest::currentGlobalDataTag () |
Returns the name of the current global test data. | |
Q_TESTLIB_EXPORT bool | QTest::currentTestFailed () |
Returns true if the current test function has failed, otherwise false. | |
Q_TESTLIB_EXPORT bool | QTest::currentTestResolved () |
Q_TESTLIB_EXPORT bool | QTest::runningTest () |
Q_TESTLIB_EXPORT Qt::Key | QTest::asciiToKey (char ascii) |
Q_TESTLIB_EXPORT char | QTest::keyToAscii (Qt::Key key) |
Q_TESTLIB_EXPORT bool | QTest::compare_helper (bool success, const char *failureMsg, const void *actualPtr, const void *expectedPtr, const char *(*actualFormatter)(const void *), const char *(*expectedFormatter)(const void *), const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::compare_helper (bool success, const char *failureMsg, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::compare_3way_helper (bool success, const char *failureMsg, const void *lhsPtr, const void *rhsPtr, const char *(*lhsFormatter)(const void *), const char *(*rhsFormatter)(const void *), const char *lhsStr, const char *rhsStr, const char *(*actualOrderFormatter)(const void *), const char *(*expectedOrderFormatter)(const void *), const void *actualOrderPtr, const void *expectedOrderPtr, const char *expectedExpression, const char *file, int line) |
Q_TESTLIB_EXPORT void | QTest::addColumnInternal (int id, const char *name) |
template<typename T> | |
void | QTest::addColumn (const char *name, T *=nullptr) |
Adds a column with type {T} to the current test data. | |
Q_TESTLIB_EXPORT QTestData & | QTest::newRow (const char *dataTag) |
Appends a new row to the current test data. | |
Q_TESTLIB_EXPORT QTestData & | QTest::addRow (const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1 |
Q_TESTLIB_EXPORT QTestData Q_TESTLIB_EXPORT bool | QTest::qCompare (qfloat16 const &t1, qfloat16 const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (float const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (int t1, int t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (unsigned t1, unsigned t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (QStringView t1, QStringView t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (QStringView t1, const QLatin1StringView &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | QTest::qCompare (const QLatin1StringView &t1, QStringView t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (const QString &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | QTest::qCompare (QString const &t1, QLatin1StringView const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | QTest::qCompare (QLatin1StringView const &t1, QString const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (const volatile void *t1, const volatile void *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (const volatile QObject *t1, const volatile QObject *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (const volatile QObject *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (std::nullptr_t, const volatile QObject *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (const volatile void *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::compare_ptr_helper (std::nullptr_t, const volatile void *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T1, typename T2 = T1> | |
bool | QTest::qCompare (const T1 &t1, const T2 &t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (double const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (float const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | QTest::qCompare (const T *t1, const T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | QTest::qCompare (T *t1, T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | QTest::qCompare (T *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | QTest::qCompare (std::nullptr_t, T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T1, typename T2> | |
bool | QTest::qCompare (const T1 *t1, const T2 *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T1, typename T2> | |
bool | QTest::qCompare (T1 *t1, T2 *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (const char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (char *t1, char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | QTest::qCompare (const char *t1, char *t2, const char *actual, const char *expected, const char *file, int line) |
template<class T> | |
bool | QTest::qTest (const T &actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line) |
bool | QTest::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, ComparisonOperation op, const char *file, int line) |
template<ComparisonOperation op, typename T1, typename T2 = T1> | |
bool | QTest::qCompareOp (T1 &&lhs, T2 &&rhs, const char *lhsExpr, const char *rhsExpr, const char *file, int line) |
template<typename OrderingType, typename LHS, typename RHS = LHS> | |
void | QTest::qCompare3Way (LHS &&lhs, RHS &&rhs, OrderingType order, const char *lhsExpression, const char *rhsExpression, const char *resultExpression, const char *file, int line)=delete |
#define QCOMPARE | ( | actual, | |
expected ) |
Definition at line 87 of file qtestcase.h.
#define QCOMPARE_3WAY | ( | ... | ) |
Definition at line 323 of file qtestcase.h.
#define QCOMPARE_EQ | ( | computed, | |
baseline ) |
Definition at line 99 of file qtestcase.h.
#define QCOMPARE_GE | ( | computed, | |
baseline ) |
Definition at line 104 of file qtestcase.h.
#define QCOMPARE_GT | ( | computed, | |
baseline ) |
Definition at line 103 of file qtestcase.h.
#define QCOMPARE_LE | ( | computed, | |
baseline ) |
Definition at line 102 of file qtestcase.h.
#define QCOMPARE_LT | ( | computed, | |
baseline ) |
Definition at line 101 of file qtestcase.h.
#define QCOMPARE_NE | ( | computed, | |
baseline ) |
Definition at line 100 of file qtestcase.h.
#define QCOMPARE_OP_IMPL | ( | lhs, | |
rhs, | |||
op, | |||
opId ) |
Definition at line 93 of file qtestcase.h.
Definition at line 298 of file qtestcase.h.
#define QEXTRACTTESTDATA | ( | resourcePath | ) |
Definition at line 340 of file qtestcase.h.
#define QFAIL | ( | message | ) |
Definition at line 70 of file qtestcase.h.
Definition at line 304 of file qtestcase.h.
Definition at line 307 of file qtestcase.h.
#define QFINDTESTDATA | ( | basepath | ) |
Definition at line 336 of file qtestcase.h.
#define QSKIP | ( | statement, | |
... ) |
Definition at line 296 of file qtestcase.h.
#define QSKIP_INTERNAL | ( | statement | ) |
Definition at line 290 of file qtestcase.h.
#define QTEST | ( | actual, | |
testElement ) |
Definition at line 310 of file qtestcase.h.
#define QTEST_FAIL_ACTION do { QTest::Internal::maybeThrowOnFail(); return; } while (false) |
Definition at line 38 of file qtestcase.h.
#define QTEST_SKIP_ACTION do { QTest::Internal::maybeThrowOnSkip(); return; } while (false) |
Definition at line 44 of file qtestcase.h.
#define QTRY_COMPARE | ( | expr, | |
expected ) |
Definition at line 237 of file qtestcase.h.
#define QTRY_COMPARE_EQ | ( | computed, | |
baseline ) |
Definition at line 251 of file qtestcase.h.
#define QTRY_COMPARE_EQ_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 248 of file qtestcase.h.
#define QTRY_COMPARE_GE | ( | computed, | |
baseline ) |
Definition at line 286 of file qtestcase.h.
#define QTRY_COMPARE_GE_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 283 of file qtestcase.h.
#define QTRY_COMPARE_GT | ( | computed, | |
baseline ) |
Definition at line 279 of file qtestcase.h.
#define QTRY_COMPARE_GT_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 276 of file qtestcase.h.
#define QTRY_COMPARE_LE | ( | computed, | |
baseline ) |
Definition at line 272 of file qtestcase.h.
#define QTRY_COMPARE_LE_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 269 of file qtestcase.h.
#define QTRY_COMPARE_LT | ( | computed, | |
baseline ) |
Definition at line 265 of file qtestcase.h.
#define QTRY_COMPARE_LT_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 262 of file qtestcase.h.
#define QTRY_COMPARE_NE | ( | computed, | |
baseline ) |
Definition at line 258 of file qtestcase.h.
#define QTRY_COMPARE_NE_WITH_TIMEOUT | ( | computed, | |
baseline, | |||
timeout ) |
Definition at line 255 of file qtestcase.h.
#define QTRY_COMPARE_OP_WITH_TIMEOUT_IMPL | ( | computed, | |
baseline, | |||
op, | |||
opId, | |||
timeout ) |
Definition at line 241 of file qtestcase.h.
Definition at line 231 of file qtestcase.h.
#define QTRY_IMPL | ( | expr, | |
timeoutAsGiven ) |
Definition at line 196 of file qtestcase.h.
#define QTRY_LOOP_IMPL | ( | expr, | |
timeoutValue, | |||
step ) |
Definition at line 174 of file qtestcase.h.
#define QTRY_TIMEOUT_DEBUG_IMPL | ( | expr, | |
timeoutValue, | |||
step ) |
Definition at line 187 of file qtestcase.h.
#define QTRY_VERIFY | ( | expr | ) |
Definition at line 216 of file qtestcase.h.
#define QTRY_VERIFY2 | ( | expr, | |
messageExpression ) |
Definition at line 226 of file qtestcase.h.
#define QTRY_VERIFY2_WITH_TIMEOUT | ( | expr, | |
messageExpression, | |||
timeout ) |
Definition at line 220 of file qtestcase.h.
#define QTRY_VERIFY_WITH_TIMEOUT | ( | expr, | |
timeout ) |
Definition at line 210 of file qtestcase.h.
#define QVERIFY | ( | statement | ) |
Definition at line 64 of file qtestcase.h.
#define QVERIFY2 | ( | statement, | |
description ) |
Definition at line 76 of file qtestcase.h.
#define QVERIFY_THROWS_EXCEPTION | ( | exceptiontype, | |
... ) |
Definition at line 130 of file qtestcase.h.
#define QVERIFY_THROWS_NO_EXCEPTION | ( | ... | ) |
Definition at line 108 of file qtestcase.h.
#define QWARN | ( | msg | ) |
Definition at line 864 of file qtestcase.h.