QtBase  v6.3.1
Namespaces | Classes | Enumerations | Functions | Variables
QTest Namespace Reference

[15] More...

Namespaces

 Internal
 

Classes

class  QTouchEventSequence
 
class  QBenchmarkIterationController
 
struct  QBenchmarkMetricKey
 
class  TestMethods
 
struct  QTestDataSetter
 
class  WatchDog
 
class  FatalSignalHandler
 
struct  IgnoreResultList
 
class  QTouchEventWidgetSequence
 
class  QExternalTestPrivate
 
class  QExternalTest
 

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  MouseAction {
  MousePress , MouseRelease , MouseClick , MouseDClick ,
  MouseMove
}
 
enum  TestFailMode { Abort = 1 , Continue = 2 }
 

Functions

template<>
char * toString< CborError > (const CborError &err)
 
Q_CORE_EXPORT void qSleep (int ms)
 
Q_CORE_EXPORT void qWait (int ms)
 
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)
 
int iterationCount ()
 
void setIterationCountHint (int count)
 
void setIterationCount (int count)
 
Q_TESTLIB_EXPORT void beginBenchmarkMeasurement ()
 
Q_TESTLIB_EXPORT quint64 endBenchmarkMeasurement ()
 
const char * benchmarkMetricName (QBenchmarkMetric metric)
 
const char * benchmarkMetricUnit (QBenchmarkMetric metric)
 
template<typename T >
QString formatResult (T number, int significantDigits)
 
template<typename T >
int formatResult (char *buffer, int bufferSize, T number, int significantDigits)
 
template<>
char * toString (const QStringView &str)
 
template<>
char * toString (const QString &str)
 
template<>
char * toString (const QLatin1String &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 QCborValue &v)
 
template<>
char * toString (const QCborValueRef &v)
 
template<>
char * toString (const QCborArray &a)
 
template<>
char * toString (const QCborMap &m)
 
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, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line)
 
template<>
bool qCompare (QLatin1String 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)
 
int defaultEventDelay ()
 
int Q_TESTLIB_EXPORT defaultMouseDelay ()
 
int Q_TESTLIB_EXPORT defaultKeyDelay ()
 
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)
 
QBenchmarkResult qMedian (const QList< QBenchmarkResult > &container)
 
voidfetchData (QTestData *data, const char *tagName, int typeId)
 
char * formatString (const char *prefix, const char *suffix, size_t numArguments,...)
 
char * toHexRepresentation (const char *ba, int length)
 
char * toPrettyCString (const char *p, int length)
 
char * toPrettyUnicode (QStringView string)
 
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)
 
Q_TESTLIB_EXPORT int qExec (QObject *testObject, const QStringList &arguments)
 
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)
 
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 ()
 
Q_TESTLIB_EXPORT const char * currentTestFunction ()
 
Q_TESTLIB_EXPORT const char * currentDataTag ()
 
Q_TESTLIB_EXPORT bool currentTestFailed ()
 
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, char *val1, char *val2, 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)
 
Q_TESTLIB_EXPORT QTestDatanewRow (const char *dataTag)
 
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 QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
 
Q_TESTLIB_EXPORT bool qCompare (const QLatin1String &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 >
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)
 
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)
 
QTouchEventSequence touchEvent (QWindow *window, QPointingDevice *device, bool autoCommit=true)
 
Q_WIDGETS_EXPORT bool qWaitForWindowActive (QWidget *widget, int timeout=5000)
 
Q_WIDGETS_EXPORT bool qWaitForWindowExposed (QWidget *widget, int timeout=5000)
 
template<>
char * toString (const Ip6 &ip6)
 
template<>
char * toString< QCborStreamReader::Type > (const QCborStreamReader::Type &t)
 
template<>
char * toString (const QTextBoundaryFinder::BoundaryReasons &flags)
 
template<>
char * toString (const QList< int > &list)
 
char * toString (const ConstructionCounted &cc)
 
char * toString (QDBusMessage::MessageType t)
 

Variables

Q_TESTLIB_EXPORT int lastMouseTimestamp = 0
 
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
 

Detailed Description

[15]

[16]

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IndentSpacesCount 

Definition at line 65 of file qsignaldumper.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 61 of file qtestelementattribute_p.h.

◆ KeyAction

Enumerator
Press 
Release 
Click 
Shortcut 

Definition at line 73 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 79 of file qtestelementattribute_p.h.

◆ MouseAction

Enumerator
MousePress 
MouseRelease 
MouseClick 
MouseDClick 
MouseMove 

Definition at line 78 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 51 of file qbenchmarkmetric.h.

◆ TestFailMode

Enumerator
Abort 
Continue 

Definition at line 61 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 425 of file qtest.h.

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:

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 388 of file qtestcase.h.

Here is the call graph for this function:

◆ addColumnInternal()

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

Definition at line 2634 of file qtestcase.cpp.

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 formatted string will appear as the name of this test data in the test output.

Returns a QTestData reference that can be used to stream in data.

Example:

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
addColumn(), QFETCH()

Definition at line 2690 of file qtestcase.cpp.

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)

Definition at line 52 of file qasciikey.cpp.

◆ beginBenchmarkMeasurement()

void QTest::beginBenchmarkMeasurement ( )

Definition at line 240 of file qbenchmark.cpp.

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 140 of file qbenchmarkmetric.cpp.

Here is the caller graph for this function:

◆ benchmarkMetricUnit()

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

Definition at line 152 of file qbenchmarkmetric.cpp.

◆ compare_helper()

bool QTest::compare_helper ( bool  success,
const char *  failureMsg,
char *  val1,
char *  val2,
const char *  actual,
const char *  expected,
const char *  file,
int  line 
)

Definition at line 2802 of file qtestcase.cpp.

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 463 of file qtestcase.h.

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 470 of file qtestcase.h.

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 456 of file qtestcase.h.

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 484 of file qtestcase.h.

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 477 of file qtestcase.h.

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 491 of file qtestcase.h.

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

Here is the call graph for this function:
Here is the caller 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 1228 of file qwindowsysteminterface.cpp.

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

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 0.

Definition at line 2758 of file qtestcase.cpp.

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

◆ currentTestFailed()

bool QTest::currentTestFailed ( )

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

Definition at line 2766 of file qtestcase.cpp.

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

◆ currentTestFunction()

const char * QTest::currentTestFunction ( )

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

Example:

Definition at line 2749 of file qtestcase.cpp.

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

◆ defaultEventDelay()

int QTest::defaultEventDelay ( )

Definition at line 479 of file qtestcase.cpp.

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

◆ defaultKeyDelay()

int QTest::defaultKeyDelay ( )

Definition at line 503 of file qtestcase.cpp.

Here is the call graph for this function:

◆ defaultMouseDelay()

int QTest::defaultMouseDelay ( )

Definition at line 491 of file qtestcase.cpp.

Here is the call graph for this function:

◆ endBenchmarkMeasurement()

quint64 QTest::endBenchmarkMeasurement ( )

Definition at line 248 of file qbenchmark.cpp.

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

Here is the call graph for this function:

◆ fetchData()

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

Definition at line 1345 of file qtestcase.cpp.

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

◆ formatResult() [1/2]

template<typename T >
int QTest::formatResult ( char *  buffer,
int  bufferSize,
T  number,
int  significantDigits 
)

Definition at line 205 of file qplaintestlogger.cpp.

◆ formatResult() [2/2]

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

Definition at line 146 of file qplaintestlogger.cpp.

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

Here is the call graph for this function:
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:

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

Definition at line 2292 of file qtestcase.cpp.

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

◆ iterationCount()

int QTest::iterationCount ( )

Definition at line 218 of file qbenchmark.cpp.

Here is the caller graph for this function:

◆ keyToAscii()

char QTest::keyToAscii ( Qt::Key  key)

Definition at line 239 of file qasciikey.cpp.

◆ mouseClick()

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

Definition at line 167 of file qtestmouse.h.

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 171 of file qtestmouse.h.

Here is the call graph for this function:

◆ mouseMove()

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

Definition at line 175 of file qtestmouse.h.

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 159 of file qtestmouse.h.

Here is the call 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 163 of file qtestmouse.h.

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. dataTag is the name of the testdata that will appear in the test output. Returns a QTestData reference that can be used to stream in data.

Example:

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
addColumn(), QFETCH()

Definition at line 2658 of file qtestcase.cpp.

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

◆ qCaught()

void QTest::qCaught ( const char *  expected,
const char *  what,
const char *  file,
int  line 
)

Definition at line 2247 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qCleanup()

void QTest::qCleanup ( )

Definition at line 2154 of file qtestcase.cpp.

◆ 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 586 of file qtestcase.h.

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 595 of file qtestcase.h.

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 600 of file qtestcase.h.

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 581 of file qtestcase.h.

Here is the call graph for this function:

◆ qCompare() [5/38]

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

Definition at line 2929 of file qtestcase.cpp.

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

Definition at line 437 of file qtestcase.h.

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 543 of file qtestcase.h.

Here is the call graph for this function:

◆ qCompare() [8/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 523 of file qtestcase.h.

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 569 of file qtestcase.h.

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

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 530 of file qtestcase.h.

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 536 of file qtestcase.h.

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

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 
)

Definition at line 2866 of file qtestcase.cpp.

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 511 of file qtest.h.

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 503 of file qtest.h.

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

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 142 of file qtest_gui.h.

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 150 of file qtest_gui.h.

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 540 of file qtest.h.

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 519 of file qtest.h.

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 526 of file qtest.h.

Here is the call graph for this function:

◆ qCompare() [23/38]

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

Definition at line 417 of file qtest.h.

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 494 of file qtest.h.

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 476 of file qtest.h.

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 484 of file qtest.h.

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 192 of file qtest_gui.h.

Here is the call graph for this function:

◆ qCompare() [28/38]

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

Definition at line 411 of file qtest.h.

Here is the caller graph for this function:

◆ qCompare() [29/38]

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

Definition at line 2917 of file qtestcase.cpp.

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 
)

Definition at line 2905 of file qtestcase.cpp.

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 547 of file qtest.h.

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 554 of file qtest.h.

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 533 of file qtest.h.

Here is the call graph for this function:

◆ qCompare() [34/38]

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

Definition at line 562 of file qtestcase.h.

Here is the call graph for this function:

◆ qCompare() [35/38]

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

Definition at line 556 of file qtestcase.h.

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 549 of file qtestcase.h.

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 575 of file qtestcase.h.

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 
)

Definition at line 2893 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qData()

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

Definition at line 2604 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qElementData()

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

Definition at line 2618 of file qtestcase.cpp.

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

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:

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

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

◆ qFail()

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

Definition at line 2200 of file qtestcase.cpp.

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

◆ qFindTestData() [1/2]

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

Definition at line 2596 of file qtestcase.cpp.

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

◆ qFindTestData() [2/2]

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

Definition at line 2456 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qGlobalData()

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

Definition at line 2611 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qInit()

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

Definition at line 2033 of file qtestcase.cpp.

◆ qMedian()

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

Definition at line 990 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qRun()

int QTest::qRun ( )

Definition at line 2079 of file qtestcase.cpp.

◆ qSkip()

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

Definition at line 2216 of file qtestcase.cpp.

Here is the call graph for this function:

◆ qSleep()

QT_BEGIN_NAMESPACE Q_CORE_EXPORT void QTest::qSleep ( int  ms)

Sleeps for ms milliseconds, blocking execution of the test. qSleep() will not do any event processing and leave your test unresponsive. Network communication might time out while sleeping. Use \l {QTest::qWait()} to do non-blocking sleeping.

ms must be greater than 0.

{Note:} The qSleep() function calls either nanosleep() on unix or Sleep() on windows, so the accuracy of time spent in qSleep() depends on the operating system.

Example:

See also
{QTest::qWait()}

Definition at line 65 of file qtestsupport_core.cpp.

Here is the caller graph for this function:

◆ qt_asprintf()

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

Definition at line 409 of file qabstracttestlogger.cpp.

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

◆ 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 607 of file qtestcase.h.

Here is the call graph for this function:

◆ qtest_qParseArgs() [1/2]

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

Definition at line 986 of file qtestcase.cpp.

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

Here is the call graph for this function:
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 2207 of file qtestcase.cpp.

◆ qWait()

Q_CORE_EXPORT void QTest::qWait ( int  ms)

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

Example:

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

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

Definition at line 108 of file qtestsupport_core.cpp.

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

◆ qWaitForWindowActive() [1/2]

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

Waits for timeout milliseconds or until the widget's window is active.

Returns true if widget's window is active within timeout milliseconds, otherwise returns false.

See also
qWaitForWindowExposed(), QWidget::isActiveWindow()

Definition at line 62 of file qtestsupport_widgets.cpp.

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

Waits for timeout milliseconds or until the window is active.

Returns true if window is active within timeout milliseconds, otherwise returns false.

See also
qWaitForWindowExposed(), QWindow::isActive()

Definition at line 63 of file qtestsupport_gui.cpp.

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

Waits for timeout milliseconds or until the widget's window is exposed. Returns true if widget's window is exposed within timeout milliseconds, otherwise returns false.

This is mainly useful for asynchronous systems like X11, where a window will be mapped to screen some time after being asked to show itself on the screen.

Note that a window that is mapped to screen may still not be considered exposed if the window client area is completely covered by other windows, or if the window is otherwise not visible. This function will then time out when waiting for such a window.

A specific configuration where this happens is when using QGLWidget as a viewport widget on macOS: The viewport widget gets the expose event, not the parent widget.

See also
qWaitForWindowActive()

Definition at line 87 of file qtestsupport_widgets.cpp.

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

Waits for timeout milliseconds or until the window is exposed. Returns true if window is exposed within timeout milliseconds, otherwise returns false.

This is mainly useful for asynchronous systems like X11, where a window will be mapped to screen some time after being asked to show itself on the screen.

Note that a window that is mapped to screen may still not be considered exposed if the window client area is completely covered by other windows, or if the window is otherwise not visible. This function will then time out when waiting for such a window.

See also
qWaitForWindowActive(), QWindow::isExposed()

Definition at line 91 of file qtestsupport_gui.cpp.

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 271 of file qbenchmark.cpp.

Here is the call graph for this function:

◆ setIterationCount()

void QTest::setIterationCount ( int  count)

Definition at line 232 of file qbenchmark.cpp.

◆ setIterationCountHint()

void QTest::setIterationCountHint ( int  count)

Definition at line 225 of file qbenchmark.cpp.

Here is the call graph for this function:

◆ setMainSourcePath()

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

Definition at line 2780 of file qtestcase.cpp.

Here is the call graph for this function:

◆ testObject()

QObject * QTest::testObject ( )

Definition at line 2773 of file qtestcase.cpp.

Here is the caller graph for this function:

◆ toHexRepresentation()

Q_TESTLIB_EXPORT char * QTest::toHexRepresentation ( const char *  ba,
int  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 1404 of file qtestcase.cpp.

Here is the call graph for this function:

◆ toPrettyCString()

Q_TESTLIB_EXPORT char * QTest::toPrettyCString ( const char *  p,
int  length 
)

Definition at line 1463 of file qtestcase.cpp.

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

◆ toPrettyUnicode()

Q_TESTLIB_EXPORT char * QTest::toPrettyUnicode ( QStringView  string)

Definition at line 1559 of file qtestcase.cpp.

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

◆ toString() [1/48]

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

Definition at line 3086 of file qtestcase.cpp.

Here is the call graph for this function:

◆ toString() [2/48]

char* QTest::toString ( const ConstructionCounted cc)

Definition at line 843 of file tst_qlist.cpp.

Here is the call graph for this function:

◆ toString() [3/48]

template<>
char* QTest::toString ( const Ip6 ip6)

Definition at line 95 of file tst_qipaddress.cpp.

Here is the call graph for this function:

◆ toString() [4/48]

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

Definition at line 71 of file src_qtestlib_qtestcase_snippet.cpp.

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

◆ toString() [5/48]

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

Definition at line 103 of file qtest.h.

Here is the call graph for this function:

◆ toString() [6/48]

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

Definition at line 98 of file qtest.h.

Here is the call graph for this function:

◆ toString() [7/48]

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

Definition at line 368 of file qtest.h.

Here is the call graph for this function:

◆ toString() [8/48]

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

Definition at line 136 of file qtest.h.

Here is the call graph for this function:

◆ toString() [9/48]

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

Definition at line 373 of file qtest.h.

Here is the call graph for this function:

◆ toString() [10/48]

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

Definition at line 358 of file qtest.h.

Here is the call graph for this function:

◆ toString() [11/48]

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

Definition at line 363 of file qtest.h.

Here is the call graph for this function:

◆ toString() [12/48]

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

Definition at line 142 of file qtest.h.

Here is the call graph for this function:

◆ toString() [13/48]

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

Definition at line 78 of file qtest_gui.h.

Here is the call graph for this function:

◆ toString() [14/48]

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

Definition at line 93 of file qtest.h.

Here is the call graph for this function:

◆ toString() [15/48]

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

Definition at line 84 of file tst_qtextboundaryfinder.cpp.

Here is the call graph for this function:

◆ toString() [16/48]

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

Definition at line 99 of file qtest_network.h.

Here is the call graph for this function:

◆ toString() [17/48]

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

Definition at line 94 of file qtest_network.h.

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 QPoint p)
inline

Definition at line 162 of file qtest.h.

Here is the call graph for this function:

◆ toString() [20/48]

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

Definition at line 184 of file qtest.h.

Here is the call graph for this function:

◆ toString() [21/48]

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

Definition at line 176 of file qtest.h.

Here is the call graph for this function:

◆ toString() [22/48]

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

Definition at line 198 of file qtest.h.

Here is the call graph for this function:

◆ toString() [23/48]

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

Definition at line 83 of file qtest_gui.h.

Here is the call graph for this function:

◆ toString() [24/48]

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

Definition at line 169 of file qtest.h.

Here is the call graph for this function:

◆ toString() [25/48]

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

Definition at line 191 of file qtest.h.

Here is the call graph for this function:

◆ toString() [26/48]

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

Definition at line 88 of file qtest.h.

Here is the call graph for this function:

◆ toString() [27/48]

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

Definition at line 83 of file qtest.h.

Here is the call graph for this function:

◆ toString() [28/48]

template<>
char* QTest::toString ( const QTextBoundaryFinder::BoundaryReasons &  flags)
inline

Definition at line 78 of file tst_qtextboundaryfinder.cpp.

Here is the call graph for this function:

◆ toString() [29/48]

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

Definition at line 206 of file qtest.h.

Here is the call graph for this function:

◆ toString() [30/48]

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

Definition at line 213 of file qtest.h.

Here is the call graph for this function:

◆ toString() [31/48]

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

Definition at line 218 of file qtest.h.

Here is the call graph for this function:

◆ toString() [32/48]

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

Definition at line 117 of file qtest_gui.h.

Here is the call graph for this function:

◆ toString() [33/48]

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

Definition at line 125 of file qtest_gui.h.

Here is the call graph for this function:

◆ toString() [34/48]

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

Definition at line 133 of file qtest_gui.h.

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 379 of file qtest.h.

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 399 of file qtest.h.

Here is the call graph for this function:

◆ toString() [37/48]

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

Definition at line 308 of file qtestcase.h.

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 387 of file qtest.h.

Here is the call graph for this function:

◆ toString() [39/48]

char * QTest::toString ( const void p)

Definition at line 3104 of file qtestcase.cpp.

Here is the call graph for this function:

◆ toString() [40/48]

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

Definition at line 3113 of file qtestcase.cpp.

Here is the call graph for this function:

◆ toString() [41/48]

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

Definition at line 3099 of file qtestcase.cpp.

Here is the call graph for this function:

◆ toString() [42/48]

char* QTest::toString ( QDBusMessage::MessageType  t)

Definition at line 51 of file tst_qdbusabstractadaptor.cpp.

Here is the call graph for this function:

◆ toString() [43/48]

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

Definition at line 83 of file qtest_network.h.

Here is the call graph for this function:

◆ toString() [44/48]

char* QTest::toString ( QSizePolicy  sp)
inline

Definition at line 117 of file qtest_widgets.h.

Here is the call graph for this function:

◆ toString() [45/48]

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

Definition at line 112 of file qtest_widgets.h.

Here is the call graph for this function:

◆ toString() [46/48]

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

Definition at line 107 of file qtest_widgets.h.

Here is the call graph for this function:

◆ toString() [47/48]

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

Definition at line 102 of file qtest_widgets.h.

Here is the call graph for this function:

◆ toString() [48/48]

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

Definition at line 405 of file qtest.h.

Here is the call graph for this function:

◆ toString< CborError >()

template<>
char * QTest::toString< CborError > ( const CborError err)

Definition at line 34 of file tst_encoder.cpp.

Here is the call graph for this function:

◆ toString< QCborStreamReader::Type >()

Definition at line 111 of file tst_qcborstreamreader.cpp.

Here is the call graph for this function:

◆ toString< QHostAddress >()

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

Definition at line 68 of file qtest_network.h.

Here is the call graph for this function:

◆ touchEvent()

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

Definition at line 78 of file qtesttouch.h.

Here is the caller graph for this function:

Variable Documentation

◆ blacklists

int QTest::blacklists = 0

Definition at line 113 of file qtestlog.cpp.

◆ fails

int QTest::fails = 0

Definition at line 110 of file qtestlog.cpp.

◆ lastMouseTimestamp

Q_TESTLIB_EXPORT int QTest::lastMouseTimestamp = 0

Definition at line 48 of file qtestmouse.cpp.

◆ passes

int QTest::passes = 0

Definition at line 111 of file qtestlog.cpp.

◆ printAvailableFunctions

Q_TESTLIB_EXPORT bool QTest::printAvailableFunctions = false

Definition at line 528 of file qtestcase.cpp.

◆ skips

int QTest::skips = 0

Definition at line 112 of file qtestlog.cpp.

◆ testFunctions

Q_TESTLIB_EXPORT QStringList QTest::testFunctions

Definition at line 529 of file qtestcase.cpp.

◆ testTags

Q_TESTLIB_EXPORT QStringList QTest::testTags

Definition at line 530 of file qtestcase.cpp.