QtBase
v6.3.1
|
[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 |
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 QPointingDevice * | createTouchDevice (QInputDevice::DeviceType devType=QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps=QInputDevice::Capability::Position) |
template<> | |
char * | toString (const MyPoint &point) |
int | qt_asprintf (QTestCharBuffer *str, const char *format,...) |
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 ®ion) |
template<> | |
char * | toString (const QVector2D &v) |
template<> | |
char * | toString (const QVector3D &v) |
template<> | |
char * | toString (const QVector4D &v) |
bool | qCompare (QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (QImage const &t1, QImage const &t2, const char *actual, const char *expected, const char *file, int line) |
bool | qCompare (QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected, const char *file, int line) |
template<> | |
char * | toString< QHostAddress > (const QHostAddress &addr) |
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) |
void * | fetchData (QTestData *data, const char *tagName, int typeId) |
char * | formatString (const char *prefix, const char *suffix, size_t numArguments,...) |
char * | toHexRepresentation (const char *ba, 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 void * | qData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | qGlobalData (const char *tagName, int typeId) |
Q_TESTLIB_EXPORT void * | qElementData (const char *elementName, int metaTypeId) |
Q_TESTLIB_EXPORT QObject * | testObject () |
Q_TESTLIB_EXPORT const char * | currentAppName () |
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 QTestData & | newRow (const char *dataTag) |
Q_TESTLIB_EXPORT QTestData & | addRow (const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1 |
Q_TESTLIB_EXPORT QTestData Q_TESTLIB_EXPORT bool | qCompare (qfloat16 const &t1, qfloat16 const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (float const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (int t1, int t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (unsigned t1, unsigned t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (QStringView t1, QStringView t2, const char *actual, const char *expected, const char *file, int line) |
Q_TESTLIB_EXPORT bool | qCompare (QStringView t1, const 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 |
[15]
[16]
anonymous enum |
Enumerator | |
---|---|
IndentSpacesCount |
Definition at line 65 of file qsignaldumper.cpp.
Enumerator | |
---|---|
AI_Undefined | |
AI_Name | |
AI_Tests | |
AI_Failures | |
AI_Errors | |
AI_Type | |
AI_Message | |
AI_PropertyValue | |
AI_Value | |
AI_Time | |
AI_Timestamp | |
AI_Hostname | |
AI_Classname | |
AI_Skipped |
Definition at line 61 of file qtestelementattribute_p.h.
enum QTest::KeyAction |
Enumerator | |
---|---|
Press | |
Release | |
Click | |
Shortcut |
Definition at line 73 of file qtestkeyboard.h.
Enumerator | |
---|---|
LET_Undefined | |
LET_Property | |
LET_Properties | |
LET_Failure | |
LET_Error | |
LET_TestCase | |
LET_TestSuite | |
LET_Text | |
LET_SystemError | |
LET_SystemOutput | |
LET_Skipped |
Definition at line 79 of file qtestelementattribute_p.h.
enum QTest::MouseAction |
Enumerator | |
---|---|
MousePress | |
MouseRelease | |
MouseClick | |
MouseDClick | |
MouseMove |
Definition at line 78 of file qtestmouse.h.
This enum lists all the things that can be benchmarked.
\value FramesPerSecond Frames per second \value BitsPerSecond Bits per second \value BytesPerSecond Bytes per second \value WalltimeMilliseconds Clock time in milliseconds \value WalltimeNanoseconds Clock time in nanoseconds \value BytesAllocated Memory usage in bytes \value Events Event count \value CPUTicks CPU time \value CPUMigrations Process migrations between CPUs \value CPUCycles CPU cycles \value RefCPUCycles Reference CPU cycles \value BusCycles Bus cycles \value StalledCycles Cycles stalled \value InstructionReads Instruction reads \value Instructions Instructions executed \value BranchInstructions Branch-type instructions \value BranchMisses Branch instructions that were mispredicted \value CacheReferences Cache accesses of any type \value CacheMisses Cache misses of any type \value CacheReads Cache reads / loads \value CacheReadMisses Cache read / load misses \value CacheWrites Cache writes / stores \value CacheWriteMisses Cache write / store misses \value CachePrefetches Cache prefetches \value CachePrefetchMisses Cache prefetch misses \value ContextSwitches Context switches \value PageFaults Page faults of any type \value MinorPageFaults Minor page faults \value MajorPageFaults Major page faults \value AlignmentFaults Faults caused due to misalignment \value EmulationFaults Faults that needed software emulation
Note that WalltimeNanoseconds
and BytesAllocated
are only provided for use via \l setBenchmarkResult(), and results in those metrics are not able to be provided automatically by the QTest framework.
Definition at line 51 of file qbenchmarkmetric.h.
enum QTest::TestFailMode |
Enumerator | |
---|---|
Abort | |
Continue |
Definition at line 61 of file qttestglobal.h.
|
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().
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 388 of file qtestcase.h.
Definition at line 2634 of file qtestcase.cpp.
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:
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 2690 of file qtestcase.cpp.
QT_BEGIN_NAMESPACE Qt::Key QTest::asciiToKey | ( | char | ascii | ) |
Definition at line 52 of file qasciikey.cpp.
void QTest::beginBenchmarkMeasurement | ( | ) |
Definition at line 240 of file qbenchmark.cpp.
const char * QTest::benchmarkMetricName | ( | QBenchmarkMetric | metric | ) |
Definition at line 140 of file qbenchmarkmetric.cpp.
const char * QTest::benchmarkMetricUnit | ( | QBenchmarkMetric | metric | ) |
Definition at line 152 of file qbenchmarkmetric.cpp.
|
inline |
Definition at line 456 of file qtestcase.h.
bool QTest::compare_string_helper | ( | const char * | t1, |
const char * | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 3155 of file qtestcase.cpp.
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.
const char * QTest::currentAppName | ( | ) |
Returns the name of the binary that is currently executed.
Definition at line 2737 of file qtestcase.cpp.
const char * QTest::currentDataTag | ( | ) |
Returns the name of the current test data. If the test doesn't have any assigned testdata, the function returns 0.
Definition at line 2758 of file qtestcase.cpp.
bool QTest::currentTestFailed | ( | ) |
Returns true
if the current test function failed, otherwise false.
Definition at line 2766 of file qtestcase.cpp.
const char * QTest::currentTestFunction | ( | ) |
Returns the name of the test function that is currently executed.
Example:
Definition at line 2749 of file qtestcase.cpp.
int QTest::defaultEventDelay | ( | ) |
Definition at line 479 of file qtestcase.cpp.
int QTest::defaultKeyDelay | ( | ) |
int QTest::defaultMouseDelay | ( | ) |
quint64 QTest::endBenchmarkMeasurement | ( | ) |
Definition at line 248 of file qbenchmark.cpp.
Definition at line 1345 of file qtestcase.cpp.
int QTest::formatResult | ( | char * | buffer, |
int | bufferSize, | ||
T | number, | ||
int | significantDigits | ||
) |
Definition at line 205 of file qplaintestlogger.cpp.
Q_TESTLIB_EXPORT char * QTest::formatString | ( | const char * | prefix, |
const char * | suffix, | ||
size_t | numArguments, | ||
... | |||
) |
Definition at line 1370 of file qtestcase.cpp.
Ignores messages created by qDebug(), qInfo() or qWarning(). If the message with the corresponding type is outputted, it will be removed from the test log. If the test finished and the message was not outputted, a test failure is appended to the test log.
Example:
The example above tests that QDir::mkdir() outputs the right warning when invoked with an invalid file name.
Definition at line 2292 of file qtestcase.cpp.
int QTest::iterationCount | ( | ) |
char QTest::keyToAscii | ( | Qt::Key | key | ) |
Definition at line 239 of file qasciikey.cpp.
|
inline |
Definition at line 167 of file qtestmouse.h.
|
inline |
Definition at line 175 of file qtestmouse.h.
|
inline |
|
inline |
Definition at line 163 of file qtestmouse.h.
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:
See \l {Chapter 2: Data Driven Testing}{Data Driven Testing} for a more extensive example.
Definition at line 2658 of file qtestcase.cpp.
void QTest::qCleanup | ( | ) |
Definition at line 2154 of file qtestcase.cpp.
bool QTest::qCompare | ( | const QLatin1String & | t1, |
QStringView | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line | ||
) |
bool QTest::qCompare | ( | QStringView | t1, |
const QLatin1String & | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line | ||
) |
bool QTest::qCompare | ( | QStringView | t1, |
QStringView | t2, | ||
const char * | actual, | ||
const char * | expected, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 2618 of file qtestcase.cpp.
int QTest::qExec | ( | QObject * | testObject, |
const QStringList & | arguments | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Behaves identically to qExec(QObject *, int, char**) but takes a QStringList of arguments instead of a char**
list.
Definition at line 2181 of file qtestcase.cpp.
Executes tests declared in testObject. In addition, the private slots {initTestCase()},
{cleanupTestCase()},
{init()} and
{cleanup()} are executed if they exist. See \l{Creating a Test} for more details.
Optionally, the command line arguments argc and argv can be provided. For a list of recognized arguments, read \l {Qt Test Command Line Arguments}.
The following example will run all tests in MyTestObject:
This function returns 0 if no tests failed, or a value other than 0 if one or more tests failed or in case of unhandled exceptions. (Skipped tests do not influence the return value.)
For stand-alone test applications, the convenience macro \l QTEST_MAIN() can be used to declare a main() function that parses the command line arguments and executes the tests, avoiding the need to call this function explicitly.
The return value from this function is also the exit code of the test application when the \l QTEST_MAIN() macro is used.
For stand-alone test applications, this function should not be called more than once, as command-line options for logging test output to files and executing individual test functions will not behave correctly.
If you have 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.
Definition at line 2019 of file qtestcase.cpp.
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.
Definition at line 2200 of file qtestcase.cpp.
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.
Definition at line 2033 of file qtestcase.cpp.
QBenchmarkResult QTest::qMedian | ( | const QList< QBenchmarkResult > & | container | ) |
int QTest::qRun | ( | ) |
Definition at line 2079 of file qtestcase.cpp.
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:
Definition at line 65 of file qtestsupport_core.cpp.
int QTest::qt_asprintf | ( | QTestCharBuffer * | str, |
const char * | format, | ||
... | |||
) |
Definition at line 409 of file qabstracttestlogger.cpp.
Q_TESTLIB_EXPORT void QTest::qtest_qParseArgs | ( | int | argc, |
char * | argv[], | ||
bool | qml | ||
) |
Definition at line 622 of file qtestcase.cpp.
bool QTest::qVerify | ( | bool | statement, |
const char * | statementStr, | ||
const char * | description, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 2207 of file qtestcase.cpp.
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.
Definition at line 108 of file qtestsupport_core.cpp.
QT_BEGIN_NAMESPACE Q_WIDGETS_EXPORT bool QTest::qWaitForWindowActive | ( | QWidget * | widget, |
int | timeout = 5000 |
||
) |
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
.
Definition at line 62 of file qtestsupport_widgets.cpp.
QT_BEGIN_NAMESPACE Q_GUI_EXPORT bool QTest::qWaitForWindowActive | ( | QWindow * | window, |
int | timeout = 5000 |
||
) |
Waits for timeout milliseconds or until the window is active.
Returns true
if window
is active within timeout milliseconds, otherwise returns false
.
Definition at line 63 of file qtestsupport_gui.cpp.
Q_WIDGETS_EXPORT bool QTest::qWaitForWindowExposed | ( | QWidget * | widget, |
int | timeout = 5000 |
||
) |
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.
Definition at line 87 of file qtestsupport_widgets.cpp.
Q_GUI_EXPORT bool QTest::qWaitForWindowExposed | ( | QWindow * | window, |
int | timeout = 5000 |
||
) |
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.
Definition at line 91 of file qtestsupport_gui.cpp.
void QTest::setBenchmarkResult | ( | qreal | result, |
QTest::QBenchmarkMetric | metric | ||
) |
Sets the benchmark result for this test function to result.
Use this function if you want to report benchmark results without using the QBENCHMARK macro. Use metric to specify how Qt Test should interpret the results.
The context for the result will be the test function name and any data tag from the _data function. This function can only be called once in each test function, subsequent calls will replace the earlier reported results.
Note that the -iterations command line argument has no effect on test functions without the QBENCHMARK macro.
Definition at line 271 of file qbenchmark.cpp.
void QTest::setIterationCount | ( | int | count | ) |
Definition at line 232 of file qbenchmark.cpp.
void QTest::setIterationCountHint | ( | int | count | ) |
QObject * QTest::testObject | ( | ) |
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.
Q_TESTLIB_EXPORT char * QTest::toPrettyCString | ( | const char * | p, |
int | length | ||
) |
Definition at line 1463 of file qtestcase.cpp.
Q_TESTLIB_EXPORT char * QTest::toPrettyUnicode | ( | QStringView | string | ) |
Definition at line 1559 of file qtestcase.cpp.
char * QTest::toString | ( | const char * | str | ) |
char* QTest::toString | ( | const ConstructionCounted & | cc | ) |
Definition at line 71 of file src_qtestlib_qtestcase_snippet.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 84 of file tst_qtextboundaryfinder.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 78 of file tst_qtextboundaryfinder.cpp.
|
inline |
|
inline |
char* QTest::toString | ( | QDBusMessage::MessageType | t | ) |
Definition at line 51 of file tst_qdbusabstractadaptor.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
char * QTest::toString< CborError > | ( | const CborError & | err | ) |
char* QTest::toString< QCborStreamReader::Type > | ( | const QCborStreamReader::Type & | t | ) |
|
inline |
|
inline |
int QTest::blacklists = 0 |
Definition at line 113 of file qtestlog.cpp.
int QTest::fails = 0 |
Definition at line 110 of file qtestlog.cpp.
Q_TESTLIB_EXPORT int QTest::lastMouseTimestamp = 0 |
Definition at line 48 of file qtestmouse.cpp.
int QTest::passes = 0 |
Definition at line 111 of file qtestlog.cpp.
Q_TESTLIB_EXPORT bool QTest::printAvailableFunctions = false |
Definition at line 528 of file qtestcase.cpp.
int QTest::skips = 0 |
Definition at line 112 of file qtestlog.cpp.
Q_TESTLIB_EXPORT QStringList QTest::testFunctions |
Definition at line 529 of file qtestcase.cpp.
Q_TESTLIB_EXPORT QStringList QTest::testTags |
Definition at line 530 of file qtestcase.cpp.