Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QTest Namespace Reference

[15] More...

Namespaces

namespace  Internal
 

Classes

struct  IgnoreResultList
 
class  QBenchmarkIterationController
 
struct  QBenchmarkMetricKey
 
struct  QTestDataSetter
 
class  QTouchEventSequence
 
class  QTouchEventWidgetSequence
 
class  TestMethods
 
class  TestRegistry
 
class  WatchDog
 

Enumerations

enum  QBenchmarkMetric {
  FramesPerSecond , BitsPerSecond , BytesPerSecond , WalltimeMilliseconds ,
  CPUTicks , InstructionReads , Events , WalltimeNanoseconds ,
  BytesAllocated , CPUMigrations , CPUCycles , BusCycles ,
  StalledCycles , Instructions , BranchInstructions , BranchMisses ,
  CacheReferences , CacheReads , CacheWrites , CachePrefetches ,
  CacheMisses , CacheReadMisses , CacheWriteMisses , CachePrefetchMisses ,
  ContextSwitches , PageFaults , MinorPageFaults , MajorPageFaults ,
  AlignmentFaults , EmulationFaults , RefCPUCycles
}
 
enum  { IndentSpacesCount = 4 }
 
enum  AttributeIndex {
  AI_Undefined = -1 , 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
}
 
enum  LogElementType {
  LET_Undefined = -1 , LET_Property , LET_Properties , LET_Failure ,
  LET_Error , LET_TestCase , LET_TestSuite , LET_Text ,
  LET_SystemError , LET_SystemOutput , LET_Skipped
}
 
enum  KeyAction { Press , Release , Click , Shortcut }
 
enum  {
  Unresolved , Passed , Skipped , Suppressed ,
  Failed
}
 
enum  MouseAction {
  MousePress , MouseRelease , MouseClick , MouseDClick ,
  MouseMove
}
 
enum  TestFailMode { Abort = 1 , Continue = 2 }
 
enum class  ComparisonOperation {
  CustomCompare , Equal , NotEqual , LessThan ,
  LessThanOrEqual , GreaterThan , GreaterThanOrEqual
}
 

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 >
static bool qWaitFor (Functor predicate, QDeadlineTimer deadline=QDeadlineTimer(std::chrono::seconds{5}))
 
template<typename Functor >
static 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 qWaitForWindowExposed (QWindow *window, int timeout=5000)
 
Q_GUI_EXPORT QPointingDevicecreateTouchDevice (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,...)
 
void Q_TESTLIB_EXPORT setBenchmarkResult (qreal result, QBenchmarkMetric metric)
 Sets the benchmark result for this test function to result.
 
int iterationCount ()
 
void setIterationCountHint (int count)
 
void setIterationCount (int count)
 
void beginBenchmarkMeasurement ()
 
QList< QBenchmarkMeasurerBase::MeasurementendBenchmarkMeasurement ()
 
const char * benchmarkMetricName (QBenchmarkMetric metric)
 
const char * benchmarkMetricUnit (QBenchmarkMetric metric)
 
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 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)
 
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 Rep , typename Period >
char * toString (std::chrono::duration< Rep, Period > dur)
 
template<typename T1 , typename T2 >
char * toString (const std::pair< T1, T2 > &pair)
 
template<typename Tuple , int... I>
char * toString (const Tuple &tuple, QtPrivate::IndexesList< I... >)
 
template<class... Types>
char * toString (const std::tuple< Types... > &tuple)
 
char * toString (std::nullptr_t)
 
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)
 
template<>
char * toString (const QColor &color)
 
template<>
char * toString (const QRegion &region)
 
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)
 
char * toString (QNetworkReply::NetworkError code)
 
char * toString (const QNetworkCookie &cookie)
 
char * toString (const QList< QNetworkCookie > &list)
 
char * toString (QSizePolicy::Policy p)
 
char * toString (QSizePolicy::ControlTypes ct)
 
char * toString (QSizePolicy::ControlType ct)
 
char * toString (QSizePolicy sp)
 
static void invokeMethod (QObject *obj, const char *methodName)
 
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< QBenchmarkResultqMedian (const QList< QList< QBenchmarkResult > > &container)
 
static void printUnknownDataTagError (QLatin1StringView name, QLatin1StringView tag, const QTestTable &lTable, const QTestTable &gTable)
 
voidfetchData (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)
 
char * toPrettyUnicode (QStringView string)
 
bool reportResult (bool success, qxp::function_ref< const char *()> lhs, qxp::function_ref< const char *()> rhs, const char *lhsExpr, const char *rhsExpr, ComparisonOperation op, const char *file, int line)
 
template<typename T >
char * toString (const T &t)
 
template<typename T1 , typename T2 >
char * toString (const QPair< T1, T2 > &pair)
 
Q_TESTLIB_EXPORT char * toString (const char *)
 
Q_TESTLIB_EXPORT char * toString (const volatile void *)
 
Q_TESTLIB_EXPORT char * toString (const void *)
 
Q_TESTLIB_EXPORT char * toString (const volatile QObject *)
 
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_TESTLIB_EXPORT void ignoreMessage (QtMsgType type, const char *message)
 Ignores messages created by qDebug(), qInfo() or qWarning().
 
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 voidqData (const char *tagName, int typeId)
 
Q_TESTLIB_EXPORT voidqGlobalData (const char *tagName, int typeId)
 
Q_TESTLIB_EXPORT voidqElementData (const char *elementName, int metaTypeId)
 
Q_TESTLIB_EXPORT QObjecttestObject ()
 
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, qxp::function_ref< const char *()> actualVal, qxp::function_ref< const char *()> expectedVal, 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 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 QTestDatanewRow (const char *dataTag)
 Appends a new row to the current test data.
 
Q_TESTLIB_EXPORT QTestDataaddRow (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)
 
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 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)
 
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 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)
 
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_GLOBAL_STATIC (TestRegistry, g_registry)
 
static void setFailed (bool failed)
 
static void resetFailed ()
 
static bool hasFailed ()
 
QTouchEventSequence touchEvent (QWindow *window, QPointingDevice *device, bool autoCommit=true)
 
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)
 
Q_WIDGETS_EXPORT bool qWaitForWindowActive (QWidget *widget, int timeout=5000)
 
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)
 

Variables

static const QBenchmarkMetricKey entries []
 
static const int NumEntries = sizeof(entries) / sizeof(entries[0])
 
static int iLevel = 0
 
static int ignoreLevel = 0
 
Q_TESTLIB_EXPORT int lastMouseTimestamp = 0
 
static QObjectcurrentTestObject = nullptr
 
static QString mainSourcePath
 
static bool inTestFunction = false
 
static int keyDelay = -1
 
static int mouseDelay = -1
 
static int eventDelay = -1
 
static bool noCrashHandler = false
 
Q_TESTLIB_EXPORT bool printAvailableFunctions = false
 
Q_TESTLIB_EXPORT QStringList testFunctions
 
Q_TESTLIB_EXPORT QStringList testTags
 
int fails = 0
 
int passes = 0
 
int skips = 0
 
int blacklists = 0
 
enum QTest:: { ... }  currentTestState
 
static IgnoreResultListignoreResultList = nullptr
 
static Q_CONSTINIT QBasicMutex mutex
 
static std::vector< QVariantfailOnWarningList
 
static int verbosity = 0
 
static int maxWarnings = 2002
 
static bool installedTestCoverage = true
 
static QtMessageHandler oldMessageHandler
 
static const int mouseDoubleClickInterval = 500
 
static QTestDatacurrentTestData = nullptr
 
static QTestDatacurrentGlobalTestData = 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
 

Detailed Description

[15]

[16]

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IndentSpacesCount 

Definition at line 29 of file qsignaldumper.cpp.

◆ anonymous enum

anonymous enum
Enumerator
Unresolved 
Passed 
Skipped 
Suppressed 
Failed 

Definition at line 81 of file qtestlog.cpp.

◆ AttributeIndex

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.

◆ ComparisonOperation

enum class QTest::ComparisonOperation
strong
Enumerator
CustomCompare 
Equal 
NotEqual 
LessThan 
LessThanOrEqual 
GreaterThan 
GreaterThanOrEqual 

Definition at line 30 of file qttestglobal.h.

◆ KeyAction

Enumerator
Press 
Release 
Click 
Shortcut 

Definition at line 37 of file qtestkeyboard.h.

◆ LogElementType

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.

◆ MouseAction

Enumerator
MousePress 
MouseRelease 
MouseClick 
MouseDClick 
MouseMove 

Definition at line 42 of file qtestmouse.h.

◆ QBenchmarkMetric

Since
4.7

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

See also
QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit()

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.

Enumerator
FramesPerSecond 
BitsPerSecond 
BytesPerSecond 
WalltimeMilliseconds 
CPUTicks 
InstructionReads 
Events 
WalltimeNanoseconds 
BytesAllocated 
CPUMigrations 
CPUCycles 
BusCycles 
StalledCycles 
Instructions 
BranchInstructions 
BranchMisses 
CacheReferences 
CacheReads 
CacheWrites 
CachePrefetches 
CacheMisses 
CacheReadMisses 
CacheWriteMisses 
CachePrefetchMisses 
ContextSwitches 
PageFaults 
MinorPageFaults 
MajorPageFaults 
AlignmentFaults 
EmulationFaults 
RefCPUCycles 

Definition at line 15 of file qbenchmarkmetric.h.

◆ TestFailMode

Enumerator
Abort 
Continue 

Definition at line 29 of file qttestglobal.h.

Function Documentation

◆ _q_compareSequence()

template<typename ActualIterator , typename ExpectedIterator >
bool QTest::_q_compareSequence ( ActualIterator  actualIt,
ActualIterator  actualEnd,
ExpectedIterator  expectedBegin,
ExpectedIterator  expectedEnd,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 419 of file qtest.h.

References compare_helper(), expected, file, i, line, qsnprintf(), and toString().

Referenced by qCompare(), qCompare(), and qCompare().

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

◆ addColumn()

template<typename T >
template< typename T > void QTest::addColumn ( const char *  name,
T *  dummy = nullptr 
)
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:

QTest::addColumn<int>("intval");
QTest::addColumn<QString>("str");
QTest::addColumn<double>("dbl");
QTest::newRow("row1") << 1 << "hello" << 1.5;
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Appends a new row to the current test data.

To add custom types to the testdata, the type must be registered with QMetaType via \l Q_DECLARE_METATYPE().

Note
This function can only be used called as part of a test's data function that is invoked by the test framework.

See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.

See also
QTest::newRow(), QFETCH(), QMetaType

Definition at line 456 of file qtestcase.h.

References addColumnInternal().

+ Here is the call graph for this function:

◆ addColumnInternal()

void QTest::addColumnInternal ( int  id,
const char *  name 
)

Definition at line 2900 of file qtestcase.cpp.

References QTestTable::addColumn(), QTestTable::currentTestTable(), and QTEST_ASSERT_X.

Referenced by addColumn().

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

◆ addRow()

QTestData & QTest::addRow ( const char *  format,
  ... 
)
Since
5.9

Appends a new row to the current test data.

The function's arguments are passed to qsnprintf() for formatting according to format. See the qvsnprintf() 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:

QTest::addColumn<int>("input");
QTest::addColumn<QString>("output");
QTest::addRow("%d", 0) << 0 << QString("0");
QTest::addRow("%d", 1) << 1 << QString("1");
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Q_TESTLIB_EXPORT QTestData & addRow(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
Note
This function can only be called as part of a test's data function that is invoked by the test framework.

See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.

See also
newRow(), addColumn(), QFETCH()

Definition at line 2965 of file qtestcase.cpp.

References QTestTable::currentTestTable(), QTestTable::elementCount(), QTestTable::newData(), QTEST_ASSERT_X, qvsnprintf(), and void.

Referenced by MyTestClass::addMultStringRows(), and for().

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

◆ asciiToKey()

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.

References Qt::Key_0, Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_A, Qt::Key_Aacute, Qt::Key_Acircumflex, Qt::Key_acute, Qt::Key_Adiaeresis, Qt::Key_AE, Qt::Key_Agrave, Qt::Key_Ampersand, Qt::Key_Apostrophe, Qt::Key_Aring, Qt::Key_AsciiCircum, Qt::Key_AsciiTilde, Qt::Key_Asterisk, Qt::Key_At, Qt::Key_Atilde, Qt::Key_B, Qt::Key_Backslash, Qt::Key_Backspace, Qt::Key_Backtab, Qt::Key_Bar, Qt::Key_BraceLeft, Qt::Key_BraceRight, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_brokenbar, Qt::Key_C, Qt::Key_Ccedilla, Qt::Key_cedilla, Qt::Key_cent, Qt::Key_Colon, Qt::Key_Comma, Qt::Key_copyright, Qt::Key_currency, Qt::Key_D, Qt::Key_degree, Qt::Key_diaeresis, Qt::Key_division, Qt::Key_Dollar, Qt::Key_Down, Qt::Key_E, Qt::Key_Eacute, Qt::Key_Ecircumflex, Qt::Key_Ediaeresis, Qt::Key_Egrave, Qt::Key_Equal, Qt::Key_Escape, Qt::Key_ETH, Qt::Key_Exclam, Qt::Key_exclamdown, Qt::Key_F, Qt::Key_G, Qt::Key_Greater, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_H, Qt::Key_hyphen, Qt::Key_I, Qt::Key_Iacute, Qt::Key_Icircumflex, Qt::Key_Idiaeresis, Qt::Key_Igrave, Qt::Key_J, Qt::Key_K, Qt::Key_L, Qt::Key_Less, Qt::Key_M, Qt::Key_macron, Qt::Key_masculine, Qt::Key_Minus, Qt::Key_mu, Qt::Key_multiply, Qt::Key_N, Qt::Key_nobreakspace, Qt::Key_notsign, Qt::Key_Ntilde, Qt::Key_NumberSign, Qt::Key_O, Qt::Key_Oacute, Qt::Key_Ocircumflex, Qt::Key_Odiaeresis, Qt::Key_Ograve, Qt::Key_onehalf, Qt::Key_onequarter, Qt::Key_onesuperior, Qt::Key_Ooblique, Qt::Key_ordfeminine, Qt::Key_Otilde, Qt::Key_P, Qt::Key_paragraph, Qt::Key_ParenLeft, Qt::Key_ParenRight, Qt::Key_Percent, Qt::Key_Period, Qt::Key_periodcentered, Qt::Key_Plus, Qt::Key_plusminus, Qt::Key_Q, Qt::Key_Question, Qt::Key_questiondown, Qt::Key_QuoteDbl, Qt::Key_QuoteLeft, Qt::Key_R, Qt::Key_registered, Qt::Key_Return, Qt::Key_S, Qt::Key_section, Qt::Key_Semicolon, Qt::Key_Slash, Qt::Key_Space, Qt::Key_ssharp, Qt::Key_sterling, Qt::Key_T, Qt::Key_Tab, Qt::Key_THORN, Qt::Key_threequarters, Qt::Key_threesuperior, Qt::Key_twosuperior, Qt::Key_U, Qt::Key_Uacute, Qt::Key_Ucircumflex, Qt::Key_Udiaeresis, Qt::Key_Ugrave, Qt::Key_Underscore, Qt::Key_Up, Qt::Key_V, Qt::Key_W, Qt::Key_X, Qt::Key_Y, Qt::Key_Yacute, Qt::Key_ydiaeresis, Qt::Key_yen, Qt::Key_Z, and QTEST_ASSERT.

Referenced by keyEvent().

+ Here is the caller graph for this function:

◆ beginBenchmarkMeasurement()

void QTest::beginBenchmarkMeasurement ( )

Definition at line 208 of file qbenchmark.cpp.

References QBenchmarkGlobalData::current, QBenchmarkGlobalData::measurer, and QBenchmarkMeasurerBase::start().

Referenced by QTest::QBenchmarkIterationController::QBenchmarkIterationController(), and QTest::QBenchmarkIterationController::QBenchmarkIterationController().

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

◆ benchmarkMetricName()

const char * QTest::benchmarkMetricName ( QBenchmarkMetric  metric)
Since
4.7 Returns the enum value metric as a character string.

Definition at line 104 of file qbenchmarkmetric.cpp.

References entries, QTest::QBenchmarkMetricKey::name, and NumEntries.

Referenced by QCsvBenchmarkLogger::addBenchmarkResult().

+ Here is the caller graph for this function:

◆ benchmarkMetricUnit()

const char * QTest::benchmarkMetricUnit ( QBenchmarkMetric  metric)
Since
4.7 Returns the units of measure for the specified metric.

Definition at line 116 of file qbenchmarkmetric.cpp.

References entries, NumEntries, and QTest::QBenchmarkMetricKey::unit.

◆ benchmarkResult2String()

static const char * QTest::benchmarkResult2String ( )
static

Definition at line 131 of file qplaintestlogger.cpp.

◆ benchmarkResultFormatString()

static const char * QTest::benchmarkResultFormatString ( )
static

Definition at line 192 of file qxmltestlogger.cpp.

Referenced by QXmlTestLogger::addBenchmarkResult().

+ Here is the caller graph for this function:

◆ compare_helper() [1/2]

bool QTest::compare_helper ( bool  success,
const char *  failureMsg,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
6.4 This function is called by various specializations of QTest::qCompare to decide whether to report a failure and to produce verbose test output.

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 3163 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, and line.

+ Here is the call graph for this function:

◆ compare_helper() [2/2]

bool QTest::compare_helper ( bool  success,
const char *  failureMsg,
qxp::function_ref< const char *()>  actualVal,
qxp::function_ref< const char *()>  expectedVal,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
6.4 This function is called by various specializations of QTest::qCompare to decide whether to report a failure and to produce verbose test output.

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.

This overload of the function uses qxp::function_ref to defer conversion of actualVal and expectedVal to strings until that is really needed (when the comparison fails). This speeds up test case execution on success.

Definition at line 3142 of file qtestcase.cpp.

References CustomCompare, expected, file, line, and QTestResult::reportResult().

Referenced by _q_compareSequence(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_string_helper(), qCompare(), qCompare(), qCompare(), and qCompare().

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

◆ compare_ptr_helper() [1/6]

bool QTest::compare_ptr_helper ( const volatile QObject t1,
const volatile QObject t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 521 of file qtestcase.h.

References compare_helper(), expected, file, line, t2, and toString().

+ Here is the call graph for this function:

◆ compare_ptr_helper() [2/6]

bool QTest::compare_ptr_helper ( const volatile QObject t1,
std::nullptr_t  ,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 529 of file qtestcase.h.

References compare_helper(), expected, file, line, and toString().

+ Here is the call graph for this function:

◆ compare_ptr_helper() [3/6]

bool QTest::compare_ptr_helper ( const volatile void t1,
const volatile void t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 513 of file qtestcase.h.

References compare_helper(), expected, file, line, t2, and toString().

Referenced by qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), and qCompare().

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

◆ compare_ptr_helper() [4/6]

bool QTest::compare_ptr_helper ( const volatile void t1,
std::nullptr_t  ,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 545 of file qtestcase.h.

References compare_helper(), expected, file, line, and toString().

+ Here is the call graph for this function:

◆ compare_ptr_helper() [5/6]

bool QTest::compare_ptr_helper ( std::nullptr_t  ,
const volatile QObject t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 537 of file qtestcase.h.

References compare_helper(), expected, file, line, t2, and toString().

+ Here is the call graph for this function:

◆ compare_ptr_helper() [6/6]

bool QTest::compare_ptr_helper ( std::nullptr_t  ,
const volatile void t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 553 of file qtestcase.h.

References compare_helper(), expected, file, line, t2, and toString().

+ Here is the call graph for this function:

◆ compare_string_helper()

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 3515 of file qtestcase.cpp.

References compare_helper(), expected, file, line, qstrcmp(), t2, and toString().

Referenced by qCompare(), qCompare(), qCompare(), and qCompare().

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

◆ countSignificantDigits()

template<typename T >
static int QTest::countSignificantDigits ( num)
static

Definition at line 158 of file qplaintestlogger.cpp.

References digits().

+ Here is the call graph for this function:

◆ createTouchDevice()

Q_GUI_EXPORT QPointingDevice * QTest::createTouchDevice ( QInputDevice::DeviceType  devType = QInputDevice::DeviceType::TouchScreen,
QInputDevice::Capabilities  caps = QInputDevice::Capability::Position 
)

Definition at line 1210 of file qwindowsysteminterface.cpp.

References createTouchDevice(), QPointingDevice::Finger, nextId, QWindowSystemInterface::registerInputDevice(), and ret.

Referenced by createTouchDevice(), and processTouchEvent().

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

◆ currentAppName()

const char * QTest::currentAppName ( )

Returns the name of the binary that is currently executed.

Definition at line 3013 of file qtestcase.cpp.

References QTestResult::currentAppName().

+ Here is the call graph for this function:

◆ currentDataTag()

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 3034 of file qtestcase.cpp.

References QTestResult::currentDataTag().

+ Here is the call graph for this function:

◆ currentTestFailed()

bool QTest::currentTestFailed ( )

Returns true if the current test function has failed, otherwise false.

See also
QTest::currentTestResolved()

Definition at line 3044 of file qtestcase.cpp.

References QTestResult::currentTestFailed().

+ Here is the call graph for this function:

◆ currentTestFunction()

const char * QTest::currentTestFunction ( )

Returns the name of the test function that is currently executed.

Example:

{
if (qstrcmp(QTest::currentTestFunction(), "myDatabaseTest") == 0) {
// clean up all database connections
}
}
Q_TESTLIB_EXPORT const char * currentTestFunction()
Returns the name of the test function that is currently executed.
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
void closeAllDatabases()

Definition at line 3025 of file qtestcase.cpp.

References QTestResult::currentTestFunction().

Referenced by MyTestClass::cleanup(), and printTestRunTime().

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

◆ currentTestResolved()

bool QTest::currentTestResolved ( )
Since
6.5 Returns 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.

See also
QTest::currentTestFailed()

Definition at line 3062 of file qtestcase.cpp.

References QTestResult::currentTestFailed(), and QTestResult::skipCurrentTest().

Referenced by QTestEventLoop::enterLoop().

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

◆ defaultEventDelay()

int QTest::defaultEventDelay ( )

Definition at line 550 of file qtestcase.cpp.

References QByteArray::constData(), eventDelay, QByteArray::isEmpty(), and qgetenv().

Referenced by defaultKeyDelay(), and defaultMouseDelay().

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

◆ defaultKeyDelay()

int Q_TESTLIB_EXPORT QTest::defaultKeyDelay ( )

Definition at line 574 of file qtestcase.cpp.

References QByteArray::constData(), defaultEventDelay(), QByteArray::isEmpty(), keyDelay, and qgetenv().

+ Here is the call graph for this function:

◆ defaultMouseDelay()

int Q_TESTLIB_EXPORT QTest::defaultMouseDelay ( )

Definition at line 562 of file qtestcase.cpp.

References QByteArray::constData(), defaultEventDelay(), QByteArray::isEmpty(), mouseDelay, and qgetenv().

Referenced by QuickTestEvent::defaultMouseDelay(), QtQuickTest::mouseEvent(), mouseEvent(), QQuickTest::pointerMove(), QQuickTest::pointerPress(), and QQuickTest::pointerRelease().

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

◆ endBenchmarkMeasurement()

QList< QBenchmarkMeasurerBase::Measurement > QTest::endBenchmarkMeasurement ( )

Definition at line 216 of file qbenchmark.cpp.

References QBenchmarkGlobalData::current, QBenchmarkGlobalData::measurer, and QBenchmarkMeasurerBase::stop().

Referenced by QTest::QBenchmarkIterationController::~QBenchmarkIterationController().

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

◆ failOnWarning()

void QTest::failOnWarning ( const char *  message)

Definition at line 2596 of file qtestcase.cpp.

References QTestLog::failOnWarning().

Referenced by QQmlDataTest::init().

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

◆ fetchData()

void * QTest::fetchData ( QTestData data,
const char *  tagName,
int  typeId 
)

Definition at line 1451 of file qtestcase.cpp.

References QMetaType::name(), Q_UNLIKELY, qFatal, QTEST_ASSERT, and QTEST_ASSERT_X.

Referenced by qData(), and qGlobalData().

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

◆ formatResult()

template<typename T >
QByteArray QTest::formatResult ( number,
int  significantDigits 
)

Definition at line 175 of file qplaintestlogger.cpp.

References QByteArray::append(), QByteArray::at(), QByteArray::chop(), i, QByteArray::insert(), QByteArray::isEmpty(), number, QByteArray::number(), qMin(), QByteArray::remove(), and QByteArray::size().

+ Here is the call graph for this function:

◆ formatString()

Q_TESTLIB_EXPORT char * QTest::formatString ( const char *  prefix,
const char *  suffix,
size_t  numArguments,
  ... 
)

Definition at line 1476 of file qtestcase.cpp.

References arguments, QList< T >::constData(), i, and qstrdup().

Referenced by toString(), and toString().

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

◆ handleFailOnWarning()

static bool QTest::handleFailOnWarning ( const QMessageLogContext context,
const QString message 
)
static

Definition at line 180 of file qtestlog.cpp.

References QTestResult::addFailure(), context, failOnWarningList, qPrintable, and qsnprintf().

Referenced by messageHandler().

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

◆ handleIgnoredMessage()

static bool QTest::handleIgnoredMessage ( QtMsgType  type,
const QString message 
)
static

Definition at line 154 of file qtestlog.cpp.

References ignoreResultList, list, mutex, and QTest::IgnoreResultList::next.

Referenced by messageHandler().

+ Here is the caller graph for this function:

◆ hasFailed()

static bool QTest::hasFailed ( )
static

Definition at line 51 of file qtestresult.cpp.

References QTest::Internal::failed.

Referenced by QTestResult::currentTestFailed(), QTestResult::finishedCurrentTestData(), and QTestResult::finishedCurrentTestDataCleanup().

+ Here is the caller graph for this function:

◆ ignoreMessage()

void QTest::ignoreMessage ( QtMsgType  type,
const char *  message 
)

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.

Note
Invoking this function will only ignore one message. If the message you want to ignore is output twice, you have to call ignoreMessage() twice, too.

Example:

QTest::ignoreMessage(QtWarningMsg, "QDir::mkdir: Empty or null file name(s)");
dir.mkdir("");
\inmodule QtCore
Definition qdir.h:19
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message)
Ignores messages created by qDebug(), qInfo() or qWarning().
@ QtWarningMsg
Definition qlogging.h:31
QString dir
[11]

The example above tests that QDir::mkdir() outputs the right warning when invoked with an invalid file name.

Definition at line 2561 of file qtestcase.cpp.

References QTestLog::ignoreMessage().

Referenced by tstQDir().

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

◆ incidentFormatString()

static const char * QTest::incidentFormatString ( bool  noDescription,
bool  noTag 
)
static

Definition at line 173 of file qxmltestlogger.cpp.

Referenced by QXmlTestLogger::addIncident().

+ Here is the caller graph for this function:

◆ invokeMethod()

static void QTest::invokeMethod ( QObject obj,
const char *  methodName 
)
static

Invoke a method of the object without generating warning if the method does not exist

Definition at line 540 of file qtestcase.cpp.

References Qt::DirectConnection, metaObject(), method, and methodName().

Referenced by qPrintDataTags().

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

◆ isEmpty()

static bool QTest::isEmpty ( const char *  str)
inlinestatic

Definition at line 168 of file qxmltestlogger.cpp.

References str.

Referenced by QXmlTestLogger::addIncident(), and QXmlTestLogger::addMessage().

+ Here is the caller graph for this function:

◆ iterationCount()

int QTest::iterationCount ( )

Definition at line 186 of file qbenchmark.cpp.

References QBenchmarkTestMethodData::current, and QBenchmarkTestMethodData::iterationCount.

Referenced by QTest::QBenchmarkIterationController::isDone().

+ Here is the caller graph for this function:

◆ keyClick() [1/2]

static void QTest::keyClick ( QWindow window,
char  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 127 of file qtestkeyboard.h.

References Click, keyEvent(), and window().

+ Here is the call graph for this function:

◆ keyClick() [2/2]

static void QTest::keyClick ( QWindow window,
Qt::Key  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 125 of file qtestkeyboard.h.

References Click, keyEvent(), and window().

Referenced by QQuickDialogTestUtils::enterText(), QuickTestEvent::keyClick(), and QuickTestEvent::keyClickChar().

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

◆ keyEvent() [1/2]

static void QTest::keyEvent ( KeyAction  action,
QWindow window,
char  ascii,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 118 of file qtestkeyboard.h.

References asciiToKey(), sendKeyEvent(), and window().

Referenced by keyClick(), keyClick(), keyPress(), keyPress(), keyRelease(), and keyRelease().

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

◆ keyEvent() [2/2]

static void QTest::keyEvent ( KeyAction  action,
QWindow window,
Qt::Key  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 121 of file qtestkeyboard.h.

References keyToAscii(), sendKeyEvent(), and window().

+ Here is the call graph for this function:

◆ keyPress() [1/2]

static void QTest::keyPress ( QWindow window,
char  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 133 of file qtestkeyboard.h.

References keyEvent(), Press, and window().

Referenced by QuickTestEvent::keyPress(), and QuickTestEvent::keyPressChar().

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

◆ keyPress() [2/2]

static void QTest::keyPress ( QWindow window,
Qt::Key  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 135 of file qtestkeyboard.h.

References keyEvent(), Press, and window().

+ Here is the call graph for this function:

◆ keyRelease() [1/2]

static void QTest::keyRelease ( QWindow window,
char  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 129 of file qtestkeyboard.h.

References keyEvent(), Release, and window().

Referenced by QuickTestEvent::keyRelease(), and QuickTestEvent::keyReleaseChar().

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

◆ keyRelease() [2/2]

static void QTest::keyRelease ( QWindow window,
Qt::Key  key,
Qt::KeyboardModifiers  modifier = Qt::NoModifier,
int  delay = -1 
)
inlinestatic

Definition at line 131 of file qtestkeyboard.h.

References keyEvent(), Release, and window().

+ Here is the call graph for this function:

◆ keyToAscii()

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.

References Qt::Key_0, Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_A, Qt::Key_Aacute, Qt::Key_Acircumflex, Qt::Key_acute, Qt::Key_Adiaeresis, Qt::Key_AE, Qt::Key_Agrave, Qt::Key_Alt, Qt::Key_Ampersand, Qt::Key_Apostrophe, Qt::Key_Aring, Qt::Key_AsciiCircum, Qt::Key_AsciiTilde, Qt::Key_Asterisk, Qt::Key_At, Qt::Key_Atilde, Qt::Key_B, Qt::Key_Back, Qt::Key_Backslash, Qt::Key_Backspace, Qt::Key_Backtab, Qt::Key_Bar, Qt::Key_BassBoost, Qt::Key_BassDown, Qt::Key_BassUp, Qt::Key_BraceLeft, Qt::Key_BraceRight, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_brokenbar, Qt::Key_C, Qt::Key_CapsLock, Qt::Key_Ccedilla, Qt::Key_cedilla, Qt::Key_cent, Qt::Key_Clear, Qt::Key_Colon, Qt::Key_Comma, Qt::Key_Control, Qt::Key_copyright, Qt::Key_currency, Qt::Key_D, Qt::Key_degree, Qt::Key_Delete, Qt::Key_diaeresis, Qt::Key_Direction_L, Qt::Key_Direction_R, Qt::Key_division, Qt::Key_Dollar, Qt::Key_Down, Qt::Key_E, Qt::Key_Eacute, Qt::Key_Ecircumflex, Qt::Key_Ediaeresis, Qt::Key_Egrave, Qt::Key_End, Qt::Key_Enter, Qt::Key_Equal, Qt::Key_Escape, Qt::Key_ETH, Qt::Key_Exclam, Qt::Key_exclamdown, Qt::Key_F, Qt::Key_F1, Qt::Key_F10, Qt::Key_F11, Qt::Key_F12, Qt::Key_F13, Qt::Key_F14, Qt::Key_F15, Qt::Key_F16, Qt::Key_F17, Qt::Key_F18, Qt::Key_F19, Qt::Key_F2, Qt::Key_F20, Qt::Key_F21, Qt::Key_F22, Qt::Key_F23, Qt::Key_F24, Qt::Key_F25, Qt::Key_F26, Qt::Key_F27, Qt::Key_F28, Qt::Key_F29, Qt::Key_F3, Qt::Key_F30, Qt::Key_F31, Qt::Key_F32, Qt::Key_F33, Qt::Key_F34, Qt::Key_F35, Qt::Key_F4, Qt::Key_F5, Qt::Key_F6, Qt::Key_F7, Qt::Key_F8, Qt::Key_F9, Qt::Key_Favorites, Qt::Key_Forward, Qt::Key_G, Qt::Key_Greater, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_H, Qt::Key_Help, Qt::Key_Home, Qt::Key_HomePage, Qt::Key_Hyper_L, Qt::Key_Hyper_R, Qt::Key_hyphen, Qt::Key_I, Qt::Key_Iacute, Qt::Key_Icircumflex, Qt::Key_Idiaeresis, Qt::Key_Igrave, Qt::Key_Insert, Qt::Key_J, Qt::Key_K, Qt::Key_L, Qt::Key_Launch0, Qt::Key_Launch1, Qt::Key_Launch2, Qt::Key_Launch3, Qt::Key_Launch4, Qt::Key_Launch5, Qt::Key_Launch6, Qt::Key_Launch7, Qt::Key_Launch8, Qt::Key_Launch9, Qt::Key_LaunchA, Qt::Key_LaunchB, Qt::Key_LaunchC, Qt::Key_LaunchD, Qt::Key_LaunchE, Qt::Key_LaunchF, Qt::Key_LaunchMail, Qt::Key_LaunchMedia, Qt::Key_Left, Qt::Key_Less, Qt::Key_M, Qt::Key_macron, Qt::Key_masculine, Qt::Key_MediaNext, Qt::Key_MediaPlay, Qt::Key_MediaPrevious, Qt::Key_MediaRecord, Qt::Key_MediaStop, Qt::Key_Menu, Qt::Key_Meta, Qt::Key_Minus, Qt::Key_mu, Qt::Key_multiply, Qt::Key_N, Qt::Key_No, Qt::Key_nobreakspace, Qt::Key_notsign, Qt::Key_Ntilde, Qt::Key_NumberSign, Qt::Key_NumLock, Qt::Key_O, Qt::Key_Oacute, Qt::Key_Ocircumflex, Qt::Key_Odiaeresis, Qt::Key_Ograve, Qt::Key_onehalf, Qt::Key_onequarter, Qt::Key_onesuperior, Qt::Key_Ooblique, Qt::Key_OpenUrl, Qt::Key_ordfeminine, Qt::Key_Otilde, Qt::Key_P, Qt::Key_PageDown, Qt::Key_PageUp, Qt::Key_paragraph, Qt::Key_ParenLeft, Qt::Key_ParenRight, Qt::Key_Pause, Qt::Key_Percent, Qt::Key_Period, Qt::Key_periodcentered, Qt::Key_Plus, Qt::Key_plusminus, Qt::Key_Print, Qt::Key_Q, Qt::Key_Question, Qt::Key_questiondown, Qt::Key_QuoteDbl, Qt::Key_QuoteLeft, Qt::Key_R, Qt::Key_Refresh, Qt::Key_registered, Qt::Key_Return, Qt::Key_Right, Qt::Key_S, Qt::Key_ScrollLock, Qt::Key_Search, Qt::Key_section, Qt::Key_Select, Qt::Key_Semicolon, Qt::Key_Shift, Qt::Key_Slash, Qt::Key_Space, Qt::Key_ssharp, Qt::Key_Standby, Qt::Key_sterling, Qt::Key_Stop, Qt::Key_Super_L, Qt::Key_Super_R, Qt::Key_SysReq, Qt::Key_T, Qt::Key_Tab, Qt::Key_THORN, Qt::Key_threequarters, Qt::Key_threesuperior, Qt::Key_TrebleDown, Qt::Key_TrebleUp, Qt::Key_twosuperior, Qt::Key_U, Qt::Key_Uacute, Qt::Key_Ucircumflex, Qt::Key_Udiaeresis, Qt::Key_Ugrave, Qt::Key_Underscore, Qt::Key_Up, Qt::Key_V, Qt::Key_VolumeDown, Qt::Key_VolumeMute, Qt::Key_VolumeUp, Qt::Key_W, Qt::Key_X, Qt::Key_Y, Qt::Key_Yacute, Qt::Key_ydiaeresis, Qt::Key_yen, Qt::Key_Yes, Qt::Key_Z, and QTEST_ASSERT.

Referenced by keyEvent().

+ Here is the caller graph for this function:

◆ messageFormatString()

static const char * QTest::messageFormatString ( bool  noDescription,
bool  noTag 
)
static

Definition at line 197 of file qxmltestlogger.cpp.

Referenced by QXmlTestLogger::addMessage().

+ Here is the caller graph for this function:

◆ messageHandler()

static void QTest::messageHandler ( QtMsgType  type,
const QMessageLogContext context,
const QString message 
)
static

Definition at line 206 of file qtestlog.cpp.

References QTestResult::addFailure(), context, FOREACH_TEST_LOGGER, handleFailOnWarning(), handleIgnoredMessage(), QTestLog::hasLoggers(), QTestLog::leaveTestFunction(), maxWarnings, oldMessageHandler, Q_BASIC_ATOMIC_INITIALIZER, qInstallMessageHandler(), QStringLiteral, QTEST_ASSERT, QtFatalMsg, QtWarningMsg, QTestLog::stopLogging(), and QAbstractTestLogger::Warn.

Referenced by QTestLog::startLogging().

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

◆ mouseClick()

void QTest::mouseClick ( QWindow window,
Qt::MouseButton  button,
Qt::KeyboardModifiers  stateKey = Qt::KeyboardModifiers(),
QPoint  pos = QPoint(),
int  delay = -1 
)
inline

Definition at line 137 of file qtestmouse.h.

References button, MouseClick, mouseEvent(), pos, and window().

Referenced by QQuickControlsTestUtils::clickButton().

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

◆ mouseDClick()

void QTest::mouseDClick ( QWindow window,
Qt::MouseButton  button,
Qt::KeyboardModifiers  stateKey = Qt::KeyboardModifiers(),
QPoint  pos = QPoint(),
int  delay = -1 
)
inline

Definition at line 141 of file qtestmouse.h.

References button, MouseDClick, mouseEvent(), pos, and window().

Referenced by QQuickControlsTestUtils::doubleClickButton().

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

◆ mouseEvent()

static void QTest::mouseEvent ( MouseAction  action,
QWindow window,
Qt::MouseButton  button,
Qt::KeyboardModifiers  stateKey,
QPoint  pos,
int  delay = -1 
)
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 67 of file qtestmouse.h.

References button, defaultMouseDelay(), global, QSize::height(), Qt::KeyboardModifierMask, lastMouseTimestamp, QEvent::MouseButtonPress, QEvent::MouseButtonRelease, MouseClick, MouseDClick, mouseDoubleClickInterval, QEvent::MouseMove, MouseMove, MousePress, MouseRelease, Qt::NoButton, pos, Q_FALLTHROUGH, qApp, qMax(), qt_handleMouseEvent(), QTEST_ASSERT, qWarning, QSize::width(), and window().

Referenced by mouseClick(), mouseDClick(), mouseMove(), mousePress(), and mouseRelease().

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

◆ mouseMove()

void QTest::mouseMove ( QWindow window,
QPoint  pos = QPoint(),
int  delay = -1 
)
inline

Definition at line 145 of file qtestmouse.h.

References mouseEvent(), MouseMove, Qt::NoButton, pos, and window().

Referenced by QQuickViewTestUtils::flick(), QQuickViewTestUtils::moveAndPress(), QQuickViewTestUtils::moveAndRelease(), and QQuickTest::pointerMove().

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

◆ mousePress()

void QTest::mousePress ( QWindow window,
Qt::MouseButton  button,
Qt::KeyboardModifiers  stateKey = Qt::KeyboardModifiers(),
QPoint  pos = QPoint(),
int  delay = -1 
)
inline

Definition at line 129 of file qtestmouse.h.

References button, mouseEvent(), MousePress, pos, and window().

Referenced by QQuickViewTestUtils::moveAndPress(), and QQuickTest::pointerPress().

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

◆ mouseRelease()

void QTest::mouseRelease ( QWindow window,
Qt::MouseButton  button,
Qt::KeyboardModifiers  stateKey = Qt::KeyboardModifiers(),
QPoint  pos = QPoint(),
int  delay = -1 
)
inline

Definition at line 133 of file qtestmouse.h.

References button, mouseEvent(), MouseRelease, pos, and window().

Referenced by QQuickViewTestUtils::moveAndRelease(), and QQuickTest::pointerRelease().

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

◆ newRow()

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:

{
QTest::addColumn<QString>("aString");
QTest::newRow("just.hello") << QString("hello");
QTest::newRow("a.null.string") << QString();
}
Note
This function can only be called as part of a test's data function that is invoked by the test framework.

See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.

See also
addRow(), addColumn(), QFETCH()

Definition at line 2928 of file qtestcase.cpp.

References QTestTable::currentTestTable(), QTestTable::elementCount(), QTestTable::newData(), and QTEST_ASSERT_X.

Referenced by MyTestClass::addDataRow(), MyTestClass::addSingleStringRows(), QQuickControlsTestUtils::addTestRowForEachControl(), QuickTestResult::setDataTag(), tst_Skip::test_data(), and TestQString::toInt_data().

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

◆ printUnknownDataTagError()

static void QTest::printUnknownDataTagError ( QLatin1StringView  name,
QLatin1StringView  tag,
const QTestTable lTable,
const QTestTable gTable 
)
static

Definition at line 1330 of file qtestcase.cpp.

References QTestTable::dataCount(), QTestData::dataTag(), i, tag, and QTestTable::testData().

+ Here is the call graph for this function:

◆ ptIncidentType2String()

static const char * QTest::ptIncidentType2String ( QAbstractTestLogger::IncidentTypes  type)
static

Definition at line 106 of file qplaintestlogger.cpp.

References QAbstractTestLogger::BlacklistedFail, QAbstractTestLogger::BlacklistedPass, QAbstractTestLogger::BlacklistedXFail, QAbstractTestLogger::BlacklistedXPass, QAbstractTestLogger::Fail, QAbstractTestLogger::Pass, QAbstractTestLogger::Skip, QAbstractTestLogger::XFail, and QAbstractTestLogger::XPass.

Referenced by QPlainTestLogger::addIncident().

+ Here is the caller graph for this function:

◆ ptMessageType2String()

static const char * QTest::ptMessageType2String ( QAbstractTestLogger::MessageTypes  type)
static

Definition at line 136 of file qplaintestlogger.cpp.

References QAbstractTestLogger::Info, QAbstractTestLogger::QCritical, QAbstractTestLogger::QDebug, QAbstractTestLogger::QFatal, QAbstractTestLogger::QInfo, QAbstractTestLogger::QWarning, and QAbstractTestLogger::Warn.

Referenced by QPlainTestLogger::addMessage(), and QPlainTestLogger::enterTestFunction().

+ Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC()

QTest::Q_GLOBAL_STATIC ( TestRegistry  ,
g_registry   
)

◆ qCaught()

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 2516 of file qtestcase.cpp.

References QString::asprintf(), expected, file, line, and qFail().

+ Here is the call graph for this function:

◆ qCleanup()

void QTest::qCleanup ( )

Definition at line 2395 of file qtestcase.cpp.

References QBenchmarkGlobalData::CallgrindParentProcess, QTestTable::clearGlobalTestTable(), QBenchmarkGlobalData::current, currentTestObject, and QTestLog::stopLogging().

Referenced by qExec(), qRun(), and runTests().

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

◆ qCompare() [1/38]

bool QTest::qCompare ( char *  t1,
char *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 650 of file qtestcase.h.

References compare_string_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [2/38]

bool QTest::qCompare ( char *  t1,
const char *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 659 of file qtestcase.h.

References compare_string_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [3/38]

bool QTest::qCompare ( const char *  t1,
char *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 664 of file qtestcase.h.

References compare_string_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [4/38]

bool QTest::qCompare ( const char *  t1,
const char *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 645 of file qtestcase.h.

References compare_string_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [5/38]

bool QTest::qCompare ( const QLatin1StringView t1,
QStringView  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
5.14

Definition at line 3289 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [6/38]

bool QTest::qCompare ( const QString t1,
const QString t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline
Since
5.14

Definition at line 494 of file qtestcase.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [7/38]

template<typename T >
template< typename T > bool QTest::qCompare ( const T *  t1,
const T *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 607 of file qtestcase.h.

References compare_ptr_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [8/38]

template<typename T1 , typename T2 = T1>
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 
)
inline

Definition at line 586 of file qtestcase.h.

References compare_helper(), expected, file, line, t2, and toString().

+ Here is the call graph for this function:

◆ qCompare() [9/38]

template<typename T1 , typename T2 >
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 
)
inline

Definition at line 633 of file qtestcase.h.

References compare_ptr_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [10/38]

bool QTest::qCompare ( double const &  t1,
double const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 3214 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, floatingCompare(), line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [11/38]

bool QTest::qCompare ( double const &  t1,
float const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 594 of file qtestcase.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [12/38]

bool QTest::qCompare ( float const &  t1,
double const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 600 of file qtestcase.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [13/38]

bool QTest::qCompare ( float const &  t1,
float const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 3203 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, floatingCompare(), line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [14/38]

bool QTest::qCompare ( int  t1,
int  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
5.14

Definition at line 3226 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [15/38]

template<typename T >
template< typename T > bool QTest::qCompare ( QFlags< T > const &  t1,
int const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 505 of file qtest.h.

References expected, file, Int, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [16/38]

template<typename T >
template< typename T > bool QTest::qCompare ( QFlags< T > const &  t1,
T const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 497 of file qtest.h.

References expected, file, Int, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [17/38]

bool QTest::qCompare ( qfloat16 const &  t1,
qfloat16 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 3191 of file qtestcase.cpp.

References compare_helper(), expected, file, floatingCompare(), line, t2, and toString().

+ Here is the call graph for this function:

◆ qCompare() [18/38]

bool QTest::qCompare ( QIcon const &  t1,
QIcon const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 116 of file qtest_gui.h.

References expected, file, line, qCompare(), QTEST_ASSERT, and t2.

+ Here is the call graph for this function:

◆ qCompare() [19/38]

bool QTest::qCompare ( QImage const &  t1,
QImage const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 124 of file qtest_gui.h.

References compare_helper(), expected, file, line, qFuzzyCompare(), qsnprintf(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [20/38]

template<>
bool QTest::qCompare ( qint32 const &  t1,
qint64 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 534 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [21/38]

template<>
bool QTest::qCompare ( qint64 const &  t1,
qint32 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 513 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [22/38]

template<>
bool QTest::qCompare ( qint64 const &  t1,
quint32 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 520 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [23/38]

template<>
bool QTest::qCompare ( QLatin1StringView const &  t1,
QString const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline
Since
5.14

Definition at line 411 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [24/38]

template<typename T , int N>
bool QTest::qCompare ( QList< T > const &  t1,
const T(&)  t2[N],
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 488 of file qtest.h.

References _q_compareSequence(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [25/38]

template<typename T >
template< typename T > bool QTest::qCompare ( QList< T > const &  t1,
QList< T > const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 470 of file qtest.h.

References _q_compareSequence(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [26/38]

template<typename T , int N>
bool QTest::qCompare ( QList< T > const &  t1,
std::initializer_list< T >  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 478 of file qtest.h.

References _q_compareSequence(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [27/38]

bool QTest::qCompare ( QPixmap const &  t1,
QPixmap const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 166 of file qtest_gui.h.

References compare_helper(), expected, file, line, qCompare(), qFuzzyCompare(), qsnprintf(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [28/38]

template<>
bool QTest::qCompare ( QString const &  t1,
QLatin1StringView const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline
Since
5.14

Definition at line 405 of file qtest.h.

References expected, file, line, qCompare(), and t2.

Referenced by qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), qCompare(), and qTest().

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

◆ qCompare() [29/38]

bool QTest::qCompare ( QStringView  t1,
const QLatin1StringView t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
5.14

Definition at line 3277 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [30/38]

bool QTest::qCompare ( QStringView  t1,
QStringView  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
5.14

Definition at line 3265 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [31/38]

template<>
bool QTest::qCompare ( quint32 const &  t1,
qint64 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 541 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [32/38]

template<>
bool QTest::qCompare ( quint32 const &  t1,
quint64 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 548 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [33/38]

template<>
bool QTest::qCompare ( quint64 const &  t1,
quint32 const &  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 527 of file qtest.h.

References expected, file, line, qCompare(), and t2.

+ Here is the call graph for this function:

◆ qCompare() [34/38]

template<typename T >
template< typename T > bool QTest::qCompare ( std::nullptr_t  ,
T *  t,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 626 of file qtestcase.h.

References compare_ptr_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [35/38]

template<typename T >
template< typename T > bool QTest::qCompare ( T *  t,
std::nullptr_t  ,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 620 of file qtestcase.h.

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

+ Here is the call graph for this function:

◆ qCompare() [36/38]

template<typename T >
template< typename T > bool QTest::qCompare ( T *  t1,
T *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 613 of file qtestcase.h.

References compare_ptr_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [37/38]

template<typename T1 , typename T2 >
template< typename T1, typename T2 > bool QTest::qCompare ( T1 *  t1,
T2 *  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 639 of file qtestcase.h.

References compare_ptr_helper(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qCompare() [38/38]

bool QTest::qCompare ( unsigned  t1,
unsigned  t2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)
Since
5.14

Definition at line 3253 of file qtestcase.cpp.

References QTestResult::compare(), expected, file, line, and t2.

+ Here is the call graph for this function:

◆ qData()

void * QTest::qData ( const char *  tagName,
int  typeId 
)

Definition at line 2870 of file qtestcase.cpp.

References QTestResult::currentTestData(), and fetchData().

+ Here is the call graph for this function:

◆ qElementData()

void * QTest::qElementData ( const char *  tagName,
int  metaTypeId 
)

Definition at line 2884 of file qtestcase.cpp.

References QTestResult::currentTestData(), and QTEST_ASSERT.

Referenced by qTest().

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

◆ qExec() [1/2]

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.

Since
4.4

Behaves identically to qExec(QObject *, int, char**) but takes a QStringList of arguments instead of a char** list.

Definition at line 2450 of file qtestcase.cpp.

References QList< T >::append(), args, arguments, QList< T >::at(), QVariant::constData(), QVarLengthArray< T, Prealloc >::data(), i, QList< T >::last(), qExec(), QList< T >::reserve(), QList< T >::size(), and testObject().

+ Here is the call graph for this function:

◆ qExec() [2/2]

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:

MyTestObject test1;
QTest::qExec(&test1);
Q_TESTLIB_EXPORT int qExec(QObject *testObject, int argc=0, char **argv=nullptr)
Executes tests declared in testObject.

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.

Note
This function is not reentrant, only one test can run at a time. A test that was executed with qExec() can't run another test via qExec() and threads are not allowed to call qExec() simultaneously.

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.

See also
QTEST_MAIN(), QTEST_GUILESS_MAIN(), QTEST_APPLESS_MAIN()

Definition at line 2244 of file qtestcase.cpp.

References qCleanup(), qInit(), qRun(), ret, and testObject().

Referenced by qExec(), and testObject().

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

◆ qExpectFail()

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

Definition at line 2494 of file qtestcase.cpp.

References QTestResult::expectFail(), file, line, and qstrdup().

+ Here is the call graph for this function:

◆ qFail()

void QTest::qFail ( const char *  message,
const char *  file,
int  line 
)

Definition at line 2469 of file qtestcase.cpp.

References QTestResult::fail(), file, and line.

Referenced by qCaught().

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

◆ qFindTestData() [1/2]

QString QTest::qFindTestData ( const char *  base,
const char *  file = nullptr,
int  line = 0,
const char *  builddir = nullptr,
const char *  sourcedir = nullptr 
)

Definition at line 2862 of file qtestcase.cpp.

References base, QFile::decodeName(), file, line, and qFindTestData().

Referenced by QTestPrivate::parseBlackList(), and qFindTestData().

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

◆ qFindTestData() [2/2]

QString QTest::qFindTestData ( const QString base,
const char *  file = nullptr,
int  line = 0,
const char *  builddir = nullptr,
const char *  sourcedir = nullptr 
)

◆ qGlobalData()

void * QTest::qGlobalData ( const char *  tagName,
int  typeId 
)

Definition at line 2877 of file qtestcase.cpp.

References QTestResult::currentGlobalTestData(), and fetchData().

+ Here is the call graph for this function:

◆ qInit()

void QTest::qInit ( QObject testObject,
int  argc = 0,
char **  argv = nullptr 
)

Definition at line 2258 of file qtestcase.cpp.

References QBenchmarkGlobalData::CallgrindParentProcess, QBenchmarkGlobalData::current, currentTestObject, QTestPrivate::disableWindowRestore(), QTestTable::globalTestTable(), initEnvironment(), maybeDisableCoreDump(), metaObject(), QTestPrivate::parseBlackList(), qApp, qstrcmp(), QTEST_ASSERT, qtest_qParseArgs(), QTestResult::reset(), QTestResult::setCurrentAppName(), QTestResult::setCurrentTestObject(), QTestLog::startLogging(), and testObject().

Referenced by runTests().

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

◆ qMedian()

static QList< QBenchmarkResult > QTest::qMedian ( const QList< QList< QBenchmarkResult > > &  container)
static

Definition at line 1070 of file qtestcase.cpp.

References QList< T >::at(), QList< T >::begin(), QList< T >::end(), and QList< T >::size().

+ Here is the call graph for this function:

◆ qPrintDataTags()

static void QTest::qPrintDataTags ( FILE *  stream)
static

Definition at line 624 of file qtestcase.cpp.

References QMetaObject::className(), QByteArray::constData(), currentTestObject, QByteArray::data(), QTestTable::dataCount(), QTestData::dataTag(), QTestTable::globalTestTable(), i, invokeMethod(), isValidSlot(), j, QMetaObject::method(), QMetaObject::methodCount(), QMetaMethod::methodSignature(), qsnprintf(), qstrdup(), qstrlen(), QByteArray::resize(), QTestLog::setPrintAvailableTagsMode(), QByteArray::size(), and QTestTable::testData().

Referenced by qtest_qParseArgs().

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

◆ qPrintMessage()

static void QTest::qPrintMessage ( const QByteArray ba)
inlinestatic

Definition at line 21 of file qsignaldumper.cpp.

References ba, QByteArray::constData(), and QTestLog::info().

Referenced by qSignalDumperCallback(), and qSignalDumperCallbackSlot().

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

◆ qPrintTestSlots()

static bool QTest::qPrintTestSlots ( FILE *  stream,
const char *  filter = nullptr,
const char *  preamble = "" 
)
static

Definition at line 603 of file qtestcase.cpp.

References Qt::CaseInsensitive, QLatin1StringView::contains(), currentTestObject, i, isValidSlot(), matches(), QMetaMethod::methodSignature(), and preamble.

Referenced by qRun(), and qtest_qParseArgs().

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

◆ qRun()

int QTest::qRun ( )

◆ qSignalDumperCallback()

static void QTest::qSignalDumperCallback ( QObject caller,
int  signal_index,
void **  argv 
)
static

Definition at line 31 of file qsignaldumper.cpp.

References QString::append(), arg, args, QList< T >::at(), QString::chop(), contains(), QString::endsWith(), QString::fill(), QMetaType::fromName(), i, QMetaType::id(), ignoreLevel, iLevel, IndentSpacesCount, QString::isEmpty(), QMetaMethod::isValid(), mo, QMetaMethod::name(), QByteArray::number(), QObject::objectName, QMetaMethod::parameterTypes(), Q_ASSERT, Q_UNUSED, qPrintMessage(), QByteArray::rightJustified(), QMetaObjectPrivate::signal(), QList< T >::size(), str, QString::toLocal8Bit(), toLocal8Bit(), toString(), and QMetaType::UnknownType.

Referenced by QSignalDumper::startDump().

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

◆ qSignalDumperCallbackEndSignal()

static void QTest::qSignalDumperCallbackEndSignal ( QObject caller,
int   
)
static

Definition at line 122 of file qsignaldumper.cpp.

References contains(), ignoreLevel, iLevel, and Q_ASSERT.

Referenced by QSignalDumper::startDump().

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

◆ qSignalDumperCallbackSlot()

static void QTest::qSignalDumperCallbackSlot ( QObject caller,
int  method_index,
void **  argv 
)
static

Definition at line 90 of file qsignaldumper.cpp.

References contains(), QString::fill(), ignoreLevel, iLevel, IndentSpacesCount, QString::isEmpty(), QMetaMethod::isValid(), QMetaMethod::methodSignature(), mo, QByteArray::number(), QObject::objectName, Q_ASSERT, Q_UNUSED, qPrintMessage(), QByteArray::rightJustified(), str, and QString::toLocal8Bit().

Referenced by QSignalDumper::startDump().

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

◆ qSkip()

void QTest::qSkip ( const char *  message,
const char *  file,
int  line 
)

Definition at line 2485 of file qtestcase.cpp.

References QTestResult::addSkip(), file, line, and QTestResult::setSkipCurrentTest().

+ Here is the call graph for this function:

◆ qSleep() [1/2]

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:

QTest::qSleep(std::chrono::milliseconds{ms});
Q_CORE_EXPORT void qSleep(int ms)
This is an overloaded member function, provided for convenience. It differs from the above function o...

Definition at line 22 of file qtestsupport_core.cpp.

References qSleep().

Referenced by qSleep(), quarterSecondSleep(), qWait(), qWaitForSignal(), and QuickTestResult::sleep().

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

◆ qSleep() [2/2]

void QTest::qSleep ( std::chrono::milliseconds  msecs)
Since
6.7

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.

Note
Starting from Qt 6.7, this function is implemented using {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:

using namespace std::chrono_literals;
See also
{QTest::qWait()}

Definition at line 49 of file qtestsupport_core.cpp.

References Q_ASSERT.

◆ qt_asprintf()

int QTest::qt_asprintf ( QTestCharBuffer str,
const char *  format,
  ... 
)

◆ qTest()

template<class T >
template< typename T > bool QTest::qTest ( const T &  actual,
const char *  elementName,
const char *  actualStr,
const char *  expected,
const char *  file,
int  line 
)
inline

Definition at line 671 of file qtestcase.h.

References expected, file, line, qCompare(), and qElementData().

+ Here is the call graph for this function:

◆ qtest_qParseArgs() [1/2]

void QTest::qtest_qParseArgs ( int  argc,
char *  argv[],
bool  qml 
)

Definition at line 1066 of file qtestcase.cpp.

References qtest_qParseArgs().

+ Here is the call graph for this function:

◆ qtest_qParseArgs() [2/2]

Q_TESTLIB_EXPORT void QTest::qtest_qParseArgs ( int  argc,
const char *const  argv[],
bool  qml 
)

Definition at line 702 of file qtestcase.cpp.

References QTestLog::addLogger(), QBenchmarkGlobalData::CallgrindChildProcess, QBenchmarkGlobalData::callgrindOutFileBase, QBenchmarkGlobalData::CallgrindParentProcess, QXcodeTestLogger::canLogTestProgress(), QTestLog::CSV, QBenchmarkGlobalData::current, QTestResult::currentAppName(), QDir::currentPath(), QTestResult::currentTestObjectName(), QBenchmarkGlobalData::EventCounter, eventDelay, QString::fromLatin1(), QTestLog::hasLoggers(), QBenchmarkValgrindUtils::haveValgrind(), i, installCoverageTool(), installedTestCoverage, QBenchmarkPerfEventsMeasurer::isAvailable(), QBenchmarkGlobalData::iterationCount, QTestLog::JUnitXML, keyDelay, QTestLog::LightXML, QBenchmarkPerfEventsMeasurer::listCounters(), QTestLog::loggerUsingStdout(), QBenchmarkGlobalData::medianIterationCount, QBenchmarkGlobalData::minimumTotal, mouseDelay, noCrashHandler, QBenchmarkValgrindUtils::outFileBase(), QXcodeTestLogger::parseCommandLineArgument(), QBenchmarkGlobalData::PerfCounter, QTestLog::Plain, AppleUnifiedLogger::preventsStderrLogging(), printAvailableFunctions, qPrintDataTags(), qPrintTestSlots(), qToInt(), QBenchmarkPerfEventsMeasurer::setCounter(), QSignalDumper::setEnabled(), QTestLog::setInstalledTestCoverage(), QTestLog::setMaxWarnings(), QBenchmarkGlobalData::setMode(), QTestLog::setVerboseLevel(), QTestLog::TAP, QTestLog::TeamCity, testFunctions, testTags, QBenchmarkGlobalData::TickCounter, QBenchmarkGlobalData::verboseOutput, QBenchmarkGlobalData::walltimeMinimum, and QTestLog::XML.

Referenced by QuickTestResult::parseArgs(), qInit(), and qtest_qParseArgs().

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

◆ qToInt()

static int QTest::qToInt ( const char *  str)
static

Definition at line 691 of file qtestcase.cpp.

References str.

Referenced by qtest_qParseArgs().

+ Here is the caller graph for this function:

◆ qVerify()

bool QTest::qVerify ( bool  statement,
const char *  statementStr,
const char *  description,
const char *  file,
int  line 
)

Definition at line 2476 of file qtestcase.cpp.

References file, line, and QTestResult::verify().

+ Here is the call graph for this function:

◆ qWait() [1/2]

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:

QTest::qWait(std::chrono::milliseconds{msecs});
Q_CORE_EXPORT void qWait(int ms)
This is an overloaded member function, provided for convenience. It differs from the above function o...

Definition at line 92 of file qtestsupport_core.cpp.

References qWait().

Referenced by QQuickViewTestUtils::flick(), QQuickTest::initView(), MyObject::isReady(), QtQuickTest::mouseEvent(), QQuickVisualTestUtils::PointLerper::move(), quick_test_main_with_setup(), qWait(), and QuickTestResult::wait().

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

◆ qWait() [2/2]

Q_CORE_EXPORT void QTest::qWait ( std::chrono::milliseconds  msecs)
Since
6.7

Waits for msecs. While waiting, events will be processed and your test will stay responsive to user interface events or network communication.

Example:

using namespace std::chrono_literals;
int i = 0;
while (myNetworkServerNotResponding() && i++ < 50)
QTest::qWait(250ms);

The code above will wait until the network server is responding for a maximum of about 12.5 seconds.

See also
QTest::qSleep(), QSignalSpy::wait()

Definition at line 112 of file qtestsupport_core.cpp.

References QEventLoop::AllEvents, deadline, QEvent::DeferredDelete, QDeadlineTimer::hasExpired(), QCoreApplication::instance(), QDeadlineTimer::isForever(), Qt::PreciseTimer, QCoreApplication::processEvents(), Q_ASSERT, qSleep(), QDeadlineTimer::remainingTimeAsDuration(), and QCoreApplication::sendPostedEvents().

+ Here is the call graph for this function:

◆ qWaitFor() [1/2]

template<typename Functor >
static bool QTest::qWaitFor ( Functor  predicate,
int  timeout 
)
static

Definition at line 63 of file qtestsupport_core.h.

References predicate, and qWaitFor().

+ Here is the call graph for this function:

◆ qWaitFor() [2/2]

template<typename Functor >
static bool QTest::qWaitFor ( Functor  predicate,
QDeadlineTimer  deadline = QDeadlineTimer(std::chrono::seconds{5}) 
)
static

Definition at line 20 of file qtestsupport_core.h.

Referenced by PlatformQuirks::isClipboardAvailable(), qWaitFor(), QQuickTest::qWaitForPolish(), QQuickTest::qWaitForPolish(), qWaitForWidgetWindow(), qWaitForWindowActive(), qWaitForWindowExposed(), and startup().

+ Here is the caller graph for this function:

◆ qWaitForWindowActive() [1/2]

Q_WIDGETS_EXPORT bool QTest::qWaitForWindowActive ( QWidget widget,
int  timeout = 5000 
)
Since
5.0

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.

Note
The method will time out and return false if another window prevents widget from becoming active.
Since focus is an exclusive property, widget may loose its focus to another window at any time - even after the method has returned true.
See also
qWaitForWindowExposed(), QWidget::isActiveWindow()

Definition at line 48 of file qtestsupport_widgets.cpp.

References QGuiApplicationPrivate::platformIntegration(), Q_UNLIKELY, qWaitForWidgetWindow(), qWaitForWindowExposed(), qWarning, widget, window(), QWidget::window(), and QPlatformIntegration::WindowActivation.

+ Here is the call graph for this function:

◆ qWaitForWindowActive() [2/2]

QT_BEGIN_NAMESPACE Q_GUI_EXPORT bool QTest::qWaitForWindowActive ( QWindow window,
int  timeout = 5000 
)
Since
5.0

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.

Note
The method will time out and return false if another window prevents window from becoming active.
Since focus is an exclusive property, window may loose its focus to another window at any time - even after the method has returned true.
See also
qWaitForWindowExposed(), QWindow::isActive()

Definition at line 34 of file qtestsupport_gui.cpp.

References QGuiApplicationPrivate::platformIntegration(), Q_UNLIKELY, qWaitFor(), qWaitForWindowExposed(), qWarning, window(), and QPlatformIntegration::WindowActivation.

Referenced by quick_test_main_with_setup(), and QQuickDialogTestUtils::DialogTestHelper< DialogType, QuickDialogType >::waitForWindowActive().

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

◆ qWaitForWindowExposed() [1/2]

Q_WIDGETS_EXPORT bool QTest::qWaitForWindowExposed ( QWidget widget,
int  timeout = 5000 
)
Since
5.0

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.

Note
A window mapped to screen may still not be considered exposed, if the window client area is not visible, e.g. because it is completely covered by other windows. In such cases, the method will time out and return false.
See also
qWaitForWindowActive(), QWidget::isVisible(), QWindow::isExposed()

Definition at line 77 of file qtestsupport_widgets.cpp.

References qWaitForWidgetWindow(), widget, window(), and QWidget::window().

+ Here is the call graph for this function:

◆ qWaitForWindowExposed() [2/2]

Q_GUI_EXPORT bool QTest::qWaitForWindowExposed ( QWindow window,
int  timeout = 5000 
)
Since
5.0

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.

Note
A window mapped to screen may still not be considered exposed, if the window client area is not visible, e.g. because it is completely covered by other windows. In such cases, the method will time out and return false.
See also
qWaitForWindowActive(), QWindow::isExposed()

Definition at line 61 of file qtestsupport_gui.cpp.

References qWaitFor(), and window().

Referenced by quick_test_main_with_setup(), qWaitForWindowActive(), qWaitForWindowActive(), and QQuickTest::showView().

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

◆ reportResult()

Q_TESTLIB_EXPORT bool QTest::reportResult ( bool  success,
qxp::function_ref< const char *()>  lhs,
qxp::function_ref< const char *()>  rhs,
const char *  lhsExpr,
const char *  rhsExpr,
ComparisonOperation  op,
const char *  file,
int  line 
)

Definition at line 1776 of file qtestcase.cpp.

References file, line, and QTestResult::reportResult().

+ Here is the call graph for this function:

◆ resetFailed()

static void QTest::resetFailed ( )
static

Definition at line 46 of file qtestresult.cpp.

References setFailed().

Referenced by QTestResult::finishedCurrentTestDataCleanup(), QTestResult::finishedCurrentTestFunction(), QTestResult::reset(), QTestResult::setCurrentTestData(), and QTestResult::setCurrentTestFunction().

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

◆ runningTest()

bool QTest::runningTest ( )
Since
6.4 Returns 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 3075 of file qtestcase.cpp.

References inTestFunction.

Referenced by QTestEventLoop::enterLoop().

+ Here is the caller graph for this function:

◆ sendKeyEvent() [1/2]

static void QTest::sendKeyEvent ( KeyAction  action,
QWindow window,
Qt::Key  code,
char  ascii,
Qt::KeyboardModifiers  modifier,
int  delay = -1 
)
static

Definition at line 109 of file qtestkeyboard.h.

References QChar::fromLatin1(), sendKeyEvent(), text, and window().

+ Here is the call graph for this function:

◆ sendKeyEvent() [2/2]

static void QTest::sendKeyEvent ( KeyAction  action,
QWindow window,
Qt::Key  code,
QString  text,
Qt::KeyboardModifiers  modifier,
int  delay = -1 
)
static

Definition at line 48 of file qtestkeyboard.h.

References Qt::AltModifier, Click, Qt::ControlModifier, QGuiApplication::focusWindow(), Qt::Key_Alt, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Shift, Qt::MetaModifier, Press, ptr(), qApp, qt_sendShortcutOverrideEvent(), QTEST_ASSERT, Release, sendKeyEvent(), Qt::ShiftModifier, Shortcut, simulateEvent(), text, and window().

Referenced by keyEvent(), keyEvent(), sendKeyEvent(), and sendKeyEvent().

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

◆ setBenchmarkResult()

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.

Since
4.7

Definition at line 239 of file qbenchmark.cpp.

References QBenchmarkTestMethodData::current, and QBenchmarkTestMethodData::setResult().

+ Here is the call graph for this function:

◆ setFailed()

static void QTest::setFailed ( bool  failed)
static

Definition at line 29 of file qtestresult.cpp.

References QTest::Internal::failed, ok, qEnvironmentVariableIntValue(), qEnvironmentVariableIsSet(), and qTerminate().

Referenced by QTestResult::addFailure(), checkStatement(), and resetFailed().

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

◆ setIterationCount()

void QTest::setIterationCount ( int  count)

◆ setIterationCountHint()

void QTest::setIterationCountHint ( int  count)

Definition at line 193 of file qbenchmark.cpp.

References QBenchmarkTestMethodData::adjustIterationCount(), and QBenchmarkTestMethodData::current.

+ Here is the call graph for this function:

◆ setMainSourcePath()

void QTest::setMainSourcePath ( const char *  file,
const char *  builddir = nullptr 
)

Definition at line 3089 of file qtestcase.cpp.

References QFileInfo::absolutePath(), QFile::decodeName(), fi, file, mainSourcePath, and QFileInfo::setFile().

+ Here is the call graph for this function:

◆ simulateEvent()

void QTest::simulateEvent ( QWindow window,
bool  press,
int  code,
Qt::KeyboardModifiers  modifier,
QString  text,
bool  repeat,
int  delay = -1 
)
static

Definition at line 39 of file qtestkeyboard.h.

References QEvent::KeyPress, QEvent::KeyRelease, qApp, qt_handleKeyEvent(), text, and window().

Referenced by QQuickVisualTestUtils::MnemonicKeySimulator::press(), QQuickVisualTestUtils::MnemonicKeySimulator::release(), and sendKeyEvent().

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

◆ tcIncidentType2String()

static const char * QTest::tcIncidentType2String ( QAbstractTestLogger::IncidentTypes  type)
static

Definition at line 24 of file qteamcitylogger.cpp.

References QAbstractTestLogger::BlacklistedFail, QAbstractTestLogger::BlacklistedPass, QAbstractTestLogger::BlacklistedXFail, QAbstractTestLogger::BlacklistedXPass, QAbstractTestLogger::Fail, QAbstractTestLogger::Pass, QAbstractTestLogger::Skip, QAbstractTestLogger::XFail, and QAbstractTestLogger::XPass.

Referenced by QTeamCityLogger::addIncident().

+ Here is the caller graph for this function:

◆ tcMessageType2String()

static const char * QTest::tcMessageType2String ( QAbstractTestLogger::MessageTypes  type)
static

Definition at line 49 of file qteamcitylogger.cpp.

References QAbstractTestLogger::Info, QAbstractTestLogger::QCritical, QAbstractTestLogger::QDebug, QAbstractTestLogger::QFatal, QAbstractTestLogger::QInfo, QAbstractTestLogger::QWarning, and QAbstractTestLogger::Warn.

Referenced by QTeamCityLogger::addMessage().

+ Here is the caller graph for this function:

◆ testObject()

QObject * QTest::testObject ( )

Definition at line 3082 of file qtestcase.cpp.

References currentTestObject.

Referenced by QTest::TestMethods::invokeTests().

+ Here is the caller graph for this function:

◆ toHexRepresentation()

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 1508 of file qtestcase.cpp.

References at, ba, i, o, qMin(), and qstrdup().

+ Here is the call graph for this function:

◆ toPrettyCString()

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 1567 of file qtestcase.cpp.

References Q_UNLIKELY.

Referenced by toString().

+ Here is the caller graph for this function:

◆ toPrettyUnicode()

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 1653 of file qtestcase.cpp.

Referenced by toString().

+ Here is the caller graph for this function:

◆ toString() [1/48]

char * QTest::toString ( const char *  str)

Definition at line 3446 of file qtestcase.cpp.

References qstrcpy(), and str.

+ Here is the call graph for this function:

◆ toString() [2/48]

template<>
char * QTest::toString ( const MyPoint &  point)

Definition at line 24 of file src_qtestlib_qtestcase_snippet.cpp.

References ba, QByteArray::data(), QByteArray::number(), and qstrdup().

Referenced by _q_compareSequence(), QuickTestResult::compare(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), compare_ptr_helper(), QuickTestResult::expectFail(), QuickTestResult::expectFailContinue(), QTest::Internal::QCborValueFormatter::format(), formatFailMessage(), qCompare(), qSignalDumperCallback(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), toString(), and toString< QHostAddress >().

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

◆ toString() [3/48]

template<>
char * QTest::toString ( const QBitArray ba)
inline

Definition at line 71 of file qtest.h.

References ba, i, QByteArray::size(), and str.

+ Here is the call graph for this function:

◆ toString() [4/48]

template<>
char * QTest::toString ( const QByteArray ba)
inline

Definition at line 66 of file qtest.h.

References ba, QByteArray::constData(), QByteArray::size(), and toPrettyCString().

+ Here is the call graph for this function:

◆ toString() [5/48]

template<>
char * QTest::toString ( const QCborArray a)
inline

Definition at line 349 of file qtest.h.

References QTest::Internal::QCborValueFormatter::format().

+ Here is the call graph for this function:

◆ toString() [6/48]

template<>
char * QTest::toString ( const QCborError c)
inline

Definition at line 104 of file qtest.h.

References toString().

+ Here is the call graph for this function:

◆ toString() [7/48]

template<>
char * QTest::toString ( const QCborMap m)
inline

Definition at line 354 of file qtest.h.

References QTest::Internal::QCborValueFormatter::format().

+ Here is the call graph for this function:

◆ toString() [8/48]

template<>
char * QTest::toString ( const QCborValue v)
inline

Definition at line 339 of file qtest.h.

References QTest::Internal::QCborValueFormatter::format().

+ Here is the call graph for this function:

◆ toString() [9/48]

template<>
char * QTest::toString ( const QCborValueRef &  v)
inline

Definition at line 344 of file qtest.h.

References toString().

+ Here is the call graph for this function:

◆ toString() [10/48]

template<>
char * QTest::toString ( const QChar c)
inline

Definition at line 110 of file qtest.h.

References arg, QString::fromLatin1(), QString::number(), qPrintable, qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [11/48]

template<>
char * QTest::toString ( const QColor color)
inline

Definition at line 45 of file qtest_gui.h.

References QColor::HexArgb, and qstrdup().

+ Here is the call graph for this function:

◆ toString() [12/48]

Q_POSITIONING_EXPORT char * QTest::toString ( const QGeoAreaMonitorInfo info)

Definition at line 396 of file qgeoareamonitorinfo.cpp.

References info, qPrintable, and qstrdup().

+ Here is the call graph for this function:

◆ toString() [13/48]

Q_POSITIONING_EXPORT char * QTest::toString ( const QGeoPositionInfo info)

Definition at line 407 of file qgeopositioninfo.cpp.

References info, qPrintable, and qstrdup().

+ Here is the call graph for this function:

◆ toString() [14/48]

Q_POSITIONING_EXPORT char * QTest::toString ( const QGeoSatelliteInfo info)

Definition at line 389 of file qgeosatelliteinfo.cpp.

References info, qPrintable, and qstrdup().

+ Here is the call graph for this function:

◆ toString() [15/48]

template<>
char * QTest::toString ( const QLatin1StringView str)
inline

Definition at line 61 of file qtest.h.

References str, and toString().

+ Here is the call graph for this function:

◆ toString() [16/48]

char * QTest::toString ( const QList< QNetworkCookie > &  list)
inline

Definition at line 63 of file qtest_network.h.

References QByteArray::chop(), QList< T >::isEmpty(), list, and toString().

+ Here is the call graph for this function:

◆ toString() [17/48]

char * QTest::toString ( const QNetworkCookie cookie)
inline

Definition at line 58 of file qtest_network.h.

References QNetworkCookie::toRawForm(), and toString().

+ Here is the call graph for this function:

◆ toString() [18/48]

template<typename T1 , typename T2 >
char * QTest::toString ( const QPair< T1, T2 > &  pair)
inline

◆ toString() [19/48]

template<>
char * QTest::toString ( const QPartialOrdering o)
inline

Definition at line 210 of file qtest.h.

References QPartialOrdering::Equivalent, QPartialOrdering::Greater, QPartialOrdering::Less, o, qstrdup(), and QPartialOrdering::Unordered.

+ Here is the call graph for this function:

◆ toString() [20/48]

template<>
char * QTest::toString ( const QPoint p)
inline

Definition at line 130 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [21/48]

template<>
char * QTest::toString ( const QPointF p)
inline

Definition at line 152 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [22/48]

template<>
char * QTest::toString ( const QRect s)
inline

Definition at line 144 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [23/48]

template<>
char * QTest::toString ( const QRectF s)
inline

Definition at line 166 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [24/48]

template<>
char * QTest::toString ( const QRegion region)
inline

Definition at line 50 of file qtest_gui.h.

References QRegion::begin(), i, QRegion::isEmpty(), QRegion::isNull(), QByteArray::number(), qstrdup(), and QRegion::rectCount().

+ Here is the call graph for this function:

◆ toString() [25/48]

template<>
char * QTest::toString ( const QSize s)
inline

Definition at line 137 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [26/48]

template<>
char * QTest::toString ( const QSizeF s)
inline

Definition at line 159 of file qtest.h.

References qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [27/48]

template<>
char * QTest::toString ( const QString str)
inline

Definition at line 56 of file qtest.h.

References str, and toString().

+ Here is the call graph for this function:

◆ toString() [28/48]

template<>
char * QTest::toString ( const QStringView str)
inline

Definition at line 51 of file qtest.h.

References str, and toPrettyUnicode().

+ Here is the call graph for this function:

◆ toString() [29/48]

template<>
char * QTest::toString ( const QUrl uri)
inline

Definition at line 174 of file qtest.h.

References QByteArray::constData(), QUrl::errorString(), QUrl::isValid(), qPrintable, qstrdup(), and QUrl::toEncoded().

+ Here is the call graph for this function:

◆ toString() [30/48]

template<>
char * QTest::toString ( const QUuid uuid)
inline

Definition at line 181 of file qtest.h.

References QByteArray::constData(), qstrdup(), and QUuid::toByteArray().

+ Here is the call graph for this function:

◆ toString() [31/48]

template<>
char * QTest::toString ( const QVariant v)
inline

Definition at line 186 of file qtest.h.

References QByteArray::append(), QByteArray::constData(), QByteArray::number(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [32/48]

template<>
char * QTest::toString ( const QVector2D v)
inline

Definition at line 84 of file qtest_gui.h.

References QByteArray::number(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [33/48]

template<>
char * QTest::toString ( const QVector3D v)
inline

Definition at line 92 of file qtest_gui.h.

References QByteArray::number(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [34/48]

template<>
char * QTest::toString ( const QVector4D v)
inline

Definition at line 100 of file qtest_gui.h.

References QByteArray::number(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [35/48]

template<typename T1 , typename T2 >
char * QTest::toString ( const std::pair< T1, T2 > &  pair)
inline

Definition at line 373 of file qtest.h.

References QScopedPointer< T, Cleanup >::data(), formatString(), and toString().

+ Here is the call graph for this function:

◆ toString() [36/48]

template<class... Types>
char * QTest::toString ( const std::tuple< Types... > &  tuple)
inline

Definition at line 393 of file qtest.h.

References toString().

+ Here is the call graph for this function:

◆ toString() [37/48]

template<typename T >
char * QTest::toString ( const T &  t)
inline

Definition at line 350 of file qtestcase.h.

References QTest::Internal::toString().

+ Here is the call graph for this function:

◆ toString() [38/48]

template<typename Tuple , int... I>
char * QTest::toString ( const Tuple &  tuple,
QtPrivate::IndexesList< I... >   
)
inline

Definition at line 381 of file qtest.h.

References formatString(), get(), and toString().

+ Here is the call graph for this function:

◆ toString() [39/48]

char * QTest::toString ( const void p)

Definition at line 3464 of file qtestcase.cpp.

References qsnprintf().

+ Here is the call graph for this function:

◆ toString() [40/48]

char * QTest::toString ( const volatile QObject vo)

Definition at line 3473 of file qtestcase.cpp.

References className, o, qPrintable, qsnprintf(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [41/48]

char * QTest::toString ( const volatile void p)

Definition at line 3459 of file qtestcase.cpp.

References toString().

+ Here is the call graph for this function:

◆ toString() [42/48]

char * QTest::toString ( QNetworkReply::NetworkError  code)
inline

Definition at line 47 of file qtest_network.h.

References mo, qstrdup(), and QMetaEnum::valueToKey().

+ Here is the call graph for this function:

◆ toString() [43/48]

char * QTest::toString ( QSizePolicy  sp)
inline

Definition at line 81 of file qtest_widgets.h.

References qstrdup(), sp, and QTest::Internal::toString().

+ Here is the call graph for this function:

◆ toString() [44/48]

char * QTest::toString ( QSizePolicy::ControlType  ct)
inline

Definition at line 76 of file qtest_widgets.h.

References toString().

+ Here is the call graph for this function:

◆ toString() [45/48]

char * QTest::toString ( QSizePolicy::ControlTypes  ct)
inline

Definition at line 71 of file qtest_widgets.h.

References qstrdup(), and QTest::Internal::toString().

+ Here is the call graph for this function:

◆ toString() [46/48]

char * QTest::toString ( QSizePolicy::Policy  p)
inline

Definition at line 66 of file qtest_widgets.h.

References qstrdup(), and QTest::Internal::toString().

+ Here is the call graph for this function:

◆ toString() [47/48]

template<typename Rep , typename Period >
char * QTest::toString ( std::chrono::duration< Rep, Period >  dur)
inline

Definition at line 359 of file qtest.h.

References d, qSetRealNumberPrecision(), and qstrdup().

+ Here is the call graph for this function:

◆ toString() [48/48]

char * QTest::toString ( std::nullptr_t  )
inline

Definition at line 399 of file qtest.h.

References QStringLiteral, and toString().

+ Here is the call graph for this function:

◆ toString< QHostAddress >()

template<>
char * QTest::toString< QHostAddress > ( const QHostAddress addr)
inline

Definition at line 32 of file qtest_network.h.

References QAbstractSocket::AnyIPProtocol, QAbstractSocket::IPv4Protocol, QAbstractSocket::IPv6Protocol, qstrdup(), toString(), and QAbstractSocket::UnknownNetworkLayerProtocol.

+ Here is the call graph for this function:

◆ touchEvent()

QTouchEventSequence QTest::touchEvent ( QWindow window,
QPointingDevice device,
bool  autoCommit = true 
)
inline

Definition at line 42 of file qtesttouch.h.

Referenced by QQuickTest::pointerMove(), QQuickTest::pointerPress(), QQuickTest::pointerRelease(), and processTouchEvent().

+ Here is the caller graph for this function:

◆ xmlIncidentType2String()

static const char * QTest::xmlIncidentType2String ( QAbstractTestLogger::IncidentTypes  type)
static

Definition at line 41 of file qxmltestlogger.cpp.

References QAbstractTestLogger::BlacklistedFail, QAbstractTestLogger::BlacklistedPass, QAbstractTestLogger::BlacklistedXFail, QAbstractTestLogger::BlacklistedXPass, QAbstractTestLogger::Fail, QAbstractTestLogger::Pass, QAbstractTestLogger::Skip, QAbstractTestLogger::XFail, and QAbstractTestLogger::XPass.

Referenced by QXmlTestLogger::addIncident().

+ Here is the caller graph for this function:

◆ xmlMessageType2String()

static const char * QTest::xmlMessageType2String ( QAbstractTestLogger::MessageTypes  type)
static

Definition at line 20 of file qxmltestlogger.cpp.

References QAbstractTestLogger::Info, QAbstractTestLogger::QCritical, QAbstractTestLogger::QDebug, QAbstractTestLogger::QFatal, QAbstractTestLogger::QInfo, QAbstractTestLogger::QWarning, and QAbstractTestLogger::Warn.

Referenced by QXmlTestLogger::addMessage().

+ Here is the caller graph for this function:

Variable Documentation

◆ blacklistCurrentTest

◆ blacklists

int QTest::blacklists = 0

◆ currentGlobalTestData

◆ currentTestData

◆ currentTestFunc

◆ currentTestObject

QObject* QTest::currentTestObject = nullptr
static

Definition at line 469 of file qtestcase.cpp.

Referenced by qCleanup(), qInit(), qPrintDataTags(), qPrintTestSlots(), qRun(), and testObject().

◆ currentTestObjectName

const char* QTest::currentTestObjectName = nullptr
static

◆ []

◆ entries

const QBenchmarkMetricKey QTest::entries[]
static

Definition at line 17 of file qbenchmarkmetric.cpp.

Referenced by benchmarkMetricName(), and benchmarkMetricUnit().

◆ eventDelay

int QTest::eventDelay = -1
static

Definition at line 531 of file qtestcase.cpp.

Referenced by defaultEventDelay(), and qtest_qParseArgs().

◆ expectFailComment

const char* QTest::expectFailComment = nullptr
static

◆ expectFailMode

◆ failOnWarningList

std::vector<QVariant> QTest::failOnWarningList
static

◆ fails

int QTest::fails = 0

◆ ignoreLevel

int QTest::ignoreLevel = 0
static

◆ ignoreResultList

◆ iLevel

int QTest::iLevel = 0
static

◆ installedTestCoverage

bool QTest::installedTestCoverage = true
static

◆ inTestFunction

bool QTest::inTestFunction = false
static

Definition at line 471 of file qtestcase.cpp.

Referenced by runningTest().

◆ keyDelay

int QTest::keyDelay = -1
static

Definition at line 529 of file qtestcase.cpp.

Referenced by defaultKeyDelay(), and qtest_qParseArgs().

◆ lastMouseTimestamp

Q_TESTLIB_EXPORT int QTest::lastMouseTimestamp = 0

◆ mainSourcePath

QString QTest::mainSourcePath
static

Definition at line 470 of file qtestcase.cpp.

Referenced by qFindTestData(), and setMainSourcePath().

◆ maxWarnings

int QTest::maxWarnings = 2002
static

Definition at line 149 of file qtestlog.cpp.

Referenced by messageHandler(), and QTestLog::setMaxWarnings().

◆ mouseDelay

int QTest::mouseDelay = -1
static

Definition at line 530 of file qtestcase.cpp.

Referenced by defaultMouseDelay(), and qtest_qParseArgs().

◆ mouseDoubleClickInterval

const int QTest::mouseDoubleClickInterval = 500
static

Definition at line 49 of file qtestmouse.h.

Referenced by mouseEvent().

◆ mutex

◆ noCrashHandler

bool QTest::noCrashHandler = false
static

Definition at line 535 of file qtestcase.cpp.

Referenced by qRun(), and qtest_qParseArgs().

◆ NumEntries

const int QTest::NumEntries = sizeof(entries) / sizeof(entries[0])
static

Definition at line 50 of file qbenchmarkmetric.cpp.

Referenced by benchmarkMetricName(), and benchmarkMetricUnit().

◆ oldMessageHandler

QtMessageHandler QTest::oldMessageHandler
static

Definition at line 152 of file qtestlog.cpp.

Referenced by messageHandler(), QTestLog::startLogging(), and QTestLog::stopLogging().

◆ passes

int QTest::passes = 0

Definition at line 78 of file qtestlog.cpp.

Referenced by QTestLog::addPass(), QTestLog::passCount(), and QTestLog::resetCounters().

◆ printAvailableFunctions

Q_TESTLIB_EXPORT bool QTest::printAvailableFunctions = false

◆ skipCurrentTest

bool QTest::skipCurrentTest = false
static

◆ skips

int QTest::skips = 0

Definition at line 79 of file qtestlog.cpp.

Referenced by QTestLog::addSkip(), QTestLog::resetCounters(), and QTestLog::skipCount().

◆ testFunctions

Q_TESTLIB_EXPORT QStringList QTest::testFunctions

◆ testTags

Q_TESTLIB_EXPORT QStringList QTest::testTags

◆ verbosity

int QTest::verbosity = 0
static

Definition at line 148 of file qtestlog.cpp.

Referenced by QTestLog::setVerboseLevel(), and QTestLog::verboseLevel().