diff options
Diffstat (limited to 'src/testlib/doc')
-rw-r--r-- | src/testlib/doc/snippets/code/doc_src_qtestlib.cpp | 30 | ||||
-rw-r--r-- | src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp | 20 | ||||
-rw-r--r-- | src/testlib/doc/src/qttest-index.qdoc | 5 | ||||
-rw-r--r-- | src/testlib/doc/src/qttestlib-manual.qdoc | 12 |
4 files changed, 38 insertions, 29 deletions
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp b/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp index 0dc45bef76..de301b8df9 100644 --- a/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp +++ b/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp @@ -48,19 +48,41 @@ ** ****************************************************************************/ +#include <QtTest> + //! [0] class MyFirstTest: public QObject { Q_OBJECT + +private: + bool myCondition() + { + return true; + } + private slots: void initTestCase() - { qDebug("called before everything else"); } + { + qDebug("Called before everything else."); + } + void myFirstTest() - { QVERIFY(1 == 1); } + { + QVERIFY(true); // check that a condition is satisfied + QCOMPARE(1, 1); // compare two values + } + void mySecondTest() - { QVERIFY(1 != 2); } + { + QVERIFY(myCondition()); + QVERIFY(1 != 2); + } + void cleanupTestCase() - { qDebug("called after myFirstTest and mySecondTest"); } + { + qDebug("Called after myFirstTest and mySecondTest."); + } }; //! [0] diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp index 990b7a38d7..202f87af52 100644 --- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp +++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp @@ -177,13 +177,6 @@ namespace MyNamespace { } //! [toString-overload] -//! [17] -int i = 0; -while (myNetworkServerNotResponding() && i++ < 50) - QTest::qWait(250); -//! [17] - - //! [18] MyTestObject test1; QTest::qExec(&test1); @@ -245,11 +238,6 @@ void MyTestClass::cleanup() QTest::qSleep(250); //! [23] -//! [24] -QWidget widget; -widget.show(); -QTest::qWaitForWindowShown(&widget); -//! [24] //! [25] QTouchDevice *dev = QTest::createTouchDevice(); @@ -306,13 +294,5 @@ QTest::keyClick(myWindow, Qt::Key_Escape); QTest::keyClick(myWindow, Qt::Key_Escape, Qt::ShiftModifier, 200); //! [29] -//! [30] -MyObject obj; -obj.startup(); -QTest::qWaitFor([&]() { - return obj.isReady(); -}, 3000); -//! [30] - } diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc index 8c817b3653..6e4f954034 100644 --- a/src/testlib/doc/src/qttest-index.qdoc +++ b/src/testlib/doc/src/qttest-index.qdoc @@ -35,6 +35,11 @@ and the \l QAbstractItemModelTester allows for non-destructive testing of item models. + \note There is no binary compatibility guarantee for the Qt Test module. + This means that an application that uses Qt Test is only guaranteed + to work with the Qt version it was developed against. However, source + compatibility is guaranteed. + \section1 Getting Started To enable Qt Test in a project, add this directive into the C++ files: diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 363ec17c6c..71b4541313 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -69,8 +69,8 @@ \li Qt Test supports benchmarking and provides several measurement back-ends. \row \li \b {IDE friendly} - \li Qt Test outputs messages that can be interpreted by Visual - Studio and KDevelop. + \li Qt Test outputs messages that can be interpreted by Qt Creator, Visual + Studio, and KDevelop. \row \li \b Thread-safety \li The error reporting is thread safe and atomic. @@ -177,7 +177,7 @@ \list \li \c -o \e{filename,format} \br Writes output to the specified file, in the specified format (one of - \c txt, \c xml, \c lightxml or \c xunitxml). The special filename \c - + \c txt, \c xml, \c lightxml, \c xunitxml or \c tap). The special filename \c - may be used to log to standard output. \li \c -o \e filename \br Writes output to the specified file. @@ -194,6 +194,8 @@ benchmarks, since it suppresses normal pass/fail messages. \li \c -teamcity \br Outputs results in TeamCity format. + \li \c -tap \br + Outputs results in Test Anything Protocol (TAP) format. \endlist The first version of the \c -o option may be repeated in order to log @@ -201,8 +203,8 @@ option can log test results to standard output. If the first version of the \c -o option is used, neither the second version - of the \c -o option nor the \c -txt, \c -xml, \c -lightxml, \c -teamcity - or \c -xunitxml options should be used. + of the \c -o option nor the \c -txt, \c -xml, \c -lightxml, \c -teamcity, + \c -xunitxml or \c -tap options should be used. If neither version of the \c -o option is used, test results will be logged to standard output. If no format option is used, test results will be logged in |