aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlsqldatabase
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-10 10:06:39 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-10 10:06:39 +0200
commit0932a59971f606f07b41da19f3974d51b7008180 (patch)
tree191aab5e88e7b4ddf3724dcbf3b8229512e433f2 /tests/auto/qml/qqmlsqldatabase
parentaca40a8361996e22ec4f020b803404031a0f0d76 (diff)
parentcd0efef04bd45eca6cc72b5a000e4e5586153290 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Part of 0e053528 was reverted in the merge, about lastTimestamp. It will be applied later in separate commit. qmltest::shadersource-dynamic-sourceobject::test_endresult() was blacklisted on linux. Conflicts: .qmake.conf tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp tests/auto/qmltest/BLACKLIST tests/auto/qmltest/qmltest.pro Task-number: QTBUG-53590 Task-number: QTBUG-53971 Change-Id: I48af90b49a3c7b29de16f4178a04807f8bc05130
Diffstat (limited to 'tests/auto/qml/qqmlsqldatabase')
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/nullvalues.js24
-rw-r--r--tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp3
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js b/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js
new file mode 100644
index 0000000000..322a7aea03
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js
@@ -0,0 +1,24 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-nullvalues", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS NullValues(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO NullValues VALUES(?, ?)', [ 'hello', null ]);
+ var firstRow = tx.executeSql("SELECT * FROM NullValues").rows.item(0);
+ if (firstRow.salutation !== "hello")
+ return
+ if (firstRow.salutee === "") {
+ r = "wrong_data_type"
+ return
+ }
+ if (firstRow.salutee === null)
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
index b1e5cc4e7a..e16bfb08a2 100644
--- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
+++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
@@ -122,7 +122,7 @@ void tst_qqmlsqldatabase::checkDatabasePath()
QVERIFY(engine->offlineStoragePath().contains("OfflineStorage"));
}
-static const int total_databases_created_by_tests = 12;
+static const int total_databases_created_by_tests = 13;
void tst_qqmlsqldatabase::testQml_data()
{
QTest::addColumn<QString>("jsfile"); // The input file
@@ -144,6 +144,7 @@ void tst_qqmlsqldatabase::testQml_data()
QTest::newRow("error-outsidetransaction") << "error-outsidetransaction.js"; // reuse above
QTest::newRow("reopen1") << "reopen1.js";
QTest::newRow("reopen2") << "reopen2.js"; // re-uses above DB
+ QTest::newRow("null-values") << "nullvalues.js";
// 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.