summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 1d0bbcf..a8a4b1a 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -303,10 +303,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)
@@ -1569,6 +1574,11 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
}
#endif
+#ifdef Q_OS_SYMBIAN
+//### FIX THIS temporary hack to delay execution of symbian os tests. Used to get emulator to stable state before running testcase
+ qSleep(3000);
+#endif
+
QTestResult::reset();
QTEST_ASSERT(testObject);
@@ -1597,7 +1607,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
qInvokeTestMethods(testObject);
}
- #ifndef QT_NO_EXCEPTIONS
+#ifndef QT_NO_EXCEPTIONS
} catch (...) {
QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__);
if (QTestResult::currentTestFunction()) {
@@ -1611,13 +1621,13 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
IOPMAssertionRelease(powerID);
}
#endif
- #ifdef Q_OS_WIN
+//# ifdef Q_OS_WIN
// rethrow exception to make debugging easier
throw;
- #endif
- return -1;
+//# endif
+ return 1;
}
- #endif
+# endif
currentTestObject = 0;
#ifdef QT_MAC_USE_COCOA
@@ -1920,7 +1930,7 @@ bool QTest::compare_helper(bool success, const char *msg, char *val1, char *val2
\internal
*/
template <>
-bool QTest::qCompare<float>(float const &t1, float const &t2, const char *actual, const char *expected,
+Q_TESTLIB_EXPORT bool QTest::qCompare<float>(float const &t1, float const &t2, const char *actual, const char *expected,
const char *file, int line)
{
return qFuzzyCompare(t1, t2)
@@ -1933,7 +1943,7 @@ bool QTest::qCompare<float>(float const &t1, float const &t2, const char *actual
\internal
*/
template <>
-bool QTest::qCompare<double>(double const &t1, double const &t2, const char *actual, const char *expected,
+Q_TESTLIB_EXPORT bool QTest::qCompare<double>(double const &t1, double const &t2, const char *actual, const char *expected,
const char *file, int line)
{
return qFuzzyCompare(t1, t2)
@@ -1943,7 +1953,7 @@ bool QTest::qCompare<double>(double const &t1, double const &t2, const char *act
}
#define COMPARE_IMPL2(TYPE, FORMAT) \
-template <> char *QTest::toString<TYPE >(const TYPE &t) \
+template <> Q_TESTLIB_EXPORT char *QTest::toString<TYPE >(const TYPE &t) \
{ \
char *msg = new char[128]; \
qt_snprintf(msg, 128, #FORMAT, t); \