diff options
author | Jan Kundrát <jkt@flaska.net> | 2010-11-14 00:06:07 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-26 03:02:34 +0200 |
commit | 2bf03fa04b7b9df5078c70c95b7fd0b55bc68339 (patch) | |
tree | 44d79e9014d0af69abd801a856e08471a00bfc30 /src/testlib/qtest.h | |
parent | d5ad900c77af563a1f3cfb0d252fd173249493fb (diff) | |
download | qtbase-2bf03fa04b7b9df5078c70c95b7fd0b55bc68339.tar.gz |
Implement QTEST_GUILESS_MAIN
Add support for test cases which require an event loop, but do not need
GUI up and running. Such cases are best accommodated by code similar to
QTEST_MAIN, but using QCoreApplication instead of QApplication.
Change-Id: I04ce82d26b80a4edeba6bf7604a7f8d974232a11
Merge-request: 919
Reviewed-on: http://codereview.qt-project.org/5427
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'src/testlib/qtest.h')
-rw-r--r-- | src/testlib/qtest.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index e671828b77..66e747a2ac 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -290,6 +290,14 @@ int main(int argc, char *argv[]) \ #endif // QT_GUI_LIB +#define QTEST_GUILESS_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QCoreApplication app(argc, argv); \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + QT_END_HEADER #endif |