Support logcat output from tests on Android

We usually do not have a console, so print out the messages
to the log as well, so that it's easier to run single tests
for debugging.

Change-Id: I31908977aac25a6f6716f8245206b01026234aa9
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2013-09-24 07:58:59 +02:00 committed by The Qt Project
parent e4ce1790b1
commit 75abfa8982

View File

@ -62,6 +62,10 @@
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/qmath.h> #include <QtCore/qmath.h>
#ifdef Q_OS_ANDROID
# include <android/log.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QTest { namespace QTest {
@ -206,6 +210,8 @@ void QPlainTestLogger::outputMessage(const char *str)
if (stream != stdout) if (stream != stdout)
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
OutputDebugStringA(str); OutputDebugStringA(str);
#elif defined(Q_OS_ANDROID)
__android_log_print(ANDROID_LOG_INFO, "QTestLib", str);
#endif #endif
outputString(str); outputString(str);
} }