summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2013-02-19 23:51:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-21 00:58:32 +0100
commit70f6652ebd7153b4a381c30756e3e76fc3cab562 (patch)
tree05bb76ebaf2a7544c84bf47fe842a29a9c233b60 /tests
parent20dbad1bbf59495b52bccf6ad44965e3953c72a3 (diff)
Forward the 3rd parameter of dataChanged
Change-Id: I94f893bf65cd150c3cb1099c91cb13882bcca79a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index c7e4664007..f750b7a9d4 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -46,6 +46,20 @@
#include "dynamictreemodel.h"
#include "qidentityproxymodel.h"
+class DataChangedModel : public QAbstractListModel
+{
+public:
+ int rowCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 1; }
+ QVariant data(const QModelIndex&, int) const { return QVariant(); }
+ QModelIndex index(int row, int column, const QModelIndex &) const { return createIndex(row, column); }
+
+ void changeData()
+ {
+ const QModelIndex idx = index(0, 0, QModelIndex());
+ Q_EMIT dataChanged(idx, idx, QVector<int>() << 1);
+ }
+};
+
class tst_QIdentityProxyModel : public QObject
{
Q_OBJECT
@@ -63,6 +77,7 @@ private slots:
void removeRows();
void moveRows();
void reset();
+ void dataChanged();
protected:
void verifyIdentity(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex());
@@ -79,6 +94,7 @@ tst_QIdentityProxyModel::tst_QIdentityProxyModel()
void tst_QIdentityProxyModel::initTestCase()
{
+ qRegisterMetaType<QVector<int> >();
m_model = new QStandardItemModel(0, 1);
m_proxy = new QIdentityProxyModel();
}
@@ -326,5 +342,27 @@ void tst_QIdentityProxyModel::reset()
m_proxy->setSourceModel(0);
}
+void tst_QIdentityProxyModel::dataChanged()
+{
+ DataChangedModel model;
+ m_proxy->setSourceModel(&model);
+
+ verifyIdentity(&model);
+
+ QSignalSpy modelSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+ QSignalSpy proxySpy(m_proxy, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ QVERIFY(modelSpy.isValid());
+ QVERIFY(proxySpy.isValid());
+
+ model.changeData();
+
+ QCOMPARE(modelSpy.first().at(2).value<QVector<int> >(), QVector<int>() << 1);
+ QVERIFY(modelSpy.first().at(2) == proxySpy.first().at(2));
+
+ verifyIdentity(&model);
+ m_proxy->setSourceModel(0);
+}
+
QTEST_MAIN(tst_QIdentityProxyModel)
#include "tst_qidentityproxymodel.moc"