diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-05-29 07:40:32 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-05-29 07:47:12 (GMT) |
commit | d4a8cb47cb106ad642e908763787407774619aac (patch) | |
tree | 871d15380006c52bca8a57ca966bd90fa192a284 /src/testlib | |
parent | dcf5d568aba893d690eedbe1e18148b504de2abb (diff) | |
download | Qt-d4a8cb47cb106ad642e908763787407774619aac.zip Qt-d4a8cb47cb106ad642e908763787407774619aac.tar.gz Qt-d4a8cb47cb106ad642e908763787407774619aac.tar.bz2 |
Disable keypad navigation for the autotests and document it.
On Symbian keypad navigation is enabled by default since there is no
reliable way to detect the presence of touch or not. Enabling this
feature though causes problems for many of Qt's autotests since they
were not written with this in mind. Many tests send QTest::key*()
events to a widget and subsequently test the state of the widget, but
with keypad navigation enabled, the behavior changes because the widget
does not have edit focus by default.
Reviewed-by: axis <qt-info@nokia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtest.h | 7 | ||||
-rw-r--r-- | src/testlib/qtestcase.cpp | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 6ea38f7..15319ce 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -226,10 +226,17 @@ int main(int argc, char *argv[]) \ #include <QtTest/qtest_gui.h> +#ifdef QT_KEYPAD_NAVIGATION +# define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setKeypadNavigationEnabled(false); +#else +# define QTEST_DISABLE_KEYPAD_NAVIGATION +#endif + #define QTEST_MAIN(TestObject) \ int main(int argc, char *argv[]) \ { \ QApplication app(argc, argv); \ + QTEST_DISABLE_KEYPAD_NAVIGATION \ TestObject tc; \ return QTest::qExec(&tc, argc, argv); \ } diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 27ba6da..b676012 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -300,10 +300,15 @@ QT_BEGIN_NAMESPACE the \a TestClass, and executes all tests in the order they were defined. Use this macro to build stand-alone executables. + \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian), + this macro will forcfully disable it to simplify the usage of key events when writing + autotests. If you wish to write a test case that uses keypad navigation, you should + enable it either in the \c {initTestCase()} or \c {init()} functions of your test case. + Example: \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 11 - \sa QTEST_APPLESS_MAIN(), QTest::qExec() + \sa QTEST_APPLESS_MAIN(), QTest::qExec(), QApplication::setKeypadNavigationEnabled() */ /*! \macro QTEST_APPLESS_MAIN(TestClass) |