summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-17 03:55:35 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-17 03:55:35 (GMT)
commitf7a1e0a2ca7eec54966fb4c0d14ffa5e93731194 (patch)
treeb9bacdb9a9c25c2cb83a469231699fa6f8893a2e /tests
parentf1efdb342224cfb1e22b55ae4c704635edbbf46a (diff)
downloadQt-f7a1e0a2ca7eec54966fb4c0d14ffa5e93731194.zip
Qt-f7a1e0a2ca7eec54966fb4c0d14ffa5e93731194.tar.gz
Qt-f7a1e0a2ca7eec54966fb4c0d14ffa5e93731194.tar.bz2
test more
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/sql/data/2-selection-bindnames.js24
-rw-r--r--tests/auto/declarative/sql/data/6-iteration-efficient.js6
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp7
3 files changed, 33 insertions, 4 deletions
diff --git a/tests/auto/declarative/sql/data/2-selection-bindnames.js b/tests/auto/declarative/sql/data/2-selection-bindnames.js
new file mode 100644
index 0000000..c00acc14
--- /dev/null
+++ b/tests/auto/declarative/sql/data/2-selection-bindnames.js
@@ -0,0 +1,24 @@
+var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
+var r=0;
+
+db.transaction(
+ function(tx) {
+ tx.executeSql('SELECT * FROM Greeting WHERE salutation=:p2 AND salutee=:p1', {':p1':'world', ':p2':'hello'},
+ function(tx, rs) {
+ if ( rs.rows.length != 4 ) {
+ if (r==0) r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows.item(0)+rs.rows.item(1)
+ }
+ },
+ function(tx, error) { if (r==0) r="SELECT FAILED: "+error.message }
+ );
+ },
+ function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message },
+ function(tx, result) { if (r==0) r="passed" }
+);
+
+
+function test()
+{
+ if (r == 0) r = "transaction_not_finished";
+ return r;
+}
diff --git a/tests/auto/declarative/sql/data/6-iteration-efficient.js b/tests/auto/declarative/sql/data/6-iteration-efficient.js
index 2222b8a..6711fb0 100644
--- a/tests/auto/declarative/sql/data/6-iteration-efficient.js
+++ b/tests/auto/declarative/sql/data/6-iteration-efficient.js
@@ -1,12 +1,16 @@
var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
var r=0;
+var fbefore="FORWARD WRONG"
+var fafter="FORWARD WRONG"
db.transaction(
function(tx) {
tx.executeSql('SELECT * FROM Greeting', [],
function(tx, rs) {
var r1=""
+ if (!rs.rows.forwardOnly) fbefore=""
rs.rows.forwardOnly = true;
+ if (rs.rows.forwardOnly) fafter="";
for(var i=0; rs.rows[i]; ++i) {
r1 += rs.rows[i].salutation + ", " + rs.rows[i].salutee + ";"
}
@@ -17,7 +21,7 @@ db.transaction(
);
},
function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message },
- function(tx, result) { if (r==0) r="passed" }
+ function(tx, result) { if (r==0) r=fbefore+"passed"+fafter }
);
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
index e4f497c..973d7b1 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -139,10 +139,11 @@ void tst_sql::testQml_data()
QTest::newRow("creation") << "data/1-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;
- QTest::newRow("iteration-iterator") << "data/5-iteration-iterator.js" << "passed" << 1 << true;
- QTest::newRow("iteration-efficient") << "data/6-iteration-efficient.js" << "passed" << 1 << true;
+ 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
}
void tst_sql::validateAgainstWebkit_data()