Remove QTEST_NOOP_MAIN from qtestlib API.
authorJason McDonald <jason.mcdonald@nokia.com>
Mon, 17 Oct 2011 07:04:39 +0000 (17:04 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 19 Oct 2011 03:56:55 +0000 (05:56 +0200)
This macro is no longer used in Qt's tests and encourages writing tests
in a way that makes test reporting less accurate -- remove it to prevent
further misuse.  If a test can be determined at compile-time to be
inapplicable, it should be omitted from the build via .pro file logic.
If that is not possible (e.g. there is no suitable qmake variable), the
test's initTestCase() function should call QSKIP to skip the entire test
with a meaningful explanation.

Task-number: QTBUG-21851
Change-Id: Icacc8c5567a700191b6ef3fa94ee52ede94c5b34
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
doc/src/snippets/code/src_qtestlib_qtestcase.cpp
src/testlib/qtest.h
src/testlib/qtestcase.cpp

index 986026f..5b1f558 100644 (file)
@@ -123,16 +123,6 @@ QTEST_MAIN(TestQString)
 //! [11]
 
 
-//! [12]
-#ifdef Q_WS_X11
-    QTEST_MAIN(MyX11Test)
-#else
-    // do nothing on non-X11 platforms
-    QTEST_NOOP_MAIN
-#endif
-//! [12]
-
-
 //! [13]
 QTest::keyClick(myWidget, 'a');
 //! [13]
index 66e747a..35ab5a3 100644 (file)
@@ -238,13 +238,6 @@ int main(int argc, char *argv[]) \
     return QTest::qExec(&tc, argc, argv); \
 }
 
-#define QTEST_NOOP_MAIN \
-int main(int argc, char *argv[]) \
-{ \
-    QObject tc; \
-    return QTest::qExec(&tc, argc, argv); \
-}
-
 #include <QtTest/qtestsystem.h>
 
 #if defined(QT_WIDGETS_LIB)
index 41bdd9b..c579e0f 100644 (file)
@@ -326,19 +326,6 @@ QT_BEGIN_NAMESPACE
     \sa QTEST_MAIN()
 */
 
-/*! \macro QTEST_NOOP_MAIN()
-
-    \relates QTest
-
-    Implements a main() function with a test class that does absolutely nothing.
-    Use this macro to create a test that produces valid test output but just
-    doesn't execute any test, for example in conditional compilations:
-
-    \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 12
-
-    \sa QTEST_MAIN()
-*/
-
 /*! \macro QTEST_GUILESS_MAIN(TestClass)
 
     \relates QTest