diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2012-02-13 14:35:21 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 17:59:38 +0100 |
commit | c3f5905b5204105172c9745ee2171c9e0c0c4750 (patch) | |
tree | ae0c8349344593a42e2674425f42cce34d6f0ccc /tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp | |
parent | 6c24d2feb43f6d640d83ee6e5ac01a1bdac3d0ce (diff) |
Console API: Pass context information from js to qt logging framework
Log the file, line, function context from the original calls in js.
Also print the stack trace as part of one multi-line message.
Change-Id: I53836df081f3ce06e9b52ebb647ba172ff6bdbef
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Diffstat (limited to 'tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp')
-rw-r--r-- | tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp index 07e744dc58..625e038882 100644 --- a/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp +++ b/tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp @@ -59,7 +59,7 @@ class tst_QDebugMessageService : public QDeclarativeDataTest public: tst_QDebugMessageService(); - void init(bool extendedOutput); + void init(); private slots: void initTestCase(); @@ -68,7 +68,6 @@ private slots: void cleanup(); void retrieveDebugOutput(); - void retrieveDebugOutputExtended(); private: QDeclarativeDebugProcess *m_process; @@ -165,14 +164,12 @@ void tst_QDebugMessageService::cleanupTestCase() delete m_connection; } -void tst_QDebugMessageService::init(bool extendedOutput) +void tst_QDebugMessageService::init() { m_connection = new QDeclarativeDebugConnection(); m_process = new QDeclarativeDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"); m_client = new QDeclarativeDebugMsgClient(m_connection); - if (extendedOutput) - m_process->setEnvironment(QProcess::systemEnvironment() << "QML_CONSOLE_EXTENDED=1"); m_process->start(QStringList() << QLatin1String(NORMALMODE) << QDeclarativeDataTest::instance()->testFile(QMLFILE)); if (!m_process->waitForSessionStart()) { QFAIL(QString("Could not launch app. Application output: \n%1").arg(m_process->output()).toAscii()); @@ -204,7 +201,7 @@ void tst_QDebugMessageService::cleanup() void tst_QDebugMessageService::retrieveDebugOutput() { - init(false); + init(); int maxTries = 2; while ((m_client->logBuffer.size() < 2) @@ -217,27 +214,6 @@ void tst_QDebugMessageService::retrieveDebugOutput() QVERIFY(m_client->logBuffer.contains(LogEntry(QtDebugMsg, QLatin1String("console.count: 1")))); } -void tst_QDebugMessageService::retrieveDebugOutputExtended() -{ - init(true); - - int maxTries = 2; - while ((m_client->logBuffer.size() < 2) - || (maxTries-- > 0)) - QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(debugOutput()), 1000); - - QVERIFY(m_client->logBuffer.size() >= 2); - - const QString path = - QUrl::fromLocalFile(QDeclarativeDataTest::instance()->testFile(QMLFILE)).toString(); - - QString logMsg = QString::fromLatin1("console.log (%1:%2)").arg(path).arg(48); - QString countMsg = QString::fromLatin1("console.count: 1 (%1:%2)").arg(path).arg(49); - - QVERIFY(m_client->logBuffer.contains(LogEntry(QtDebugMsg, logMsg))); - QVERIFY(m_client->logBuffer.contains(LogEntry(QtDebugMsg, countMsg))); -} - QTEST_MAIN(tst_QDebugMessageService) #include "tst_qdebugmessageservice.moc" |