diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-19 05:34:42 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-19 05:34:42 (GMT) |
commit | 2b383690c17e1f0f58ad0061fda9d51ff4fe469a (patch) | |
tree | 70d39a12f5f13aeebd9d126bd43eadbae633dd75 /tests/auto/declarative/sql | |
parent | 8f6453c94a9fb146b3f44f66677a3d4579b2583b (diff) | |
download | Qt-2b383690c17e1f0f58ad0061fda9d51ff4fe469a.zip Qt-2b383690c17e1f0f58ad0061fda9d51ff4fe469a.tar.gz Qt-2b383690c17e1f0f58ad0061fda9d51ff4fe469a.tar.bz2 |
Test new creation APIs.
Diffstat (limited to 'tests/auto/declarative/sql')
-rw-r--r-- | tests/auto/declarative/sql/data/1a-creation.js | 25 | ||||
-rw-r--r-- | tests/auto/declarative/sql/data/1b-creation.js | 22 | ||||
-rw-r--r-- | tests/auto/declarative/sql/tst_sql.cpp | 14 |
3 files changed, 55 insertions, 6 deletions
diff --git a/tests/auto/declarative/sql/data/1a-creation.js b/tests/auto/declarative/sql/data/1a-creation.js new file mode 100644 index 0000000..5ff2c73 --- /dev/null +++ b/tests/auto/declarative/sql/data/1a-creation.js @@ -0,0 +1,25 @@ +function test() { + var r=0; + + var db = openDatabaseSync("QmlTestDB", "", "Test database from Qt autotests", 1000000, + function(db) { + r = "FAILED: should have already been created"; + db.transaction(function(tx){ + tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)'); + }) + }); + + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + if (r==0) { + if (rs.rows.length==1) // created in 1-creation + r = "passed"; + else + r = "FAILED"; + } + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/data/1b-creation.js b/tests/auto/declarative/sql/data/1b-creation.js new file mode 100644 index 0000000..e02c7f0 --- /dev/null +++ b/tests/auto/declarative/sql/data/1b-creation.js @@ -0,0 +1,22 @@ +function test() { + var db = openDatabaseSync("QmlTestDB-b", "", "Test B database from Qt autotests", 1000000, + function(db) { + db.transaction(function(tx){ + tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)'); + }) + }); + var r; + + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + if (rs.rows.length == 0) + r = "passed"; + else + r = "FAILED: got results:" + rs.rows.length + } + ); + + return r; +} + diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index cbd14ab..ceab74b 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -138,13 +138,15 @@ void tst_sql::testQml_data() QTest::addColumn<bool>("qmlextension"); // Things WebKit can't do QTest::newRow("creation") << "data/1-creation.js" << "passed" << 1 << false; + QTest::newRow("creation-a") << "data/1a-creation.js" << "passed" << 1 << false; QTest::newRow("selection") << "data/2-selection.js" << "passed" << 1 << false; - QTest::newRow("selection-bindnames") << "data/2-selection-bindnames.js" << "passed" << 1 << true; // WebKit somehow breaks named parameters - QTest::newRow("iteration-item-function") << "data/3-iteration-item-function.js" << "passed" << 1 << false; - 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; + QTest::newRow("creation-b") << "data/1b-creation.js" << "passed" << 2 << false; + QTest::newRow("selection-bindnames") << "data/2-selection-bindnames.js" << "passed" << 2 << true; // WebKit somehow breaks named parameters + QTest::newRow("iteration-item-function") << "data/3-iteration-item-function.js" << "passed" << 2 << false; + QTest::newRow("iteration-index") << "data/4-iteration-index.js" << "passed" << 2 << true; // Some HTML5 documents say to use rows by index, others by item() function + QTest::newRow("iteration-iterator") << "data/5-iteration-iterator.js" << "passed" << 2 << true; // As with previous, WebKit doesn't give an array + QTest::newRow("iteration-efficient") << "data/6-iteration-efficient.js" << "passed" << 2 << 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" << 2 << false; } void tst_sql::validateAgainstWebkit_data() |