summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/itemmodels/qitemmodel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/itemmodels/qitemmodel')
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt21
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp82
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro4
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp140
4 files changed, 89 insertions, 158 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt
new file mode 100644
index 0000000000..57d9ba4913
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_qitemmodel Test:
+#####################################################################
+
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qitemmodel LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
+qt_internal_add_test(tst_qitemmodel
+ SOURCES
+ tst_qitemmodel.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::Sql
+ Qt::Widgets
+)
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
index d61d45bc52..b2d507875d 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
@@ -1,33 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+
+#include <QTest>
#include <QtCore/QCoreApplication>
#include <QtSql/QtSql>
#include <QtWidgets/QtWidgets>
@@ -83,16 +58,13 @@ private:
Add new tests, they can be the same model, but in a different state.
The name of the model is passed to createModel
- If readOnly is true the remove tests will be skipped. Example: QDirModel is disabled.
- If createModel returns an empty model. Example: QDirModel does not
+ If readOnly is true the remove tests will be skipped. Example: QSqlQueryModel is disabled.
+ If createModel returns an empty model.
*/
ModelsToTest::ModelsToTest()
{
setupDatabase();
-#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
- tests.append(test("QDirModel", ReadOnly, HasData));
-#endif
tests.append(test("QStringListModel", ReadWrite, HasData));
tests.append(test("QStringListModelEmpty", ReadWrite, Empty));
@@ -145,14 +117,14 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType)
if (modelType == "QSortFilterProxyModelEmpty") {
QSortFilterProxyModel *model = new QSortFilterProxyModel;
- QStandardItemModel *standardItemModel = new QStandardItemModel;
+ QStandardItemModel *standardItemModel = new QStandardItemModel(model);
model->setSourceModel(standardItemModel);
return model;
}
if (modelType == "QSortFilterProxyModelRegExp") {
QSortFilterProxyModel *model = new QSortFilterProxyModel;
- QStandardItemModel *standardItemModel = new QStandardItemModel;
+ QStandardItemModel *standardItemModel = new QStandardItemModel(model);
model->setSourceModel(standardItemModel);
populateTestArea(model);
model->setFilterRegularExpression(QRegularExpression("(^$|I.*)"));
@@ -161,23 +133,12 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType)
if (modelType == "QSortFilterProxyModel") {
QSortFilterProxyModel *model = new QSortFilterProxyModel;
- QStandardItemModel *standardItemModel = new QStandardItemModel;
+ QStandardItemModel *standardItemModel = new QStandardItemModel(model);
model->setSourceModel(standardItemModel);
populateTestArea(model);
return model;
}
-#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (modelType == "QDirModel") {
- QDirModel *model = new QDirModel();
- model->setReadOnly(false);
- return model;
- }
-QT_WARNING_POP
-#endif
-
if (modelType == "QSqlQueryModel") {
QSqlQueryModel *model = new QSqlQueryModel();
populateTestArea(model);
@@ -294,25 +255,6 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
return returnIndex;
}
-#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
- if (QDirModel *dirModel = qobject_cast<QDirModel *>(model)) {
- m_dirModelTempDir.reset(new QTemporaryDir);
- if (!m_dirModelTempDir->isValid())
- qFatal("Cannot create temporary directory \"%s\": %s",
- qPrintable(QDir::toNativeSeparators(m_dirModelTempDir->path())),
- qPrintable(m_dirModelTempDir->errorString()));
-
- QDir tempDir(m_dirModelTempDir->path());
- for (int i = 0; i < 26; ++i) {
- const QString subdir = QLatin1String("foo_") + QString::number(i);
- if (!tempDir.mkdir(subdir))
- qFatal("Cannot create directory %s",
- qPrintable(QDir::toNativeSeparators(tempDir.path() + QLatin1Char('/') +subdir)));
- }
- return dirModel->index(tempDir.path());
- }
-#endif // QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
-
if (QSqlQueryModel *queryModel = qobject_cast<QSqlQueryModel *>(model)) {
QSqlQuery q;
q.exec("CREATE TABLE test(id int primary key, name varchar(30))");
@@ -370,10 +312,6 @@ void ModelsToTest::cleanupTestArea(QAbstractItemModel *model)
{
if (qobject_cast<QSqlQueryModel *>(model))
QSqlQuery q("DROP TABLE test");
-#if QT_CONFIG(dirmodel) && QT_DEPRECATED_SINCE(5, 15)
- if (qobject_cast<QDirModel *>(model))
- m_dirModelTempDir.reset();
-#endif
}
void ModelsToTest::setupDatabase()
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro b/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro
deleted file mode 100644
index ff21d6afa5..0000000000
--- a/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qitemmodel
-QT += widgets sql testlib
-SOURCES = tst_qitemmodel.cpp
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
index b9deb7b6a9..b1f91fe9a3 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QTest>
+#include <QSignalSpy>
#include <QtCore/QCoreApplication>
#include <qdebug.h>
#include "modelstotest.cpp"
@@ -611,7 +587,7 @@ void tst_QItemModel::setData()
QVERIFY(currentModel);
QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged);
QVERIFY(spy.isValid());
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QFETCH(bool, isEmpty);
if (isEmpty)
@@ -635,7 +611,7 @@ void tst_QItemModel::setData()
// Changing the text shouldn't change the layout, parent, pointer etc.
QModelIndex changedIndex = currentModel->index(0, 0, topIndex);
QCOMPARE(changedIndex, index);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
}
void tst_QItemModel::setHeaderData_data()
@@ -685,7 +661,7 @@ void tst_QItemModel::setHeaderData()
++signalCount;
}
}
- QCOMPARE(spy.count(), signalCount);
+ QCOMPARE(spy.size(), signalCount);
}
void tst_QItemModel::sort_data()
@@ -716,7 +692,7 @@ void tst_QItemModel::sort()
for (int i=-1; i < 10; ++i){
currentModel->sort(i);
if (index != currentModel->index(0, 0, topIndex)){
- QVERIFY(spy.count() > 0);
+ QVERIFY(spy.size() > 0);
index = currentModel->index(0, 0, topIndex);
spy.clear();
}
@@ -882,7 +858,7 @@ void tst_QItemModel::remove()
if (shouldSucceed && dyingIndex.isValid())
QCOMPARE(dyingIndex.row(), start + 1);
- if (rowsAboutToBeRemovedSpy.count() > 0){
+ if (rowsAboutToBeRemovedSpy.size() > 0){
QList<QVariant> arguments = rowsAboutToBeRemovedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -892,7 +868,7 @@ void tst_QItemModel::remove()
QVERIFY(parentOfRemoved == parent);
}
- if (rowsRemovedSpy.count() > 0){
+ if (rowsRemovedSpy.size() > 0){
QList<QVariant> arguments = rowsRemovedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -903,26 +879,26 @@ void tst_QItemModel::remove()
}
// Only the row signals should have been emitted
- if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >=1 ){
- QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0);
- QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0);
- QCOMPARE(columnsRemovedSpy.count(), 0);
- QCOMPARE(rowsRemovedSpy.count(), 0);
+ if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >=1 ){
+ QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0);
+ QCOMPARE(rowsAboutToBeRemovedSpy.size(), 0);
+ QCOMPARE(columnsRemovedSpy.size(), 0);
+ QCOMPARE(rowsRemovedSpy.size(), 0);
}
else {
- QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0);
- QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals);
- QCOMPARE(columnsRemovedSpy.count(), 0);
- QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals);
+ QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0);
+ QCOMPARE(rowsAboutToBeRemovedSpy.size(), numberOfRowsAboutToBeRemovedSignals);
+ QCOMPARE(columnsRemovedSpy.size(), 0);
+ QCOMPARE(rowsRemovedSpy.size(), numberOfRowsRemovedSignals);
}
// The row count should only change *after* rowsAboutToBeRemoved has been emitted
if (shouldSucceed) {
- if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0){
+ if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0){
QCOMPARE(afterAboutToRemoveRowCount, beforeRemoveRowCount);
QCOMPARE(afterRemoveRowCount, beforeRemoveRowCount-count-(numberOfRowsRemovedSignals-1));
}
- if (modelResetSpy.count() == 0 )
+ if (modelResetSpy.size() == 0 )
QCOMPARE(currentModel->rowCount(parentOfRemoved), beforeRemoveRowCount-count-(numberOfRowsRemovedSignals-1));
}
else {
@@ -937,7 +913,7 @@ void tst_QItemModel::remove()
disconnect(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(slot_rowsRemoved(QModelIndex)));
modelResetSpy.clear();
- QCOMPARE(modelResetSpy.count(), 0);
+ QCOMPARE(modelResetSpy.size(), 0);
//
// Test remove column
@@ -952,26 +928,26 @@ void tst_QItemModel::remove()
if (currentModel->removeColumns(start, count, parentOfRemoved)) {
currentModel->submit();
// Didn't reset the rows, so they should still be at the same value
- if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1){
- QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0);
+ if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1){
+ QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0);
//QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals);
- QCOMPARE(columnsRemovedSpy.count(), 0);
+ QCOMPARE(columnsRemovedSpy.size(), 0);
//QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals);
}
else {
- QCOMPARE(columnsAboutToBeRemovedSpy.count(), numberOfColumnsAboutToBeRemovedSignals);
- QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals);
- QCOMPARE(columnsRemovedSpy.count(), numberOfColumnsRemovedSignals);
- QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals);
+ QCOMPARE(columnsAboutToBeRemovedSpy.size(), numberOfColumnsAboutToBeRemovedSignals);
+ QCOMPARE(rowsAboutToBeRemovedSpy.size(), numberOfRowsAboutToBeRemovedSignals);
+ QCOMPARE(columnsRemovedSpy.size(), numberOfColumnsRemovedSignals);
+ QCOMPARE(rowsRemovedSpy.size(), numberOfRowsRemovedSignals);
}
// The column count should only change *after* rowsAboutToBeRemoved has been emitted
if (shouldSucceed) {
- if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0){
+ if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0){
QCOMPARE(afterAboutToRemoveColumnCount, beforeRemoveColumnCount);
QCOMPARE(afterRemoveColumnCount, beforeRemoveColumnCount-count-(numberOfColumnsRemovedSignals-1));
}
- if (modelResetSpy.count() == 0)
+ if (modelResetSpy.size() == 0)
QCOMPARE(currentModel->columnCount(parentOfRemoved), beforeRemoveColumnCount-count-(numberOfColumnsRemovedSignals-1));
}
else
@@ -982,7 +958,7 @@ void tst_QItemModel::remove()
disconnect(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(slot_columnsRemoved(QModelIndex)));
- if (columnsAboutToBeRemovedSpy.count() > 0){
+ if (columnsAboutToBeRemovedSpy.size() > 0){
QList<QVariant> arguments = columnsAboutToBeRemovedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -992,7 +968,7 @@ void tst_QItemModel::remove()
QVERIFY(parentOfRemoved == parent);
}
- if (columnsRemovedSpy.count() > 0){
+ if (columnsRemovedSpy.size() > 0){
QList<QVariant> arguments = columnsRemovedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -1221,7 +1197,7 @@ void tst_QItemModel::insert()
QCOMPARE(currentModel->insertRows(start, count, parentOfInserted), shouldSucceed);
currentModel->submit();
- if (rowsAboutToBeInsertedSpy.count() > 0){
+ if (rowsAboutToBeInsertedSpy.size() > 0){
QList<QVariant> arguments = rowsAboutToBeInsertedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -1231,7 +1207,7 @@ void tst_QItemModel::insert()
QVERIFY(parentOfInserted == parent);
}
- if (rowsInsertedSpy.count() > 0){
+ if (rowsInsertedSpy.size() > 0){
QList<QVariant> arguments = rowsInsertedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -1242,25 +1218,25 @@ void tst_QItemModel::insert()
}
// Only the row signals should have been emitted
- if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1) {
- QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0);
- QCOMPARE(rowsAboutToBeInsertedSpy.count(), 0);
- QCOMPARE(columnsInsertedSpy.count(), 0);
- QCOMPARE(rowsInsertedSpy.count(), 0);
+ if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1) {
+ QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0);
+ QCOMPARE(rowsAboutToBeInsertedSpy.size(), 0);
+ QCOMPARE(columnsInsertedSpy.size(), 0);
+ QCOMPARE(rowsInsertedSpy.size(), 0);
}
else {
- QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0);
- QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals);
- QCOMPARE(columnsInsertedSpy.count(), 0);
- QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals);
+ QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0);
+ QCOMPARE(rowsAboutToBeInsertedSpy.size(), numberOfRowsAboutToBeInsertedSignals);
+ QCOMPARE(columnsInsertedSpy.size(), 0);
+ QCOMPARE(rowsInsertedSpy.size(), numberOfRowsInsertedSignals);
}
// The row count should only change *after* rowsAboutToBeInserted has been emitted
if (shouldSucceed) {
- if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0) {
+ if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0) {
QCOMPARE(afterAboutToInsertRowCount, beforeInsertRowCount);
QCOMPARE(afterInsertRowCount, beforeInsertRowCount+count+(numberOfRowsInsertedSignals-1));
}
- if (modelResetSpy.count() == 0)
+ if (modelResetSpy.size() == 0)
QCOMPARE(currentModel->rowCount(parentOfInserted), beforeInsertRowCount+count+(numberOfRowsInsertedSignals-1));
}
else {
@@ -1288,27 +1264,27 @@ void tst_QItemModel::insert()
// Some models don't let you insert the column, only row
if (currentModel->insertColumns(start, count, parentOfInserted)) {
currentModel->submit();
- if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1) {
+ if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1) {
// Didn't reset the rows, so they should still be at the same value
- QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0);
+ QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0);
//QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals);
- QCOMPARE(columnsInsertedSpy.count(), 0);
+ QCOMPARE(columnsInsertedSpy.size(), 0);
//QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals);
}
else {
// Didn't reset the rows, so they should still be at the same value
- QCOMPARE(columnsAboutToBeInsertedSpy.count(), numberOfColumnsAboutToBeInsertedSignals);
- QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals);
- QCOMPARE(columnsInsertedSpy.count(), numberOfColumnsInsertedSignals);
- QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals);
+ QCOMPARE(columnsAboutToBeInsertedSpy.size(), numberOfColumnsAboutToBeInsertedSignals);
+ QCOMPARE(rowsAboutToBeInsertedSpy.size(), numberOfRowsAboutToBeInsertedSignals);
+ QCOMPARE(columnsInsertedSpy.size(), numberOfColumnsInsertedSignals);
+ QCOMPARE(rowsInsertedSpy.size(), numberOfRowsInsertedSignals);
}
// The column count should only change *after* rowsAboutToBeInserted has been emitted
if (shouldSucceed) {
- if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0) {
+ if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0) {
QCOMPARE(afterAboutToInsertColumnCount, beforeInsertColumnCount);
QCOMPARE(afterInsertColumnCount, beforeInsertColumnCount+count+(numberOfColumnsInsertedSignals-1));
}
- if (modelResetSpy.count() == 0)
+ if (modelResetSpy.size() == 0)
QCOMPARE(currentModel->columnCount(parentOfInserted), beforeInsertColumnCount+count+(numberOfColumnsInsertedSignals-1));
}
else
@@ -1319,7 +1295,7 @@ void tst_QItemModel::insert()
disconnect(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(slot_columnsInserted(QModelIndex)));
- if (columnsAboutToBeInsertedSpy.count() > 0){
+ if (columnsAboutToBeInsertedSpy.size() > 0){
QList<QVariant> arguments = columnsAboutToBeInsertedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();
@@ -1329,7 +1305,7 @@ void tst_QItemModel::insert()
QVERIFY(parentOfInserted == parent);
}
- if (columnsInsertedSpy.count() > 0){
+ if (columnsInsertedSpy.size() > 0){
QList<QVariant> arguments = columnsInsertedSpy.at(0);
QModelIndex parent = (qvariant_cast<QModelIndex>(arguments.at(0)));
int first = arguments.at(1).toInt();