summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-24 16:25:55 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-24 16:29:06 +0200
commit91d3ef83c7572fefdc059470ec7582c2d7ec9190 (patch)
treeded27fa1b435f4317b674c4e022d0d5cec664bd5 /tests
parent0f628fc1ac247a88bc68e3b3977aa9802c1129bc (diff)
Fix deprecation warnings in tests
tst_proxy.cpp:224:33: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:224:82: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:225:33: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:225:66: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:293:33: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:293:82: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:294:33: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_proxy.cpp:294:66: warning: ‘static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = int]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_modelview.cpp:210:48: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] tst_modelview.cpp:210:74: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] Change-Id: I888769aaf9fce97595711bc92cfdfb57150c536d Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/modelview/tst_modelview.cpp5
-rw-r--r--tests/auto/proxy/tst_proxy.cpp22
2 files changed, 22 insertions, 5 deletions
diff --git a/tests/auto/modelview/tst_modelview.cpp b/tests/auto/modelview/tst_modelview.cpp
index 1512f10..14773a2 100644
--- a/tests/auto/modelview/tst_modelview.cpp
+++ b/tests/auto/modelview/tst_modelview.cpp
@@ -207,7 +207,10 @@ void compareIndex(const QModelIndex &sourceIndex, const QModelIndex &replicaInde
QCOMPARE(replicaColumnCount, sourceColumnCount);
for (int i = 0; i < sourceRowCount; ++i) {
for (int j = 0; j < sourceColumnCount; ++j) {
- compareIndex(sourceIndex.child(i, j), replicaIndex.child(i, j), roles);
+ auto sourceChild = sourceModel->index(i, j, sourceIndex);
+ auto replicaChild = replicaModel->index(i, j, replicaIndex);
+ compareIndex(sourceChild, replicaChild, roles);
+
}
}
}
diff --git a/tests/auto/proxy/tst_proxy.cpp b/tests/auto/proxy/tst_proxy.cpp
index 8022063..79e1adf 100644
--- a/tests/auto/proxy/tst_proxy.cpp
+++ b/tests/auto/proxy/tst_proxy.cpp
@@ -221,8 +221,15 @@ void ProxyTest::testProxy()
if (!useProxy)
QCOMPARE(rep->tracks()->availableRoles(), QVector<int>{Qt::DisplayRole});
else {
- QCOMPARE(QSet<int>::fromList(rep->tracks()->availableRoles().toList()),
- QSet<int>::fromList(model.roleNames().keys()));
+ const auto &availableRolesVec = rep->tracks()->availableRoles();
+ QSet<int> availableRoles;
+ for (int r : availableRolesVec)
+ availableRoles.insert(r);
+ const auto &rolesHash = model.roleNames();
+ QSet<int> roles;
+ for (auto it = rolesHash.cbegin(), end = rolesHash.cend(); it != end; ++it)
+ roles.insert(it.key());
+ QCOMPARE(availableRoles, roles);
}
QSignalSpy dataSpy(rep->tracks(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
QVector<QModelIndex> pending;
@@ -290,8 +297,15 @@ void ProxyTest::testProxy()
if (!useProxy)
QCOMPARE(tracksReplica->availableRoles(), QVector<int>{Qt::DisplayRole});
else {
- QCOMPARE(QSet<int>::fromList(tracksReplica->availableRoles().toList()),
- QSet<int>::fromList(model.roleNames().keys()));
+ const auto &availableRolesVec = tracksReplica->availableRoles();
+ QSet<int> availableRoles;
+ for (int r : availableRolesVec)
+ availableRoles.insert(r);
+ const auto &rolesHash = model.roleNames();
+ QSet<int> roles;
+ for (auto it = rolesHash.cbegin(), end = rolesHash.cend(); it != end; ++it)
+ roles.insert(it.key());
+ QCOMPARE(availableRoles, roles);
}
QTRY_COMPARE(tracksReplica->isInitialized(), true);
QSignalSpy dataSpy(tracksReplica, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));