summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql/models
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/sql/models')
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp38
-rw-r--r--tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp2
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp36
3 files changed, 38 insertions, 38 deletions
diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
index 8b7476b3e7..202fc1080c 100644
--- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -202,7 +202,7 @@ void tst_QSqlQueryModel::removeColumn()
QCOMPARE(model.columnCount(), 3);
QVERIFY(model.removeColumn(0));
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(0).at(1).toInt(), 0);
QCOMPARE(spy.at(0).at(2).toInt(), 0);
@@ -232,7 +232,7 @@ void tst_QSqlQueryModel::removeColumn()
QVERIFY(model.removeColumn(2));
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(1).at(1).toInt(), 2);
QCOMPARE(spy.at(1).at(2).toInt(), 2);
@@ -245,7 +245,7 @@ void tst_QSqlQueryModel::removeColumn()
QVERIFY(model.removeColumn(1));
- QCOMPARE(spy.count(), 3);
+ QCOMPARE(spy.size(), 3);
QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(2).at(1).toInt(), 1);
QCOMPARE(spy.at(2).at(2).toInt(), 1);
@@ -259,7 +259,7 @@ void tst_QSqlQueryModel::removeColumn()
QVERIFY(model.removeColumn(0));
- QCOMPARE(spy.count(), 4);
+ QCOMPARE(spy.size(), 4);
QVERIFY(*(QModelIndex *)spy.at(3).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(3).at(1).toInt(), 0);
QCOMPARE(spy.at(3).at(2).toInt(), 0);
@@ -301,7 +301,7 @@ void tst_QSqlQueryModel::insertColumn()
QVERIFY(model.insertColumn(1));
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(0).at(1).toInt(), 1);
QCOMPARE(spy.at(0).at(2).toInt(), 1);
@@ -330,7 +330,7 @@ void tst_QSqlQueryModel::insertColumn()
QVERIFY(model.insertColumn(0));
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(1).at(1).toInt(), 0);
QCOMPARE(spy.at(1).at(2).toInt(), 0);
@@ -345,7 +345,7 @@ void tst_QSqlQueryModel::insertColumn()
QVERIFY(!model.insertColumn(6));
QVERIFY(model.insertColumn(5));
- QCOMPARE(spy.count(), 3);
+ QCOMPARE(spy.size(), 3);
QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex());
QCOMPARE(spy.at(2).at(1).toInt(), 5);
QCOMPARE(spy.at(2).at(2).toInt(), 5);
@@ -424,7 +424,7 @@ void tst_QSqlQueryModel::setHeaderData()
QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar"));
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar"));
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(qvariant_cast<Qt::Orientation>(spy.value(0).value(0)), Qt::Horizontal);
QCOMPARE(spy.value(0).value(1).toInt(), 2);
QCOMPARE(spy.value(0).value(2).toInt(), 2);
@@ -452,8 +452,8 @@ void tst_QSqlQueryModel::fetchMore()
model.setQuery(QSqlQuery("select * from " + qTableName("many", __FILE__, db), db));
int rowCount = model.rowCount();
- QCOMPARE(modelAboutToBeResetSpy.count(), 1);
- QCOMPARE(modelResetSpy.count(), 1);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 1);
+ QCOMPARE(modelResetSpy.size(), 1);
// If the driver doesn't return the query size fetchMore() causes the
// model to grow and new signals are emitted
@@ -499,11 +499,11 @@ void tst_QSqlQueryModel::withSortFilterProxyModel()
QCOMPARE(proxy.rowCount(), 511);
// setQuery() resets the model accompanied by begin and end signals
- QCOMPARE(modelAboutToBeResetSpy.count(), 1);
- QCOMPARE(modelResetSpy.count(), 1);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 1);
+ QCOMPARE(modelResetSpy.size(), 1);
// The call to scrollToBottom() forces the model to fetch additional rows.
- QCOMPARE(modelRowsInsertedSpy.count(), 1);
+ QCOMPARE(modelRowsInsertedSpy.size(), 1);
QCOMPARE(modelRowsInsertedSpy.value(0).value(1).toInt(), 256);
QCOMPARE(modelRowsInsertedSpy.value(0).value(2).toInt(), 510);
}
@@ -523,14 +523,14 @@ void tst_QSqlQueryModel::setQuerySignalEmission()
// First select, the model was empty and no rows had to be removed, but model resets anyway.
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db));
- QCOMPARE(modelAboutToBeResetSpy.count(), 1);
- QCOMPARE(modelResetSpy.count(), 1);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 1);
+ QCOMPARE(modelResetSpy.size(), 1);
// Second select, the model wasn't empty and two rows had to be removed!
// setQuery() resets the model accompanied by begin and end signals
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db));
- QCOMPARE(modelAboutToBeResetSpy.count(), 2);
- QCOMPARE(modelResetSpy.count(), 2);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 2);
+ QCOMPARE(modelResetSpy.size(), 2);
}
// For task 170783: When the query's result set is empty no rows should be inserted,
@@ -549,8 +549,8 @@ void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet()
QSqlQuery query(db);
QVERIFY_SQL(query, exec("SELECT * FROM " + qTableName("test", __FILE__, db) + " where 0 = 1"));
model.setQuery(std::move(query));
- QCOMPARE(modelRowsAboutToBeInsertedSpy.count(), 0);
- QCOMPARE(modelRowsInsertedSpy.count(), 0);
+ QCOMPARE(modelRowsAboutToBeInsertedSpy.size(), 0);
+ QCOMPARE(modelRowsInsertedSpy.size(), 0);
}
class NestedResetsTest: public QSqlQueryModel
diff --git a/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp b/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp
index 5c49600b8f..1a9f8310c9 100644
--- a/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp
+++ b/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp
@@ -146,7 +146,7 @@ void tst_QSqlRelationalDelegate::comboBoxEditor()
tv.setCurrentIndex(index);
tv.edit(index);
QList<QComboBox*> comboBoxes = tv.viewport()->findChildren<QComboBox *>();
- QCOMPARE(comboBoxes.count(), 1);
+ QCOMPARE(comboBoxes.size(), 1);
QComboBox *editor = comboBoxes.at(0);
QCOMPARE(editor->currentText(), "herr");
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index ebddefb5fd..ece99efa0a 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -148,7 +148,7 @@ tst_QSqlTableModel::~tst_QSqlTableModel()
void tst_QSqlTableModel::dropTestTables()
{
- for (int i = 0; i < dbs.dbNames.count(); ++i) {
+ for (int i = 0; i < dbs.dbNames.size(); ++i) {
QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i));
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
QSqlQuery q(db);
@@ -177,7 +177,7 @@ void tst_QSqlTableModel::dropTestTables()
void tst_QSqlTableModel::createTestTables()
{
- for (int i = 0; i < dbs.dbNames.count(); ++i) {
+ for (int i = 0; i < dbs.dbNames.size(); ++i) {
QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i));
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
QSqlQuery q(db);
@@ -207,7 +207,7 @@ void tst_QSqlTableModel::createTestTables()
void tst_QSqlTableModel::repopulateTestTables()
{
- for (int i = 0; i < dbs.dbNames.count(); ++i) {
+ for (int i = 0; i < dbs.dbNames.size(); ++i) {
QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i));
QSqlQuery q(db);
const auto test = qTableName("test1", __FILE__, db);
@@ -602,8 +602,8 @@ void tst_QSqlTableModel::setRecord()
// dataChanged() emitted by setData() for each *changed* column
if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) {
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(0).count(), 2);
+ QCOMPARE(spy.size(), 2);
+ QCOMPARE(spy.at(0).size(), 2);
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(1).at(0)), model.index(i, 2));
@@ -614,10 +614,10 @@ void tst_QSqlTableModel::setRecord()
else {
if ((QSqlTableModel::EditStrategy)submitpolicy != QSqlTableModel::OnManualSubmit)
// dataChanged() also emitted by selectRow()
- QCOMPARE(spy.count(), 3);
+ QCOMPARE(spy.size(), 3);
else
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(0).count(), 2);
+ QCOMPARE(spy.size(), 2);
+ QCOMPARE(spy.at(0).size(), 2);
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(1).at(0)), model.index(i, 2));
@@ -1092,7 +1092,7 @@ void tst_QSqlTableModel::removeRow()
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
QVERIFY(model.removeRow(1));
- QCOMPARE(headerDataChangedSpy.count(), 1);
+ QCOMPARE(headerDataChangedSpy.size(), 1);
QCOMPARE(*static_cast<const Qt::Orientation *>(headerDataChangedSpy.at(0).value(0).constData()), Qt::Vertical);
QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1);
QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 1);
@@ -1112,7 +1112,7 @@ void tst_QSqlTableModel::removeRow()
headerDataChangedSpy.clear();
QVERIFY(model.removeRow(1));
- QCOMPARE(headerDataChangedSpy.count(), 1);
+ QCOMPARE(headerDataChangedSpy.size(), 1);
QCOMPARE(model.rowCount(), 3);
QVERIFY_SQL(model, select());
@@ -1148,7 +1148,7 @@ void tst_QSqlTableModel::removeRows()
QVERIFY_SQL(model, removeRows(0, 1));
QVERIFY_SQL(model, removeRows(1, 1));
- QCOMPARE(beforeDeleteSpy.count(), 2);
+ QCOMPARE(beforeDeleteSpy.size(), 2);
QCOMPARE(beforeDeleteSpy.at(0).at(0).toInt(), 0);
QCOMPARE(beforeDeleteSpy.at(1).at(0).toInt(), 1);
// deleted rows shown as empty until select
@@ -1179,15 +1179,15 @@ void tst_QSqlTableModel::removeRows()
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
QVERIFY(model.removeRows(0, 2, QModelIndex()));
- QCOMPARE(headerDataChangedSpy.count(), 2);
+ QCOMPARE(headerDataChangedSpy.size(), 2);
QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1);
QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 1);
QCOMPARE(headerDataChangedSpy.at(1).at(1).toInt(), 0);
QCOMPARE(headerDataChangedSpy.at(1).at(2).toInt(), 0);
QCOMPARE(model.rowCount(), 3);
- QCOMPARE(beforeDeleteSpy.count(), 0);
+ QCOMPARE(beforeDeleteSpy.size(), 0);
QVERIFY(model.submitAll());
- QCOMPARE(beforeDeleteSpy.count(), 2);
+ QCOMPARE(beforeDeleteSpy.size(), 2);
QCOMPARE(beforeDeleteSpy.at(0).at(0).toInt(), 0);
QCOMPARE(beforeDeleteSpy.at(1).at(0).toInt(), 1);
QCOMPARE(model.rowCount(), 1);
@@ -1784,8 +1784,8 @@ void tst_QSqlTableModel::setFilter()
model.setFilter("id = 2");
// check the signals
- QCOMPARE(modelAboutToBeResetSpy.count(), 1);
- QCOMPARE(modelResetSpy.count(), 1);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 1);
+ QCOMPARE(modelResetSpy.size(), 1);
QCOMPARE(model.rowCount(), 1);
QCOMPARE(model.data(model.index(0, 0)).toInt(), 2);
@@ -1928,8 +1928,8 @@ void tst_QSqlTableModel::insertRecordsInLoop()
model.submitAll(); // submitAll() calls select() which clears and repopulates the table
// model emits reset signals
- QCOMPARE(modelAboutToBeResetSpy.count(), 1);
- QCOMPARE(modelResetSpy.count(), 1);
+ QCOMPARE(modelAboutToBeResetSpy.size(), 1);
+ QCOMPARE(modelResetSpy.size(), 1);
QCOMPARE(model.rowCount(), 13);
QCOMPARE(model.columnCount(), 3);