From 2a3738265a873307077067ab02bc1a31a9ddc49a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 2 Dec 2011 11:45:12 +1000 Subject: Update documentation for QTest::qExec() Update the documentation to make it clear that regular test applications should not call QTest::qExec() more than once. Also minor rewording of description of return value. Change-Id: I45bdf520ed10fd3c9232847a0ec0bc2b32d4caf3 Reviewed-by: Rohan McGovern --- src/testlib/qtestcase.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index b97a1abe18..8a8298c022 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1914,19 +1914,24 @@ FatalSignalHandler::~FatalSignalHandler() Optionally, the command line arguments \a argc and \a argv can be provided. For a list of recognized arguments, read \l {QTestLib Command Line Arguments}. - For stand-alone tests, the convenience macro \l QTEST_MAIN() can - be used to declare a main method that parses the command line arguments - and executes the tests. + The following example will run all tests in \c MyTestObject: - Returns 0 if all tests passed. Returns a value other than 0 if tests failed - or in case of unhandled exceptions. The return value from this function is - also the exit code of the test application when the \l QTEST_MAIN() macro - is used. + \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 18 - The following example will run all tests in \c MyFirstTestObject and - \c{MySecondTestObject}: + 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.) - \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 18 + 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 -- cgit v1.2.3