summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/sql/data
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-09-18 02:57:15 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-09-18 02:57:15 (GMT)
commit62615291477b6268263fad5c1f767d6291b541c4 (patch)
treebdd566135354472f6494b0cad264e324864da59e /tests/auto/declarative/sql/data
parentf2d5e83afcc30de4d77b30f90df6f82e53796d59 (diff)
downloadQt-62615291477b6268263fad5c1f767d6291b541c4.zip
Qt-62615291477b6268263fad5c1f767d6291b541c4.tar.gz
Qt-62615291477b6268263fad5c1f767d6291b541c4.tar.bz2
Make SqlDatabase testable and add a basic test.
Diffstat (limited to 'tests/auto/declarative/sql/data')
-rw-r--r--tests/auto/declarative/sql/data/test1.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/sql/data/test1.js b/tests/auto/declarative/sql/data/test1.js
new file mode 100644
index 0000000..2ae9988
--- /dev/null
+++ b/tests/auto/declarative/sql/data/test1.js
@@ -0,0 +1,18 @@
+var db;
+db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
+var r="testerror";
+
+// Asynchronous in WebKit, so must wait before calling test()
+db.transaction(function(tx) {
+ r = "passed";
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', [],
+ function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message });
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ],
+ function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message });
+}, function(tx, error) { r="TXFAILED: "+error.message }, function(tx, result) { if (r=="testerror") r="passed" });
+
+
+function test()
+{
+ return r;
+}