diff options
author | Aurindam Jana <aurindam.jana@nokia.com> | 2012-01-17 14:38:06 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-24 14:11:52 +0100 |
commit | b77ecde410ace1545ac6fdad7466e64e4fc635da (patch) | |
tree | 791e9501a6f40a97879afa3a70e4b54bffb2663b /tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp | |
parent | b514fecbeae6a4fed9e593ea6405dbeec7fe7883 (diff) |
Console API: Add console.exception
console.exception writes a message to the console
and prints the JavaScript stack trace at the point
where it is called.
Change-Id: Idd2ff5982826accae0895db44c7ecf6130338cc7
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp index 9a4a39fa6d..34b0f6582f 100644 --- a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp +++ b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp @@ -55,6 +55,7 @@ private slots: void tracing(); void profiling(); void assert(); + void exception(); private: QDeclarativeEngine engine; @@ -141,6 +142,26 @@ void tst_qdeclarativeconsole::assert() delete object; } +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)); + + QDeclarativeComponent component(&engine, testUrl); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + QTEST_MAIN(tst_qdeclarativeconsole) #include "tst_qdeclarativeconsole.moc" |