Remove legacy Symbian code from qtestlib.

Change-Id: Ia4ac52ce0b5f5a4ba1fcd6594daf424fd7208777
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-10-21 16:48:12 +10:00 committed by Qt by Nokia
parent 47fc4e0f8c
commit f49bd47099
6 changed files with 8 additions and 71 deletions

View File

@ -76,13 +76,6 @@ QAbstractTestLogger::~QAbstractTestLogger()
QTEST_ASSERT(stream); QTEST_ASSERT(stream);
if (stream != stdout) { if (stream != stdout) {
fclose(stream); fclose(stream);
} else {
#ifdef Q_OS_SYMBIAN
// Convenience sleep for Symbian and TRK. Without this sleep depending on the timing the
// user would not see the complete output because it is still pending in any of the buffers
// before arriving via the USB port on the development PC
User::AfterHighRes(2*1000*1000);
#endif
} }
stream = 0; stream = 0;
} }

View File

@ -55,10 +55,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(Q_OS_SYMBIAN)
#include <e32debug.h>
#endif
#ifdef Q_OS_WINCE #ifdef Q_OS_WINCE
#include <QtCore/QString> #include <QtCore/QString>
#endif #endif
@ -217,27 +213,6 @@ void QPlainTestLogger::outputMessage(const char *str)
// OutputDebugString is not threadsafe // OutputDebugString is not threadsafe
OutputDebugStringA(str); OutputDebugStringA(str);
LeaveCriticalSection(&QTest::outputCriticalSection); LeaveCriticalSection(&QTest::outputCriticalSection);
#elif defined(Q_OS_SYMBIAN)
// RDebug::Print has a cap of 256 characters so break it up
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
_LIT(format, "[QTestLib] %S");
const int maxBlockSize = 256 - ((const TDesC &)format).Length();
HBufC* hbuffer = HBufC::New(maxBlockSize);
if (hbuffer) {
for (int i = 0; i < ptr.Length(); i += maxBlockSize) {
int size = Min(maxBlockSize, ptr.Length() - i);
hbuffer->Des().Copy(ptr.Mid(i, size));
RDebug::Print(format, hbuffer);
}
delete hbuffer;
}
else {
// fast, no allocations, but truncates silently
RDebug::RawPrint(format);
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
RDebug::RawPrint(ptr);
RDebug::RawPrint(_L8("\n"));
}
#endif #endif
outputString(str); outputString(str);
} }

View File

@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test) QT_MODULE(Test)
#if !defined(QT_SHARED) && !defined(QT_DLL) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) #if !defined(QT_SHARED) && !defined(QT_DLL)
# define Q_TESTLIB_EXPORT # define Q_TESTLIB_EXPORT
#else #else
# ifdef QTESTLIB_MAKEDLL # ifdef QTESTLIB_MAKEDLL
@ -60,7 +60,7 @@ QT_MODULE(Test)
# endif # endif
#endif #endif
#if defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) || defined (Q_CC_NOKIAX86) #if defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3))
# define QTEST_NO_SPECIALIZATIONS # define QTEST_NO_SPECIALIZATIONS
#endif #endif

View File

@ -898,7 +898,7 @@ namespace QTest
static int mouseDelay = -1; static int mouseDelay = -1;
static int eventDelay = -1; static int eventDelay = -1;
static int keyVerbose = -1; static int keyVerbose = -1;
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) #if defined(Q_OS_UNIX)
static bool noCrashHandler = false; static bool noCrashHandler = false;
#endif #endif
@ -1067,7 +1067,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" -keyevent-verbose : Turn on verbose messages for keyboard simulation\n" " -keyevent-verbose : Turn on verbose messages for keyboard simulation\n"
" -maxwarnings n : Sets the maximum amount of messages to output.\n" " -maxwarnings n : Sets the maximum amount of messages to output.\n"
" 0 means unlimited, default: 2000\n" " 0 means unlimited, default: 2000\n"
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) #if defined(Q_OS_UNIX)
" -nocrashhandler : Disables the crash handler\n" " -nocrashhandler : Disables the crash handler\n"
#endif #endif
"\n" "\n"
@ -1188,7 +1188,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
} else { } else {
QTestLog::setMaxWarnings(qToInt(argv[++i])); QTestLog::setMaxWarnings(qToInt(argv[++i]));
} }
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) #if defined(Q_OS_UNIX)
} else if (strcmp(argv[i], "-nocrashhandler") == 0) { } else if (strcmp(argv[i], "-nocrashhandler") == 0) {
QTest::noCrashHandler = true; QTest::noCrashHandler = true;
#endif #endif
@ -1662,7 +1662,7 @@ static void qInvokeTestMethods(QObject *testObject)
QTestLog::stopLogging(); QTestLog::stopLogging();
} }
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) #if defined(Q_OS_UNIX)
class FatalSignalHandler class FatalSignalHandler
{ {
public: public:
@ -1822,14 +1822,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
} }
#endif #endif
#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
// Delay execution of tests in Symbian emulator.
// Needed to allow worst of other higher priority apps and services launched by emulator
// to get out of the way before we run our test. Otherwise some of the timing sensitive tests
// will not work properly.
qSleep(3000);
#endif
QTestResult::reset(); QTestResult::reset();
QTEST_ASSERT(testObject); QTEST_ASSERT(testObject);
@ -1852,7 +1844,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
} else } else
#endif #endif
{ {
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) #if defined(Q_OS_UNIX)
QScopedPointer<FatalSignalHandler> handler; QScopedPointer<FatalSignalHandler> handler;
if (!noCrashHandler) if (!noCrashHandler)
handler.reset(new FatalSignalHandler); handler.reset(new FatalSignalHandler);

View File

@ -275,7 +275,7 @@ namespace QTest
return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line); return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line);
} }
#elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) #elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE)
template <> template <>
inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual, inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual,
const char *expected, const char *file, int line) const char *expected, const char *file, int line)
@ -331,28 +331,6 @@ namespace QTest
return compare_string_helper(t1, t2, actual, expected, file, line); return compare_string_helper(t1, t2, actual, expected, file, line);
} }
#else /* QTEST_NO_SPECIALIZATIONS */ #else /* QTEST_NO_SPECIALIZATIONS */
// In Symbian we have QTEST_NO_SPECIALIZATIONS defined, but still float related specialization
// should be used. If QTEST_NO_SPECIALIZATIONS is enabled we get ambiguous overload errors.
#if defined(QT_ARCH_SYMBIAN)
template <typename T1, typename T2>
bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int);
template <>
inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare<float>(float(t1), float(t2), actual, expected, file, line);
}
template <>
inline bool qCompare<double, qreal>(double const &t1, qreal const &t2, const char *actual,
const char *expected, const char *file, int line)
{
return qCompare<float>(float(t1), float(t2), actual, expected, file, line);
}
#endif
inline bool qCompare(const char *t1, const char *t2, const char *actual, inline bool qCompare(const char *t1, const char *t2, const char *actual,
const char *expected, const char *file, int line) const char *expected, const char *file, int line)
{ {

View File

@ -83,4 +83,3 @@ QMAKE_TARGET_DESCRIPTION = Qt \
Unit \ Unit \
Testing \ Testing \
Library Library
symbian:TARGET.UID3=0x2001B2DF