From cf571ec8471d611c737e998e96b202eb118d29c8 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 14:34:25 +1000 Subject: QTBUG-6507 appears fixed (don't know when) --- src/declarative/qml/qmlsqldatabase.cpp | 7 +------ .../qmlecmascript/data/exceptionProducesWarning.qml | 2 +- .../declarative/qmlecmascript/tst_qmlecmascript.cpp | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 4fa63cb..684caa2 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -44,7 +44,7 @@ #include "qmlengine.h" #include "qmlengine_p.h" #include "qmlrefcount_p.h" -#include "qmlexpression_p.h" +#include "qmlengine_p.h" #include #include @@ -199,7 +199,6 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine * static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine * /*engine*/) { - qDebug() << QmlEngine::tr("executeSql called outside transaction()"); // XXX pending bug QTBUG-6507 THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()")); } @@ -319,10 +318,6 @@ static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, Q instance.setProperty(QLatin1String("executeSql"), engine->newFunction(qmlsqldatabase_executeSql_outsidetransaction)); if (engine->hasUncaughtException()) { - QmlError error; - QmlExpressionPrivate::exceptionToError(engine, error); - qWarning() << error; - engine->clearExceptions(); db.rollback(); } else { if (!db.commit()) diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml index 44722a9..acc3163 100644 --- a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml +++ b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml @@ -3,6 +3,6 @@ import Qt.test 1.0 MyQmlObject { Component.onCompleted: - { throw(123,"JS exception") } + { throw(new Error("JS exception")) } } diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 6f7832a..a153296 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -106,7 +106,8 @@ private slots: void signalTriggeredBindings(); void listProperties(); void exceptionClearsOnReeval(); - void exceptionProducesWarning(); + void exceptionSlotProducesWarning(); + void exceptionBindingProducesWarning(); void transientErrors(); void shutdownErrors(); void externalScript(); @@ -933,12 +934,24 @@ void tst_qmlecmascript::exceptionClearsOnReeval() QCOMPARE(object->property("test").toBool(), true); } -void tst_qmlecmascript::exceptionProducesWarning() +void tst_qmlecmascript::exceptionSlotProducesWarning() { QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning.qml")); QString url = component.url().toString(); - QString warning = "Expected error - QTBUG-6507"; + QString warning = component.url().toString() + ":6: Error: JS exception"; + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); +} + +void tst_qmlecmascript::exceptionBindingProducesWarning() +{ + QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning2.qml")); + QString url = component.url().toString(); + + QString warning = component.url().toString() + ":5: Error: JS exception"; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast(component.create()); -- cgit v0.12