![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
[15] More...
Namespaces | |
namespace | CrashHandler |
namespace | Internal |
Classes | |
struct | IgnoreResultList |
class | QBenchmarkIterationController |
struct | QBenchmarkMetricKey |
struct | QTestDataSetter |
class | QTouchEventSequence |
class | QTouchEventWidgetSequence |
class | TestMethods |
class | TestRegistry |
class | ThrowOnFailDisabler |
class | ThrowOnFailEnabler |
class | ThrowOnSkipDisabler |
class | ThrowOnSkipEnabler |
class | WatchDog |
Functions | |
Q_CORE_EXPORT void | qSleep (int ms) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sleeps for ms milliseconds, blocking execution of the test. | |
Q_CORE_EXPORT void | qSleep (std::chrono::milliseconds msecs) |
template<typename Functor> | |
bool | qWaitFor (Functor predicate, QDeadlineTimer deadline=QDeadlineTimer(std::chrono::seconds{5})) |
template<typename Functor> | |
bool | qWaitFor (Functor predicate, int timeout) |
Q_CORE_EXPORT void | qWait (int ms) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Waits for msecs. | |
Q_CORE_EXPORT void | qWait (std::chrono::milliseconds msecs) |
Q_GUI_EXPORT bool | qWaitForWindowActive (QWindow *window, int timeout=5000) |
Q_GUI_EXPORT bool | qWaitForWindowFocused (QWindow *window, QDeadlineTimer timeout=std::chrono::seconds{5}) |
Q_GUI_EXPORT bool | qWaitForWindowExposed (QWindow *window, int timeout=5000) |
Q_GUI_EXPORT QPointingDevice * | createTouchDevice (QInputDevice::DeviceType devType=QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps=QInputDevice::Capability::Position) |
template<> | |
char * | toString (const MyPoint &point) |
int | qt_asprintf (QTestCharBuffer *str, const char *format,...) |
int | iterationCount () noexcept |
void | setIterationCountHint (int count) |
void | setIterationCount (int count) |
void | beginBenchmarkMeasurement () |
QList< QBenchmarkMeasurerBase::Measurement > | endBenchmarkMeasurement () |
static const char * | ptIncidentType2String (QAbstractTestLogger::IncidentTypes type) |
static const char * | benchmarkResult2String () |
static const char * | ptMessageType2String (QAbstractTestLogger::MessageTypes type) |
template<typename T> | |
static int | countSignificantDigits (T num) |
template<typename T> | |
QByteArray | formatResult (T number, int significantDigits) |
static void | qPrintMessage (const QByteArray &ba) |
static bool | classIsIgnored (const char *className) |
static void | qSignalDumperCallback (QObject *caller, int signal_index, void **argv) |
static void | qSignalDumperCallbackSlot (QObject *caller, int method_index, void **argv) |
static void | qSignalDumperCallbackEndSignal (QObject *caller, int) |
static const char * | tcIncidentType2String (QAbstractTestLogger::IncidentTypes type) |
static const char * | tcMessageType2String (QAbstractTestLogger::MessageTypes type) |
void | setThrowOnFail (bool enable) noexcept |
void | setThrowOnSkip (bool enable) noexcept |
static bool | invokeTestMethodIfValid (QMetaMethod m, QObject *obj=QTest::currentTestObject) |
static void | invokeTestMethodIfExists (const char *methodName, QObject *obj=QTest::currentTestObject) |
int | defaultEventDelay () |
int Q_TESTLIB_EXPORT | defaultMouseDelay () |
int Q_TESTLIB_EXPORT | defaultKeyDelay () |
static bool | qPrintTestSlots (FILE *stream, const char *filter=nullptr, const char *preamble="") |
static void | qPrintDataTags (FILE *stream) |
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, char *argv[], bool qml) |
static QList< QBenchmarkResult > | qMedian (const QList< QList< QBenchmarkResult > > &container) |
template<typename Functor> | |
void | runWithWatchdog (std::optional< WatchDog > &watchDog, Functor &&f) |
static void | printUnknownDataTagError (QLatin1StringView name, QLatin1StringView tag, const QTestTable &lTable, const QTestTable &gTable) |
void * | fetchData (QTestData *data, const char *tagName, int typeId) |
char * | formatString (const char *prefix, const char *suffix, size_t numArguments,...) |
char * | toHexRepresentation (const char *ba, qsizetype length) |
Returns a pointer to a string that is the string ba represented as a space-separated sequence of hex characters. | |
char * | toPrettyCString (const char *p, qsizetype length) |
static char * | writePrettyUnicodeChar (char16_t ch, char *const buffer) |
char * | toPrettyUnicode (QStringView string) |
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, ComparisonOperation op, const char *file, int line) |
static bool | handleIgnoredMessage (QtMsgType type, const QString &message) |
static bool | handleFailOnWarning (const QMessageLogContext &context, const QString &message) |
static void | messageHandler (QtMsgType type, const QMessageLogContext &context, const QString &message) |
Q_GLOBAL_STATIC (TestRegistry, g_registry) | |
static void | setFailed (bool failed) |
static void | resetFailed () |
static bool | hasFailed () |
static const char * | xmlMessageType2String (QAbstractTestLogger::MessageTypes type) |
static const char * | xmlIncidentType2String (QAbstractTestLogger::IncidentTypes type) |
static bool | isEmpty (const char *str) |
static const char * | incidentFormatString (bool noDescription, bool noTag) |
static const char * | benchmarkResultFormatString () |
static const char * | messageFormatString (bool noDescription, bool noTag) |
template<> | |
bool | qCompare (QString const &t1, QLatin1StringView const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (QLatin1StringView const &t1, QString const &t2, const char *actual, const char *expected, const char *file, int line) |
template<typename ActualIterator, typename ExpectedIterator> | |
bool | _q_compareSequence (ActualIterator actualIt, ActualIterator actualEnd, ExpectedIterator expectedBegin, ExpectedIterator expectedEnd, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (QList< T > const &t1, QList< T > const &t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T, int N> | |
bool | qCompare (QList< T > const &t1, std::initializer_list< T > t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T, int N> | |
bool | qCompare (QList< T > const &t1, const T(&t2)[N], const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (QFlags< T > const &t1, T const &t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (QFlags< T > const &t1, int const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (qint64 const &t1, qint32 const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (qint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (quint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (qint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (quint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
bool | qCompare (quint32 const &t1, quint64 const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_WIDGETS_EXPORT bool | qWaitForWindowActive (QWidget *widget, int timeout=5000) |
Q_WIDGETS_EXPORT bool | qWaitForWindowFocused (QWidget *widget, QDeadlineTimer timeout=std::chrono::seconds{5}) |
Q_WIDGETS_EXPORT bool | qWaitForWindowExposed (QWidget *widget, int timeout=5000) |
char * | toString (const QGeoAreaMonitorInfo &info) |
char * | toString (const QGeoPositionInfo &info) |
char * | toString (const QGeoSatelliteInfo &info) |
template<> | |
char * | toString (const MyPoint &point) |
void Q_TESTLIB_EXPORT | setBenchmarkResult (qreal result, QBenchmarkMetric metric) |
Sets the benchmark result for this test function to result. | |
const char * | benchmarkMetricName (QBenchmarkMetric metric) |
const char * | benchmarkMetricUnit (QBenchmarkMetric metric) |
template<> | |
char * | toString (const QColor &color) |
template<> | |
char * | toString (const QRegion ®ion) |
template<> | |
char * | toString (const QVector2D &v) |
template<> | |
char * | toString (const QVector3D &v) |
template<> | |
char * | toString (const QVector4D &v) |
bool | qCompare (QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (QImage const &t1, QImage const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
char * | toString< QHostAddress > (const QHostAddress &addr) |
Q_TESTLIB_EXPORT void | qInit (QObject *testObject, int argc=0, char **argv=nullptr) |
Q_TESTLIB_EXPORT int | qRun () |
Q_TESTLIB_EXPORT void | qCleanup () |
Q_TESTLIB_EXPORT int | qExec (QObject *testObject, int argc=0, char **argv=nullptr) |
Executes tests declared in testObject. | |
Q_TESTLIB_EXPORT int | 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 | setMainSourcePath (const char *file, const char *builddir=nullptr) |
Q_TESTLIB_EXPORT bool | qVerify (bool statement, const char *statementStr, const char *description, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | qFail (const char *message, const char *file, int line) |
Q_TESTLIB_EXPORT void | qSkip (const char *message, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qExpectFail (const char *dataIndex, const char *comment, TestFailMode mode, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | qCaught (const char *expected, const char *what, const char *file, int line) |
Q_DECL_COLD_FUNCTION Q_TESTLIB_EXPORT void | qCaught (const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT void | ignoreMessage (QtMsgType type, const char *message) |
Ignores messages created by qDebug(), qInfo() or qWarning(). | |
Q_TESTLIB_EXPORT void | failOnWarning () |
Q_TESTLIB_EXPORT void | failOnWarning (const char *message) |
Q_TESTLIB_EXPORT QString | qFindTestData (const char *basepath, const char *file=nullptr, int line=0, const char *builddir=nullptr, const char *sourcedir=nullptr) |
Q_TESTLIB_EXPORT QString | qFindTestData (const QString &basepath, const char *file=nullptr, int line=0, const char *builddir=nullptr, const char *sourcedir=nullptr) |
Q_TESTLIB_EXPORT void * | qData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | qGlobalData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | qElementData (const char *elementName, int metaTypeId) |
Q_TESTLIB_EXPORT QObject * | testObject () |
Q_TESTLIB_EXPORT const char * | currentAppName () |
Returns the name of the binary that is currently executed. | |
Q_TESTLIB_EXPORT const char * | currentTestFunction () |
Returns the name of the test function that is currently executed. | |
Q_TESTLIB_EXPORT const char * | currentDataTag () |
Returns the name of the current test data. | |
Q_TESTLIB_EXPORT bool | currentTestFailed () |
Returns true if the current test function has failed, otherwise false. | |
Q_TESTLIB_EXPORT bool | currentTestResolved () |
Q_TESTLIB_EXPORT bool | runningTest () |
Q_TESTLIB_EXPORT Qt::Key | asciiToKey (char ascii) |
Q_TESTLIB_EXPORT char | keyToAscii (Qt::Key key) |
Q_TESTLIB_EXPORT bool | 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 | compare_helper (bool success, const char *failureMsg, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | 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 | addColumnInternal (int id, const char *name) |
template<typename T> | |
void | addColumn (const char *name, T *=nullptr) |
Adds a column with type {T} to the current test data. | |
Q_TESTLIB_EXPORT QTestData & | newRow (const char *dataTag) |
Appends a new row to the current test data. | |
Q_TESTLIB_EXPORT QTestData & | addRow (const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1 |
Q_TESTLIB_EXPORT QTestData Q_TESTLIB_EXPORT bool | qCompare (qfloat16 const &t1, qfloat16 const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (float const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (int t1, int t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (unsigned t1, unsigned t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (QStringView t1, QStringView t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (QStringView t1, const QLatin1StringView &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (const QLatin1StringView &t1, QStringView t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (const QString &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line) |
bool | compare_ptr_helper (const volatile void *t1, const volatile void *t2, const char *actual, const char *expected, const char *file, int line) |
bool | compare_ptr_helper (const volatile QObject *t1, const volatile QObject *t2, const char *actual, const char *expected, const char *file, int line) |
bool | compare_ptr_helper (const volatile QObject *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
bool | compare_ptr_helper (std::nullptr_t, const volatile QObject *t2, const char *actual, const char *expected, const char *file, int line) |
bool | compare_ptr_helper (const volatile void *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
bool | 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 | qCompare (const T1 &t1, const T2 &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (double const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (float const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (const T *t1, const T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (T *t1, T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (T *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
bool | qCompare (std::nullptr_t, T *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T1, typename T2> | |
bool | qCompare (const T1 *t1, const T2 *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T1, typename T2> | |
bool | qCompare (T1 *t1, T2 *t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (const char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (char *t1, char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (const char *t1, char *t2, const char *actual, const char *expected, const char *file, int line) |
template<class T> | |
bool | qTest (const T &actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line) |
template<ComparisonOperation op, typename T1, typename T2 = T1> | |
bool | 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 | qCompare3Way (LHS &&lhs, RHS &&rhs, OrderingType order, const char *lhsExpression, const char *rhsExpression, const char *resultExpression, const char *file, int line)=delete |
static void | simulateEvent (QWindow *window, bool press, int code, Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1) |
static void | sendKeyEvent (KeyAction action, QWindow *window, Qt::Key code, QString text, Qt::KeyboardModifiers modifier, int delay=-1) |
static void | sendKeyEvent (KeyAction action, QWindow *window, Qt::Key code, char ascii, Qt::KeyboardModifiers modifier, int delay=-1) |
static void | keyEvent (KeyAction action, QWindow *window, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyEvent (KeyAction action, QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyClick (QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyClick (QWindow *window, char key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyRelease (QWindow *window, char key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyRelease (QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyPress (QWindow *window, char key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | keyPress (QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1) |
static void | mouseEvent (MouseAction action, QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) |
void | mousePress (QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1) |
void | mouseRelease (QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1) |
void | mouseClick (QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1) |
void | mouseDClick (QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1) |
void | mouseMove (QWindow *window, QPoint pos=QPoint(), int delay=-1) |
Q_TESTLIB_EXPORT bool | compare_string_helper (const char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line) |
template<typename T> | |
char * | toString (const T &t) |
template<typename T1, typename T2> | |
char * | toString (const std::pair< T1, T2 > &pair) |
template<class... Types> | |
char * | toString (const std::tuple< Types... > &tuple) |
template<typename Rep, typename Period> | |
char * | toString (std::chrono::duration< Rep, Period > duration) |
Q_TESTLIB_EXPORT char * | toString (const char *) |
Q_TESTLIB_EXPORT char * | toString (const volatile void *) |
Q_TESTLIB_EXPORT char * | toString (const QObject *) |
Q_TESTLIB_EXPORT char * | toString (const volatile QObject *) |
template<> | |
char * | toString (const QStringView &str) |
template<> | |
char * | toString (const QString &str) |
template<> | |
char * | toString (const QLatin1StringView &str) |
template<> | |
char * | toString (const QByteArray &ba) |
template<> | |
char * | toString (const QBitArray &ba) |
template<> | |
char * | toString (const QCborError &c) |
template<> | |
char * | toString (const QChar &c) |
template<> | |
char * | toString (const QPoint &p) |
template<> | |
char * | toString (const QSize &s) |
template<> | |
char * | toString (const QRect &s) |
template<> | |
char * | toString (const QPointF &p) |
template<> | |
char * | toString (const QSizeF &s) |
template<> | |
char * | toString (const QRectF &s) |
template<> | |
char * | toString (const QUrl &uri) |
template<> | |
char * | toString (const QUuid &uuid) |
template<> | |
char * | toString (const QVariant &v) |
template<> | |
char * | toString (const QPartialOrdering &o) |
template<> | |
char * | toString (const QCborValue &v) |
template<> | |
char * | toString (const QCborValueRef &v) |
template<> | |
char * | toString (const QCborArray &a) |
template<> | |
char * | toString (const QCborMap &m) |
template<typename Tuple, std::size_t... I> | |
char * | tupleToString (const Tuple &tuple, std::index_sequence< I... >) |
char * | toString (std::nullptr_t) |
QTouchEventSequence | touchEvent (QWindow *window, QPointingDevice *device, bool autoCommit=true) |
static void | wheelEvent (QWindow *window, QPointF pos, QPoint angleDelta, QPoint pixelDelta=QPoint(0, 0), Qt::KeyboardModifiers stateKey=Qt::NoModifier, Qt::ScrollPhase phase=Qt::NoScrollPhase) |
Variables | |
static const QBenchmarkMetricKey | entries [] |
static const int | NumEntries = sizeof(entries) / sizeof(entries[0]) |
static Q_CONSTINIT QBasicMutex | ignoreClassesMutex |
Q_CONSTINIT thread_local int | iLevel = 0 |
Q_CONSTINIT thread_local int | ignoreLevel = 0 |
static Q_CONSTINIT QBasicAtomicInt | g_throwOnFail = Q_BASIC_ATOMIC_INITIALIZER(0) |
static Q_CONSTINIT QBasicAtomicInt | g_throwOnSkip = Q_BASIC_ATOMIC_INITIALIZER(0) |
Q_TESTLIB_EXPORT int | lastMouseTimestamp = 0 |
static QObject * | currentTestObject = nullptr |
static QString | mainSourcePath |
static bool | inTestFunction = false |
static int | keyDelay = -1 |
static int | mouseDelay = -1 |
static int | eventDelay = -1 |
static int | repetitions = 1 |
static bool | skipBlacklisted = false |
Q_TESTLIB_EXPORT bool | printAvailableFunctions = false |
Q_TESTLIB_EXPORT QStringList | testFunctions |
Q_TESTLIB_EXPORT QStringList | testTags |
constexpr qsizetype | PrettyUnicodeMaxOutputSize = 256 |
constexpr qsizetype | PrettyUnicodeMaxIncrement = sizeof(R"(\uXXXX"...)") |
int | fails = 0 |
int | passes = 0 |
int | skips = 0 |
int | blacklists = 0 |
enum QTest:: { ... } | currentTestState |
static IgnoreResultList * | ignoreResultList = nullptr |
static Q_CONSTINIT QBasicMutex | mutex |
static std::vector< QVariant > | failOnWarningList |
static int | verbosity = 0 |
static int | maxWarnings = 2002 |
static bool | installedTestCoverage = true |
static QtMessageHandler | oldMessageHandler |
static QTestData * | currentTestData = nullptr |
static QTestData * | currentGlobalTestData = nullptr |
static const char * | currentTestFunc = nullptr |
static const char * | currentTestObjectName = nullptr |
static bool | skipCurrentTest = false |
static bool | blacklistCurrentTest = false |
static const char * | expectFailComment = nullptr |
static int | expectFailMode = 0 |
static const int | mouseDoubleClickInterval = 500 |
[15]
[16]
anonymous enum |
Enumerator | |
---|---|
IndentSpacesCount | |
IndentSpacesCount |
Definition at line 30 of file qsignaldumper.cpp.
anonymous enum |
Enumerator | |
---|---|
IndentSpacesCount | |
IndentSpacesCount |
Definition at line 30 of file qsignaldumper.cpp.
anonymous enum |
Enumerator | |
---|---|
Unresolved | |
Passed | |
Skipped | |
Suppressed | |
Failed | |
Unresolved | |
Passed | |
Skipped | |
Suppressed | |
Failed |
Definition at line 144 of file qtestlog.cpp.
anonymous enum |
Enumerator | |
---|---|
Unresolved | |
Passed | |
Skipped | |
Suppressed | |
Failed | |
Unresolved | |
Passed | |
Skipped | |
Suppressed | |
Failed |
Definition at line 144 of file qtestlog.cpp.
Enumerator | |
---|---|
AI_Undefined | |
AI_Name | |
AI_Tests | |
AI_Failures | |
AI_Errors | |
AI_Type | |
AI_Message | |
AI_PropertyValue | |
AI_Value | |
AI_Time | |
AI_Timestamp | |
AI_Hostname | |
AI_Classname | |
AI_Skipped |
Definition at line 26 of file qtestelementattribute_p.h.
|
strong |
Enumerator | |
---|---|
CustomCompare | |
Equal | |
NotEqual | |
LessThan | |
LessThanOrEqual | |
GreaterThan | |
GreaterThanOrEqual | |
ThreeWayCompare |
Definition at line 26 of file qttestglobal.h.
enum QTest::KeyAction |
Enumerator | |
---|---|
Press | |
Release | |
Click | |
Shortcut |
Definition at line 37 of file qtestkeyboard.h.
Enumerator | |
---|---|
LET_Undefined | |
LET_Property | |
LET_Properties | |
LET_Failure | |
LET_Error | |
LET_TestCase | |
LET_TestSuite | |
LET_Text | |
LET_SystemError | |
LET_SystemOutput | |
LET_Skipped |
Definition at line 44 of file qtestelementattribute_p.h.
enum QTest::MouseAction |
Enumerator | |
---|---|
MousePress | |
MouseRelease | |
MouseClick | |
MouseDClick | |
MouseMove |
Definition at line 40 of file qtestmouse.h.
This enum lists all the things that can be benchmarked.
\value FramesPerSecond Frames per second \value BitsPerSecond Bits per second \value BytesPerSecond Bytes per second \value WalltimeMilliseconds Clock time in milliseconds \value WalltimeNanoseconds Clock time in nanoseconds \value BytesAllocated Memory usage in bytes \value Events Event count \value CPUTicks CPU time \value CPUMigrations Process migrations between CPUs \value CPUCycles CPU cycles \value RefCPUCycles Reference CPU cycles \value BusCycles Bus cycles \value StalledCycles Cycles stalled \value InstructionReads Instruction reads \value Instructions Instructions executed \value BranchInstructions Branch-type instructions \value BranchMisses Branch instructions that were mispredicted \value CacheReferences Cache accesses of any type \value CacheMisses Cache misses of any type \value CacheReads Cache reads / loads \value CacheReadMisses Cache read / load misses \value CacheWrites Cache writes / stores \value CacheWriteMisses Cache write / store misses \value CachePrefetches Cache prefetches \value CachePrefetchMisses Cache prefetch misses \value ContextSwitches Context switches \value PageFaults Page faults of any type \value MinorPageFaults Minor page faults \value MajorPageFaults Major page faults \value AlignmentFaults Faults caused due to misalignment \value EmulationFaults Faults that needed software emulation
Note that WalltimeNanoseconds
and BytesAllocated
are only provided for use via \l setBenchmarkResult(), and results in those metrics are not able to be provided automatically by the QTest framework.
Definition at line 15 of file qbenchmarkmetric.h.
enum QTest::TestFailMode |
Enumerator | |
---|---|
Abort | |
Continue |
Definition at line 25 of file qttestglobal.h.
bool QTest::_q_compareSequence | ( | ActualIterator | actualIt, |
ActualIterator | actualEnd, | ||
ExpectedIterator | expectedBegin, | ||
ExpectedIterator | expectedEnd, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
|
inline |
Adds a column with type {T} to the current test data.
name is the name of the column. dummy is a workaround for buggy compilers and can be ignored.
To populate the column with values, newRow() can be used. Use \l QFETCH() to fetch the data in the actual test.
Example:
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 538 of file qtestcase.h.
void QTest::addColumnInternal | ( | int | id, |
const char * | name ) |
Definition at line 2559 of file qtestcase.cpp.
QTestData & QTest::addRow | ( | const char * | format, |
... ) |
Appends a new row to the current test data.
The function's arguments are passed to std::snprintf() for formatting according to format. See the \l{https://en.cppreference.com/w/cpp/io/c/fprintf}{std::snprintf() documentation} for caveats and limitations.
The test output will identify the test run with this test data using the name that results from this formatting.
Returns a QTestData reference that can be used to stream in data, one value for each column in the table.
Example:
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 2625 of file qtestcase.cpp.
QT_BEGIN_NAMESPACE Qt::Key QTest::asciiToKey | ( | char | ascii | ) |
Convert an ascii char key value to a Qt Key value. If the key is unknown a 0 is returned.
Note: this may happen more than you like since not all known ascii keys are converted already. So feel free to add all the keys you need.
Definition at line 16 of file qasciikey.cpp.
void QTest::beginBenchmarkMeasurement | ( | ) |
Definition at line 207 of file qbenchmark.cpp.
const char * QTest::benchmarkMetricName | ( | QBenchmarkMetric | metric | ) |
Definition at line 104 of file qbenchmarkmetric.cpp.
References entries, and NumEntries.
const char * QTest::benchmarkMetricUnit | ( | QBenchmarkMetric | metric | ) |
Definition at line 116 of file qbenchmarkmetric.cpp.
References entries, and NumEntries.
|
static |
Definition at line 132 of file qplaintestlogger.cpp.
|
static |
Definition at line 192 of file qxmltestlogger.cpp.
|
static |
Definition at line 32 of file qsignaldumper.cpp.
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 * | lhsExpression, | ||
const char * | rhsExpression, | ||
const char *(* | actualOrderFormatter )(const void *), | ||
const char *(* | expectedOrderFormatter )(const void *), | ||
const void * | actualOrderPtr, | ||
const void * | expectedOrderPtr, | ||
const char * | expectedExpression, | ||
const char * | file, | ||
int | line ) |
Aside from logging every check if in verbose mode and reporting an unexpected pass when failure was expected, if success is true
this produces no output. Otherwise, a failure is reported. The output on failure reports the expressions compared, their values, the actual result of the comparison and the expected result of comparison, along with the supplied failure message failureMsg and the file and line number at which the error arose.
The expressions compared are supplied as lhsExpression and rhsExpression. These are combined, with {"<=>"}, to obtain the actual comparison expression. Their actual values are pointed to by lhsPtr and rhsPtr, which are formatted by lhsFormatter and rhsFormatter as, respectively,
lhsFormatter(lhsPtr)
and rhsFormatter(rhsPtr)
. The actual comparison expression is contrasted, in the output, with the expected comparison expression expectedExpression. Their respective values are supplied by actualOrderPtr and expectedOrderPtr pointers, which are formatted by actualOrderFormatter and expectedOrderFormatter.
If failureMsg is \nullptr a default is used. If a formatter function returns nullptr, the text {"<null>"} is used.
Definition at line 2865 of file qtestcase.cpp.
bool QTest::compare_helper | ( | bool | success, |
const char * | failureMsg, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
This overload should be used when there is no string representation of actual and expected values, so only the failureMsg is shown when the comparison fails. Because of that, failureMsg can't be {nullptr}
. If the comparison succeeds, failureMsg will not be output.
Definition at line 2897 of file qtestcase.cpp.
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 ) |
The failureMsg parameter can be {nullptr}
, in which case a default message will be output if the compare fails. If the comparison succeeds, failureMsg will not be output.
Definition at line 2823 of file qtestcase.cpp.
|
inline |
Definition at line 604 of file qtestcase.h.
|
inline |
Definition at line 613 of file qtestcase.h.
|
inline |
Definition at line 595 of file qtestcase.h.
|
inline |
Definition at line 633 of file qtestcase.h.
|
inline |
Definition at line 623 of file qtestcase.h.
|
inline |
Definition at line 643 of file qtestcase.h.
bool QTest::compare_string_helper | ( | const char * | t1, |
const char * | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 3227 of file qtestcase.cpp.
|
static |
Definition at line 159 of file qplaintestlogger.cpp.
Q_GUI_EXPORT QPointingDevice * QTest::createTouchDevice | ( | QInputDevice::DeviceType | devType = QInputDevice::DeviceType::TouchScreen, |
QInputDevice::Capabilities | caps = QInputDevice::Capability::Position ) |
Definition at line 1221 of file qwindowsysteminterface.cpp.
const char * QTest::currentAppName | ( | ) |
Returns the name of the binary that is currently executed.
Definition at line 2669 of file qtestcase.cpp.
const char * QTest::currentDataTag | ( | ) |
Returns the name of the current test data.
If the test doesn't have any assigned testdata, the function returns \nullptr.
Definition at line 2690 of file qtestcase.cpp.
bool QTest::currentTestFailed | ( | ) |
Returns true
if the current test function has failed, otherwise false.
Definition at line 2700 of file qtestcase.cpp.
const char * QTest::currentTestFunction | ( | ) |
Returns the name of the test function that is currently executed.
Example:
Definition at line 2681 of file qtestcase.cpp.
bool QTest::currentTestResolved | ( | ) |
true
if the current test function has failed or skipped.This applies if the test has failed or exercised a skip. When it is true, the test function should return early. In particular, the {QTRY_*} macros and the test event loop terminate their loops early if executed during the test function (but not its cleanup()). After a test has called a helper function that uses this module's macros, it can use this function to test whether to return early.
Definition at line 2718 of file qtestcase.cpp.
int QTest::defaultEventDelay | ( | ) |
Definition at line 449 of file qtestcase.cpp.
References eventDelay.
int Q_TESTLIB_EXPORT QTest::defaultKeyDelay | ( | ) |
Definition at line 473 of file qtestcase.cpp.
int Q_TESTLIB_EXPORT QTest::defaultMouseDelay | ( | ) |
Definition at line 461 of file qtestcase.cpp.
QList< QBenchmarkMeasurerBase::Measurement > QTest::endBenchmarkMeasurement | ( | ) |
Definition at line 215 of file qbenchmark.cpp.
|
Definition at line 2226 of file qtestcase.cpp.
void QTest::failOnWarning | ( | const char * | message | ) |
Definition at line 2239 of file qtestcase.cpp.
Definition at line 1393 of file qtestcase.cpp.
QByteArray QTest::formatResult | ( | T | number, |
int | significantDigits ) |
Definition at line 176 of file qplaintestlogger.cpp.
Q_TESTLIB_EXPORT char * QTest::formatString | ( | const char * | prefix, |
const char * | suffix, | ||
size_t | numArguments, | ||
... ) |
Definition at line 1418 of file qtestcase.cpp.
|
static |
Definition at line 243 of file qtestlog.cpp.
Definition at line 217 of file qtestlog.cpp.
References ignoreResultList, and QTest::IgnoreResultList::next.
|
static |
Definition at line 55 of file qtestresult.cpp.
References QTest::Internal::failed.
Ignores messages created by qDebug(), qInfo() or qWarning().
If the message with the corresponding type is outputted, it will be removed from the test log. If the test finished and the message was not outputted, a test failure is appended to the test log.
Example:
The example above tests that QDir::mkdir() outputs the right warning when invoked with an invalid file name.
Definition at line 2191 of file qtestcase.cpp.
|
static |
Definition at line 173 of file qxmltestlogger.cpp.
|
static |
Definition at line 441 of file qtestcase.cpp.
Referenced by qPrintDataTags().
|
static |
Definition at line 429 of file qtestcase.cpp.
|
inlinestatic |
Definition at line 168 of file qxmltestlogger.cpp.
|
noexcept |
Definition at line 185 of file qbenchmark.cpp.
|
inlinestatic |
Definition at line 127 of file qtestkeyboard.h.
References Click.
|
inlinestatic |
Definition at line 125 of file qtestkeyboard.h.
References Click.
|
inlinestatic |
Definition at line 118 of file qtestkeyboard.h.
|
inlinestatic |
Definition at line 121 of file qtestkeyboard.h.
|
inlinestatic |
Definition at line 133 of file qtestkeyboard.h.
References Press.
|
inlinestatic |
Definition at line 135 of file qtestkeyboard.h.
References Press.
|
inlinestatic |
Definition at line 129 of file qtestkeyboard.h.
References Release.
|
inlinestatic |
Definition at line 131 of file qtestkeyboard.h.
References Release.
char QTest::keyToAscii | ( | Qt::Key | key | ) |
Convert a Qt Key to an ascii char value. If the Qt key is unknown a 0 is returned.
Note: this may happen more than you like since not all known Qt keys are converted already. So feel free to add all the keys you need.
Definition at line 203 of file qasciikey.cpp.
|
static |
Definition at line 197 of file qxmltestlogger.cpp.
|
static |
Definition at line 269 of file qtestlog.cpp.
References maxWarnings, and oldMessageHandler.
|
inline |
Definition at line 139 of file qtestmouse.h.
References MouseClick.
|
inline |
Definition at line 143 of file qtestmouse.h.
References MouseDClick.
|
static |
This function creates a QPA mouse event of type specified by action and calls QWindowSystemInterface::handleMouseEvent(), simulating the windowing system and bypassing the platform plugin. delay is the amount of time to be added to the simulated clock so that QInputEvent::timestamp() will be greater than that of the previous event. We expect all event-handling code to rely on the event timestamps, not the system clock; therefore tests can be run faster than real-time.
If delay is not given, a default minimum mouse delay is used, and unintended double-click events are prevented by incrementing the timestamp by 500ms after each mouse release. Therefore, to test double-clicks, it's necessary to give a realistic delay value (for example, 10ms).
Definition at line 65 of file qtestmouse.h.
References lastMouseTimestamp, mouseDoubleClickInterval, MouseMove, and MousePress.
Definition at line 147 of file qtestmouse.h.
|
inline |
Definition at line 131 of file qtestmouse.h.
References MousePress.
|
inline |
Definition at line 135 of file qtestmouse.h.
References MouseRelease.
QTestData & QTest::newRow | ( | const char * | dataTag | ) |
Appends a new row to the current test data.
The test output will identify the test run with this test data using the name dataTag.
Returns a QTestData reference that can be used to stream in data, one value for each column in the table.
Example:
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 2587 of file qtestcase.cpp.
|
static |
Definition at line 1257 of file qtestcase.cpp.
|
static |
Definition at line 107 of file qplaintestlogger.cpp.
|
static |
Definition at line 137 of file qplaintestlogger.cpp.
QTest::Q_GLOBAL_STATIC | ( | TestRegistry | , |
g_registry | ) |
void QTest::qCaught | ( | const char * | expected, |
const char * | file, | ||
int | line ) |
Contains the implementation of the catch(...) block of QVERIFY_THROWS_EXCEPTION.
The function inspects std::current_exception() by rethrowing it using std::rethrow_exception().
The function must be called from a catch handler.
If the exception inherits std::exception, its what() message is logged and this function returns normally. The caller of this function must then execute a {QTEST_FAIL_ACTION} to exit from the test function.
Otherwise, a message saying an unknown exception was caught is logged and this function rethrows the exception, skipping the {QTEST_FAIL_ACTION} that follows this function call in the caller.
Definition at line 2149 of file qtestcase.cpp.
void QTest::qCaught | ( | const char * | expected, |
const char * | what, | ||
const char * | file, | ||
int | line ) |
Executes qFail() following a failed QVERIFY_THROWS_EXCEPTION or QVERIFY_THROWS_NO_EXCEPTION, passing a suitable message created from expected, what, along with file and line.
The expected parameter contains the type of the exception that is expected to be thrown, or \nullptr, if no exception was expected.
The what parameter contains the result of {std::exception::what()}, or nullptr, if a non-
{std::exception}-derived exception was caught.
The file and line parameters hold expansions of the {FILE} and
{LINE} macros, respectively.
Definition at line 2113 of file qtestcase.cpp.
void QTest::qCleanup | ( | ) |
Definition at line 1995 of file qtestcase.cpp.
References currentTestObject.
|
inline |
Definition at line 728 of file qtestcase.h.
|
inline |
Definition at line 737 of file qtestcase.h.
|
inline |
Definition at line 742 of file qtestcase.h.
|
inline |
Definition at line 723 of file qtestcase.h.
bool QTest::qCompare | ( | const QLatin1StringView & | t1, |
QStringView | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 3024 of file qtestcase.cpp.
|
inline |
Definition at line 576 of file qtestcase.h.
|
inline |
Definition at line 685 of file qtestcase.h.
|
inline |
Definition at line 654 of file qtestcase.h.
|
inline |
Definition at line 711 of file qtestcase.h.
bool QTest::qCompare | ( | double const & | t1, |
double const & | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 2949 of file qtestcase.cpp.
|
inline |
Definition at line 672 of file qtestcase.h.
|
inline |
Definition at line 678 of file qtestcase.h.
bool QTest::qCompare | ( | float const & | t1, |
float const & | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 2938 of file qtestcase.cpp.
bool QTest::qCompare | ( | int | t1, |
int | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 2961 of file qtestcase.cpp.
|
inline |
|
inline |
bool QTest::qCompare | ( | qfloat16 const & | t1, |
qfloat16 const & | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 2925 of file qtestcase.cpp.
|
inline |
Definition at line 119 of file qtest_gui.h.
|
inline |
Definition at line 127 of file qtest_gui.h.
|
inline |
bool QTest::qCompare | ( | QList< T > const & | t1, |
const T(&) | t2[N], | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
bool QTest::qCompare | ( | QList< T > const & | t1, |
std::initializer_list< T > | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
|
inline |
Definition at line 169 of file qtest_gui.h.
|
inline |
bool QTest::qCompare | ( | QStringView | t1, |
const QLatin1StringView & | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 3012 of file qtestcase.cpp.
bool QTest::qCompare | ( | QStringView | t1, |
QStringView | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 3000 of file qtestcase.cpp.
|
inline |
Definition at line 704 of file qtestcase.h.
|
inline |
Definition at line 698 of file qtestcase.h.
|
inline |
Definition at line 691 of file qtestcase.h.
|
inline |
Definition at line 717 of file qtestcase.h.
bool QTest::qCompare | ( | unsigned | t1, |
unsigned | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line ) |
Definition at line 2988 of file qtestcase.cpp.
|
delete |
|
inline |
Definition at line 771 of file qtestcase.h.
void * QTest::qData | ( | const char * | tagName, |
int | typeId ) |
Definition at line 2529 of file qtestcase.cpp.
void * QTest::qElementData | ( | const char * | tagName, |
int | metaTypeId ) |
Definition at line 2543 of file qtestcase.cpp.
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.
Behaves identically to qExec(QObject *, int, char**) but takes a QStringList of arguments instead of a char**
list.
Definition at line 2047 of file qtestcase.cpp.
int QTest::qExec | ( | QObject * | testObject, |
int | argc = 0, | ||
char ** | argv = nullptr ) |
Executes tests declared in testObject.
In addition, the private slots {initTestCase()},
{cleanupTestCase()},
{init()} and
{cleanup()} are executed if they exist. See \l{Creating a Test} for more details.
Optionally, the command line arguments argc and argv can be provided. For a list of recognized arguments, read \l {Qt Test Command Line Arguments}.
The following example will run all tests in MyTestObject:
This function returns 0 if no tests failed, or a value other than 0 if one or more tests failed or in case of unhandled exceptions. (Skipped tests do not influence the return value.)
For stand-alone test applications, the convenience macro \l QTEST_MAIN() can be used to declare a main() function that parses the command line arguments and executes the tests, avoiding the need to call this function explicitly.
The return value from this function is also the exit code of the test application when the \l QTEST_MAIN() macro is used.
For stand-alone test applications, this function should not be called more than once, as command-line options for logging test output to files and executing individual test functions will not behave correctly.
If you have programmatically created the arguments, as opposed to getting them from the arguments in main()
, it is likely of interest to use QTest::qExec(QObject *, const QStringList &) since it is Unicode safe.
Definition at line 1816 of file qtestcase.cpp.
bool QTest::qExpectFail | ( | const char * | dataIndex, |
const char * | comment, | ||
QTest::TestFailMode | mode, | ||
const char * | file, | ||
int | line ) |
Definition at line 2091 of file qtestcase.cpp.
void QTest::qFail | ( | const char * | message, |
const char * | file, | ||
int | line ) |
Definition at line 2066 of file qtestcase.cpp.
QString QTest::qFindTestData | ( | const char * | base, |
const char * | file = nullptr, | ||
int | line = 0, | ||
const char * | builddir = nullptr, | ||
const char * | sourcedir = nullptr ) |
Definition at line 2521 of file qtestcase.cpp.
QString QTest::qFindTestData | ( | const QString & | base, |
const char * | file = nullptr, | ||
int | line = 0, | ||
const char * | builddir = nullptr, | ||
const char * | sourcedir = nullptr ) |
Definition at line 2384 of file qtestcase.cpp.
void * QTest::qGlobalData | ( | const char * | tagName, |
int | typeId ) |
Definition at line 2536 of file qtestcase.cpp.
Definition at line 1838 of file qtestcase.cpp.
References currentTestObject, initEnvironment(), and qtest_qParseArgs().
|
static |
Definition at line 987 of file qtestcase.cpp.
|
static |
Definition at line 523 of file qtestcase.cpp.
References invokeTestMethodIfExists().
Referenced by qtest_qParseArgs().
|
inlinestatic |
Definition at line 21 of file qsignaldumper.cpp.
|
static |
Definition at line 502 of file qtestcase.cpp.
References currentTestObject.
Referenced by qtest_qParseArgs().
int QTest::qRun | ( | ) |
Definition at line 1886 of file qtestcase.cpp.
References currentTestObject, QTest::Internal::noCrashHandler, and repetitions.
|
static |
Definition at line 42 of file qsignaldumper.cpp.
References IndentSpacesCount.
Definition at line 132 of file qsignaldumper.cpp.
|
static |
Definition at line 101 of file qsignaldumper.cpp.
References ignoreLevel, and IndentSpacesCount.
void QTest::qSkip | ( | const char * | message, |
const char * | file, | ||
int | line ) |
Definition at line 2082 of file qtestcase.cpp.
QT_BEGIN_NAMESPACE void QTest::qSleep | ( | int | ms | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sleeps for ms milliseconds, blocking execution of the test.
Equivalent to calling:
Definition at line 22 of file qtestsupport_core.cpp.
References qSleep().
Referenced by qSleep().
void QTest::qSleep | ( | std::chrono::milliseconds | msecs | ) |
Sleeps for msecs, blocking execution of the test.
This method will not do any event processing and will leave your test unresponsive. Network communication might time out while sleeping. Use \l {QTest::qWait()} to do non-blocking sleeping.
msecs must be greater than 0ms.
{std::this_thread::sleep_for}
, so the accuracy of time spent depends on the Standard Library implementation. Before Qt 6.7 this function called either nanosleep()
on Unix or Sleep()
on Windows, so the accuracy of time spent in this function depended on the operating system.Example:
Definition at line 49 of file qtestsupport_core.cpp.
int QTest::qt_asprintf | ( | QTestCharBuffer * | str, |
const char * | format, | ||
... ) |
Definition at line 399 of file qabstracttestlogger.cpp.
Referenced by QTestPrivate::generateTestIdentifier().
|
inline |
Definition at line 749 of file qtestcase.h.
void QTest::qtest_qParseArgs | ( | int | argc, |
char * | argv[], | ||
bool | qml ) |
Definition at line 983 of file qtestcase.cpp.
Referenced by qInit().
Q_TESTLIB_EXPORT void QTest::qtest_qParseArgs | ( | int | argc, |
const char *const | argv[], | ||
bool | qml ) |
Definition at line 600 of file qtestcase.cpp.
References eventDelay, keyDelay, mouseDelay, QTest::Internal::noCrashHandler, printAvailableFunctions, qPrintDataTags(), qPrintTestSlots(), qToInt(), repetitions, and skipBlacklisted.
|
static |
Definition at line 589 of file qtestcase.cpp.
Referenced by qtest_qParseArgs().
bool QTest::qVerify | ( | bool | statement, |
const char * | statementStr, | ||
const char * | description, | ||
const char * | file, | ||
int | line ) |
Definition at line 2073 of file qtestcase.cpp.
Q_CORE_EXPORT void QTest::qWait | ( | int | msecs | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Waits for msecs.
Equivalent to calling:
Definition at line 92 of file qtestsupport_core.cpp.
Q_CORE_EXPORT void QTest::qWait | ( | std::chrono::milliseconds | msecs | ) |
Waits for msecs. While waiting, events will be processed and your test will stay responsive to user interface events or network communication.
Example:
The code above will wait until the network server is responding for a maximum of about 12.5 seconds.
Definition at line 112 of file qtestsupport_core.cpp.
Waits for timeout milliseconds or until the predicate returns true.
This is equivalent to calling:
Definition at line 55 of file qtestsupport_core.h.
|
nodiscard |
Waits until deadline has expired, or until predicate returns true, whichever happens first.
Returns true
if predicate returned true at any point, otherwise returns false
.
Example:
The code above will wait for the object to become ready, for a maximum of three seconds.
Definition at line 21 of file qtestsupport_core.h.
|
nodiscard |
Returns true
if widget is active within timeout milliseconds. Otherwise returns false
.
The method is useful in tests that call QWidget::show() and rely on the widget actually being active (i.e. being visible and having focus) before proceeding.
false
if another window prevents widget from becoming active.true
.Definition at line 48 of file qtestsupport_widgets.cpp.
|
nodiscard |
Returns true
, if window is active within timeout milliseconds. Otherwise returns false
.
The method is useful in tests that call QWindow::show() and rely on the window actually being active (i.e. being visible and having focus) before proceeding.
false
if another window prevents window from becoming active.true
.Definition at line 41 of file qtestsupport_gui.cpp.
|
nodiscard |
Returns true
if widget is exposed within timeout milliseconds. Otherwise returns false
.
The method is useful in tests that call QWidget::show() and rely on the widget actually being being visible before proceeding.
false
.Definition at line 103 of file qtestsupport_widgets.cpp.
|
nodiscard |
Returns true
, if window is exposed within timeout milliseconds. Otherwise returns false
.
The method is useful in tests that call QWindow::show() and rely on the window actually being being visible before proceeding.
false
.Definition at line 89 of file qtestsupport_gui.cpp.
|
nodiscard |
Returns true
, if widget is the focus window within timeout. Otherwise returns false
.
The method is useful in tests that call QWidget::show() and rely on the widget having focus (for receiving keyboard events e.g.) before proceeding.
false
if another window prevents widget from becoming focused.true
.Definition at line 80 of file qtestsupport_widgets.cpp.
|
nodiscard |
Returns true
, if window is the focus window within timeout. Otherwise returns false
.
The method is useful in tests that call QWindow::show() and rely on the window having focus (for receiving keyboard events e.g.) before proceeding.
false
if another window prevents window from becoming focused.true
.Definition at line 70 of file qtestsupport_gui.cpp.
Q_TESTLIB_EXPORT 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 ) |
Definition at line 1754 of file qtestcase.cpp.
|
static |
Definition at line 50 of file qtestresult.cpp.
References setFailed().
bool QTest::runningTest | ( | ) |
true
during the run of the test-function and its set-up.Used by the {QTRY_*} macros and \l QTestEventLoop to check whether to return when QTest::currentTestResolved() is true.
Definition at line 2731 of file qtestcase.cpp.
References inTestFunction.
void QTest::runWithWatchdog | ( | std::optional< WatchDog > & | watchDog, |
Functor && | f ) |
Definition at line 1246 of file qtestcase.cpp.
|
static |
Definition at line 109 of file qtestkeyboard.h.
void QTest::setBenchmarkResult | ( | qreal | result, |
QTest::QBenchmarkMetric | metric ) |
Sets the benchmark result for this test function to result.
Use this function if you want to report benchmark results without using the QBENCHMARK macro. Use metric to specify how Qt Test should interpret the results.
The context for the result will be the test function name and any data tag from the _data function. This function can only be called once in each test function, subsequent calls will replace the earlier reported results.
Note that the -iterations command line argument has no effect on test functions without the QBENCHMARK macro.
Definition at line 238 of file qbenchmark.cpp.
|
static |
Definition at line 33 of file qtestresult.cpp.
References QTest::Internal::failed.
Referenced by checkStatement(), and resetFailed().
void QTest::setIterationCount | ( | int | count | ) |
Definition at line 199 of file qbenchmark.cpp.
void QTest::setIterationCountHint | ( | int | count | ) |
Definition at line 192 of file qbenchmark.cpp.
void QTest::setMainSourcePath | ( | const char * | file, |
const char * | builddir = nullptr ) |
Definition at line 2745 of file qtestcase.cpp.
References mainSourcePath.
|
noexcept |
Enables (enable = true
) or disables (\ enable = false
) throwing on QCOMPARE()/QVERIFY() failures (as opposed to just returning from the immediately-surrounding function context).
The feature is reference-counted: If you call this function {N} times with {true}, you need to call it {N} times with
{false} to get back to where you started.
This call has no effect when the \l{QTEST_THROW_ON_FAIL} C++ macro is defined.
Definition at line 316 of file qtestcase.cpp.
|
noexcept |
Enables (enable = true
) or disables (\ enable = false
) throwing on QSKIP() (as opposed to just returning from the immediately-surrounding function context).
The feature is reference-counted: If you call this function {N} times with {true}, you need to call it {N} times with
{false} to get back to where you started.
This call has no effect when the \l{QTEST_THROW_ON_SKIP} C++ macro is defined.
Definition at line 340 of file qtestcase.cpp.
|
static |
Definition at line 39 of file qtestkeyboard.h.
|
static |
Definition at line 24 of file qteamcitylogger.cpp.
|
static |
Definition at line 49 of file qteamcitylogger.cpp.
QObject * QTest::testObject | ( | ) |
Definition at line 2738 of file qtestcase.cpp.
Q_TESTLIB_EXPORT char * QTest::toHexRepresentation | ( | const char * | ba, |
qsizetype | length ) |
Returns a pointer to a string that is the string ba represented as a space-separated sequence of hex characters.
If the input is considered too long, it is truncated. A trucation is indicated in the returned string as an ellipsis at the end. The caller has ownership of the returned pointer and must ensure it is later passed to operator delete[].
length is the length of the string ba.
Definition at line 1450 of file qtestcase.cpp.
Q_TESTLIB_EXPORT char * QTest::toPrettyCString | ( | const char * | p, |
qsizetype | length ) |
Returns the same QByteArray but with only the ASCII characters still shown; everything else is replaced with {\xHH
}.
Definition at line 1509 of file qtestcase.cpp.
Q_TESTLIB_EXPORT char * QTest::toPrettyUnicode | ( | QStringView | string | ) |
Returns the same QString but with only the ASCII characters still shown; everything else is replaced with {\uXXXX
}.
Similar to QDebug::putString().
Definition at line 1643 of file qtestcase.cpp.
char * QTest::toString | ( | const char * | str | ) |
Definition at line 3153 of file qtestcase.cpp.
char * QTest::toString | ( | const MyPoint & | point | ) |
Definition at line 24 of file src_qtestlib_qtestcase_snippet.cpp.
char * QTest::toString | ( | const MyPoint & | point | ) |
Definition at line 24 of file src_qtestlib_qtestcase_snippet.cpp.
|
inline |
Definition at line 159 of file qtesttostring.h.
|
inline |
Definition at line 154 of file qtesttostring.h.
|
inline |
Definition at line 447 of file qtesttostring.h.
|
inline |
Definition at line 192 of file qtesttostring.h.
|
inline |
Definition at line 452 of file qtesttostring.h.
|
inline |
Definition at line 437 of file qtesttostring.h.
|
inline |
Definition at line 442 of file qtesttostring.h.
|
inline |
Definition at line 198 of file qtesttostring.h.
|
inline |
Definition at line 48 of file qtest_gui.h.
Q_POSITIONING_EXPORT char * QTest::toString | ( | const QGeoAreaMonitorInfo & | info | ) |
Definition at line 402 of file qgeoareamonitorinfo.cpp.
char * QTest::toString | ( | const QGeoPositionInfo & | info | ) |
Definition at line 413 of file qgeopositioninfo.cpp.
char * QTest::toString | ( | const QGeoSatelliteInfo & | info | ) |
Definition at line 395 of file qgeosatelliteinfo.cpp.
|
inline |
Definition at line 149 of file qtesttostring.h.
char * QTest::toString | ( | const QObject * | o | ) |
Definition at line 3185 of file qtestcase.cpp.
|
inline |
Definition at line 300 of file qtesttostring.h.
|
inline |
Definition at line 220 of file qtesttostring.h.
|
inline |
Definition at line 242 of file qtesttostring.h.
|
inline |
Definition at line 234 of file qtesttostring.h.
|
inline |
Definition at line 256 of file qtesttostring.h.
|
inline |
Definition at line 53 of file qtest_gui.h.
|
inline |
Definition at line 227 of file qtesttostring.h.
|
inline |
Definition at line 249 of file qtesttostring.h.
|
inline |
Definition at line 144 of file qtesttostring.h.
|
inline |
Definition at line 139 of file qtesttostring.h.
|
inline |
Definition at line 264 of file qtesttostring.h.
|
inline |
Definition at line 271 of file qtesttostring.h.
|
inline |
Definition at line 276 of file qtesttostring.h.
|
inline |
Definition at line 87 of file qtest_gui.h.
|
inline |
Definition at line 95 of file qtest_gui.h.
|
inline |
Definition at line 103 of file qtest_gui.h.
|
inline |
Definition at line 471 of file qtesttostring.h.
|
inline |
Definition at line 491 of file qtesttostring.h.
|
inline |
Definition at line 98 of file qtesttostring.h.
char * QTest::toString | ( | const volatile QObject * | vo | ) |
Definition at line 3175 of file qtestcase.cpp.
char * QTest::toString | ( | const volatile void * | p | ) |
Definition at line 3166 of file qtestcase.cpp.
|
inline |
Definition at line 457 of file qtesttostring.h.
|
inline |
Definition at line 496 of file qtesttostring.h.
|
inline |
Definition at line 32 of file qtest_network.h.
|
inline |
Definition at line 42 of file qtesttouch.h.
|
inline |
Definition at line 479 of file qtesttostring.h.
|
static |
This function creates a mouse wheel event and calls QWindowSystemInterface::handleWheelEvent(). window is the window that should be receiving the event and pos provides the location of the event in the window's local coordinates. angleDelta contains the wheel rotation angle, while pixelDelta contains the scrolling distance in pixels on screen. The keyboard states at the time of the event are specified by stateKey. The scrolling phase of the event is specified by phase.
Definition at line 40 of file qtestwheel.h.
|
static |
Definition at line 1601 of file qtestcase.cpp.
|
static |
Definition at line 41 of file qxmltestlogger.cpp.
|
static |
Definition at line 20 of file qxmltestlogger.cpp.
|
static |
Definition at line 65 of file qtestresult.cpp.
int QTest::blacklists = 0 |
Definition at line 143 of file qtestlog.cpp.
|
static |
Definition at line 61 of file qtestresult.cpp.
|
static |
Definition at line 60 of file qtestresult.cpp.
|
static |
Definition at line 62 of file qtestresult.cpp.
|
static |
Definition at line 356 of file qtestcase.cpp.
Referenced by qCleanup(), qInit(), qPrintTestSlots(), and qRun().
|
static |
Definition at line 63 of file qtestresult.cpp.
enum { ... } QTest::currentTestState |
|
static |
Definition at line 17 of file qbenchmarkmetric.cpp.
Referenced by benchmarkMetricName(), and benchmarkMetricUnit().
|
static |
Definition at line 418 of file qtestcase.cpp.
Referenced by defaultEventDelay(), and qtest_qParseArgs().
|
static |
Definition at line 67 of file qtestresult.cpp.
Referenced by clearExpectFail().
|
static |
Definition at line 68 of file qtestresult.cpp.
Referenced by checkStatement(), clearExpectFail(), compareHelper(), and compareHelper().
|
static |
Definition at line 207 of file qtestlog.cpp.
int QTest::fails = 0 |
Definition at line 140 of file qtestlog.cpp.
|
static |
Definition at line 192 of file qtestcase.cpp.
|
static |
Definition at line 193 of file qtestcase.cpp.
|
static |
Definition at line 27 of file qsignaldumper.cpp.
Q_CONSTINIT thread_local int QTest::ignoreLevel = 0 |
Definition at line 29 of file qsignaldumper.cpp.
Referenced by qSignalDumperCallbackSlot().
|
static |
Definition at line 204 of file qtestlog.cpp.
Referenced by handleIgnoredMessage().
Q_CONSTINIT thread_local int QTest::iLevel = 0 |
Definition at line 28 of file qsignaldumper.cpp.
|
static |
Definition at line 213 of file qtestlog.cpp.
|
static |
Definition at line 358 of file qtestcase.cpp.
Referenced by runningTest().
|
static |
Definition at line 416 of file qtestcase.cpp.
Referenced by qtest_qParseArgs().
Q_TESTLIB_EXPORT int QTest::lastMouseTimestamp = 0 |
Definition at line 12 of file qtestmouse.cpp.
Referenced by mouseEvent().
|
static |
Definition at line 357 of file qtestcase.cpp.
Referenced by setMainSourcePath().
|
static |
Definition at line 212 of file qtestlog.cpp.
Referenced by messageHandler().
|
static |
Definition at line 417 of file qtestcase.cpp.
Referenced by qtest_qParseArgs().
|
static |
Definition at line 47 of file qtestmouse.h.
Referenced by mouseEvent().
|
static |
Definition at line 205 of file qtestlog.cpp.
Definition at line 50 of file qbenchmarkmetric.cpp.
Referenced by benchmarkMetricName(), and benchmarkMetricUnit().
|
static |
Definition at line 215 of file qtestlog.cpp.
Referenced by messageHandler().
int QTest::passes = 0 |
Definition at line 141 of file qtestlog.cpp.
|
constexpr |
Definition at line 1599 of file qtestcase.cpp.
|
constexpr |
Definition at line 1597 of file qtestcase.cpp.
Q_TESTLIB_EXPORT bool QTest::printAvailableFunctions = false |
Definition at line 498 of file qtestcase.cpp.
Referenced by qtest_qParseArgs().
|
static |
Definition at line 422 of file qtestcase.cpp.
Referenced by qRun(), and qtest_qParseArgs().
|
static |
Definition at line 423 of file qtestcase.cpp.
Referenced by qtest_qParseArgs().
|
static |
Definition at line 64 of file qtestresult.cpp.
int QTest::skips = 0 |
Definition at line 142 of file qtestlog.cpp.
Q_TESTLIB_EXPORT QStringList QTest::testFunctions |
Definition at line 499 of file qtestcase.cpp.
Q_TESTLIB_EXPORT QStringList QTest::testTags |
Definition at line 500 of file qtestcase.cpp.
|
static |
Definition at line 211 of file qtestlog.cpp.