summaryrefslogtreecommitdiffstats
path: root/src/testlib/qplaintestlogger.cpp
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-08-03 13:12:46 (GMT)
committerHarald Fernengel <harald@trolltech.com>2009-08-03 13:12:46 (GMT)
commit41a83e1ff19ad1396e6001e6b0ac003c701ba55a (patch)
tree609e40eda10418bbf925002c36552074796b96b6 /src/testlib/qplaintestlogger.cpp
parentd1f3b9df2bc5c57d414da73a7d4f9ed7b25df3db (diff)
downloadQt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.zip
Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.gz
Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.bz2
Squashed commit of the topic/exceptions branch.
Contains some smaller fixes and renaming of macros. Looks big, but isn't scary at all ;)
Diffstat (limited to 'src/testlib/qplaintestlogger.cpp')
-rw-r--r--src/testlib/qplaintestlogger.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index ce4bb5d..a0f0d25 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -129,7 +129,11 @@ namespace QTest {
static const char *messageType2String(QAbstractTestLogger::MessageTypes type)
{
+#ifdef Q_OS_WIN
static bool colored = (!qgetenv("QTEST_COLORED").isEmpty());
+#else
+ static bool colored = ::getenv("QTEST_COLORED");
+#endif
switch (type) {
case QAbstractTestLogger::Skip:
return COLORED_MSG(0, 37, "SKIP "); //white
@@ -165,10 +169,16 @@ namespace QTest {
LeaveCriticalSection(&outputCriticalSection);
#elif defined(Q_OS_SYMBIAN)
TPtrC8 ptr(reinterpret_cast<const TUint8*>(str));
- HBufC* hbuffer = HBufC::NewL(ptr.Length());
- hbuffer->Des().Copy(ptr);
- RDebug::Print(_L("[QTestLib Message] %S"), hbuffer);
- delete hbuffer;
+ 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);
+ }
#endif
QAbstractTestLogger::outputString(str);
}