summaryrefslogtreecommitdiffstats
path: root/src/testlib/qplaintestlogger.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-10 06:56:35 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-10 06:56:35 (GMT)
commitf61ec84fc296c6f70011e30788ee511d6b6a18c6 (patch)
tree54b3b81ac83570e65dc9b44b6756005f6ba1efde /src/testlib/qplaintestlogger.cpp
parentcc0a411e5e874aa224c26298a109973cb15ea291 (diff)
parentd13418effc5f00474541ae513a30c9a42c2a1cb3 (diff)
downloadQt-f61ec84fc296c6f70011e30788ee511d6b6a18c6.zip
Qt-f61ec84fc296c6f70011e30788ee511d6b6a18c6.tar.gz
Qt-f61ec84fc296c6f70011e30788ee511d6b6a18c6.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer_impl.h src/gui/widgets/qdatetimeedit.cpp src/gui/widgets/qlinecontrol.cpp src/gui/widgets/qlineedit.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qicoimageformat/tst_qicoimageformat.cpp tests/auto/qmultiscreen/qmultiscreen.pro tests/auto/qresourceengine/qresourceengine.pro tests/auto/qresourceengine/tst_qresourceengine.cpp tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
Diffstat (limited to 'src/testlib/qplaintestlogger.cpp')
-rw-r--r--src/testlib/qplaintestlogger.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index c529d3e..a2be00f 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -156,11 +156,13 @@ namespace QTest {
static void outputMessage(const char *str)
{
#if defined(Q_OS_WINCE)
- int length = strlen(str);
- for (int pos = 0; pos < length; pos +=255) {
- QString uniText = QString::fromLatin1(str + pos, 255);
- OutputDebugString((wchar_t*)uniText.utf16());
- }
+ QString strUtf16 = QString::fromLatin1(str);
+ const int maxOutputLength = 255;
+ do {
+ QString tmp = strUtf16.left(maxOutputLength);
+ OutputDebugString((wchar_t*)tmp.utf16());
+ strUtf16.remove(0, maxOutputLength);
+ } while (!strUtf16.isEmpty());
if (QTestLog::outputFileName())
#elif defined(Q_OS_WIN)
EnterCriticalSection(&outputCriticalSection);
@@ -198,7 +200,7 @@ namespace QTest {
: "";
const char *filler = (tag[0] && gtag[0]) ? ":" : "";
if (file) {
- QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n"
+ QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n"
#ifdef Q_OS_WIN
"%s(%d) : failure location\n"
#else
@@ -207,14 +209,14 @@ namespace QTest {
, type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
msg[0] ? " " : "", msg, file, line);
} else {
- QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n",
+ QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n",
type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
msg[0] ? " " : "", msg);
}
// In colored mode, printf above stripped our nonprintable control characters.
// Put them back.
- memcpy(buf, type, strlen(type));
- outputMessage(buf);
+ memcpy(buf.data(), type, strlen(type));
+ outputMessage(buf.data());
}
template <typename T>
@@ -225,7 +227,7 @@ namespace QTest {
int digits = 0;
qreal divisor = 1;
-
+
while (num / divisor >= 1) {
divisor *= 10;
++digits;