summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqlquery
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2009-11-05 07:26:06 (GMT)
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2009-11-05 07:26:06 (GMT)
commit7f7d4cdf01409283d32a6799c1f73663b8ec3ea1 (patch)
tree057102ed546240efc7e5e8054e150fecf0e14001 /tests/auto/qsqlquery
parentaa58293b57a05cd52b36ba14a05958dceb65c603 (diff)
parent91c09562ed9c6eb1bd3a4dbd84a8cc64647751ee (diff)
downloadQt-7f7d4cdf01409283d32a6799c1f73663b8ec3ea1.zip
Qt-7f7d4cdf01409283d32a6799c1f73663b8ec3ea1.tar.gz
Qt-7f7d4cdf01409283d32a6799c1f73663b8ec3ea1.tar.bz2
Merge branch '4.5' into 4.6
Conflicts: tests/auto/qsqlquery/tst_qsqlquery.cpp tests/auto/qtextlayout/tst_qtextlayout.cpp
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 4d9e50f..4264a70 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -193,9 +193,13 @@ private slots:
void sqlServerReturn0_data() { generic_data(); }
void sqlServerReturn0();
+
void QTBUG_551_data() { generic_data("QOCI"); }
void QTBUG_551();
+ void QTBUG_5251_data() { generic_data("QPSQL"); }
+ void QTBUG_5251();
+
private:
// returns all database connections
void generic_data(const QString &engine=QString());
@@ -2901,5 +2905,35 @@ void tst_QSqlQuery::QTBUG_551()
QCOMPARE(res_outLst[2].toString(), QLatin1String("3. Value is 2"));
}
+void tst_QSqlQuery::QTBUG_5251()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+
+ if (!db.driverName().startsWith( "QPSQL" )) return;
+
+ QSqlQuery q(db);
+ q.exec("DROP TABLE " + qTableName("timetest"));
+ QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("timetest") + " (t TIME)"));
+ QVERIFY_SQL(q, exec("INSERT INTO " + qTableName("timetest") + " VALUES ('1:2:3.666')"));
+
+ QSqlTableModel timetestModel(0,db);
+ timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit);
+ timetestModel.setTable(qTableName("timetest"));
+ QVERIFY_SQL(timetestModel, select());
+
+ QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666"));
+ QVERIFY_SQL(timetestModel,setData(timetestModel.index(0, 0), QTime(0,12,34,500)));
+ QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500"));
+ QVERIFY_SQL(timetestModel, submitAll());
+ QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500"));
+
+ QVERIFY_SQL(q, exec("UPDATE " + qTableName("timetest") + " SET t = '0:11:22.33'"));
+ QVERIFY_SQL(timetestModel, select());
+ QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330"));
+
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"