diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-11-09 14:58:53 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-11 11:21:06 +0100 |
commit | 3346a77474e1b21990b049b824d621413ab9b80f (patch) | |
tree | 96266c30e27483a451edee76b6d32c145c5e71c9 /tests/auto/declarative/debugger/shared | |
parent | 2a812493bc97983b85110f853d3dbe57b54667d8 (diff) |
Debugger: Fix trace service for tracing on startup in block mode
Don't call QDeclarativeDebugTrace::instance() inside messageReceived,
since messageReceived() will be called for the first message while
the constructor is still running.
Also add proper autotests for qdeclarativedebugtrace.
Change-Id: Ic37d077d93ad4957fb21035abe40b2d281278314
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'tests/auto/declarative/debugger/shared')
-rw-r--r-- | tests/auto/declarative/debugger/shared/debugutil.cpp | 21 | ||||
-rw-r--r-- | tests/auto/declarative/debugger/shared/debugutil_p.h | 1 |
2 files changed, 14 insertions, 8 deletions
diff --git a/tests/auto/declarative/debugger/shared/debugutil.cpp b/tests/auto/declarative/debugger/shared/debugutil.cpp index 6ab15f35ba..5abafd2111 100644 --- a/tests/auto/declarative/debugger/shared/debugutil.cpp +++ b/tests/auto/declarative/debugger/shared/debugutil.cpp @@ -149,18 +149,24 @@ bool QDeclarativeDebugProcess::waitForSessionStart() QString QDeclarativeDebugProcess::output() const { - return m_outputBuffer; + return m_output; } void QDeclarativeDebugProcess::processAppOutput() { m_mutex.lock(); - const QString appOutput = m_process.readAll(); - static QRegExp newline("[\n\r]{1,2}"); - QStringList lines = appOutput.split(newline); - foreach (const QString &line, lines) { - if (line.isEmpty()) - continue; + + QString newOutput = m_process.readAll(); + m_output.append(newOutput); + m_outputBuffer.append(newOutput); + + while (true) { + const int nlIndex = m_outputBuffer.indexOf(QLatin1Char('\n')); + if (nlIndex < 0) // no further complete lines + break; + const QString line = m_outputBuffer.left(nlIndex); + m_outputBuffer = m_outputBuffer.right(m_outputBuffer.size() - nlIndex - 1); + if (line.startsWith("Qml debugging is enabled")) // ignore continue; if (line.startsWith("QDeclarativeDebugServer:")) { @@ -173,7 +179,6 @@ void QDeclarativeDebugProcess::processAppOutput() continue; } } - m_outputBuffer.append(appOutput); } m_mutex.unlock(); } diff --git a/tests/auto/declarative/debugger/shared/debugutil_p.h b/tests/auto/declarative/debugger/shared/debugutil_p.h index 99a482cf2a..24b7e252cb 100644 --- a/tests/auto/declarative/debugger/shared/debugutil_p.h +++ b/tests/auto/declarative/debugger/shared/debugutil_p.h @@ -113,6 +113,7 @@ private: QString m_executable; QProcess m_process; QString m_outputBuffer; + QString m_output; QTimer m_timer; QEventLoop m_eventLoop; QMutex m_mutex; |