summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-16 17:49:05 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-17 06:45:59 +0200
commitfe3bebbd68e9b0eca1b4cef8671853ed4ff630d2 (patch)
tree9f4ead4dd451e90e2604cae150b138d4eec9ce2a /tests
parentb850322147250a1bd35d5c63e958dec161284244 (diff)
Fix deprecation warnings in tests
Adjust to changes to QIcon::pixmap, QMetaType::type, and QAbstractItemView::itemDelegate. Change-Id: I9eb0331ef899131afc86c33f27feeee76331ffc8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp2
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp24
3 files changed, 16 insertions, 16 deletions
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 46bdd9ef2c..ece9941dfb 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -458,7 +458,7 @@ void tst_QIcon::pixmap()
QVERIFY(icon.pixmap(16, 16).size().width() >= 16);
QVERIFY(icon.pixmap(QSize(16, 16)).size().width() >= 16);
QVERIFY(icon.pixmap(QSize(16, 16), 1).size().width() == 16);
- QVERIFY(icon.pixmap(nullptr, QSize(16, 16)).size().width() >= 16);
+ QVERIFY(icon.pixmap(QSize(16, 16), -1).size().width() >= 16);
}
static bool sizeLess(const QSize &a, const QSize &b)
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index cee6d47dbd..39712c6d22 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -3425,12 +3425,12 @@ void tst_Moc::autoSignalSpyMetaTypeRegistration()
QVERIFY(i > 0);
- QCOMPARE(QMetaType::type("CustomObject12"), (int)QMetaType::UnknownType);
+ QCOMPARE(QMetaType::fromName("CustomObject12").id(), (int)QMetaType::UnknownType);
QSignalSpy spy(&aro, SIGNAL(someSignal(CustomObject12)));
- QVERIFY(QMetaType::type("CustomObject12") != QMetaType::UnknownType);
- QCOMPARE(QMetaType::type("CustomObject12"), qMetaTypeId<CustomObject12>());
+ QVERIFY(QMetaType::fromName("CustomObject12").id() != QMetaType::UnknownType);
+ QCOMPARE(QMetaType::fromName("CustomObject12").id(), qMetaTypeId<CustomObject12>());
}
void tst_Moc::parseDefines()
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 94f3e52ff3..7a22128af3 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -1069,7 +1069,7 @@ void tst_QTreeView::itemDelegateForColumnOrRow()
QVERIFY(!view.itemDelegateForRow(0));
QVERIFY(!view.itemDelegateForColumn(0));
- QCOMPARE(view.itemDelegate(QModelIndex()), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(QModelIndex()), defaultDelegate);
QStandardItemModel model;
for (int i = 0; i < 100; ++i) {
@@ -1085,26 +1085,26 @@ void tst_QTreeView::itemDelegateForColumnOrRow()
QVERIFY(!view.itemDelegateForRow(0));
QVERIFY(!view.itemDelegateForColumn(0));
- QCOMPARE(view.itemDelegate(QModelIndex()), defaultDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(0, 0)), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(QModelIndex()), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(0, 0)), defaultDelegate);
QPointer<QAbstractItemDelegate> rowDelegate = new QStyledItemDelegate;
view.setItemDelegateForRow(0, rowDelegate);
QVERIFY(!rowDelegate->parent());
QCOMPARE(view.itemDelegateForRow(0), rowDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(0, 0)), rowDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(0, 1)), rowDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(1, 0)), defaultDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(1, 1)), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(0, 0)), rowDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(0, 1)), rowDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(1, 0)), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(1, 1)), defaultDelegate);
QPointer<QAbstractItemDelegate> columnDelegate = new QStyledItemDelegate;
view.setItemDelegateForColumn(1, columnDelegate);
QVERIFY(!columnDelegate->parent());
QCOMPARE(view.itemDelegateForColumn(1), columnDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(0, 0)), rowDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(0, 1)), rowDelegate); // row wins
- QCOMPARE(view.itemDelegate(view.model()->index(1, 0)), defaultDelegate);
- QCOMPARE(view.itemDelegate(view.model()->index(1, 1)), columnDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(0, 0)), rowDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(0, 1)), rowDelegate); // row wins
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(1, 0)), defaultDelegate);
+ QCOMPARE(view.itemDelegateForIndex(view.model()->index(1, 1)), columnDelegate);
view.setItemDelegateForRow(0, nullptr);
QVERIFY(!view.itemDelegateForRow(0));
@@ -2496,7 +2496,7 @@ void tst_QTreeView::spanningItems()
for (int i = 0; i < model.rowCount(QModelIndex()); ++i) {
if (!view.isFirstColumnSpanned(i, QModelIndex())) {
QModelIndex index = model.index(i, 0, QModelIndex());
- w = qMax(w, view.itemDelegate(index)->sizeHint(option, index).width() + view.indentation());
+ w = qMax(w, view.itemDelegateForIndex(index)->sizeHint(option, index).width() + view.indentation());
}
}
QCOMPARE(view.sizeHintForColumn(0), w);