diff options
-rw-r--r-- | tests/auto/declarative/sql/data/7a-error.js | 26 | ||||
-rw-r--r-- | tests/auto/declarative/sql/tst_sql.cpp | 3 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/declarative/sql/data/7a-error.js b/tests/auto/declarative/sql/data/7a-error.js new file mode 100644 index 0000000..0bb39ef --- /dev/null +++ b/tests/auto/declarative/sql/data/7a-error.js @@ -0,0 +1,26 @@ +var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000); +var r=0; + +db.transaction( + function(tx) { + tx.executeSql('SELECT * FROM NotExists', [], + function(tx, rs) { + r = "SHOULD NOT SUCCEED"; + }, + function(tx, error) { + if (error.message == "no such table: NotExists Unable to execute statement" // QML + || error.message == "no such table: NotExists") r="passed" // WebKit + else r="WRONG ERROR:"+error.message + } + ); + }, + function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message }, + function(tx, result) { if (r==0) r="SHOULD NOT SUCCEED2" } +); + + +function test() +{ + if (r == 0) r = "transaction_not_finished"; + return r; +} diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 973d7b1..a929aba 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -144,6 +144,7 @@ void tst_sql::testQml_data() QTest::newRow("iteration-index") << "data/4-iteration-index.js" << "passed" << 1 << true; // Some HTML5 documents say to use rows by index, others by item() function QTest::newRow("iteration-iterator") << "data/5-iteration-iterator.js" << "passed" << 1 << true; // As with previous, WebKit doesn't give an array QTest::newRow("iteration-efficient") << "data/6-iteration-efficient.js" << "passed" << 1 << true; // It's very inefficient to find the total number of results, here is a solution + QTest::newRow("error-a") << "data/7a-error.js" << "passed" << 1 << false; } void tst_sql::validateAgainstWebkit_data() @@ -177,7 +178,7 @@ void tst_sql::validateAgainstWebkit() webpage.mainFrame()->evaluateJavaScript(js); QTest::qWait(200); // WebKit db access is asynchronous QTRY_COMPARE(webpage.mainFrame()->evaluateJavaScript("test()").toString(),result); - QTest::qWait(200); // WebKit crashes if you quit it too fast + QTest::qWait(1000); // WebKit crashes if you quit it too fast QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin(); QList<QWebDatabase> dbs = origin.databases(); |