summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/sql
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/sql')
-rw-r--r--tests/auto/declarative/sql/data/error-creation.js12
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp5
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/declarative/sql/data/error-creation.js b/tests/auto/declarative/sql/data/error-creation.js
new file mode 100644
index 0000000..92245fd
--- /dev/null
+++ b/tests/auto/declarative/sql/data/error-creation.js
@@ -0,0 +1,12 @@
+function test() {
+ var r="transaction_not_finished";
+ try {
+ var db = openDatabaseSync("QmlTestDB-creation", "2.0", "Test database from Qt autotests", 1000000);
+ } catch (err) {
+ if (err.message == "SQL: database version mismatch")
+ 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 6fd4189..4296279 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -141,6 +141,8 @@ void tst_sql::testQml_data()
// Each test should use a newly named DB to avoid inter-test dependencies
QTest::newRow("creation") << "data/creation.js";
QTest::newRow("creation-a") << "data/creation-a.js";
+ QTest::newRow("creation") << "data/creation.js";
+ QTest::newRow("error-creation") << "data/error-creation.js"; // re-uses above DB
QTest::newRow("changeversion") << "data/changeversion.js";
QTest::newRow("readonly") << "data/readonly.js";
QTest::newRow("readonly-error") << "data/readonly-error.js";
@@ -151,7 +153,7 @@ void tst_sql::testQml_data()
QTest::newRow("error-a") << "data/error-a.js";
QTest::newRow("error-notransaction") << "data/error-notransaction.js";
QTest::newRow("reopen1") << "data/reopen1.js";
- QTest::newRow("reopen2") << "data/reopen2.js";
+ QTest::newRow("reopen2") << "data/reopen2.js"; // re-uses above DB
// If you add a test, you should usually use a new database in the
// test - in which case increment total_databases_created_by_tests above.
@@ -208,6 +210,7 @@ void tst_sql::testQml_cleanopen_data()
QTest::addColumn<QString>("jsfile"); // The input file
QTest::newRow("reopen1") << "data/reopen1.js";
QTest::newRow("reopen2") << "data/reopen2.js";
+ QTest::newRow("error-creation") << "data/error-creation.js"; // re-uses creation DB
}
void tst_sql::testQml_cleanopen()