summaryrefslogtreecommitdiffstats
path: root/src/testlib/qplaintestlogger.cpp
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-08-19 08:15:38 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-08-19 08:18:18 (GMT)
commitca0b5b503e8865c0eedeea86aa132291281fc49f (patch)
tree1eca392e65bf5be617a5189d93a8327cc9ec5e34 /src/testlib/qplaintestlogger.cpp
parentf21096e918a587287d61446e930c40914e2b7ce5 (diff)
parent23d2550e6d19c3e84ff2167f5696d4b6dd3f49d4 (diff)
downloadQt-ca0b5b503e8865c0eedeea86aa132291281fc49f.zip
Qt-ca0b5b503e8865c0eedeea86aa132291281fc49f.tar.gz
Qt-ca0b5b503e8865c0eedeea86aa132291281fc49f.tar.bz2
Merge branch 'master' into mmfphonon
Conflicts: src/gui/itemviews/qitemselectionmodel.cpp tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
Diffstat (limited to 'src/testlib/qplaintestlogger.cpp')
-rw-r--r--src/testlib/qplaintestlogger.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index a2be00f..8229490 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
+** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -170,16 +170,24 @@ namespace QTest {
OutputDebugStringA(str);
LeaveCriticalSection(&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));
- HBufC* hbuffer = HBufC::New(ptr.Length());
- if (hbuffer) {
- hbuffer->Des().Copy(ptr);
- RDebug::Print(_L("[QTestLib Message] %S"), hbuffer);
- delete hbuffer;
- } else {
- TBuf<256> tmp;
- tmp.Copy(ptr.Left(Min(256, ptr.Length())));
- RDebug::Print(_L("[QTestLib Message] %S"), &tmp);
+ _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);
+ }
+ }
+ 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
QAbstractTestLogger::outputString(str);
@@ -247,10 +255,10 @@ namespace QTest {
QString beforeDecimalPoint = QString::number(qint64(number), 'f', 0);
QString afterDecimalPoint = QString::number(number, 'f', 20);
afterDecimalPoint.remove(0, beforeDecimalPoint.count() + 1);
-
+
int beforeUse = qMin(beforeDecimalPoint.count(), significantDigits);
int beforeRemove = beforeDecimalPoint.count() - beforeUse;
-
+
// Replace insignificant digits before the decimal point with zeros.
beforeDecimalPoint.chop(beforeRemove);
for (int i = 0; i < beforeRemove; ++i) {
@@ -288,10 +296,10 @@ namespace QTest {
print = beforeDecimalPoint;
if (afterUse > 0)
print.append(decimalPoint);
-
+
print += afterDecimalPoint;
-
+
return print;
}
@@ -312,7 +320,7 @@ namespace QTest {
char buf1[1024];
QTest::qt_snprintf(
buf1, sizeof(buf1), "%s: %s::%s",
- bmtag,
+ bmtag,
QTestResult::currentTestObjectName(),
result.context.slotName.toAscii().data());
@@ -323,7 +331,7 @@ namespace QTest {
if (tag.isEmpty() == false) {
QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
}
-
+
char fillFormat[8];
int fillLength = 5;