From 99d1969284dba08c68a5153a64b17aa160afd51f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 2 Nov 2015 16:42:21 +0100 Subject: [PATCH] tests: remove use of obsolete QStyleOption*V They are obsolete since Qt 5.0. Change-Id: Iefe47684526832def8fc5be5a170817059dcc530 Reviewed-by: Jake Petroules --- .../itemviews/qlistview/tst_qlistview.cpp | 3 +-- .../itemviews/qtreeview/tst_qtreeview.cpp | 19 +++++++++---------- .../styles/qstyleoption/tst_qstyleoption.cpp | 16 ---------------- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 4 ++-- .../widgets/qprogressbar/tst_qprogressbar.cpp | 2 +- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index d94a3c8bca..5b206af357 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -2020,8 +2020,7 @@ void tst_QListView::styleOptionViewItem() public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QVERIFY(qstyleoption_cast(&option)); - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); QCOMPARE(opt.index, index); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 6d5f5a1c60..033464c9db 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -3075,7 +3075,7 @@ void tst_QTreeView::styleOptionViewItem() { class MyDelegate : public QStyledItemDelegate { - static QString posToString(QStyleOptionViewItemV4::ViewItemPosition pos) { + static QString posToString(QStyleOptionViewItem::ViewItemPosition pos) { static const char* s_pos[] = { "Invalid", "Beginning", "Middle", "End", "OnlyOne" }; return s_pos[pos]; } @@ -3088,8 +3088,7 @@ void tst_QTreeView::styleOptionViewItem() void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const { - QVERIFY(qstyleoption_cast(&option)); - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); QVERIFY(!opt.text.isEmpty()); @@ -3097,20 +3096,20 @@ void tst_QTreeView::styleOptionViewItem() //qDebug() << index << opt.text; if (allCollapsed) - QCOMPARE(!(opt.features & QStyleOptionViewItemV2::Alternate), !(index.row() % 2)); - QCOMPARE(!(opt.features & QStyleOptionViewItemV2::HasCheckIndicator), !opt.text.contains("Checkable")); + QCOMPARE(!(opt.features & QStyleOptionViewItem::Alternate), !(index.row() % 2)); + QCOMPARE(!(opt.features & QStyleOptionViewItem::HasCheckIndicator), !opt.text.contains("Checkable")); if (opt.text.contains("Beginning")) - QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::Beginning)); + QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::Beginning)); if (opt.text.contains("Middle")) - QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::Middle)); + QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::Middle)); if (opt.text.contains("End")) - QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::End)); + QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::End)); if (opt.text.contains("OnlyOne")) - QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::OnlyOne)); + QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::OnlyOne)); if (opt.text.contains("Checked")) QCOMPARE(opt.checkState, Qt::Checked); @@ -4192,7 +4191,7 @@ void tst_QTreeView::taskQTBUG_25333_adjustViewOptionsForIndex() #ifdef QT_BUILD_INTERNAL { - QStyleOptionViewItemV4 option; + QStyleOptionViewItem option; view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item1)); diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp index 3c1d4c589b..2e26ba609b 100644 --- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp +++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp @@ -43,7 +43,6 @@ class tst_QStyleOption: public QObject private slots: void qstyleoptioncast_data(); void qstyleoptioncast(); - void copyconstructors(); }; // Just a simple container for QStyleOption-pointer @@ -133,21 +132,6 @@ void tst_QStyleOption::qstyleoptioncast() delete testOption; } -void tst_QStyleOption::copyconstructors() -{ - QStyleOptionFrame frame; - QStyleOptionFrameV2 frame2(frame); - QCOMPARE(frame2.version, int(QStyleOptionFrameV2::Version)); - frame2 = frame; - QCOMPARE(frame2.version, int(QStyleOptionFrameV2::Version)); - - QStyleOptionProgressBar bar; - QStyleOptionProgressBarV2 bar2(bar); - QCOMPARE(bar2.version, int(QStyleOptionProgressBarV2::Version)); - bar2 = bar; - QCOMPARE(bar2.version, int(QStyleOptionProgressBarV2::Version)); -} - QTEST_MAIN(tst_QStyleOption) #include "tst_qstyleoption.moc" diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index a511e91e2c..a360803c50 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1301,9 +1301,9 @@ void tst_QStyleSheetStyle::proxyStyle() QTest::qWait(100); // Test for QTBUG-7198 - style sheet overrides custom element size - QStyleOptionViewItemV4 opt; + QStyleOptionViewItem opt; opt.initFrom(w); - opt.features |= QStyleOptionViewItemV2::HasCheckIndicator; + opt.features |= QStyleOptionViewItem::HasCheckIndicator; QVERIFY(pb5->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, pb5).width() == 3); delete w; diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 4a5f9d535b..5455ebb830 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -267,7 +267,7 @@ void tst_QProgressBar::sizeHint() //test if the sizeHint is big enough QFontMetrics fm = bar.fontMetrics(); - QStyleOptionProgressBarV2 opt; + QStyleOptionProgressBar opt; bar.initStyleOption(&opt); QSize size = QSize(9 * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8); size= bar.style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, &bar);