From 3f095e957f27744c9c7a79679e35bfcc9db161fd Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 13:15:11 +1000 Subject: Qt has more stuff in rich text now. --- tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index 96df0a5..66ecff6 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -173,6 +173,7 @@ void tst_qmlgraphicstextedit::text() actual.replace(QRegExp(".*]*>"),""); actual.replace(QRegExp("(<[^>]*>)+"),"<>"); expected.replace(QRegExp("(<[^>]*>)+"),"<>"); + expected = "<> <> <> " + expected; QCOMPARE(actual.simplified(),expected.simplified()); } } -- cgit v0.12 From d5d90d1518f9767874a2a22733ce7753aef328d2 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 13:50:48 +1000 Subject: Don't put necessary code in Q_ASSERT (test failed in release mode) --- tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 543ba3f..c244030 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -90,8 +90,8 @@ static QString strippedHtml(QString html) static QString fileContents(const QString& filename) { QFile file(filename); - Q_ASSERT(file.open(QIODevice::ReadOnly)); - return file.readAll(); + file.open(QIODevice::ReadOnly); + return QString::fromUtf8(file.readAll()); } -- cgit v0.12 From 39949590be794ec5d50a24b87c46d2771b67852b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 14:32:50 +1000 Subject: avoid false pass --- tests/auto/declarative/sql/data/readonly-error.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/declarative/sql/data/readonly-error.js b/tests/auto/declarative/sql/data/readonly-error.js index ab82712..69ec67f 100644 --- a/tests/auto/declarative/sql/data/readonly-error.js +++ b/tests/auto/declarative/sql/data/readonly-error.js @@ -6,7 +6,6 @@ function test() { function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); - r = "passed"; } ); -- cgit v0.12 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 From 349f93700f58611bc7f2f244c4f19fb4e8c986e4 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 15:03:12 +1000 Subject: document test weakness --- tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp index e74d1c5..dc48195 100644 --- a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp +++ b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp @@ -57,6 +57,12 @@ public: tst_xmlhttprequest() {} private slots: + void initTestCase() { + if (QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')) != QLatin1String("en-US")) { + qWarning() << "Test will fail unless LANG is en_US"; + } + } + void domExceptionCodes(); void staticStateValues(); void instanceStateValues(); -- cgit v0.12 From 8c7dfd168d9eb42a75b79d8b448902b0df490419 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 11 Jan 2010 15:03:30 +1000 Subject: report error better --- tests/auto/declarative/shared/testhttpserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp index c7b7f25..215f3c3 100644 --- a/tests/auto/declarative/shared/testhttpserver.cpp +++ b/tests/auto/declarative/shared/testhttpserver.cpp @@ -206,7 +206,7 @@ void TestHTTPServer::readyRead() continue; else { QByteArray data = ba.mid(ii); - qWarning() << "TestHTTPServer: Unexpected data" << data; + qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData; m_hasFailed = true; socket->disconnect(); return; -- cgit v0.12