diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-26 23:34:47 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-26 23:34:47 (GMT) |
commit | c9f0c578bbaf73211ad4729e1496e53867a641c9 (patch) | |
tree | b73534ee0487e485d4336907465550688f5b2ad1 /tests/auto | |
parent | aa19362a14ce20bde2ada61edf7b946019845ed2 (diff) | |
parent | 2c60a4f67f9fb02f3b711fe749b2f293a07b4e02 (diff) | |
download | Qt-c9f0c578bbaf73211ad4729e1496e53867a641c9.zip Qt-c9f0c578bbaf73211ad4729e1496e53867a641c9.tar.gz Qt-c9f0c578bbaf73211ad4729e1496e53867a641c9.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Make it possible to update a related table after an external update
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index cc4ab67..5f1a621 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -92,6 +92,7 @@ private slots: void escapedTableName(); void whiteSpaceInIdentifiers(); void psqlSchemaTest(); + void selectAfterUpdate(); private: void dropTestTables( QSqlDatabase db ); @@ -1467,5 +1468,27 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() QVERIFY_SQL(model, select()); } +void tst_QSqlRelationalTableModel::selectAfterUpdate() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlRelationalTableModel model(0, db); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); + QVERIFY_SQL(model, select()); + QVERIFY(model.relationModel(2)->rowCount() == 2); + { + QSqlQuery q(db); + QVERIFY_SQL(q, exec("insert into " + reltest2 + " values(3, 'mrs')")); + model.relationModel(2)->select(); + } + QVERIFY(model.relationModel(2)->rowCount() == 3); + QVERIFY(model.setData(model.index(0,2), 3)); + QVERIFY(model.submitAll()); + QCOMPARE(model.data(model.index(0,2)), QVariant("mrs")); +} + QTEST_MAIN(tst_QSqlRelationalTableModel) #include "tst_qsqlrelationaltablemodel.moc" |