summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/sql
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-17 05:01:11 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-17 05:01:11 (GMT)
commit5edfb015ac0d8193dc1f455e7a04f6c9c0b3b013 (patch)
treecf366c030e0819893caa03125d8f7ebc86d77b1f /tests/auto/declarative/sql
parentf7a1e0a2ca7eec54966fb4c0d14ffa5e93731194 (diff)
downloadQt-5edfb015ac0d8193dc1f455e7a04f6c9c0b3b013.zip
Qt-5edfb015ac0d8193dc1f455e7a04f6c9c0b3b013.tar.gz
Qt-5edfb015ac0d8193dc1f455e7a04f6c9c0b3b013.tar.bz2
Test error reporting.
Diffstat (limited to 'tests/auto/declarative/sql')
-rw-r--r--tests/auto/declarative/sql/data/7a-error.js26
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp3
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();