diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-07-29 07:26:37 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-07-30 04:54:44 (GMT) |
commit | a92117be4323e26efe3f13b5c624e5010a7cd26a (patch) | |
tree | 23aa971a07a98543324fa69761a1b4183a537991 /src/testlib/qabstracttestlogger_p.h | |
parent | 5246aeb198ccfd2a3fc94298161c24cb8f57f81f (diff) | |
download | Qt-a92117be4323e26efe3f13b5c624e5010a7cd26a.zip Qt-a92117be4323e26efe3f13b5c624e5010a7cd26a.tar.gz Qt-a92117be4323e26efe3f13b5c624e5010a7cd26a.tar.bz2 |
Allow testlib loggers to dynamically allocate storage for strings.
This enables very long failure messages (e.g. including an entire
build log in a failure message).
This change modifies only the plain test logger to use this feature.
Task: 253861
Reviewed-by: Michael Goddard
Diffstat (limited to 'src/testlib/qabstracttestlogger_p.h')
-rw-r--r-- | src/testlib/qabstracttestlogger_p.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index a0e8a1e..588184e 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -99,6 +99,42 @@ public: static bool isTtyOutput(); }; +struct QTestCharBuffer +{ + inline QTestCharBuffer() + : buf(0) + {} + + inline ~QTestCharBuffer() + { + delete[] buf; + buf = 0; + } + + inline operator void*() + { + return buf; + } + + inline operator char*() + { + return buf; + } + + inline operator char**() + { + return &buf; + } + + inline const char* constData() const + { + return buf; + } + +private: + char* buf; +}; + QT_END_NAMESPACE #endif |