diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp | 30 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp | 43 |
2 files changed, 26 insertions, 47 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" diff --git a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp index 7ab1f150ad..f5788dcf55 100644 --- a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp +++ b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp @@ -97,10 +97,11 @@ void tst_qdeclarativeconsole::tracing() { QUrl testUrl = testFileUrl("tracing.qml"); - QString trace1 = QString::fromLatin1("tracing (%1:%2:%3)\n").arg(testUrl.toString()).arg(50).arg(17); - QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(9); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); + QString traceText = + QString::fromLatin1("tracing (%1:%2:%3)\n").arg(testUrl.toString()).arg(50).arg(17) + + QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(54).arg(9); + + QTest::ignoreMessage(QtDebugMsg, qPrintable(traceText)); QDeclarativeComponent component(&engine, testUrl); QObject *object = component.create(); @@ -127,14 +128,15 @@ void tst_qdeclarativeconsole::assert() QUrl testUrl = testFileUrl("assert.qml"); // assert() - QTest::ignoreMessage(QtCriticalMsg, "This will fail"); - QTest::ignoreMessage(QtCriticalMsg, "This will fail too"); - QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(54).arg(17); - QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(59).arg(9); - QString trace3 = QString::fromLatin1("assertFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(47).arg(17); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3)); + QString assert1 = "This will fail\n" + + QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(54).arg(17); + + QString assert2 = "This will fail too\n" + + QString::fromLatin1("assertFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(47).arg(17) + + QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(59).arg(9); + + QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert1)); + QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert2)); QDeclarativeComponent component(&engine, testUrl); QObject *object = component.create(); @@ -147,14 +149,15 @@ void tst_qdeclarativeconsole::exception() QUrl testUrl = testFileUrl("exception.qml"); // exception() - QTest::ignoreMessage(QtCriticalMsg, "Exception 1"); - QTest::ignoreMessage(QtCriticalMsg, "Exception 2"); - QString trace1 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(51).arg(21); - QString trace2 = QString::fromLatin1("onCompleted (%1:%2:%3)\n").arg(testUrl.toString()).arg(56).arg(9); - QString trace3 = QString::fromLatin1("exceptionFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(46).arg(17); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace1)); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace2)); - QTest::ignoreMessage(QtDebugMsg, qPrintable(trace3)); + QString exception1 = "Exception 1\n" + + QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(51).arg(21); + + QString exception2 = "Exception 2\n" + + QString::fromLatin1("exceptionFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(46).arg(17) + + QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(56).arg(9); + + QTest::ignoreMessage(QtCriticalMsg, qPrintable(exception1)); + QTest::ignoreMessage(QtCriticalMsg, qPrintable(exception2)); QDeclarativeComponent component(&engine, testUrl); QObject *object = component.create(); |