diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-07-13 09:25:02 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-07-13 09:25:02 (GMT) |
commit | 425f9035d6309111cdc8f30e1fdb4995e96c38a6 (patch) | |
tree | def07997c8fc5c609c9b7fa5a648170c789464aa | |
parent | de07df9001586cc18ae267591359541b7ea494a0 (diff) | |
download | Qt-425f9035d6309111cdc8f30e1fdb4995e96c38a6.zip Qt-425f9035d6309111cdc8f30e1fdb4995e96c38a6.tar.gz Qt-425f9035d6309111cdc8f30e1fdb4995e96c38a6.tar.bz2 |
Fix line endings.
-rw-r--r-- | tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 24bc42b..ded29d7 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -938,49 +938,49 @@ void tst_QSqlTableModel::tableModifyWithBlank() model.setTable(qTableName("test4")); model.select(); - //generate a time stamp for the test. Add one second to the current time to make sure
- //it is different than the QSqlQuery test.
- QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate);
-
- //insert a new row, with column0 being the timestamp.
- //Should be equivalent to QSqlQuery INSERT INTO... command)
+ //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); QVERIFY_SQL(model, submitAll()); -
- //set a filter on the table so the only record we get is the one we just made
- //I could just do another setData command, but I want to make sure the TableModel
- //matches exactly what is stored in the database
+ + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row QVERIFY_SQL(model, select()); - //Make sure we only get one record, and that it is the one we just made
+ //Make sure we only get one record, and that it is the one we just made QCOMPARE(model.rowCount(), 1); //verify only one entry QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record - //At this point we know that the intial value (timestamp) was succsefully stored in the database
- //Attempt to modify the data in the new record
- //equivalent to query.exec("update test set column3="... command in direct test
- //set the data in the first column to "col1ModelData"
+ //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); - //do a quick check to make sure that the setData command properly set the value in the model
+ //do a quick check to make sure that the setData command properly set the value in the model QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); - //submit the changed data to the database
- //This is where I have been getting errors.
+ //submit the changed data to the database + //This is where I have been getting errors. QVERIFY_SQL(model, submitAll()); - //make sure the model has the most current data for our record
+ //make sure the model has the most current data for our record QVERIFY_SQL(model, select()); - //verify that our new record was the only record returned
+ //verify that our new record was the only record returned QCOMPARE(model.rowCount(), 1); - //And that the record returned is, in fact, our test record.
+ //And that the record returned is, in fact, our test record. QCOMPARE(model.record(0).value(0).toString(), timeString); - //Make sure the value of the first column matches what we set it to previously.
+ //Make sure the value of the first column matches what we set it to previously. QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } |