summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-12-04 04:53:08 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-12-04 04:53:08 (GMT)
commit80fe1a635d4bee97f5e6b15be34b59c7536ae54d (patch)
treec8ca810059a7b6c5b0619648c6708036340b6682 /tests/auto
parent69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250 (diff)
downloadQt-80fe1a635d4bee97f5e6b15be34b59c7536ae54d.zip
Qt-80fe1a635d4bee97f5e6b15be34b59c7536ae54d.tar.gz
Qt-80fe1a635d4bee97f5e6b15be34b59c7536ae54d.tar.bz2
Test for 69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/sql/data/error-outsidetransaction.js17
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp1
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/sql/data/error-outsidetransaction.js b/tests/auto/declarative/sql/data/error-outsidetransaction.js
new file mode 100644
index 0000000..a7af3bd
--- /dev/null
+++ b/tests/auto/declarative/sql/data/error-outsidetransaction.js
@@ -0,0 +1,17 @@
+function test() {
+ var db = openDatabaseSync("QmlTestDB-data/error-notransaction", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+ var v;
+
+ try {
+ db.transaction(function(tx) { v = tx });
+ v.executeSql("SELECT 'bad'")
+ } catch (err) {
+ if (err.message == "executeSql called outside transaction()")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
index 4296279..1e4e6f8 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -152,6 +152,7 @@ void tst_sql::testQml_data()
QTest::newRow("iteration-forwardonly") << "data/iteration-forwardonly.js";
QTest::newRow("error-a") << "data/error-a.js";
QTest::newRow("error-notransaction") << "data/error-notransaction.js";
+ QTest::newRow("error-outsidetransaction") << "data/error-outsidetransaction.js"; // reuse above
QTest::newRow("reopen1") << "data/reopen1.js";
QTest::newRow("reopen2") << "data/reopen2.js"; // re-uses above DB